Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 77849) +++ channels/chan_sip.c (working copy) @@ -1090,6 +1090,7 @@ char lastmsg[256]; /*!< Last Message sent/received */ int amaflags; /*!< AMA Flags */ int pendinginvite; /*!< Any pending invite ? (seqno of this) */ + int xfersound; /*!< Play xfersound on tranfser*/ struct sip_request initreq; /*!< Latest request that opened a new transaction within this dialog. NOT the request that opened the dialog @@ -14901,6 +14901,18 @@ ast_set_flag(&transferer->flags[0], SIP_DEFER_BYE_ON_TRANSFER); /* Delay hangup */ + /*Set XFERSOUND */ + if(current->chan2) { + ast_log(LOG_DEBUG,"Setting target.chan1->xfersound=1, target.chan2->xfersound=1\n"); + target.chan1->xfersound=1; + target.chan2->xfersound=1; + } else { + target.chan1->xfersound=0; + target.chan2->xfersound=0; + ast_log(LOG_DEBUG,"Don't play a xfersound, one bridge\n"); + } + + ast_log(LOG_DEBUG,"attempt_transfer\n"); /* Perform the transfer */ res = attempt_transfer(current, &target); sip_pvt_unlock(targetcall_pvt); Index: include/asterisk/channel.h =================================================================== --- include/asterisk/channel.h (revision 77849) +++ include/asterisk/channel.h (working copy) @@ -455,6 +455,8 @@ in the CHANNEL dialplan function */ struct ast_channel_monitor *monitor; /*!< Channel monitoring */ + + int xfersound; /*!< Play XFERSOUND on tranfer */ unsigned long insmpl; /*!< Track the read/written samples for monitor use */ unsigned long outsmpl; /*!< Track the read/written samples for monitor use */ Index: main/channel.c =================================================================== --- main/channel.c (revision 77849) +++ main/channel.c (working copy) @@ -3841,6 +3841,9 @@ int frame_put_in_jb = 0; int jb_in_use; int to; + + /* Indicates where the xfersound was played */ + int xfersoundplayed=0; cs[0] = c0; cs[1] = c1; @@ -3926,6 +3929,18 @@ if (bridge_exit) break; } + + /* Play XFERSOUND */ + if ((f->frametype == AST_FRAME_VOICE ) && ((c1->xfersound) || (c0->xfersound)) && ! xfersoundplayed) { + ast_log(LOG_DEBUG, "Playing xfersound on channel: %s.\n",c0->name); + bridge_playfile(c0,c1,"beep",0); + ast_log(LOG_DEBUG, "Playing xfersound on channel: %s.\n",c1->name); + bridge_playfile(c1,c0,"beep",0); + xfersoundplayed=1; + } else { + ast_log(LOG_DEBUG, "Not Playing xfersound on channel0: %s or channel1: %s.\n", c0->name, c1->name); + } + if ((f->frametype == AST_FRAME_VOICE) || (f->frametype == AST_FRAME_DTMF_BEGIN) || (f->frametype == AST_FRAME_DTMF) ||