[asterisk-users] Dial(PJSIP/xx) - finding the IP address it connected to

Kingsley Tart kingsley at dns99.co.uk
Wed Nov 3 13:30:51 CDT 2021


When dialling a remote SIP host with PJSIP, is it possible either
within the dialplan or via the AMI to find out the IP address of the
remote host?

If for example a remote host has multiple A records, I would like to
know which one Asterisk has connected to.

We have an issue with some remote hosts that send INVITE messages back
periodically mid-call, but because of our firewall the messages aren't
being received by Asterisk, therefore not being answered, and the
remote host is dropping the call.

We can't open those hosts up by default in the firewall because
customers could choose any SIP destination, but if I could allow the
specific remote address for the duration of the call, it would solve
some issues. I could use AGI scripts to add/remove firewall rules as

Unless, that is, there's a better way?

I'm using Asterisk 18.7.1 FWIW.


More information about the asterisk-users mailing list