Best practice to hangup or deny a call

Hi all,

I’m in my testing phase of this:

and I naively thought an exit(1) of an AGI script caused a hangup, but I’ll need to exec_goto to the right hangup context etc. I was thinking:

exten => s-INVALIDNMBR,1,Noop(Dial failed due to trunk reporting Address Incomplete - giving up)

in `[macro-dialout-trunk]’ but wanted to be to check if I should play the caller a message etc.

What’s nice for a user, logs and every other module that might want to tidy up things. Like the sangomacrm agi etc.

There is a AGI hangup command: Asterisk 20 AGICommand_hangup - Asterisk Project - Asterisk Project Wiki however, it does not seem like you can pass a causecode like in the dialplan: Asterisk 20 Application_Hangup - Asterisk Project - Asterisk Project Wiki

So perhaps sending back to the dialplan and using a Hangup(causecode) would be best.

1 Like

I think I’ll opt to add some settings for the admin to pick things like:

  1. Hangup
  2. Play a message (from Recordings)
  3. Send email

Maybe just go to hangup first/number not found.

etc.

Actually, I’m going to keep logic out of my AGI script and send a call that I want to hangup into a dialplan context that has a -custom in it for others to hook into if they want to.

Plus those options on the config page later :slight_smile:

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