Handle unreachable sip account

I want handle uncreachable sip account.

My scenario is,
Sip client call 100, if 100 is unreachable, i want send email.

How can i handle it?

Thanks for replies.

Make a logic decision based on the value of variable ${DIALSTATUS} and then Use the System() cmd for send the email

my distro is AsteriskNow

extensions context is “from-internal”

I seach and find document
wiki.asterisk.org/wiki/display/ … ion_System
I read document and apply my extensions.conf

;------------------------------------------------------------------------------- ; from-internal: ; ; Internal dialplan that most internal phones have access to ; [from-internal] exten => 100,1,System(php /root/notify/notify.php) ; or ; exten => 100,1,System("php /root/notify/notify.php") include => from-internal-noxfer include => from-internal-xfer include => bad-number ; auto-generated ;-------------------------------------------------------------------------------
and restart asterisk, notify.php don’t execute


I add extensions_additional.conf

exten => 100,1,Set(__RINGTIMER=${IF($[${DB(AMPUSER/309/ringtimer)} > 0]?${DB(AMPUSER/309/ringtimer)}:${RINGTIMER_DEFAULT})}) exten => 100,2,System(php /root/notify/notify.php) exten => 100,n,Macro(exten-vm,novm,309,0,0,0) exten => 100,n(dest),Set(__PICKUPMARK=) exten => 100,n,Goto(${IVR_CONTEXT},return,1) exten => 100,n,Goto(from-internal,309,1) exten => 100,hint,PJSIP/309&Custom:DND309,CustomPresence:309
and restart asterisk, notify.php don’t execute
but I execute in bash

php /root/notify/notify.php it’s successfully execute.

If I must do in freepbx/gui, where is location?

If you are going to customise FreePBX, you need to use community.freepbx.org/

No, I dont customise FreePBX. I want send mail with asterisk config.

I don’t believe that file is part of Asterisk. It is fairly clear from the files that you have presented that you are trying to customise FreePBX.

On FreePBX Asterisk is owned by the asterisk user and that user doesn’t have the privileges to execute the notify.php

Yes you’re right. Now I can execute script with System method. But now I have new problem.

exten => 156,n,system(/usr/share/elastix/privileged/myscript ${CALLERID(num)} 156 ${HANGUPCAUSE})
exten => 156,n,system(/usr/share/elastix/privileged/myscript ${CALLERID(num)} d156 ${DIALSTATUS})

myscript; arg1,arg2 and arg3 write some file.
tail -f somefile

157 156 0 157 d156

if I solved this problem, I haven’t problems this topic =)

@david55 thanks for replies.