DialPlan VoiceMail exit behaviour varies depending if # is pressed or not

Asterisk Version: 13.28.1 FreePBX

Hi. I’ve a dialplan that calls VoiceMail and then sends an SMS. I’ve found Asterisk behaves differently depending how the caller ends the call:

  1. If they press the # key then the script continues and the SMS is sent:
app.c: User ended message by pressing #
file.c: <SIP/501-00000015> Playing 'auth-thankyou.ulaw' (language 'en')
pbx.c: Executing [012345678@Inbound-Call-Filtering:100] Goto("SIP/501-00000015", "sendSMS") in new stack
[SMS code]
Executing [012345678@Inbound-Call-Filtering:109] Hangup("SIP/501-00000015", "") in new stack
Spawn extension (Inbound-Call-Filtering, 012345678, 109) exited non-zero on 'SIP/501-00000015'

  1. if they hang up then the script does not continue:
app.c: User hung up
 pbx.c: Spawn extension (Inbound-Call-Filtering, 012345678, 99) exited non-zero on 'SIP/501-00000016'

Is this behaviour correct and is there a solution?

I did think about sending the SMS before calling VoiceMail but 1) I was worried about the delay and 2) I don’t want to send the SMS if they don’t leave a message.

Thanks for reading.

Once a call is hung up dialplan execution stops. If you want things to execute even after hangup, then a hangup handler[1] is what is commonly used. As you are using FreePBX there may be FreePBX specific ways to hook into its dialplan appropriately.

[1] https://wiki.asterisk.org/wiki/display/AST/Hangup+Handlers

1 Like

Hi jcolp. Many thanks for a quick and helpful reply. I have not heard of hangup handlers but it did the trick :slight_smile:

I’ve now implemented a hangup handler and also used the ${VMSTATUS} to check if they have left a message or not.


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