[asterisk-users] SIP and RTP port and IP addresses

Matthew Jordan mjordan at digium.com
Thu Nov 10 09:14:42 CST 2016


On Thu, Nov 10, 2016 at 7:15 AM, Ethy H. Brito <ethy.brito at inexo.com.br>
wrote:

> On Thu, 10 Nov 2016 00:35:54 +0100
> Max Grobecker <max.grobecker at ml.grobecker.info> wrote:
>
> > Hi Ethy,
>
> Hi Max and All.
>
> >
> >
> > Am 09.11.2016 um 17:13 schrieb Ethy H. Brito:
> >
> > > 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
> >
> >
> > 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
>
> Hmmmm.
>
> ${CHANNEL(rtpsource)} is always returning something like "0.0.0.0:ppppp"
> where
> p=[0-9]
>
>
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.



> and ${CHANNEL(rtpdest)} returns the internal (not accessible) IP addr if
> the
> caller is behind NAT, therefore, not what I need.
>
>
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.




> Wouldn't these two variables have correct values only after the callee
> answers
> the call??
>
>
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



> >
> > Please note that, if you have not disabled re-invites, the RTP address
> may
> > change while the call is running.
>
> Interesting observation.
>
> Thanx
>
> Ethy
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> Check out the new Asterisk community forum at: https://community.asterisk.
> org/
>
> New to Asterisk? Start here:
>       https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>



-- 
Matthew Jordan
Digium, Inc. | CTO
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20161110/2b6bb6c7/attachment.html>


More information about the asterisk-users mailing list