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

David Vossel dvossel at digium.com
Mon Apr 27 18:32:04 CDT 2009


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

(Updated 2009-04-27 18:32:04.063700)


Review request for Asterisk Developers.


Summary (updated)
-------

With TCP, find_peer does not work when using p->recv.  Because of the way TCP work's, the port number in p->recv is not what we're looking for at all.  This results in all kinds of weirdness.  I was originally queued into the problem when my calls would not complete because the extension wasn't found.  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, Hooray!

There is currently only one place that find_peer searches for a peer using sockaddr_in.  If the peer is not found after using p->recv, 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 past 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