[asterisk-users] Allowing calls - maybe I'm just stupid... [almost solved]

Luca Bertoncello lucabert at lucabert.de
Thu Jun 11 02:39:52 CDT 2015


Zitat von Luca Bertoncello <lucabert at lucabert.de>:

> Now my problem is to check in my dialplan if the peer, that  
> originate the call, is reachable, and if not, to give an error...
>
> Is there any function to know if the peer is reachable?

I answer myself...

I did that (in my [myproxy]-context):

exten => _X.,n,Set(reachable=${SHELL(asterisk -rx "sip show peer  
${CALLERID(num)}" | grep "Status" | grep "OK")})
exten => _X.,n,GotoIf($["${LEN(${reachable})}" = "0"]?notallowed)
....
exten => _X.,n(notallowed),Set(ip=${SIPPEER(${CALLERID(num)},ip)})
exten => _X.,n,Log(WARNING,Refusing call from UNREACHABLE peer  
${CALLERID(num)} to ${EXTEN}. Call from IP ${ip})
exten => _X.,n,Playback(privacy-incorrect)
exten => _X.,n,Hangup

and it works.
But I'm not very happy to call the CLI for this test... Is there  
another possibility to do my check?

Thanks
Luca Bertoncello
(lucabert at lucabert.de)




More information about the asterisk-users mailing list