I have been stuck for a half of a day regarding extracting IP’s from precent calls. Main goal is getting present conversations IP’s of both trunk/extensions in the following way. At some point of the initiation of the future call, I would like to export does detail to an external text file. I have managed to get caller IP extract from asterisk by adding a line in extension.conf:
...
same => n,Answer
same => n,System(echo ${CHANNEL(rtp,dest)} > /var/spool/asterisk/system/iptables/caller)
...
It allows getting does info from pjsip trunk/extension.
Is there any way to easy extract does infos this way from sip/pjsip extensions/trunks dialling plan?
The main purpose is getting the rtp IP’s of both entities.
I think I didn’t explain my problem properly.
I have asterisk server runs with several extensions (pjsip.conf) and have a few trunks (sip.conf) connects to the outside world. Function “CHANNEL” allows only to get the caller and server IP’s and ports information, but when I’m making call outside via the sip account (trunk) I’m having a problem getting hands on the rtp IP station on the other site.
The question is hot to get IP’s of the both ends?
pjsip.conf defines endpoints, not extensions, and asterisk is the client on the side that you can’t get.
A Dial() answer subroutine will run on the B side channel, after the initial SDP handshake, so should have access to the SDP version of the callee media address. However, if you are relying on symmetric RTP, the address may not have stabilised at that point. I’m not sure when addresses obtained by ICE stabilise in relation to the answer subroutine being run.
BRIDGEPEER should contain the B side channel, but there is no easy way to trigger dialplan part way into the call, after the media address has stabilised.