Zitat von Luca Bertoncello <lucab...@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
(lucab...@lucabert.de)


--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
              http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to