|Summary:||ASTERISK-18572: SIP REGISTER fails if :port appears in the To: header|
|Reporter:||Richard Miller (ulogic)||Labels:|
|Date Opened:||2011-09-18 10:25:03||Date Closed:||2011-11-14 13:10:15.000-0600|
|Versions:||1.8.1 1.8.2 1.8.3 1.8.4 18.104.22.168 22.214.171.124||Frequency of|
|Environment:||openSuSE 10.1, Fedora 14||Attachments:||( 0) chan_sip_v2.diff|
( 1) chan_sip_v3.diff
( 2) chan_sip_v4.diff
( 3) chan_sip.diff
( 4) port_in_to_header.log
( 5) reqresp_parser.h.diff
|Description:||SIP REGISTER fails with the error|
SIP/2.0 404 Not found (unknown domain)
when the To: field in the headers contains :port following the domain name.
This affects the Aastra 9112i and Aastra 480i phones with the latest firmware 126.96.36.1991.
It also affects 3CXPhone version 6.0.200943.0.
This problem does not exist in version 1.6.x, but does exist in version 10.0.0.beta1.
The original reason for removing the feature was to support IPv6 addresses which use colon separators, but that breaks some devices and softphones.
Also the documentation for the parse_uri() function reflects the 1.6 behavior and not the 1.8 behavior.
Patches are provided for channels/chan_sip.c and channels/sip/include/reqresp_parser.h
|Comments:||By: Richard Miller (ulogic) 2011-09-18 10:28:34.756-0500|
The chan_sip.c patch restores 2 lines of code that are present in the 1.6.x source.
The reqresp_parser.h patch corrects documentation of the parse_uri() function from the 1.6 to the 1.8 behavior.
By: Olle Johansson (oej) 2011-09-19 14:52:08.967-0500
The patch will break if we have an IPv6 address in the domain string.
By: Leif Madsen (lmadsen) 2011-09-19 14:56:58.864-0500
Ya I don't think this patch is right. Can you please provide the Asterisk console output along with the SIP debug for a failing call?
By: Leif Madsen (lmadsen) 2011-09-19 14:57:11.661-0500
Requesting feedback from the reporter.
By: Richard Miller (ulogic) 2011-09-19 15:02:23.470-0500
I will make up a new patch to look for periods in a domain name or IPv4 address before looking for the colon. I believe that should work without breaking IPv6 code.
By: Richard Miller (ulogic) 2011-09-19 15:32:56.622-0500
I have attached a log file and an updated patch.
By: Richard Miller (ulogic) 2011-09-19 15:48:06.956-0500
One more revision to the patch to meet the Asterisk formatting guidelines.
By: Leif Madsen (lmadsen) 2011-09-21 09:27:42.978-0500
Requesting feedback from the reported after testing the latest patch.
By: Richard Miller (ulogic) 2011-09-22 13:20:41.700-0500
Sorry for the delay. I wanted to do some IPv6 testing. Most softphones don't support IPv6. I tried a SNOM 320 with the latest firmware which supposedly supports IPv6 but I couldn't even ping6 the static IP address of the phone at [FE80::2:118]. I was able to get LinPhone to register, but couldn't place any calls. Under LinPhone, you have to enclose the IPv6 address in brackets as it does append :port. The one caveat is that in sip.conf, you need an additional domain bracketing the [IP::v6] address of the Asterisk server. The other alternative would be to strip the surrounding brackets in the check_sip_domain() function, but I decided not to go that route.
With the fourth version of the patch, I am able to register with phones that send :port in the To: header field following a domain.tld name, a dotted IPv4 address, or an [IP::v6] address.
By: Richard Miller (ulogic) 2011-09-29 07:08:31.437-0500
Are you still waiting for something from me? Should I add the code to strip surrounding brackets before checking the domain?
By: Leif Madsen (lmadsen) 2011-10-03 14:08:43.434-0500
I think it would be worth it to use https://reviewboard.asterisk.org at this point and get some feedback from developers. You should probably start with the asterisk-dev mailing list though to ask the question about whether you should be stripping the surrounding brackets before checking the domain.
By: Richard Miller (ulogic) 2011-10-03 14:15:50.742-0500
I don't think it needs further review at this time. It is not really necessary to strip the brackets around an [IP::v6] address as you can accommodate this by putting including an additional domain=[IP::v6] declaration in sip.conf.
By: Paul Belanger (pabelanger) 2011-10-12 11:31:01.870-0500
Uploading this patch to reviewboard will help triage the issue.
By: Walter Doekes (wdoekes) 2011-11-13 09:19:50.237-0600
(Sorry about my bad issse linking/review linking.)
Didn't Terry's extract_host_from_hostport(&domain); just before the check fix this? Did you try latest 1.8 SVN?
r344215 | twilson | 2011-11-09 20:57:04 +0100 (Wed, 09 Nov 2011) | 18 lines
Don't treat a host:port string as a domain
By: Richard Miller (ulogic) 2011-11-14 10:23:46.724-0600
Walter: I tried the latest version from trunk and it does correct the issue I reported. However, the comments in channels/sip/include/reqresp_parser.h still reflect the 1.6 behavior of the parse_uri() function for which I did provide a patch. I do not have commit permissions. Can you commit those comment changes and close this issue?
By: Walter Doekes (wdoekes) 2011-11-14 10:29:57.205-0600
I can certainly do that. Thank you for pointing it out.