[asterisk-dev] [Code Review] SIP: TCP not finding peer

David Vossel dvossel at digium.com
Wed Apr 29 16:39:29 CDT 2009


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.digium.com/r/236/
-----------------------------------------------------------

(Updated 2009-04-29 16:39:29.303532)


Review request for Asterisk Developers.


Summary (updated)
-------

With TCP in chan_sip, find_peer does not find a valid peer when using pvt->recv as the sockaddr_in argument.  Because of the way TCP works, the port number in pvt->recv is not what we're looking for at all.  I was originally cued into the problem when my calls would not complete because the extension wasn't found.  I spent some time debugging and found that Asterisk wasn't even looking for the extension in the right context.  Instead of using the context from the peer, it was using 'default' because the peer was never found.

There is currently only one place that find_peer searches for a peer using the sockaddr_in argument.  If the peer is not found after using pvt->recv (works for UDP since the port number will be correct), a temp sockaddr_in struct is made using the Contact header in the sip_request.  This has the correct port number in it. 

This seems to work, but organizationally it may or may not be the best option.  I debated on putting the Contact header parsing logic within find_peer, but leaving it outside find_peer seemed the least invasive.  To me, find_peer is working correctly.  The right sockaddr_in struct just needs to be passed in. Thoughts? 


Diffs
-----

  /trunk/channels/chan_sip.c 190545 

Diff: http://reviewboard.digium.com/r/236/diff


Testing
-------

TCP calls complete.  extension is found using the correct context from peer. 


Thanks,

David




More information about the asterisk-dev mailing list