SIP And RTP Port And IP Addresses
Hi all
I’d like to log the client IP addr and port used for SIP and RTP *during* in a call.
The IPs must be the real source IPs (internet accessible).
How are these parameters available from dialplan?
For instance, ${SIPURI} holds the internal “IP:port” if the client is behind NAT. I need the external IP:port
Regards
Ethy
4 thoughts on - SIP And RTP Port And IP Addresses
http://www.voip-info.org/wiki/view/Asterisk+func+sip_header
–c8i0EU1JTVqj5LdeWcwxtf2J0aCqhsxit Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
Hi Ethy,
Am 09.11.2016 um 17:13 schrieb Ethy H. Brito:
You can get the peer’s signalling IP address from ${CHANNEL(recvip)} and the RTP address with ${CHANNEL(rtpsource)} resp. ${CHANNEL(rtpdest)}. If you need more information (like the codecs used) you can find other channel variables on https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+Function_CHANNEL
Please note that, if you have not disabled re-invites, the RTP address may change while the call is running.
Max
–c8i0EU1JTVqj5LdeWcwxtf2J0aCqhsxit
Hi Max and All.
Hmmmm.
${CHANNEL(rtpsource)} is always returning something like “0.0.0.0:ppppp” where p=[0-9]
and ${CHANNEL(rtpdest)} returns the internal (not accessible) IP addr if the caller is behind NAT, therefore, not what I need.
Wouldn’t these two variables have correct values only after the callee answers the call??
Interesting observation.
Thanx
Ethy
You’ve bound to the ‘bind all’ address – hence why you get ‘0.0.0.0’. The
‘p’ values are the RTP port that was chosen for that call. RTP port ranges, by default, are from 5000 to 31000.
The RTP destination is going to be what is negotiated in the SDP. If that’s a private IP address, then that’s what you’d see there.
If you have symmetric RTP enabled, then this will switch to the address that we are receiving RTP from. That may or may not be the original negotiated address – if the remote end is behind a NAT, it will most likely switch to the public IP address that we are receiving media from.
No. In fact, as Asterisk is a B2BUA, there are always going to be two sets of RTP values:
– The source/destination of the RTP stream to the inbound channel
– The source/destination of the RTP stream to the outbound channel
The inbound channel will have its set of RTP addresses when Asterisk either sends a Progress indication or Answers the inbound channel. The outbound channel will have its set of RTP addresses when the far end sends a Progress indication or Answers the outbound channel.
All of these RTP addresses may change due to:
* NAT settings (symmetric RTP)
* re-INVITEs, either due to Asterisk directmedia settings or re-INVITEs initiated by the far endpoints (call hold, etc.)
* ICE negotiation