Summary: | ASTERISK-10593: [patch] Register to the SIP server with domain name | ||
Reporter: | Adam Lee (adam lee) | Labels: | |
Date Opened: | 2007-10-23 01:18:46 | Date Closed: | 2011-06-07 14:07:46 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Channels/chan_sip/Registration |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ||
Description: | I tried to connect the the Nortel CS5200 Sip Server which is configured with its local domain name, however, the asterisk could not register to the server successfully. I set the following descriptions in the sip.conf: [general] . . maxexpiry=3600 defaultexpiry=1200 register=>390@myproxy.domain:390:390@10.0.174.221:5060/390 registertimeout=30 The 10.0.174.221 is its actual ip address and "myproxy.domain" is its local domain name which is not a real domain name and only can be regonized in the local domain name server. I captured the SIP REGISTER Request with "sip debug" as follows: [Oct 23 14:03:58] NOTICE[15232]: chan_sip.c:7296 sip_reregister: -- Re-registration for 390@myproxy.domain@10.0.174.221 REGISTER 12 headers, 0 lines Reliably Transmitting (no NAT) to 10.0.174.221:5060: REGISTER sip:10.0.174.221 SIP/2.0 Via: SIP/2.0/UDP 10.0.174.125:5060;branch=z9hG4bK24503299;rport From: <sip:390@myproxy.domain>;tag=as1a549b74 To: <sip:390@myproxy.domain> Call-ID: 6f2143e66db5fc393d8ffeb918a559bc@127.0.0.1 CSeq: 102 REGISTER User-Agent: SI-688 IPPBX Max-Forwards: 70 Expires: 1200 Contact: <sip:390@10.0.174.125> Event: registration Content-Length: 0 I think the problem is that the SIP Request line of the REGISTER Request is the ip address of the server instead of its domain name. Therefore, I modified the source code of Asterisk v1.4.13 and captured the outgoing REGISTER Request again as follows: [Oct 23 14:10:11] NOTICE[19490]: chan_sip.c:7296 sip_reregister: -- Re-registration for 390@myproxy.domain@10.0.174.221 REGISTER 12 headers, 0 lines Reliably Transmitting (no NAT) to 10.0.174.221:5060: REGISTER sip:myproxy.domain SIP/2.0 Via: SIP/2.0/UDP 10.0.174.125:5060;branch=z9hG4bK0b0ab833;rport From: <sip:390@myproxy.domain>;tag=as03e91925 To: <sip:390@myproxy.domain> Call-ID: 1aaa5911374141993743c63a20e7d4f9@127.0.0.1 CSeq: 102 REGISTER User-Agent: SI-688 IPPBX Max-Forwards: 70 Expires: 1200 Contact: <sip:390@10.0.174.125> Event: registration Content-Length: 0 Now, Asterisk registers with the Nortel SIP Server successfully. Here is my patch: --- chan_sip.c 2007-10-10 22:42:00.000000000 +0800 +++ chan_sip_mod.c 2007-10-23 13:53:45.000000000 +0800 @@ -7477,10 +7477,14 @@ else snprintf(addr, sizeof(addr), "sip:%s", p->fromdomain); } else { - if (r->portno && r->portno != STANDARD_SIP_PORT) - snprintf(addr, sizeof(addr), "sip:%s:%d", r->hostname, r->portno); - else - snprintf(addr, sizeof(addr), "sip:%s", r->hostname); + if (strchr(r->username, '@')) { + snprintf(addr, sizeof(addr), "sip:%s", strchr(r->username, '@') + 1); + } else { + if (r->portno && r->portno != STANDARD_SIP_PORT) + snprintf(addr, sizeof(addr), "sip:%s:%d", r->hostname, r->portno); + else + snprintf(addr, sizeof(addr), "sip:%s", r->hostname); + } } ast_string_field_set(p, uri, addr); Thank you. | ||
Comments: | By: Joshua C. Colp (jcolp) 2007-11-07 19:52:11.000-0600 Greetings! This can be accomplished using a peer entry with fromuser and fromdomain set. You would just specify the peer name instead of the IP address in the register line. As well in the future please attach patches and mark them as code so licensing is verified on them. Peace! |