[asterisk-dev] [Code Review] 3925: PJSIP: Use IP address in favor of hostname in SDP origin line.

Paul Belanger reviewboard at asterisk.org
Thu Aug 21 13:03:38 CDT 2014



> On Aug. 21, 2014, 7:04 a.m., wdoekes wrote:
> > > This changeset modifies the process by getting the hostname and then
> > > resolving that into an IP address. On my box, I could change the IP
> > > address by modifying my /etc/hosts file to resolve my hostname to a
> > > different IP address.
> > 
> > That's not going to work on many debian style boxes that have 127.0.1.1
> > as their IP. Which happens to be the default.
> > 
> > https://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_hostname_resolution
> > 
> > Example:
> > 
> >   $ grep ns1.osso /etc/hosts
> >   127.0.1.1	ns1.osso.xx osso-ns1
> > 
> >   $ ping `hostname -f`
> >   PING ns1.osso.xx (127.0.1.1) 56(84) bytes of data.
> > 
> >   $ host `hostname -f`
> >   ns1.osso.xx has address 91.194.xx.xx
> > 
> >   
> > 
> > Is this going to be configurable somehow? Because 127.0.1.1 is worse
> > than my hostname.
> 
> Mark Michelson wrote:
>     Yes, it's configurable by changing /etc/hosts to not be 127.0.1.1 :)
> 
> Mark Michelson wrote:
>     In all seriousness though, a better idea would probably be to set the SDP origin information per session based on the transport in use, similar to how the connection line is set.
> 
> Paul Belanger wrote:
>     +1 I'd actually like the ability to assign a specific IP address for the SDP.  For example, bind SIP to one IP and RTP to another.
> 
> Mark Michelson wrote:
>     You can already do this with the media_address option for endpoints.
> 
> Matt Jordan wrote:
>     {quote}
>         +1 I'd actually like the ability to assign a specific IP address for the SDP.  For example, bind SIP to one IP and RTP to another.
>     {quote}
>     
>     That's actually already possible. The setting 'media_address' will already override what IP address is communicated in the Connection Data ("c=") field. That field is what the receiver of the Offer/Answer should use when determining where to send media.
>     
>     This issue is about the Origin ("o=") field, which forms a global unique identifier for the session. Generally, the IP address in the Origin field MUST be a fully qualified domain name, or an IPv4/IPv6 address. Technically, we *can* put a private IP address in the Origin field *if* we felt there were privacy concerns:
>     
>     {quote}
>     
>        For privacy reasons, it is sometimes desirable to obfuscate the
>        username and IP address of the session originator.  If this is a
>        concern, an arbitrary <username> and private <unicast-address> MAY be
>        chosen to populate the "o=" field, provided that these are selected
>        in a manner that does not affect the global uniqueness of the field.
>     
>     {quote}
>     
>     Unfortunately, there are SIP providers that are attempting to parse and use the IP address regardless of that field's intended use. So... hence the issue/patch.
> 
> Matt Jordan wrote:
>     Jinx!

Hotness.  Moving on.


- Paul


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3925/#review13129
-----------------------------------------------------------


On Aug. 21, 2014, 3:36 p.m., Mark Michelson wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3925/
> -----------------------------------------------------------
> 
> (Updated Aug. 21, 2014, 3:36 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-23994
>     https://issues.asterisk.org/jira/browse/ASTERISK-23994
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> From the issue, it was determined that using pj_gethostname() to populate the origin line of SDPs is not guaranteed to meet RFC 4566's requirement that the address be a FQDN or IP address. This changeset modifies the process by getting the hostname and then resolving that into an IP address. On my box, I could change the IP address by modifying my /etc/hosts file to resolve my hostname to a different IP address.
> 
> 
> Diffs
> -----
> 
>   /branches/12/res/res_pjsip_session.c 421564 
> 
> Diff: https://reviewboard.asterisk.org/r/3925/diff/
> 
> 
> Testing
> -------
> 
> Placed an outbound call from Asterisk. I observed that the SDP origin line now contained an IP address instead of a hostname. When I modified /etc/hosts to resolve the hostname to a different IP address, that IP address appeared in the SDP origin line instead.
> 
> 
> Thanks,
> 
> Mark Michelson
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140821/673be365/attachment-0001.html>


More information about the asterisk-dev mailing list