diff --git a/CHANGES b/CHANGES index ba0ede2127fa51ed23be52cc72f1e553c9a9e26c..bc224b4a8fe78a3d2eab3b08322d5af81c6a4aaa 100644 --- a/CHANGES +++ b/CHANGES @@ -26,6 +26,11 @@ Application Changes 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 ------------- ------------------------------------------------------------------------------ diff --git a/channels/chan_sip.c b/channels/chan_sip.c index a6e6b4bb5bc77b747a24e2b6f258911fd8e0a78d..1281752341fe7135df761f7721e62e5385e65a0d 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -16869,6 +16869,17 @@ 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, diff --git a/configs/sip.conf.sample b/configs/sip.conf.sample index baabc9b6e0832d8090dbb93c87c9d3f3940c3270..1080777aa583242979c47cb0fa15e4878e4ffdf3 100644 --- a/configs/sip.conf.sample +++ b/configs/sip.conf.sample @@ -930,6 +930,8 @@ 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 ;[pre14-asterisk] ;type=friend diff --git a/main/channel.c b/main/channel.c index 920ee37ddaf97734381f810453f9b7ebebfc52d3..005f76ff134b41a81db816778b60bd9b8b8da5c7 100644 --- a/main/channel.c +++ b/main/channel.c @@ -4355,6 +4355,7 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha for (/* ever */;;) { struct timeval now = { 0, }; int to; + const char *bridge_play_sound = NULL; to = -1; @@ -4438,6 +4439,16 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha 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) &&