[asterisk-commits] file: trunk r110631 - in /trunk: ./ channels/ configs/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 25 10:18:42 CDT 2008


Author: file
Date: Tue Mar 25 10:18:41 2008
New Revision: 110631

URL: http://svn.digium.com/view/asterisk?view=rev&rev=110631
Log:
Add a special dialplan variable to chan_sip which will cause an audio file to be played upon completion of an attended transfer.
(closes issue #9239)
Reported by: sunder

Modified:
    trunk/CHANGES
    trunk/channels/chan_sip.c
    trunk/configs/sip.conf.sample
    trunk/main/channel.c

Modified: trunk/CHANGES
URL: http://svn.digium.com/view/asterisk/trunk/CHANGES?view=diff&rev=110631&r1=110630&r2=110631
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Tue Mar 25 10:18:41 2008
@@ -25,6 +25,11 @@
    the arguments to Directory; previously, you could enter only 3, regardless
    of how many names are in your company.  For large companies, this should be
    quite helpful.
+
+SIP Changes
+-----------
+ * The ATTENDED_TRANSFER_COMPLETE_SOUND can now be set using setvar to cause a given
+   audio file to be played upon completion of an attended transfer.
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 1.4.X to Asterisk 1.6.0  -------------

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=110631&r1=110630&r2=110631
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Mar 25 10:18:41 2008
@@ -16868,6 +16868,17 @@
 	}
 
 	ast_set_flag(&transferer->flags[0], SIP_DEFER_BYE_ON_TRANSFER);	/* Delay hangup */
+
+	/* If we are performing an attended transfer and we have two channels involved then copy sound file information to play upon attended transfer completion */
+	if (target.chan2) {
+		const char *chan1_attended_sound = pbx_builtin_getvar_helper(target.chan1, "ATTENDED_TRANSFER_COMPLETE_SOUND"), *chan2_attended_sound = pbx_builtin_getvar_helper(target.chan2, "ATTENDED_TRANSFER_COMPLETE_SOUND");
+		if (!ast_strlen_zero(chan1_attended_sound)) {
+			pbx_builtin_setvar_helper(target.chan1, "BRIDGE_PLAY_SOUND", chan1_attended_sound);
+		}
+		if (!ast_strlen_zero(chan2_attended_sound)) {
+			pbx_builtin_setvar_helper(target.chan2, "BRIDGE_PLAY_SOUND", chan2_attended_sound);
+		}
+	}
 
 	/* Perform the transfer */
 	manager_event(EVENT_FLAG_CALL, "Transfer", "TransferMethod: SIP\r\nTransferType: Attended\r\nChannel: %s\r\nUniqueid: %s\r\nSIP-Callid: %s\r\nTargetChannel: %s\r\nTargetUniqueid: %s\r\n",

Modified: trunk/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/sip.conf.sample?view=diff&rev=110631&r1=110630&r2=110631
==============================================================================
--- trunk/configs/sip.conf.sample (original)
+++ trunk/configs/sip.conf.sample Tue Mar 25 10:18:41 2008
@@ -930,6 +930,8 @@
 ;defaultuser=goran		; Username to use when calling this device before registration
 				; Normally you do NOT need to set this parameter
 ;setvar=CUSTID=5678		; Channel variable to be set for all calls from this device
+;setvar=ATTENDED_TRANSFER_COMPLETE_SOUND=beep ; This channel variable will cause the given audio file to be played
+                                              ; upon completion of an attended transfer
 
 ;[pre14-asterisk]
 ;type=friend

Modified: trunk/main/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/main/channel.c?view=diff&rev=110631&r1=110630&r2=110631
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Tue Mar 25 10:18:41 2008
@@ -4355,6 +4355,7 @@
 	for (/* ever */;;) {
 		struct timeval now = { 0, };
 		int to;
+		const char *bridge_play_sound = NULL;
 
 		to = -1;
 
@@ -4438,6 +4439,16 @@
 			pbx_builtin_setvar_helper(c1, "BRIDGEPVTCALLID", c0->tech->get_pvt_uniqueid(c0));
 		if (c1->tech->get_pvt_uniqueid)
 			pbx_builtin_setvar_helper(c0, "BRIDGEPVTCALLID", c1->tech->get_pvt_uniqueid(c1));
+
+		/* See if we need to play an audio file to any side of the bridge */
+		if ((bridge_play_sound = pbx_builtin_getvar_helper(c0, "BRIDGE_PLAY_SOUND"))) {
+			bridge_playfile(c0, c1, bridge_play_sound, 0);
+			pbx_builtin_setvar_helper(c0, "BRIDGE_PLAY_SOUND", NULL);
+		}
+		if ((bridge_play_sound = pbx_builtin_getvar_helper(c1, "BRIDGE_PLAY_SOUND"))) {
+			bridge_playfile(c1, c0, bridge_play_sound, 0);
+			pbx_builtin_setvar_helper(c1, "BRIDGE_PLAY_SOUND", NULL);
+		}
 		
 		if (c0->tech->bridge &&
 		    (c0->tech->bridge == c1->tech->bridge) &&




More information about the asterisk-commits mailing list