Asterisk: forward if peer unreachable
Posted
by
Cedric H.
on Super User
See other posts from Super User
or by Cedric H.
Published on 2013-10-13T16:48:02Z
Indexed on
2013/10/18
22:01 UTC
Read the original article
Hit count: 236
asterisk
I would like to respond to incoming calls by checking is a specific peer is reachable, and dial the appropriate number accordingly.
Presently I did this:
exten => 1200,1,Answer()
same => n,Set(reachable=${SHELL(asterisk -rx "sip show peers" | grep ^cedrich-phone.*OK)})
same => n,GotoIf($["${LEN(${reachable})}" = "0"]?extoffline)
same => n,Dial(SIP/cedrich-phone,20)
same => n(extoffline),Dial(SIP/another-phone,20,tr)
same => n,Hangup()
Could you tell me if this is acceptable and if it can be improved ?
© Super User or respective owner