[prev in list] [next in list] [prev in thread] [next in thread]
List: asterisk-dev
Subject: [Asterisk-Dev] chan_sip.c - fix for Asterisk not on port 5060, other bugs
From: Stephen Davies <steve () daviesfam ! org>
Date: 2003-03-28 12:53:01
Message-ID: Pine.LNX.4.21.0303281242070.1015-200000 () bob ! daviesfam ! org
[Download RAW message or body]
Hi Mark,
There's problems with the SIP channel if Asterisk is running on other than
port 5060 - Asterisk was not including its port number in From and Contact
headers.
Attached is a fix.
I've also been hunting down *s problems with being a client to Free World
Dialup - which boils down to lack of proper handling of
Contact: and Record-Route: in the 200 OK reply.
But in the process I did notice another minor thing: RFC3261 says that
the ACK to a 200 OK should have a new branch in the Via header. See the
example in section 24.2 and also 8.1.1.7. This should probably be fixed
(or, perhaps, the branch= should be left off entirely?)
Regards,
Steve
["asterisk-patch-sld-20030328-fixContactandFrom" (TEXT/PLAIN)]
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.15
diff -u -r1.15 chan_sip.c
--- channels/chan_sip.c 28 Mar 2003 06:59:34 -0000 1.15
+++ channels/chan_sip.c 28 Mar 2003 12:46:00 -0000
@@ -1727,10 +1727,10 @@
char contact[256];
char *c;
if ((c=getsipuri(ot))) {
- snprintf(contact, sizeof(contact), "<%s@%s>", c, inet_ntoa(p->ourip));
+ snprintf(contact, sizeof(contact), "<%s@%s:%d>", c, inet_ntoa(p->ourip), \
ourport); free(c);
} else {
- snprintf(contact, sizeof(contact), "<%s>", inet_ntoa(p->ourip));
+ snprintf(contact, sizeof(contact), "<%s:%d>", inet_ntoa(p->ourip), ourport);
}
snprintf(tmp, sizeof(tmp), "%d", p->expirey);
add_header(resp, "Expires", tmp);
@@ -1741,10 +1741,10 @@
very stupidly *sigh* XXX */
char *c;
if ((c=getsipuri(ot))) {
- snprintf(contact, sizeof(contact), "<%s@%s>", c, inet_ntoa(p->ourip));
+ snprintf(contact, sizeof(contact), "<%s@%s:%d>", c, inet_ntoa(p->ourip), \
ourport); free(c);
} else {
- snprintf(contact, sizeof(contact), "<%s>", inet_ntoa(p->ourip));
+ snprintf(contact, sizeof(contact), "<%s:%d>", inet_ntoa(p->ourip), ourport);
}
add_header(resp, "Contact", contact);
}
@@ -2035,7 +2035,7 @@
}
if (!n)
n = callerid;
- snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s>;tag=%08x", n, l, \
inet_ntoa(p->ourip), p->tag); + snprintf(from, sizeof(from), "\"%s\" \
<sip:%s@%s:%d>;tag=%08x", n, l, inet_ntoa(p->ourip), ourport, p->tag); if \
(strlen(p->username)) { if (ntohs(p->sa.sin_port) != DEFAULT_SIP_PORT) {
snprintf(invite, sizeof(invite), "sip:%s@%s:%d",p->username, \
inet_ntoa(p->sa.sin_addr), ntohs(p->sa.sin_port));
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic