How to know the Status after a declined w/ an outgoing file


I’m doing for my company, a management alert by phone if something goes wrong on a server (with nagios).

I use the command “originate” to call, and also with the outgoing files “.call”

I would, if the user declines the call, that my program call another person, for example with a “.call” file.

The worry is in the Asterisk’s CLI, if the person does not answer or declined, the call does not go in my [context] in the extensions.conf, and so I can not have access to the status DIALSTATUS.

Is there any way to know the status, or force the .call file to go in the [contexte] and then blocked at the Dial lines ?

Use a local channel to indirectly dial the target channels. … o-dial+out

exten => failed,1,Noop(${DIALSTATUS})


exten => failed,1,Noop(${DIALSTATUS})

I do not have the NoOp line in my asterisk CLI :confused:


Seems to work ! Now i have to configure the extensions.conf to do the work ! ty

Like this ?

exten => s,1,Answer
exten => s,2,NoOp(foo-bar)
exten => s,n,Dial(local/200@internals,30,r)
exten => s,n,NoOp(${DIALSTATUS})
exten => s,n,Hangup

exten => 200,1,Dial(SIP/${EXTEN},40,gtr)
exten => 200,2,NoUp(${DIALSTATUS}
exten => 200,3,Hangup

and then, i try to call my sip client with : $asterisk*CLI> originate SIP/1002 extension 1001@inbound

But the foo-bar appear only if my client answerd the call and then hangup.

If i declined the call, i got :

asterisk*CLI> originate SIP/1002 extension 1001@inbound
== Using SIP RTP CoS mark 5
– Got SIP response 603 “Decline” back from

[EDIT] => Seems to work with the failed exensions in the main context ! Now i have to configure the extensions.conf to do the work ! ty

Originate with local/, not with sip/

Channel: SIP/trunkname/18882223333 Context: callme Extension: 800 Priority: 1


[callme] exten => 800,1,... exten => 800,2,... ... exten => failed,1,... exten => failed,2,...