[asterisk-commits] file: branch 1.4 r106235 - in /branches/1.4: apps/ channels/ include/asterisk...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Mar 5 16:32:10 CST 2008
Author: file
Date: Wed Mar 5 16:32:10 2008
New Revision: 106235
URL: http://svn.digium.com/view/asterisk?view=rev&rev=106235
Log:
Add a control frame to indicate the source of media has changed. Depending on the underlying technology it may need to change some things.
(closes issue #12148)
Reported by: jcomellas
Modified:
branches/1.4/apps/app_dial.c
branches/1.4/apps/app_followme.c
branches/1.4/channels/chan_alsa.c
branches/1.4/channels/chan_h323.c
branches/1.4/channels/chan_mgcp.c
branches/1.4/channels/chan_oss.c
branches/1.4/channels/chan_phone.c
branches/1.4/channels/chan_sip.c
branches/1.4/channels/chan_skinny.c
branches/1.4/channels/chan_zap.c
branches/1.4/include/asterisk/frame.h
branches/1.4/main/channel.c
branches/1.4/main/dial.c
branches/1.4/main/file.c
branches/1.4/main/rtp.c
Modified: branches/1.4/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_dial.c?view=diff&rev=106235&r1=106234&r2=106235
==============================================================================
--- branches/1.4/apps/app_dial.c (original)
+++ branches/1.4/apps/app_dial.c Wed Mar 5 16:32:10 2008
@@ -635,6 +635,11 @@
ast_verbose (VERBOSE_PREFIX_3 "%s requested a video update, passing it to %s\n", c->name, in->name);
ast_indicate(in, AST_CONTROL_VIDUPDATE);
break;
+ case AST_CONTROL_SRCUPDATE:
+ if (option_verbose > 2)
+ ast_verbose (VERBOSE_PREFIX_3 "%s requested a source update, passing it to %s\n", c->name, in->name);
+ ast_indicate(in, AST_CONTROL_SRCUPDATE);
+ break;
case AST_CONTROL_PROCEEDING:
if (option_verbose > 2)
ast_verbose (VERBOSE_PREFIX_3 "%s is proceeding passing it to %s\n", c->name, in->name);
@@ -745,7 +750,8 @@
if (single && (f->frametype == AST_FRAME_CONTROL) &&
((f->subclass == AST_CONTROL_HOLD) ||
(f->subclass == AST_CONTROL_UNHOLD) ||
- (f->subclass == AST_CONTROL_VIDUPDATE))) {
+ (f->subclass == AST_CONTROL_VIDUPDATE) ||
+ (f->subclass == AST_CONTROL_SRCUPDATE))) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "%s requested special control %d, passing it to %s\n", in->name, f->subclass, outgoing->chan->name);
ast_indicate_data(outgoing->chan, f->subclass, f->data, f->datalen);
Modified: branches/1.4/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_followme.c?view=diff&rev=106235&r1=106234&r2=106235
==============================================================================
--- branches/1.4/apps/app_followme.c (original)
+++ branches/1.4/apps/app_followme.c Wed Mar 5 16:32:10 2008
@@ -673,6 +673,10 @@
if (option_verbose > 2)
ast_verbose ( VERBOSE_PREFIX_3 "%s requested a video update, passing it to %s\n", winner->name, caller->name);
break;
+ case AST_CONTROL_SRCUPDATE:
+ if (option_verbose > 2)
+ ast_verbose ( VERBOSE_PREFIX_3 "%s requested a source update, passing it to %s\n", winner->name, caller->name);
+ break;
case AST_CONTROL_PROCEEDING:
if (option_verbose > 2)
ast_verbose ( VERBOSE_PREFIX_3 "%s is proceeding passing it to %s\n", winner->name,caller->name);
Modified: branches/1.4/channels/chan_alsa.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_alsa.c?view=diff&rev=106235&r1=106234&r2=106235
==============================================================================
--- branches/1.4/channels/chan_alsa.c (original)
+++ branches/1.4/channels/chan_alsa.c Wed Mar 5 16:32:10 2008
@@ -743,32 +743,34 @@
ast_mutex_lock(&alsalock);
switch (cond) {
- case AST_CONTROL_BUSY:
- res = 1;
- break;
- case AST_CONTROL_CONGESTION:
- res = 2;
- break;
- case AST_CONTROL_RINGING:
- case AST_CONTROL_PROGRESS:
- break;
- case -1:
- res = -1;
- break;
- case AST_CONTROL_VIDUPDATE:
- res = -1;
- break;
- case AST_CONTROL_HOLD:
- ast_verbose(" << Console Has Been Placed on Hold >> \n");
- ast_moh_start(chan, data, mohinterpret);
- break;
- case AST_CONTROL_UNHOLD:
- ast_verbose(" << Console Has Been Retrieved from Hold >> \n");
- ast_moh_stop(chan);
- break;
- default:
- ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", cond, chan->name);
- res = -1;
+ case AST_CONTROL_BUSY:
+ res = 1;
+ break;
+ case AST_CONTROL_CONGESTION:
+ res = 2;
+ break;
+ case AST_CONTROL_RINGING:
+ case AST_CONTROL_PROGRESS:
+ break;
+ case -1:
+ res = -1;
+ break;
+ case AST_CONTROL_VIDUPDATE:
+ res = -1;
+ break;
+ case AST_CONTROL_HOLD:
+ ast_verbose(" << Console Has Been Placed on Hold >> \n");
+ ast_moh_start(chan, data, mohinterpret);
+ break;
+ case AST_CONTROL_UNHOLD:
+ ast_verbose(" << Console Has Been Retrieved from Hold >> \n");
+ ast_moh_stop(chan);
+ break;
+ case AST_CONTROL_SRCUPDATE:
+ break;
+ default:
+ ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", cond, chan->name);
+ res = -1;
}
if (res > -1)
Modified: branches/1.4/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_h323.c?view=diff&rev=106235&r1=106234&r2=106235
==============================================================================
--- branches/1.4/channels/chan_h323.c (original)
+++ branches/1.4/channels/chan_h323.c Wed Mar 5 16:32:10 2008
@@ -915,6 +915,10 @@
ast_moh_stop(c);
res = 0;
break;
+ case AST_CONTROL_SRCUPDATE:
+ ast_rtp_new_source(pvt->rtp);
+ res = 0;
+ break;
case AST_CONTROL_PROCEEDING:
case -1:
break;
Modified: branches/1.4/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_mgcp.c?view=diff&rev=106235&r1=106234&r2=106235
==============================================================================
--- branches/1.4/channels/chan_mgcp.c (original)
+++ branches/1.4/channels/chan_mgcp.c Wed Mar 5 16:32:10 2008
@@ -1444,6 +1444,9 @@
break;
case AST_CONTROL_UNHOLD:
ast_moh_stop(ast);
+ break;
+ case AST_CONTROL_SRCUPDATE:
+ ast_rtp_new_source(sub->rtp);
break;
case -1:
transmit_notify_request(sub, "");
Modified: branches/1.4/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_oss.c?view=diff&rev=106235&r1=106234&r2=106235
==============================================================================
--- branches/1.4/channels/chan_oss.c (original)
+++ branches/1.4/channels/chan_oss.c Wed Mar 5 16:32:10 2008
@@ -951,32 +951,33 @@
int res = -1;
switch (cond) {
- case AST_CONTROL_BUSY:
- case AST_CONTROL_CONGESTION:
- case AST_CONTROL_RINGING:
+ case AST_CONTROL_BUSY:
+ case AST_CONTROL_CONGESTION:
+ case AST_CONTROL_RINGING:
res = cond;
break;
-
- case -1:
- o->cursound = -1;
- o->nosound = 0; /* when cursound is -1 nosound must be 0 */
- return 0;
-
- case AST_CONTROL_VIDUPDATE:
- res = -1;
+
+ case -1:
+ o->cursound = -1;
+ o->nosound = 0; /* when cursound is -1 nosound must be 0 */
+ return 0;
+
+ case AST_CONTROL_VIDUPDATE:
+ res = -1;
+ break;
+ case AST_CONTROL_HOLD:
+ ast_verbose(" << Console Has Been Placed on Hold >> \n");
+ ast_moh_start(c, data, o->mohinterpret);
break;
- case AST_CONTROL_HOLD:
- ast_verbose(" << Console Has Been Placed on Hold >> \n");
- ast_moh_start(c, data, o->mohinterpret);
- break;
- case AST_CONTROL_UNHOLD:
- ast_verbose(" << Console Has Been Retrieved from Hold >> \n");
- ast_moh_stop(c);
- break;
-
- default:
- ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", cond, c->name);
- return -1;
+ case AST_CONTROL_UNHOLD:
+ ast_verbose(" << Console Has Been Retrieved from Hold >> \n");
+ ast_moh_stop(c);
+ break;
+ case AST_CONTROL_SRCUPDATE:
+ break;
+ default:
+ ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", cond, c->name);
+ return -1;
}
if (res > -1)
Modified: branches/1.4/channels/chan_phone.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_phone.c?view=diff&rev=106235&r1=106234&r2=106235
==============================================================================
--- branches/1.4/channels/chan_phone.c (original)
+++ branches/1.4/channels/chan_phone.c Wed Mar 5 16:32:10 2008
@@ -213,21 +213,24 @@
int res=-1;
ast_log(LOG_DEBUG, "Requested indication %d on channel %s\n", condition, chan->name);
switch(condition) {
- case AST_CONTROL_FLASH:
- ioctl(p->fd, IXJCTL_PSTN_SET_STATE, PSTN_ON_HOOK);
- usleep(320000);
- ioctl(p->fd, IXJCTL_PSTN_SET_STATE, PSTN_OFF_HOOK);
+ case AST_CONTROL_FLASH:
+ ioctl(p->fd, IXJCTL_PSTN_SET_STATE, PSTN_ON_HOOK);
+ usleep(320000);
+ ioctl(p->fd, IXJCTL_PSTN_SET_STATE, PSTN_OFF_HOOK);
p->lastformat = -1;
res = 0;
break;
- case AST_CONTROL_HOLD:
- ast_moh_start(chan, data, NULL);
- break;
- case AST_CONTROL_UNHOLD:
- ast_moh_stop(chan);
- break;
- default:
- ast_log(LOG_WARNING, "Condition %d is not supported on channel %s\n", condition, chan->name);
+ case AST_CONTROL_HOLD:
+ ast_moh_start(chan, data, NULL);
+ break;
+ case AST_CONTROL_UNHOLD:
+ ast_moh_stop(chan);
+ break;
+ case AST_CONTROL_SRCUPDATE:
+ res = 0;
+ break;
+ default:
+ ast_log(LOG_WARNING, "Condition %d is not supported on channel %s\n", condition, chan->name);
}
return res;
}
Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=106235&r1=106234&r2=106235
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Wed Mar 5 16:32:10 2008
@@ -3663,7 +3663,6 @@
ast_log(LOG_DEBUG,"T38State change to %d on channel %s\n", p->t38.state, ast->name);
res = transmit_response_with_t38_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL);
} else {
- ast_rtp_new_source(p->rtp);
res = transmit_response_with_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL);
}
}
@@ -3937,6 +3936,9 @@
/* ast_rtcp_send_h261fur(p->vrtp); */
} else
res = -1;
+ break;
+ case AST_CONTROL_SRCUPDATE:
+ ast_rtp_new_source(p->rtp);
break;
case -1:
res = -1;
Modified: branches/1.4/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_skinny.c?view=diff&rev=106235&r1=106234&r2=106235
==============================================================================
--- branches/1.4/channels/chan_skinny.c (original)
+++ branches/1.4/channels/chan_skinny.c Wed Mar 5 16:32:10 2008
@@ -2794,6 +2794,9 @@
break;
case AST_CONTROL_PROCEEDING:
break;
+ case AST_CONTROL_SRCUPDATE:
+ ast_rtp_new_source(sub->rtp);
+ break;
default:
ast_log(LOG_WARNING, "Don't know how to indicate condition %d\n", ind);
return -1;
Modified: branches/1.4/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_zap.c?view=diff&rev=106235&r1=106234&r2=106235
==============================================================================
--- branches/1.4/channels/chan_zap.c (original)
+++ branches/1.4/channels/chan_zap.c Wed Mar 5 16:32:10 2008
@@ -5185,6 +5185,9 @@
res = 0;
} else
res = 0;
+ break;
+ case AST_CONTROL_SRCUPDATE:
+ res = 0;
break;
case -1:
res = tone_zone_play_tone(p->subs[index].zfd, -1);
Modified: branches/1.4/include/asterisk/frame.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/frame.h?view=diff&rev=106235&r1=106234&r2=106235
==============================================================================
--- branches/1.4/include/asterisk/frame.h (original)
+++ branches/1.4/include/asterisk/frame.h Wed Mar 5 16:32:10 2008
@@ -85,6 +85,7 @@
\arg \b HOLD Call is placed on hold
\arg \b UNHOLD Call is back from hold
\arg \b VIDUPDATE Video update requested
+ \arg \b SRCUPDATE The source of media has changed
*/
@@ -290,6 +291,7 @@
AST_CONTROL_HOLD = 16, /*!< Indicate call is placed on hold */
AST_CONTROL_UNHOLD = 17, /*!< Indicate call is left from hold */
AST_CONTROL_VIDUPDATE = 18, /*!< Indicate video frame update */
+ AST_CONTROL_SRCUPDATE = 20, /*!< Indicate source of media has changed */
};
#define AST_SMOOTHER_FLAG_G729 (1 << 0)
Modified: branches/1.4/main/channel.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/channel.c?view=diff&rev=106235&r1=106234&r2=106235
==============================================================================
--- branches/1.4/main/channel.c (original)
+++ branches/1.4/main/channel.c Wed Mar 5 16:32:10 2008
@@ -2372,6 +2372,8 @@
/* Do nothing.... */
} else if (condition == AST_CONTROL_VIDUPDATE) {
/* Do nothing.... */
+ } else if (condition == AST_CONTROL_SRCUPDATE) {
+ /* Do nothing... */
} else {
/* not handled */
ast_log(LOG_WARNING, "Unable to handle indication %d for '%s'\n", condition, chan->name);
@@ -2890,6 +2892,7 @@
case AST_CONTROL_HOLD:
case AST_CONTROL_UNHOLD:
case AST_CONTROL_VIDUPDATE:
+ case AST_CONTROL_SRCUPDATE:
case -1: /* Ignore -- just stopping indications */
break;
@@ -3774,6 +3777,7 @@
case AST_CONTROL_HOLD:
case AST_CONTROL_UNHOLD:
case AST_CONTROL_VIDUPDATE:
+ case AST_CONTROL_SRCUPDATE:
ast_indicate_data(other, f->subclass, f->data, f->datalen);
break;
default:
@@ -3906,6 +3910,10 @@
ast_set_flag(c1, AST_FLAG_END_DTMF_ONLY);
if (!c1->tech->send_digit_begin)
ast_set_flag(c0, AST_FLAG_END_DTMF_ONLY);
+
+ /* Before we enter in and bridge these two together tell them both the source of audio has changed */
+ ast_indicate(c0, AST_CONTROL_SRCUPDATE);
+ ast_indicate(c1, AST_CONTROL_SRCUPDATE);
for (/* ever */;;) {
struct timeval now = { 0, };
@@ -4070,6 +4078,10 @@
ast_clear_flag(c0, AST_FLAG_END_DTMF_ONLY);
ast_clear_flag(c1, AST_FLAG_END_DTMF_ONLY);
+ /* Now that we have broken the bridge the source will change yet again */
+ ast_indicate(c0, AST_CONTROL_SRCUPDATE);
+ ast_indicate(c1, AST_CONTROL_SRCUPDATE);
+
c0->_bridge = NULL;
c1->_bridge = NULL;
Modified: branches/1.4/main/dial.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/dial.c?view=diff&rev=106235&r1=106234&r2=106235
==============================================================================
--- branches/1.4/main/dial.c (original)
+++ branches/1.4/main/dial.c Wed Mar 5 16:32:10 2008
@@ -358,6 +358,10 @@
ast_verbose (VERBOSE_PREFIX_3 "%s requested a video update, passing it to %s\n", channel->owner->name, chan->name);
ast_indicate(chan, AST_CONTROL_VIDUPDATE);
break;
+ case AST_CONTROL_SRCUPDATE:
+ if (option_verbose > 2)
+ ast_verbose (VERBOSE_PREFIX_3 "%s requested a source update, passing it to %s\n", channel->owner->name, chan->name);
+ ast_indicate(chan, AST_CONTROL_SRCUPDATE);
case AST_CONTROL_PROCEEDING:
if (option_verbose > 2)
ast_verbose (VERBOSE_PREFIX_3 "%s is proceeding, passing it to %s\n", channel->owner->name, chan->name);
Modified: branches/1.4/main/file.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/file.c?view=diff&rev=106235&r1=106234&r2=106235
==============================================================================
--- branches/1.4/main/file.c (original)
+++ branches/1.4/main/file.c Wed Mar 5 16:32:10 2008
@@ -1159,6 +1159,7 @@
case AST_CONTROL_RINGING:
case AST_CONTROL_ANSWER:
case AST_CONTROL_VIDUPDATE:
+ case AST_CONTROL_SRCUPDATE:
case AST_CONTROL_HOLD:
case AST_CONTROL_UNHOLD:
/* Unimportant */
Modified: branches/1.4/main/rtp.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/rtp.c?view=diff&rev=106235&r1=106234&r2=106235
==============================================================================
--- branches/1.4/main/rtp.c (original)
+++ branches/1.4/main/rtp.c Wed Mar 5 16:32:10 2008
@@ -2968,7 +2968,8 @@
} else if ((fr->frametype == AST_FRAME_CONTROL) && !(flags & AST_BRIDGE_IGNORE_SIGS)) {
if ((fr->subclass == AST_CONTROL_HOLD) ||
(fr->subclass == AST_CONTROL_UNHOLD) ||
- (fr->subclass == AST_CONTROL_VIDUPDATE)) {
+ (fr->subclass == AST_CONTROL_VIDUPDATE) ||
+ (fr->subclass == AST_CONTROL_SRCUPDATE)) {
if (fr->subclass == AST_CONTROL_HOLD) {
/* If we someone went on hold we want the other side to reinvite back to us */
if (who == c0)
@@ -3199,7 +3200,8 @@
} else if ((fr->frametype == AST_FRAME_CONTROL) && !(flags & AST_BRIDGE_IGNORE_SIGS)) {
if ((fr->subclass == AST_CONTROL_HOLD) ||
(fr->subclass == AST_CONTROL_UNHOLD) ||
- (fr->subclass == AST_CONTROL_VIDUPDATE)) {
+ (fr->subclass == AST_CONTROL_VIDUPDATE) ||
+ (fr->subclass == AST_CONTROL_SRCUPDATE)) {
/* If we are going on hold, then break callback mode and P2P bridging */
if (fr->subclass == AST_CONTROL_HOLD) {
if (p0_callback)
More information about the asterisk-commits
mailing list