[Asterisk-Dev] Re: Registrations SHOULD use same Call-ID. Packet8 seems to care

Stephen Davies steve at daviesfam.org
Mon Apr 21 01:26:01 MST 2003



On Sun, 20 Apr 2003, Mark Spencer wrote:

> Patch would be nice :)

Ask and you shall receive...

Steve
-------------- next part --------------
Index: channels/chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.86
diff -u -r1.86 chan_sip.c
--- channels/chan_sip.c	20 Apr 2003 22:19:22 -0000	1.86
+++ channels/chan_sip.c	21 Apr 2003 08:33:11 -0000
@@ -329,6 +329,7 @@
 	int regstate;
 	int callid_valid;		/* 0 means we haven't chosen callid for this registry yet. */
 	char callid[80];		/* Global CallID for this registry */
+	unsigned int ocseq;		/* Sequence number we got to for REGISTERs for this registry */
 	struct sockaddr_in us;			/* Who the server thinks we are */
 	struct sip_registry *next;
 };
@@ -1478,6 +1483,7 @@
 		reg->addr.sin_port = porta ? htons(atoi(porta)) : htons(DEFAULT_SIP_PORT);
 		reg->next = registrations;
 		reg->callid_valid = 0;
+		reg->ocseq = 101;
 		registrations = reg;
 	} else {
 		ast_log(LOG_ERROR, "Out of memory\n");
@@ -2582,7 +2588,8 @@
 	memset(&req, 0, sizeof(req));
 	init_req(&req, cmd, addr);
 
-	snprintf(tmp, sizeof(tmp), "%d %s", ++p->ocseq, cmd);
+	snprintf(tmp, sizeof(tmp), "%u %s", ++r->ocseq, cmd);
+	p->ocseq = r->ocseq;
 
 	snprintf(via, sizeof(via), "SIP/2.0/UDP %s:%d;branch=z9hG4bK%08x", inet_ntoa(p->ourip), ourport, p->branch);
 	add_header(&req, "Via", via);


More information about the asterisk-dev mailing list