[asterisk-dev] [Code Review] SendMessage strips extension from To: Header in SIP MESSAGE

David Vossel reviewboard at asterisk.org
Fri Dec 2 14:01:04 CST 2011


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



/branches/10/channels/chan_sip.c
<https://reviewboard.asterisk.org/r/1597/#comment9177>

    The to field given here in this function can be a couple of things.
    
    sip:peername where peername is a peer defined in sip.conf
    
    or
    
    sip:user at host:port where the to field is an actual URI to send to.
    
    the create_addr() function knows what to do with the host field you are giving it regardless if it is a peer name or actual host/ip:port to send to. That isn't a problem.
    
    The problem is that it is possible that the host portion being put in the tohost field of the sip_pvt might not be a host at all.  It might be a sip.conf peer name, which won't make sense.  Also, the way the host is being parsed may end up with the port put on the end of the To header twice.
    
    For example. if MessageSend(sip:host:5060) is used, the To header will be "sip:host:5060:5060" because we are setting the to host on the sip_pvt as "host:5060".  This results in the port being added to the host later on.
    
    
    
    


- David


On Nov. 23, 2011, 9:30 a.m., mjordan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1597/
> -----------------------------------------------------------
> 
> (Updated Nov. 23, 2011, 9:30 a.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> When using the MessageSend application to send a SIP MESSAGE to a non-peer, chan_sip attempts to validate the hostname / IP Address.  In the process, it strips off the destination, and fails to add it back to the sip_pvt structure before transmission.  This patch attempts to handle valid URIs passed to chan_sip from the message core that contain either a peer to send to or a URI.  Acceptable forms from MessageSend take one of the following two forms:
> 
> sip:peer
> sip:destination at hostname
> sip:destination at ip_address
> 
> Note that more complex URIs (such as "User" <sip: blah at blah>) won't be accepted by the message core, as the message technology will assume that the user name is part of the message technology type.  That limitation is outside the scope of this issue.
> 
> 
> This addresses bug ASTERISK-18903.
>     https://issues.asterisk.org/jira/browse/ASTERISK-18903
> 
> 
> Diffs
> -----
> 
>   /branches/10/channels/chan_sip.c 345977 
> 
> Diff: https://reviewboard.asterisk.org/r/1597/diff
> 
> 
> Testing
> -------
> 
> Tested with:
> 
> sip:destination at hostname
> sip:destination at ip_address
> sip:peer
> 
> All three were accepted by the MessageSend application and properly forwarded to their destinations / peers.
> 
> 
> Thanks,
> 
> mjordan
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20111202/71883686/attachment-0001.htm>


More information about the asterisk-dev mailing list