aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-20 22:19:22 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-20 22:19:22 +0000
commit3b13ba27d449c01d0596b578b8278761e1c61d40 (patch)
tree2133505f1707244c4a0ba60a7820b3305a46982a /channels
parentaa7e115df6f8d0caa6fd5e484ff5a4d039273a84 (diff)
Use the same call id for registrations
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@875 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_sip.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 5af31effe..e7440ee78 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -52,6 +52,7 @@
#define SIPDUMPER
#define DEFAULT_DEFAULT_EXPIRY 120
#define DEFAULT_MAX_EXPIRY 3600
+#define EXPIRY_GUARD_SECS 15
#define SIP_DTMF_RFC2833 (1 << 0)
#define SIP_DTMF_INBAND (1 << 1)
@@ -2540,7 +2541,10 @@ static int transmit_register(struct sip_registry *r, char *cmd, char *auth)
} else
p = r->call;
} else {
- build_callid(r->callid, sizeof(r->callid), __ourip);
+ if (!r->callid_valid) {
+ build_callid(r->callid, sizeof(r->callid), __ourip);
+ r->callid_valid = 1;
+ }
p=sip_alloc( r->callid, &r->addr, 0);
if (!p) {
ast_log(LOG_WARNING, "Unable to allocate registration call\n");
@@ -3919,7 +3923,9 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_
ast_sched_del(sched, r->expire);
expires=atoi(get_header(req, "expires"));
if (!expires) expires=default_expiry;
- r->expire=ast_sched_add(sched, (expires-2)*1000, sip_reregister, r);
+ if (expires > EXPIRY_GUARD_SECS)
+ expires -= EXPIRY_GUARD_SECS;
+ r->expire=ast_sched_add(sched, expires*1000, sip_reregister, r);
} else
ast_log(LOG_WARNING, "Got 200 OK on REGISTER that isn't a register\n");