mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
Reuse correct sequence numbers
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@877 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -329,6 +329,7 @@ struct sip_registry {
|
|||||||
int regstate;
|
int regstate;
|
||||||
int callid_valid; /* 0 means we haven't chosen callid for this registry yet. */
|
int callid_valid; /* 0 means we haven't chosen callid for this registry yet. */
|
||||||
char callid[80]; /* Global CallID for this registry */
|
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 sockaddr_in us; /* Who the server thinks we are */
|
||||||
struct sip_registry *next;
|
struct sip_registry *next;
|
||||||
};
|
};
|
||||||
@@ -1478,6 +1479,7 @@ static int sip_register(char *value, int lineno)
|
|||||||
reg->addr.sin_port = porta ? htons(atoi(porta)) : htons(DEFAULT_SIP_PORT);
|
reg->addr.sin_port = porta ? htons(atoi(porta)) : htons(DEFAULT_SIP_PORT);
|
||||||
reg->next = registrations;
|
reg->next = registrations;
|
||||||
reg->callid_valid = 0;
|
reg->callid_valid = 0;
|
||||||
|
reg->ocseq = 101;
|
||||||
registrations = reg;
|
registrations = reg;
|
||||||
} else {
|
} else {
|
||||||
ast_log(LOG_ERROR, "Out of memory\n");
|
ast_log(LOG_ERROR, "Out of memory\n");
|
||||||
@@ -2582,7 +2584,8 @@ static int transmit_register(struct sip_registry *r, char *cmd, char *auth)
|
|||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
init_req(&req, cmd, addr);
|
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);
|
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);
|
add_header(&req, "Via", via);
|
||||||
|
Reference in New Issue
Block a user