[asterisk-users] (NAT) direct media to host on local net when registering from external address
Joshua C. Colp
jcolp at digium.com
Tue Jan 15 11:20:33 CST 2019
On Tue, Jan 15, 2019, at 1:17 PM, Brian J. Murrell wrote:
> On Tue, 2019-01-15 at 12:01 -0500, Joshua C. Colp wrote:
> >
> > The chan_sip module has this implemented under the "nat" option using
> > "comedia" as I recall.
>
> Yeah. The help for which reads:
>
> Send media to the port Asterisk received it from regardless
> of where the SDP says to send it.
>
> > It causes media to be sent to where media was originally received
> > from.
>
> Right. But this is the part I don't think I'm understanding. What is
> "originally received from"? There is no media at the point where the
> media session is being set up according the the SDP is there?
It waits until the RTP flows to determine this.
>
> > As for whether it would work or not... this all ultimately depends on
> > how exactly the intermediary behaves, what is let through, what is
> > altered. There's nothing inherent in either chan_sip or chan_pjsip
> > to know/care, as it's just SIP. You'd need to look at the SIP
> > signaling and the SDP to understand what is happening.
>
> I have looked. Asterisk on my LAN is sending an INVITE to the mobile
> client and since the INVITE is being sent to an external IP, it is
> (correctly for all other cases) writing the external IP into the SDP
> payload. What else could/should I be looking for?
>
> Ultimately I don't think comedia is the problem or solution because
> it's not where Asterisk is sending it's media that is the problem.
>
> The problem is that Asterisk is sending an INVITE to the client with
> it's external IP address in the SDP because it sees the client as being
> external and the client is then correctly trying to set up the media
> session with the external IP address of the Asterisk instead of it's
> internal address.
Ah yes... yeah, there's nothing built in to handle the scenario.
> What needs to happen is that Asterisk has to know "somehow" that even
> though the client registered from an external address, that it really
> is internal. Probably that "somehow" doesn't actually exist at this
> point.
>
> Let me ask this, in the REGISTER request, where is the IP address of
> the client taken from? Is it taken from the Via: header?
For what purpose? The SIP response goes to the source of the request. If you mean the registration address, that is the Contact header. A REGISTER essentially means "I can be reached at this Contact address for requests".
--
Joshua C. Colp
Digium - A Sangoma Company | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org
More information about the asterisk-users
mailing list