[asterisk-dev] [Code Review] Properly route responses according to the Via headers in the request

Matthew Nicholson reviewboard at asterisk.org
Fri Dec 17 18:38:46 UTC 2010



> On 2010-12-17 09:51:48, Mark Michelson wrote:
> > /branches/1.4/channels/chan_sip.c, lines 4964-4980
> > <https://reviewboard.asterisk.org/r/1059/diff/2/?file=14712#file14712line4964>
> >
> >     This is the RFC 2543 grammar for Via headers. RFC 3261 defines its grammar in section 25.1. Though the processing below is no different due to the limited scope of the parsing, it would make sense to have the proper grammar here.

Done.


> On 2010-12-17 09:51:48, Mark Michelson wrote:
> > /branches/1.4/channels/chan_sip.c, lines 4982-4987
> > <https://reviewboard.asterisk.org/r/1059/diff/2/?file=14712#file14712line4982>
> >
> >     This part is not necessary since get_header() returns the portion after "Via:" or "v:"

Done.


> On 2010-12-17 09:51:48, Mark Michelson wrote:
> > /branches/1.4/channels/chan_sip.c, lines 4992-4993
> > <https://reviewboard.asterisk.org/r/1059/diff/2/?file=14712#file14712line4992>
> >
> >     Similarly, this is done in get_header already.

Done.


> On 2010-12-17 09:51:48, Mark Michelson wrote:
> > /branches/1.4/channels/chan_sip.c, lines 4998-5000
> > <https://reviewboard.asterisk.org/r/1059/diff/2/?file=14712#file14712line4998>
> >
> >     This shouldn't be necessary since strsep() will return the position past the end of a sequence of the tokens you pass to it.
> >     
> >     To give an example, if you have a string str set to "Mark,,',,''',is cool" and call strsep(&str, ",'") once then you'll be returned a pointer to the 'i' in "is cool"
> 
> Matthew Nicholson wrote:
>     Ok, I'll make these adjustments.  These changes probably need to be made in the other branches that use this function too.

This is necessary, strsep returns a pointer to the second ',' in that string.  In other words, it returns a pointer to after the first matched token.


- Matthew


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


On 2010-12-17 09:27:27, Matthew Nicholson wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1059/
> -----------------------------------------------------------
> 
> (Updated 2010-12-17 09:27:27)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> This patch makes asterisk respect the Via headers in a request when responding to it. This is necessary in the even that a stateless proxy is in between asterisk and the requester. Without this patch, the response is simply routed back to the address we received the initial request from (unless nat=yes is set).
> 
> 
> Diffs
> -----
> 
>   /branches/1.4/channels/chan_sip.c 294163 
> 
> Diff: https://reviewboard.asterisk.org/r/1059/diff
> 
> 
> Testing
> -------
> 
> Briefly tested using openser as a stateless proxy and another asterisk machine as the requester.  I sent and invite, then some INFO DTMF messages.  Without the patch, our asterisk machine sends all responses to the INFO requests to the proxy, with the patch they are properly routed to the requesting asterisk machine.  I also briefly tested with openser configured to use the Record-Route header as a stateful proxy.
> 
> 
> Thanks,
> 
> Matthew
> 
>

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


More information about the asterisk-dev mailing list