[asterisk-commits] oej: branch group/rana-moh-sip-transfer-1.8 r390012 - in /team/group/rana-moh...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed May 29 07:55:54 CDT 2013
Author: oej
Date: Wed May 29 07:55:50 2013
New Revision: 390012
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390012
Log:
Add function for turning on/off hold on remote channel
(and marking your own channel as locally held)
Modified:
team/group/rana-moh-sip-transfer-1.8/README.rana-moh-sip-transfer
team/group/rana-moh-sip-transfer-1.8/channels/chan_sip.c
team/group/rana-moh-sip-transfer-1.8/include/asterisk/channel.h
team/group/rana-moh-sip-transfer-1.8/main/channel.c
Modified: team/group/rana-moh-sip-transfer-1.8/README.rana-moh-sip-transfer
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/README.rana-moh-sip-transfer?view=diff&rev=390012&r1=390011&r2=390012
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/README.rana-moh-sip-transfer (original)
+++ team/group/rana-moh-sip-transfer-1.8/README.rana-moh-sip-transfer Wed May 29 07:55:50 2013
@@ -52,3 +52,11 @@
- If it's locally on hold, send AST_CONTROL_HOLD to the channel with the musicclass from the bridged channel
(After brainstorm with Matt Jordan 2013-05-28)
+
+Other channel drivers
+=====================
+- chan_dahdi: Don't understand the hold functions...
+- chan_iax2:
+- chan_mgcp:
+- chan_?
+- chan_local No changes needed
Modified: team/group/rana-moh-sip-transfer-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/channels/chan_sip.c?view=diff&rev=390012&r1=390011&r2=390012
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/channels/chan_sip.c (original)
+++ team/group/rana-moh-sip-transfer-1.8/channels/chan_sip.c Wed May 29 07:55:50 2013
@@ -7494,7 +7494,7 @@
ast_channel_lock(tmp);
sip_pvt_lock(i);
ast_channel_cc_params_init(tmp, i->cc_params);
- ast_channel_set_musicclass(tmp, i->mohsuggest);
+ ast_channel_set_hold_musicclass(tmp, i->mohsuggest);
tmp->caller.id.tag = ast_strdup(i->cid_tag);
tmp->tech = ( ast_test_flag(&i->flags[0], SIP_DTMF) == SIP_DTMF_INFO || ast_test_flag(&i->flags[0], SIP_DTMF) == SIP_DTMF_SHORTINFO) ? &sip_tech_info : &sip_tech;
@@ -9893,16 +9893,12 @@
}
if (ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD) && (!ast_sockaddr_isnull(sa) || !ast_sockaddr_isnull(vsa) || !ast_sockaddr_isnull(tsa) || !ast_sockaddr_isnull(isa)) && (!sendonly || sendonly == -1)) {
- ast_channel_set_local_hold(p->owner, FALSE);
- ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
+ ast_channel_put_remote_off_hold(p->owner);
/* Activate a re-invite */
ast_queue_frame(p->owner, &ast_null_frame);
change_hold_state(p, req, FALSE, sendonly);
} else if ((sockaddr_is_null_or_any(sa) && sockaddr_is_null_or_any(vsa) && sockaddr_is_null_or_any(tsa) && sockaddr_is_null_or_any(isa)) || (sendonly && sendonly != -1)) {
- ast_channel_set_local_hold(p->owner, TRUE);
- ast_queue_control_data(p->owner, AST_CONTROL_HOLD,
- S_OR(p->mohsuggest, NULL),
- !ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
+ ast_channel_put_remote_on_hold(p->owner, S_OR(p->mohsuggest, NULL));
if (sendonly)
ast_rtp_instance_stop(p->rtp);
/* RTCP needs to go ahead, even if we're on hold!!! */
Modified: team/group/rana-moh-sip-transfer-1.8/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/include/asterisk/channel.h?view=diff&rev=390012&r1=390011&r2=390012
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/include/asterisk/channel.h (original)
+++ team/group/rana-moh-sip-transfer-1.8/include/asterisk/channel.h Wed May 29 07:55:50 2013
@@ -3554,6 +3554,20 @@
*/
int ast_channel_get_remote_hold_state(struct ast_channel *chan);
+/*! \brief Put the bridged channel on hold.
+
+This means that we send AST_CONTROL_HOLD to the other side and
+let that channel driver decide what to do - send hold all the way out
+or just play some funky music.
+
+This change state of the channel to local hold.
+*/
+int ast_channel_put_remote_on_hold(struct ast_channel *chan, const char *mohsuggest);
+
+/*! \brief Take the other side of the bridge OFF hold
+*/
+int ast_channel_put_remote_off_hold(struct ast_channel *chan);
+
#if defined(__cplusplus) || defined(c_plusplus)
}
Modified: team/group/rana-moh-sip-transfer-1.8/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/main/channel.c?view=diff&rev=390012&r1=390011&r2=390012
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/main/channel.c (original)
+++ team/group/rana-moh-sip-transfer-1.8/main/channel.c Wed May 29 07:55:50 2013
@@ -9753,6 +9753,31 @@
return 0;
}
+int ast_channel_put_remote_on_hold(struct ast_channel *chan, const char *mohsuggest)
+{
+ if (!chan) {
+ return -1;
+ }
+ ast_channel_set_local_hold(chan, 1); /* Put this channel on hold */
+ ast_queue_control_data(chan, AST_CONTROL_HOLD, S_OR(mohsuggest, NULL), !ast_strlen_zero(mohsuggest) ? strlen(mohsuggest) + 1 : 0);
+
+ /* Remember this music class for transfers */
+ if (ast_strlen_zero(chan->hold_state.mohsuggest)) {
+ ast_channel_set_hold_musicclass(chan, mohsuggest);
+ }
+ return 0;
+}
+
+int ast_channel_put_remote_off_hold(struct ast_channel *chan)
+{
+ if (!chan) {
+ return -1;
+ }
+ ast_channel_set_local_hold(chan, 0); /* Put this channel off hold */
+ ast_queue_control(chan, AST_CONTROL_UNHOLD);
+ return 0;
+}
+
int ast_channel_set_local_hold(struct ast_channel *chan, int hold)
{
if (!chan) {
More information about the asterisk-commits
mailing list