Move implementation of an attended-transfer-complete sound from one channel
authorTilghman Lesher <tilghman@meg.abyt.es>
Wed, 30 Jul 2008 16:40:43 +0000 (16:40 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Wed, 30 Jul 2008 16:40:43 +0000 (16:40 +0000)
driver into a common place for multiple channel drivers.
(closes issue #13152)
 Reported by: caio1982
 Patches:
       atxfer_complete_sound3.diff uploaded by caio1982 (license 22)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@134401 65c4cc65-6c06-0410-ace0-fbb531ad65f3

CHANGES
channels/chan_sip.c
configs/chan_dahdi.conf.sample
configs/iax.conf.sample
configs/sip.conf.sample
configs/skinny.conf.sample
main/features.c

diff --git a/CHANGES b/CHANGES
index 28b224a..7418e19 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -109,8 +109,6 @@ Application Changes
 
 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.
  * Added DNS manager support to registrations for peers referencing peer entries.
    DNS manager runs in the background which allows DNS lookups to be run asynchronously 
    as well as periodically updating the IP address. These properties allow for
@@ -180,6 +178,13 @@ Queue changes
     "QUEUE TIMING OPTIONS" in configs/queues.conf.sample for a detailed explanation of the option
     as well as an explanation about timeout options in general
 
+Miscellaneous
+-------------
+  * The channel variable ATTENDED_TRANSFER_COMPLETE_SOUND can now be set using
+    the 'setvar' option to cause a given audio file to be played upon completion
+    of an attended transfer.  Currently it works for DAHDI, IAX2, SIP, and
+    Skinny channels only.
+
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 1.4.X to Asterisk 1.6.0  -------------
 ------------------------------------------------------------------------------
index 746edfd..af353db 100644 (file)
@@ -17748,17 +17748,6 @@ static int local_attended_transfer(struct sip_pvt *transferer, struct sip_dual *
 
        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",
                transferer->owner->name,
index 9c486b1..6c86a08 100644 (file)
@@ -538,7 +538,11 @@ callgroup=1
 pickupgroup=1
 
 ; Channel variable to be set for all calls from this channel
-;setvar=CHANNEL=42             
+;setvar=CHANNEL=42
+;setvar=ATTENDED_TRANSFER_COMPLETE_SOUND=beep   ; This channel variable will
+                                                ; cause the given audio file to
+                                                ; be played upon completion of
+                                                ; an attended transfer.
 
 ;
 ; Specify whether the channel should be answered immediately or if the simple
index 97faa2b..bbdfdca 100644 (file)
@@ -368,7 +368,10 @@ inkeys=freeworlddialup
 ;context=local
 ;auth=md5,plaintext,rsa
 ;secret=markpasswd
-;setvar=foo=bar
+;setvar=ATTENDED_TRANSFER_COMPLETE_SOUND=beep   ; This channel variable will
+                                                ; cause the given audio file to
+                                                ; be played upon completion of
+                                                ; an attended transfer.
 ;dbsecret=mysecrets/place      ; Secrets can be stored in astdb, too
 ;transfer=no           ; Disable IAX native transfer
 ;transfer=mediaonly    ; When doing IAX native transfers, transfer 
index 9bdced5..0dcbced 100644 (file)
@@ -961,8 +961,10 @@ srvlookup=yes                      ; Enable DNS SRV lookups on outbound calls
 ;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
+;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
index 0cfb4fb..389e986 100644 (file)
@@ -87,6 +87,10 @@ keepalive=120
 ;nat=yes
 ;callerid="George W. Bush" <202-456-1414>
 ;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.
 ;mailbox=500
 ;callwaiting=yes
 ;transfer=yes
index 0d8ea93..a7eeedb 100644 (file)
@@ -1235,6 +1235,21 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
 
        l = strlen(xferto);
        snprintf(xferto + l, sizeof(xferto) - l, "@%s/n", transferer_real_context);     /* append context */
+
+       /* 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 (transferee) {
+               const char *chan1_attended_sound = pbx_builtin_getvar_helper(transferer, "ATTENDED_TRANSFER_COMPLETE_SOUND");
+               const char *chan2_attended_sound = pbx_builtin_getvar_helper(transferee, "ATTENDED_TRANSFER_COMPLETE_SOUND");
+
+               if (!ast_strlen_zero(chan1_attended_sound)) {
+                       pbx_builtin_setvar_helper(transferer, "BRIDGE_PLAY_SOUND", chan1_attended_sound);
+               }
+               if (!ast_strlen_zero(chan2_attended_sound)) {
+                       pbx_builtin_setvar_helper(transferee, "BRIDGE_PLAY_SOUND", chan2_attended_sound);
+               }
+       }
+
        newchan = ast_feature_request_and_dial(transferer, transferee, "Local", ast_best_codec(transferer->nativeformats),
                xferto, atxfernoanswertimeout, &outstate, transferer->cid.cid_num, transferer->cid.cid_name, 1, transferer->language);