[asterisk-commits] file: branch group/pimp_my_sip r379116 - /team/group/pimp_my_sip/channels/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jan 15 10:57:19 CST 2013
Author: file
Date: Tue Jan 15 10:57:15 2013
New Revision: 379116
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=379116
Log:
Look! It's gulp_indicate!
Modified:
team/group/pimp_my_sip/channels/chan_gulp.c
Modified: team/group/pimp_my_sip/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/channels/chan_gulp.c?view=diff&rev=379116&r1=379115&r2=379116
==============================================================================
--- team/group/pimp_my_sip/channels/chan_gulp.c (original)
+++ team/group/pimp_my_sip/channels/chan_gulp.c Tue Jan 15 10:57:15 2013
@@ -166,7 +166,82 @@
/*! \brief Function called by core to ask the channel to indicate some sort of condition */
static int gulp_indicate(struct ast_channel *ast, int condition, const void *data, size_t datalen)
{
- return -1;
+ int res = 0;
+ struct ast_sip_session *session = ast_channel_tech_pvt(ast);
+ pj_status_t status = -1;
+ pjsip_tx_data *packet = NULL;
+
+ switch (condition) {
+ case AST_CONTROL_RINGING:
+ if (ast_channel_state(ast) == AST_STATE_RING) {
+ status = pjsip_inv_answer(session->inv_session, 180, NULL, NULL, &packet);
+ } else {
+ res = -1;
+ }
+ break;
+ case AST_CONTROL_BUSY:
+ if (ast_channel_state(ast) != AST_STATE_UP) {
+ status = pjsip_inv_answer(session->inv_session, 486, NULL, NULL, &packet);
+ } else {
+ res = -1;
+ }
+ break;
+ case AST_CONTROL_CONGESTION:
+ if (ast_channel_state(ast) != AST_STATE_UP) {
+ status = pjsip_inv_answer(session->inv_session, 503, NULL, NULL, &packet);
+ } else {
+ res = -1;
+ }
+ break;
+ case AST_CONTROL_INCOMPLETE:
+ if (ast_channel_state(ast) != AST_STATE_UP) {
+ status = pjsip_inv_answer(session->inv_session, 484, NULL, NULL, &packet);
+ } else {
+ res = -1;
+ }
+ break;
+ case AST_CONTROL_PROCEEDING:
+ if (ast_channel_state(ast) != AST_STATE_UP) {
+ status = pjsip_inv_answer(session->inv_session, 100, NULL, NULL, &packet);
+ } else {
+ res = -1;
+ }
+ break;
+ case AST_CONTROL_PROGRESS:
+ if (ast_channel_state(ast) != AST_STATE_UP) {
+ status = pjsip_inv_answer(session->inv_session, 183, NULL, NULL, &packet);
+ } else {
+ res = -1;
+ }
+ break;
+ case AST_CONTROL_VIDUPDATE:
+ case AST_CONTROL_UPDATE_RTP_PEER:
+ case AST_CONTROL_PVT_CAUSE_CODE:
+ break;
+ case AST_CONTROL_HOLD:
+ ast_moh_start(ast, data, NULL);
+ break;
+ case AST_CONTROL_UNHOLD:
+ ast_moh_stop(ast);
+ break;
+ case AST_CONTROL_SRCUPDATE:
+ break;
+ case AST_CONTROL_SRCCHANGE:
+ break;
+ case -1:
+ res = -1;
+ break;
+ default:
+ ast_log(LOG_WARNING, "Don't know how to indicate condition %d\n", condition);
+ res = -1;
+ break;
+ }
+
+ if (packet && (status == PJ_SUCCESS)) {
+ pjsip_inv_send_msg(session->inv_session, packet);
+ }
+
+ return res;
}
/*! \brief Function called by core to start a DTMF digit */
More information about the asterisk-commits
mailing list