[Asterisk-cvs] asterisk/channels chan_iax2.c, 1.345,
1.346 chan_sip.c, 1.851, 1.852
kpfleming
kpfleming
Tue Sep 13 22:20:11 CDT 2005
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv31388/channels
Modified Files:
chan_iax2.c chan_sip.c
Log Message:
ensure that Manager hold/unhold events are generated even for non-bridged channels (issue #4594)
Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.345
retrieving revision 1.346
diff -u -d -r1.345 -r1.346
--- chan_iax2.c 9 Sep 2005 01:07:25 -0000 1.345
+++ chan_iax2.c 14 Sep 2005 02:18:45 -0000 1.346
@@ -6592,6 +6592,15 @@
break;
case IAX_COMMAND_QUELCH:
if (iaxs[fr.callno]->state & IAX_STATE_STARTED) {
+ /* Generate Manager Hold event, if necessary*/
+ if (iaxs[fr.callno]->owner) {
+ manager_event(EVENT_FLAG_CALL, "Hold",
+ "Channel: %s\r\n"
+ "Uniqueid: %s\r\n",
+ iaxs[fr.callno]->owner->name,
+ iaxs[fr.callno]->owner->uniqueid);
+ }
+
ast_set_flag(iaxs[fr.callno], IAX_QUELCH);
if (ies.musiconhold) {
if (iaxs[fr.callno]->owner &&
@@ -6600,8 +6609,17 @@
}
}
break;
- case IAX_COMMAND_UNQUELCH:
+ case IAX_COMMAND_UNQUELCH:
if (iaxs[fr.callno]->state & IAX_STATE_STARTED) {
+ /* Generate Manager Unhold event, if necessary*/
+ if (iaxs[fr.callno]->owner && ast_test_flag(iaxs[fr.callno], IAX_QUELCH)) {
+ manager_event(EVENT_FLAG_CALL, "Unhold",
+ "Channel: %s\r\n"
+ "Uniqueid: %s\r\n",
+ iaxs[fr.callno]->owner->name,
+ iaxs[fr.callno]->owner->uniqueid);
+ }
+
ast_clear_flag(iaxs[fr.callno], IAX_QUELCH);
if (iaxs[fr.callno]->owner &&
ast_bridged_channel(iaxs[fr.callno]->owner))
Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.851
retrieving revision 1.852
diff -u -d -r1.851 -r1.852
--- chan_sip.c 14 Sep 2005 02:15:14 -0000 1.851
+++ chan_sip.c 14 Sep 2005 02:18:45 -0000 1.852
@@ -3484,32 +3484,12 @@
struct ast_frame af = { AST_FRAME_NULL, };
if (sin.sin_addr.s_addr && !sendonly) {
ast_moh_stop(bridgepeer);
- /* Indicate UNHOLD status to the other channel */
- ast_indicate(bridgepeer, AST_CONTROL_UNHOLD);
- append_history(p, "Unhold", req->data);
- if (callevents && ast_test_flag(p, SIP_CALL_ONHOLD)) {
- manager_event(EVENT_FLAG_CALL, "Unhold",
- "Channel: %s\r\n"
- "Uniqueid: %s\r\n",
- p->owner->name,
- p->owner->uniqueid);
- }
- ast_clear_flag(p, SIP_CALL_ONHOLD);
+
/* Activate a re-invite */
ast_queue_frame(p->owner, &af);
} else {
/* No address for RTP, we're on hold */
- append_history(p, "Hold", req->data);
- if (callevents && !ast_test_flag(p, SIP_CALL_ONHOLD)) {
- manager_event(EVENT_FLAG_CALL, "Hold",
- "Channel: %s\r\n"
- "Uniqueid: %s\r\n",
- p->owner->name,
- p->owner->uniqueid);
- }
- ast_set_flag(p, SIP_CALL_ONHOLD);
- /* Indicate HOLD status to the other channel */
- ast_indicate(bridgepeer, AST_CONTROL_HOLD);
+
ast_moh_start(bridgepeer, NULL);
if (sendonly)
ast_rtp_stop(p->rtp);
@@ -3517,6 +3497,34 @@
ast_queue_frame(p->owner, &af);
}
}
+
+ /* Manager Hold and Unhold events must be generated, if necessary */
+ if (sin.sin_addr.s_addr && !sendonly) {
+ append_history(p, "Unhold", req->data);
+
+ if (callevents && ast_test_flag(p, SIP_CALL_ONHOLD)) {
+ manager_event(EVENT_FLAG_CALL, "Unhold",
+ "Channel: %s\r\n"
+ "Uniqueid: %s\r\n",
+ p->owner->name,
+ p->owner->uniqueid);
+
+ }
+ ast_clear_flag(p, SIP_CALL_ONHOLD);
+ } else {
+ /* No address for RTP, we're on hold */
+ append_history(p, "Hold", req->data);
+
+ if (callevents && !ast_test_flag(p, SIP_CALL_ONHOLD)) {
+ manager_event(EVENT_FLAG_CALL, "Hold",
+ "Channel: %s\r\n"
+ "Uniqueid: %s\r\n",
+ p->owner->name,
+ p->owner->uniqueid);
+ }
+ ast_set_flag(p, SIP_CALL_ONHOLD);
+ }
+
return 0;
}
More information about the svn-commits
mailing list