How can I play custom tone when the other end caller hangup the call?

Hi,

I would like to play a little tone to indicate the end of call when the other end hangup the phone.
Is there any easy way to achieve this?

Many thanks in advance,

I assume you want “Remote Disconnect” tone.
I believe this is a phone level feature, not something on the PBX.

When the other channel disconnects, the channel the phone is using is still active and can still be processed until the hangup is giving to it.

There are options in Dial() is exaclty what the OP is looking for. They will send the phone to another point in in the dialplan when the other channel disconnects. They could be sent to something that plays back the tone

1 Like

The option is F

2 Likes

Thank you, Tom and Dicko!

Dial() and F Option, yes I will look into it.

Just curious, when I look through asterisk console, (asterisk -vvvvr) I see macro-hangupcall is called when the call is terminated.

I thought Playback() may work, so I append [macro-hangupcall] section like below in /etc/asterisk/extension_override_freepbx.conf,

[macro-hangupcall]
include => macro-hangupcall-custom
exten => s,1(start),GotoIf($["${USE_CONFIRMATION}"="" | "${RINGGROUP_INDEX}"="" | "${CHANNEL}"!="${UNIQCHAN}"]?theend)
exten => s,n(delrgi),Noop(Deleting: RG/${RINGGROUP_INDEX}/${CHANNEL} ${DB_DELETE(RG/${RINGGROUP_INDEX}/${CHANNEL})})
exten => s,n(theend),ExecIf($["${ONETOUCH_RECFILE}"!="" & "${CDR(recordingfile)}"=""]?Set(CDR(recordingfile)=${ONETOUCH_REC\
FILE}))
exten => s,n,Noop(${CDR(dstchannel)} monior file= ${MIXMONITOR_FILENAME})
exten => s,n,AGI(attendedtransfer-rec-restart.php,${CDR(dstchannel)},${MIXMONITOR_FILENAME})
;Added to see whether it plays sound when hanged up.  (but not working...)
exten => s,n,Playback(confbridge-leave)
exten => s,n,Hangup
exten => s,n,MacroExit()

;--== end of [macro-hangupcall] ==--;

and I saw below while terminating the call, but I don’t hear the sound from the handset.

    Executing [s@macro-hangupcall:6] Playback("SIP/xxxxx-000000b9", "confbridge-leave") in new stack
    <SIP/xxxxx-000000b9> Playing 'confbridge-leave.g722' (language 'en')
    Executing [s@macro-hangupcall:7] Hangup("SIP/xxxxx-000000b9", "") in new stack
  Spawn extension (macro-hangupcall, s, 7) exited non-zero on 'SIP/xxxxx-000000b9' in macro 'hangupcall'

I will test with Dial() app.

Best regards,

When it hits that macro that is tearing down the channel you want to use. You need to do this before that happens.

1 Like

Ah…, I see… That means perhaps I have to perform before the call leave simple_bridge.
# simple_bridge??? Humm, I need to learn what it is, and how it is configured…

   Executing [s@macro-setmusic:1] Set("SIP/Trunk_Junction-00000001", "CHANNEL(musicclass)=none") in new stack
   Channel SIP/Trunk_Junction-00000001 joined 'simple_bridge' basic-bridge <9696f4f4-a076-4892-ad72-660a5b36c7d6>
   Channel PJSIP/xxxxx-00000001 joined 'simple_bridge' basic-bridge <9696f4f4-a076-4892-ad72-660a5b36c7d6>
; <--- The call hanged up here.
   Channel SIP/Trunk_Junction-00000001 left 'simple_bridge' basic-bridge <9696f4f4-a076-4892-ad72-660a5b36c7d6>
   Channel PJSIP/xxxxx-00000001 left 'simple_bridge' basic-bridge <9696f4f4-a076-4892-ad72-660a5b36c7d6>

OK, let’s try this a different way.

  1. You go into Advanced Settings and go to Asterisk Dial Options. ← This settings controls how internal/local extensions are dialed from the PBX.

  2. You’re going to add at the end F(context^extension^priority). So your string ends up like: HhTtrF(endcall-tone^s^1)

  3. Make sure you have your context is setup something like:

[endcall-tone]
exten => s,1,PlayTones(tone)
same => n,macro(hangupcall,)

That’s pretty much it. That will send the called party to the tone when the caller hangs up.

Note: “tone” is just a placeholder as is the context, etc. Just to give you an idea on how to do it.

2 Likes

Hi Tom,

Thank you very much for your detailed instruction, it is very informative!
I have been tweaking around the setting by following your instruction, I noticed, F(endcall-tone^s^1) was appearing on DIAL_OPTION; however, for some reason it didn’t jump to endcall-tone context when the call was hanged. Once hanged, I see left 'simple_bridge' basic-bridge message, and channel got destroyed.

Channel SIP/Trunk_Junction-00000001 left 'simple_bridge' basic-bridge &lt;9696f4f4-a076-4892-ad72-660a5b36c7d6&gt; Channel PJSIP/xxxxx-00000001 left 'simple_bridge' basic-bridge &lt;9696f4f4-a076-4892-ad72-660a5b36c7d6&gt;

Perhaps I have to set F option on Bridge app? (But I don’t know where I can set it, I am still not sure what simple_bridge / basic_bridge is…)

You need to show the whole call not just one or two lines.

Apologize in advance, it is a bit long, but endcall-tone context is not triggered when call is terminated, it just destroy channels and gointo hangupcall process…

; Calling from internal extension x12345 to outside number, 1234567890. 9 is prefix to call out.

  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5
    -- Executing [911234567890@from-internal:1] Macro("SIP/12345-000001a4", "user-callerid,LIMIT,EXTERNAL,") in new stack
    -- Executing [s@macro-user-callerid:1] Set("SIP/12345-000001a4", "TOUCH_MONITOR=xxxxxxxxxx.xxx") in new stack
    -- Executing [s@macro-user-callerid:2] Set("SIP/12345-000001a4", "AMPUSER=12345") in new stack
    -- Executing [s@macro-user-callerid:3] GotoIf("SIP/12345-000001a4", "0?report") in new stack
    -- Executing [s@macro-user-callerid:4] ExecIf("SIP/12345-000001a4", "1?Set(REALCALLERIDNUM=12345)") in new stack
    -- Executing [s@macro-user-callerid:5] Set("SIP/12345-000001a4", "AMPUSER=12345") in new stack
    -- Executing [s@macro-user-callerid:6] GotoIf("SIP/12345-000001a4", "0?limit") in new stack
    -- Executing [s@macro-user-callerid:7] Set("SIP/12345-000001a4", "AMPUSERCIDNAME=CID") in new stack
    -- Executing [s@macro-user-callerid:8] ExecIf("SIP/12345-000001a4", "0?Set(__CIDMASQUERADING=TRUE)") in new stack
    -- Executing [s@macro-user-callerid:9] GotoIf("SIP/12345-000001a4", "0?report") in new stack
    -- Executing [s@macro-user-callerid:10] Set("SIP/12345-000001a4", "AMPUSERCID=12345") in new stack
    -- Executing [s@macro-user-callerid:11] Set("SIP/12345-000001a4", "__DIAL_OPTIONS=HhTtrF(endcall-tone^s^1)") in new stack
    -- Executing [s@macro-user-callerid:12] Set("SIP/12345-000001a4", "CALLERID(all)="CID" <12345>") in new stack
    -- Executing [s@macro-user-callerid:13] GotoIf("SIP/12345-000001a4", "0?limit") in new stack
    -- Executing [s@macro-user-callerid:14] ExecIf("SIP/12345-000001a4", "1?Set(GROUP(concurrency_limit)=12345)") in new stack
    -- Executing [s@macro-user-callerid:15] NoOp("SIP/12345-000001a4", "Macro Depth is 1") in new stack
    -- Executing [s@macro-user-callerid:16] GotoIf("SIP/12345-000001a4", "1?report2:macroerror") in new stack
    -- Goto (macro-user-callerid,s,17)
    -- Executing [s@macro-user-callerid:17] GotoIf("SIP/12345-000001a4", "1?continue") in new stack
    -- Goto (macro-user-callerid,s,36)
    -- Executing [s@macro-user-callerid:36] Set("SIP/12345-000001a4", "CALLERID(number)=12345") in new stack
    -- Executing [s@macro-user-callerid:37] Set("SIP/12345-000001a4", "CALLERID(name)=CID") in new stack
    -- Executing [s@macro-user-callerid:38] GotoIf("SIP/12345-000001a4", "0?cnum") in new stack
    -- Executing [s@macro-user-callerid:39] Set("SIP/12345-000001a4", "CDR(cnam)=CID") in new stack
    -- Executing [s@macro-user-callerid:40] Set("SIP/12345-000001a4", "CDR(cnum)=12345") in new stack
    -- Executing [s@macro-user-callerid:41] Set("SIP/12345-000001a4", "CHANNEL(language)=en") in new stack
    -- Executing [s@macro-user-callerid:42] Set("SIP/12345-000001a4", "CDR(userfield)=Trunk(TX/RX):,0,0") in new stack
    -- Executing [911234567890@from-internal:2] Gosub("SIP/12345-000001a4", "sub-record-check,s,1(out,911234567890,dontcare)") in new stack
    -- Executing [s@sub-record-check:1] GotoIf("SIP/12345-000001a4", "0?initialized") in new stack
    -- Executing [s@sub-record-check:2] Set("SIP/12345-000001a4", "__REC_STATUS=INITIALIZED") in new stack
    -- Executing [s@sub-record-check:3] Set("SIP/12345-000001a4", "NOW=xxxxxxxxxx") in new stack
    -- Executing [s@sub-record-check:4] Set("SIP/12345-000001a4", "__DAY=13") in new stack
    -- Executing [s@sub-record-check:5] Set("SIP/12345-000001a4", "__MONTH=11") in new stack
    -- Executing [s@sub-record-check:6] Set("SIP/12345-000001a4", "__YEAR=2018") in new stack
    -- Executing [s@sub-record-check:7] Set("SIP/12345-000001a4", "__TIMESTR=20181113-162120") in new stack
    -- Executing [s@sub-record-check:8] Set("SIP/12345-000001a4", "__FROMEXTEN=12345") in new stack
    -- Executing [s@sub-record-check:9] Set("SIP/12345-000001a4", "__MON_FMT=wav") in new stack
    -- Executing [s@sub-record-check:10] NoOp("SIP/12345-000001a4", "Recordings initialized") in new stack
    -- Executing [s@sub-record-check:11] ExecIf("SIP/12345-000001a4", "0?Set(ARG3=dontcare)") in new stack
    -- Executing [s@sub-record-check:12] Set("SIP/12345-000001a4", "REC_POLICY_MODE_SAVE=") in new stack
    -- Executing [s@sub-record-check:13] ExecIf("SIP/12345-000001a4", "0?Set(REC_STATUS=NO)") in new stack
    -- Executing [s@sub-record-check:14] GotoIf("SIP/12345-000001a4", "3?checkaction") in new stack
    -- Goto (sub-record-check,s,17)
    -- Executing [s@sub-record-check:17] GotoIf("SIP/12345-000001a4", "1?sub-record-check,out,1") in new stack
    -- Goto (sub-record-check,out,1)
    -- Executing [out@sub-record-check:1] NoOp("SIP/12345-000001a4", "Outbound Recording Check from 12345 to 911234567890") in new stack
    -- Executing [out@sub-record-check:2] Set("SIP/12345-000001a4", "RECMODE=dontcare") in new stack
    -- Executing [out@sub-record-check:3] ExecIf("SIP/12345-000001a4", "1?Goto(routewins)") in new stack
    -- Goto (sub-record-check,out,7)
    -- Executing [out@sub-record-check:7] Gosub("SIP/12345-000001a4", "recordcheck,1(dontcare,out,911234567890)") in new stack
    -- Executing [recordcheck@sub-record-check:1] NoOp("SIP/12345-000001a4", "Starting recording check against dontcare") in new stack
    -- Executing [recordcheck@sub-record-check:2] Goto("SIP/12345-000001a4", "dontcare") in new stack
    -- Goto (sub-record-check,recordcheck,3)
    -- Executing [recordcheck@sub-record-check:3] Return("SIP/12345-000001a4", "") in new stack
    -- Executing [out@sub-record-check:8] Return("SIP/12345-000001a4", "") in new stack
    -- Executing [911234567890@from-internal:3] ExecIf("SIP/12345-000001a4", "0 ?Set(CDR(accountcode)=)") in new stack
    -- Executing [911234567890@from-internal:4] Set("SIP/12345-000001a4", "ROUTE_CIDSAVE="CID" <12345>") in new stack
    -- Executing [911234567890@from-internal:5] Set("SIP/12345-000001a4", "MOHCLASS=default") in new stack
    -- Executing [911234567890@from-internal:6] Set("SIP/12345-000001a4", "_NODEST=") in new stack
    -- Executing [911234567890@from-internal:7] Macro("SIP/12345-000001a4", "dialout-trunk,2,11234567890,,off") in new stack
    -- Executing [s@macro-dialout-trunk:1] Set("SIP/12345-000001a4", "DIAL_TRUNK=2") in new stack
    -- Executing [s@macro-dialout-trunk:2] ExecIf("SIP/12345-000001a4", "0?Set(DIAL_OPTIONS=HhtrF(endcall-tone^s^1))") in new stack
    -- Executing [s@macro-dialout-trunk:3] GosubIf("SIP/12345-000001a4", "0?sub-pincheck,s,1()") in new stack
    -- Executing [s@macro-dialout-trunk:4] ExecIf("SIP/12345-000001a4", "0?Set(CALLERID(num)=12345)") in new stack
    -- Executing [s@macro-dialout-trunk:5] GotoIf("SIP/12345-000001a4", "0?disabletrunk,1") in new stack
    -- Executing [s@macro-dialout-trunk:6] Set("SIP/12345-000001a4", "DIAL_NUMBER=11234567890") in new stack
    -- Executing [s@macro-dialout-trunk:7] Set("SIP/12345-000001a4", "DIAL_TRUNK_OPTIONS=HhTtr") in new stack
    -- Executing [s@macro-dialout-trunk:8] Set("SIP/12345-000001a4", "OUTBOUND_GROUP=OUT_2") in new stack
    -- Executing [s@macro-dialout-trunk:9] Set("SIP/12345-000001a4", "DIAL_TRUNK_OPTIONS=T") in new stack
    -- Executing [s@macro-dialout-trunk:10] GotoIf("SIP/12345-000001a4", "1?nomax") in new stack
    -- Goto (macro-dialout-trunk,s,12)
    -- Executing [s@macro-dialout-trunk:12] GotoIf("SIP/12345-000001a4", "0?skipoutcid") in new stack
    -- Executing [s@macro-dialout-trunk:13] Macro("SIP/12345-000001a4", "outbound-callerid,2") in new stack
    -- Executing [s@macro-outbound-callerid:1] NoOp("SIP/12345-000001a4", "12345") in new stack
    -- Executing [s@macro-outbound-callerid:2] NoOp("SIP/12345-000001a4", "") in new stack
    -- Executing [s@macro-outbound-callerid:3] NoOp("SIP/12345-000001a4", "off") in new stack
    -- Executing [s@macro-outbound-callerid:4] ExecIf("SIP/12345-000001a4", "0?Set(CALLERPRES(name-pres)=)") in new stack
    -- Executing [s@macro-outbound-callerid:5] ExecIf("SIP/12345-000001a4", "0?Set(CALLERPRES(num-pres)=)") in new stack
    -- Executing [s@macro-outbound-callerid:6] ExecIf("SIP/12345-000001a4", "0?Set(REALCALLERIDNUM=12345)") in new stack
    -- Executing [s@macro-outbound-callerid:7] ExecIf("SIP/12345-000001a4", "0?Set(AMPUSER=12345)") in new stack
    -- Executing [s@macro-outbound-callerid:8] GotoIf("SIP/12345-000001a4", "1?normcid") in new stack
    -- Goto (macro-outbound-callerid,s,12)
    -- Executing [s@macro-outbound-callerid:12] Set("SIP/12345-000001a4", "USEROUTCID="CID" <1234567890>") in new stack
    -- Executing [s@macro-outbound-callerid:13] Set("SIP/12345-000001a4", "EMERGENCYCID=") in new stack
    -- Executing [s@macro-outbound-callerid:14] Set("SIP/12345-000001a4", "TRUNKOUTCID=") in new stack
    -- Executing [s@macro-outbound-callerid:15] GotoIf("SIP/12345-000001a4", "1?trunkcid") in new stack
    -- Goto (macro-outbound-callerid,s,20)
    -- Executing [s@macro-outbound-callerid:20] ExecIf("SIP/12345-000001a4", "0?Set(CALLERID(all)=)") in new stack
    -- Executing [s@macro-outbound-callerid:21] ExecIf("SIP/12345-000001a4", "1?Set(CALLERID(all)="CID" <1234567890>)") in new stack
    -- Executing [s@macro-outbound-callerid:22] ExecIf("SIP/12345-000001a4", "0?Set(CALLERID(all)=)") in new stack
    -- Executing [s@macro-outbound-callerid:23] ExecIf("SIP/12345-000001a4", "0?Set(CALLERPRES(name-pres)=prohib_passed_screen)") in new stack
    -- Executing [s@macro-outbound-callerid:24] ExecIf("SIP/12345-000001a4", "0?Set(CALLERPRES(num-pres)=prohib_passed_screen)") in new stack
    -- Executing [s@macro-outbound-callerid:25] Set("SIP/12345-000001a4", "CDR(outbound_cnum)=xxxxxxxxxx") in new stack
    -- Executing [s@macro-outbound-callerid:26] Set("SIP/12345-000001a4", "CDR(outbound_cnam)=xxxxx") in new stack
    -- Executing [s@macro-outbound-callerid:27] Set("SIP/12345-000001a4", "CDR(userfield)=Trunk(TX/RX):,1,0") in new stack
    -- Executing [s@macro-dialout-trunk:14] GosubIf("SIP/12345-000001a4", "0?sub-flp-2,s,1()") in new stack
    -- Executing [s@macro-dialout-trunk:15] Set("SIP/12345-000001a4", "OUTNUM=xxxxxxxxxxx") in new stack
    -- Executing [s@macro-dialout-trunk:16] Set("SIP/12345-000001a4", "custom=SIP/Trunk_Junction") in new stack
    -- Executing [s@macro-dialout-trunk:17] ExecIf("SIP/12345-000001a4", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default)T)") in new stack
    -- Executing [s@macro-dialout-trunk:18] ExecIf("SIP/12345-000001a4", "0?Set(DIAL_TRUNK_OPTIONS=TM(confirm))") in new stack
    -- Executing [s@macro-dialout-trunk:19] Macro("SIP/12345-000001a4", "dialout-trunk-predial-hook,") in new stack
    -- Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("SIP/12345-000001a4", "") in new stack
    -- Executing [s@macro-dialout-trunk:20] GotoIf("SIP/12345-000001a4", "0?bypass,1") in new stack
    -- Executing [s@macro-dialout-trunk:21] ExecIf("SIP/12345-000001a4", "1?Set(CONNECTEDLINE(num,i)=11234567890)") in new stack
    -- Executing [s@macro-dialout-trunk:22] ExecIf("SIP/12345-000001a4", "1?Set(CONNECTEDLINE(name,i)=CID:1234567890)") in new stack
    -- Executing [s@macro-dialout-trunk:23] ExecIf("SIP/12345-000001a4", "0?Set(CONNECTEDLINE(name,i)=CID:(Hidden)1234567890)") in new stack
    -- Executing [s@macro-dialout-trunk:24] GotoIf("SIP/12345-000001a4", "0?customtrunk") in new stack
    -- Executing [s@macro-dialout-trunk:25] Dial("SIP/12345-000001a4", "SIP/Trunk_Junction/11234567890,300,Tb(func-apply-sipheaders^s^1)") in new stack
  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5
    -- SIP/Trunk_Junction-000001a5 Internal Gosub(func-apply-sipheaders,s,1) start
    -- Executing [s@func-apply-sipheaders:1] NoOp("SIP/Trunk_Junction-000001a5", "Applying SIP Headers to channel") in new stack
    -- Executing [s@func-apply-sipheaders:2] Set("SIP/Trunk_Junction-000001a5", "SIPHEADERKEYS=") in new stack
    -- Executing [s@func-apply-sipheaders:3] ExecIf("SIP/Trunk_Junction-000001a5", "0?Set(Rheader=1)") in new stack
    -- Executing [s@func-apply-sipheaders:4] While("SIP/Trunk_Junction-000001a5", "0") in new stack
    -- Jumping to priority 8
    -- Executing [s@func-apply-sipheaders:9] ExecIf("SIP/Trunk_Junction-000001a5", "0?SIPRemoveHeader(Alert-Info:)") in new stack
    -- Executing [s@func-apply-sipheaders:10] ExecIf("SIP/Trunk_Junction-000001a5", "0?Set(PJSIP_HEADER(remove,Alert-Info)=)") in new stack
    -- Executing [s@func-apply-sipheaders:11] Return("SIP/Trunk_Junction-000001a5", "") in new stack
  == Spawn extension (from-pstn-e164-us, 911234567890, 1) exited non-zero on 'SIP/Trunk_Junction-000001a5'
    -- SIP/Trunk_Junction-000001a5 Internal Gosub(func-apply-sipheaders,s,1) complete GOSUB_RETVAL=
    -- Called SIP/Trunk_Junction/11234567890
    -- SIP/Trunk_Junction-000001a5 is making progress passing it to SIP/12345-000001a4
    -- SIP/Trunk_Junction-000001a5 is making progress passing it to SIP/12345-000001a4
    -- SIP/Trunk_Junction-000001a5 answered SIP/12345-000001a4
    -- Channel SIP/Trunk_Junction-000001a5 joined 'simple_bridge' basic-bridge <3482999a-6750-4ffa-9800-2fa11627c3f1>
    -- Channel SIP/12345-000001a4 joined 'simple_bridge' basic-bridge <3482999a-6750-4ffa-9800-2fa11627c3f1>

; <--- Here, disconnect call from 12324567890

    -- Channel SIP/Trunk_Junction-000001a5 left 'simple_bridge' basic-bridge <3482999a-6750-4ffa-9800-2fa11627c3f1>
    -- Channel SIP/12345-000001a4 left 'simple_bridge' basic-bridge <3482999a-6750-4ffa-9800-2fa11627c3f1>
  == Spawn extension (macro-dialout-trunk, s, 25) exited non-zero on 'SIP/12345-000001a4' in macro 'dialout-trunk'
  == Spawn extension (from-internal, 911234567890, 7) exited non-zero on 'SIP/12345-000001a4'
    -- Executing [h@from-internal:1] Macro("SIP/12345-000001a4", "hangupcall") in new stack
    -- Executing [s@macro-hangupcall:1] GotoIf("SIP/12345-000001a4", "1?theend") in new stack
    -- Goto (macro-hangupcall,s,3)
    -- Executing [s@macro-hangupcall:3] ExecIf("SIP/12345-000001a4", "0?Set(CDR(recordingfile)=)") in new stack
    -- Executing [s@macro-hangupcall:4] NoOp("SIP/12345-000001a4", "SIP/Trunk_Junction-000001a5 monior file= ") in new stack
    -- Executing [s@macro-hangupcall:5] AGI("SIP/12345-000001a4", "attendedtransfer-rec-restart.php,SIP/Trunk_Junction-000001a5,") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/attendedtransfer-rec-restart.php
    -- <SIP/12345-000001a4>AGI Script attendedtransfer-rec-restart.php completed, returning 0
    -- Executing [s@macro-hangupcall:6] Hangup("SIP/12345-000001a4", "") in new stack
  == Spawn extension (macro-hangupcall, s, 6) exited non-zero on 'SIP/12345-000001a4' in macro 'hangupcall'
  == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/12345-000001a4'

Uhm, this is an outbound call. My guide was based on inbound calls to the endpoints. You would have to change your Outbound Dial settings for this to work.

Hi Tom,

Yes, I set both Dial Options like below and checked internal call as well, (simply called from one extension to the other extension) but it is not jumping to endcall-tone context somehow.

I don’t see the functions being added here, just the T which is the only other option you have for this based on your screenshots.

Now that you’ve shown your screen shots do another call. Grab it from when start the trace until the hangup. Let’s see if your options are being applied.

Hi Tom!

My apology! I tested again, simple internal extension calls (calling between 10000 to 10001) and I’ve heard the tone! (I used confbridge-leave which is in /var/lib/asterisk/sound/en folder)

   -- Channel SIP/10000-000001df joined 'simple_bridge' basic-bridge <372a2b53-e511-496b-9c6a-0b0ad05c3b0b>
    -- Channel PJSIP/10001-00000001 joined 'simple_bridge' basic-bridge <372a2b53-e511-496b-9c6a-0b0ad05c3b0b>
       > 0x7faf48015ce0 -- Strict RTP switching to RTP target address 10.0.0.11:64908 as source
       > 0x7faf78123710 -- Strict RTP switching to RTP target address 10.0.0.1:5004 as source
    -- Channel PJSIP/10001-00000001 left 'simple_bridge' basic-bridge <372a2b53-e511-496b-9c6a-0b0ad05c3b0b>
  == Spawn extension (macro-dial-one, s, 54) exited non-zero on 'PJSIP/10001-00000001' in macro 'dial-one'
  == Spawn extension (macro-exten-vm, s, 14) exited non-zero on 'PJSIP/10001-00000001' in macro 'exten-vm'
  == Spawn extension (ext-local, 10000, 2) exited non-zero on 'PJSIP/10001-00000001'
    -- Executing [h@ext-local:1] Macro("PJSIP/10001-00000001", "hangupcall,") in new stack
    -- Executing [s@macro-hangupcall:1] GotoIf("PJSIP/10001-00000001", "1?theend") in new stack
    -- Goto (macro-hangupcall,s,3)
    -- Channel SIP/10000-000001df left 'simple_bridge' basic-bridge <372a2b53-e511-496b-9c6a-0b0ad05c3b0b>

; <---  Yes, I hear it!

    -- Executing [s@endcall-tone:1] Playback("SIP/10000-000001df", "confbridge-leave") in new stack
    -- <SIP/10000-000001df> Playing 'confbridge-leave.g722' (language 'en')
    -- Executing [s@macro-hangupcall:3] ExecIf("PJSIP/10001-00000001", "0?Set(CDR(recordingfile)=)") in new stack
    -- Executing [s@macro-hangupcall:4] NoOp("PJSIP/10001-00000001", "SIP/10000-000001df monior file= ") in new stack

It worked on outside call as well!

Interesting thing to note is that there are cases that I hear the tone and the cases I don’t hear the tone.

Case 1: Tone was heard (internal call)

  1. x10000 called x10001
  2. x10001 picked up the call.
  3. x10000 hanged up the call.
  4. x10001 heard the tone.

Case 2: Tone was not heard (internal call)

  1. x10000 called x10001
  2. x10001 picked up the call.
  3. x10001 hanged up the call.
  4. x10000 didn’t hear the tone.

Case 3. Tone was heard (external call)

  1. x10000 called outside number.
  2. The call was picked up by the cellular phone
  3. x10000 terminated the call.
  4. The tone was heard by the cellular phone.

Case 4. Tone was not heard (external call)

  1. Received outside call from the cellular phone.
  2. x10000 picked up the call.
  3. x10000 hanged up the call.
  4. The tone wasn’t heard by the cellular phone.

It looks to me the tone will be heard by the callee when the caller terminated the call.
The caller won’t hear the tone when the callee hang up the call first.

I need to look closer to the case when the tone is not heard, but it started to work!

Once again, than you very much for your valuable insight, I learned quite a lot through your advice!!!

Best regards,

Again, the F option takes the called channel to that context/exten/priority when the caller hangs up. If 1001 (caller) calls 1000 (called) and the 1000 hangs up, then it’s not the caller hanging up.

Your request was that the called party hear a tone when the caller/calling partying hangs up the call. This achieves this. So to recap

  1. The Caller will never hear the tone. Regardless of which side hung up.
  2. The Called Party will hear the tone only when the Caller hangs up first
  3. If the Called Party hangs up then no tone is played back.

Do you want to change that?

1 Like

Hi Tom,

Once again, thank you very much for sharing your knowledge. (I am still new to asterisk detail…)
“1. The Caller will never hear the tone.”, that explains it, I am wondering whether there a way for the caller to hear some notification tone when the call gets terminated. (just curious) :slight_smile:

Just for my reference, I added below in /etc/asterisk/extensions_override_freepbx.conf to hear the tone.
It is a very simple solution, I like it! :wink:

[endcall-tone]
exten => s,1,Playback(confbridge-leave)
exten => s,n,Macro(hangupcall,)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.