Summary: | ASTERISK-04912: [patch] rport stripped from all via headers not just top one | ||
Reporter: | Ivan Tikhonov (ivan tikhonov) | Labels: | |
Date Opened: | 2005-08-27 04:00:13 | Date Closed: | 2008-01-15 15:48:05.000-0600 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Channels/chan_sip/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) viarport.txt | |
Description: | when replying on message containing: Via: SIP/2.0/UDP 127.0.0.1:5071;branch=z9hG4bKejloRzRiS0U0NEI2MEQ5MUJBMzQxRTI5RDFENjMzRkI5MjJERDZF Via: SIP/2.0/UDP 127.0.0.1:5072;received=127.0.0.1;rport=5072;branch=z9hG4bKE44B60D91BA341E29D1D633FB922DD6E asterisk produce: Via: SIP/2.0/UDP 127.0.0.1:5071;branch=z9hG4bKejloRzRiS0U0NEI2MEQ5MUJBMzQxRTI5RDFENjMzRkI5MjJERDZF;received=127.0.0.1;rport=5071 Via: SIP/2.0/UDP 127.0.0.1:5072;received=127.0.0.1;branch=z9hG4bKE44B60D91BA341E29D1D633FB922DD6E there is no rport=5072 in last via. As far as i can see this may lead to broken nat traversal on proxy which sends to asterisk. Solution: rport stripping must be surrounded by if (!copied) { ... } in function copy_via_headers ****** ADDITIONAL INFORMATION ****** INVITE sip:123@localhost SIP/2.0 Record-Route: <sip:127.0.0.1:5071;lr=on> Via: SIP/2.0/UDP 127.0.0.1:5071;branch=z9hG4bKejloRzRiS0U0NEI2MEQ5MUJBMzQxRTI5RDFENjMzRkI5MjJERDZF Via: SIP/2.0/UDP 127.0.0.1:5072;received=127.0.0.1;rport=5072;branch=z9hG4bKE44B60D91BA341E29D1D633FB922DD6E From: <sip:anonymous@localhost;user=phone>;tag=bbb To: <sip:123@localhost;user=phone> Call-Id: 0.106392096512 Cseq: 1 INVITE Content-Length: 0 SIP/2.0 100 Trying Via: SIP/2.0/UDP 127.0.0.1:5071;branch=z9hG4bKejloRzRiS0U0NEI2MEQ5MUJBMzQxRTI5RDFENjMzRkI5MjJERDZF;received=127.0.0.1;rport=5071 Via: SIP/2.0/UDP 127.0.0.1:5072;received=127.0.0.1;branch=z9hG4bKE44B60D91BA341E29D1D633FB922DD6E From: <sip:anonymous@localhost;user=phone>;tag=bbb To: <sip:123@localhost;user=phone>;tag=as771d7a88 Call-ID: 0.106392096512 CSeq: 1 INVITE User-Agent: Asterisk PBX Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER Contact: <sip:123@172.16.61.154> Content-Length: 0 | ||
Comments: | By: Olle Johansson (oej) 2005-09-06 12:16:22 Any idea on why we do strip those rport headers? There is code in there just for that for a reason... By: Olle Johansson (oej) 2005-09-06 13:14:17 Please test this patch. Disclaimer on file. Seems like the previous programmer misunderstood the RFCs. Now we always add ;received to the topmost via and only adds rport=port if we get an empty ;rport in the topmost via. By: Olle Johansson (oej) 2005-09-09 08:26:27 We are waiting for your feedback!!! By: Ivan Tikhonov (ivan tikhonov) 2005-09-11 01:58:01 Sorry, can't test - already patched my asterisk and it's in production use. With nat=always it's clearer to always put rport. But actually there is no need for adding rport at all because asterisk don't forward sip messages and rport info is useless for downstream proxies and client. By: Michael Jerris (mikej) 2005-09-11 11:51:14 Ivan, can you provide a disclaimed patch? By: Olle Johansson (oej) 2005-09-12 10:12:28 This patch is confirmed as solving the problem in ASTERISK-5058 By: Kevin P. Fleming (kpfleming) 2005-09-13 21:54:42 Committed to CVS HEAD, thanks! By: Digium Subversion (svnbot) 2008-01-15 15:48:05.000-0600 Repository: asterisk Revision: 6582 U trunk/channels/chan_sip.c ------------------------------------------------------------------------ r6582 | kpfleming | 2008-01-15 15:48:05 -0600 (Tue, 15 Jan 2008) | 2 lines handle rport/received in Via headers properly (issue ASTERISK-4912) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=6582 |