diff options
author | Mark Spencer <markster@digium.com> | 2006-02-28 20:58:21 +0000 |
---|---|---|
committer | Mark Spencer <markster@digium.com> | 2006-02-28 20:58:21 +0000 |
commit | 2639b0a397cc9e6f1fa08d512344bd96caacbf51 (patch) | |
tree | 11348b2a9732c54809086b53ff46929df8c729c0 | |
parent | 6cff0b11f078b9ba3c7b26d4fc824c1c37a65010 (diff) |
Handle disappearing calls for registers
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@11437 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | channels/chan_iax2.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 167af9dd9..a52e16821 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -5226,6 +5226,11 @@ static int register_verify(int callno, struct sockaddr_in *sin, struct iax_ies * p = find_peer(peer, 1); ast_mutex_lock(&iaxsl[callno]); + if (!iaxs[callno]) { + /* Call has disappeared */ + ast_mutex_unlock(&iaxsl[callno]); + return -1; + } if (!p) { if (authdebug) ast_log(LOG_NOTICE, "No registration for peer '%s' (from %s)\n", peer, ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr)); @@ -6059,15 +6064,17 @@ static int auth_fail(int callno, int failcode) /* Schedule sending the authentication failure in one second, to prevent guessing */ ast_mutex_lock(&iaxsl[callno]); - iaxs[callno]->authfail = failcode; - if (delayreject) { - ast_mutex_lock(&iaxsl[callno]); - if (iaxs[callno]->authid > -1) - ast_sched_del(sched, iaxs[callno]->authid); - iaxs[callno]->authid = ast_sched_add(sched, 1000, auth_reject, (void *)(long)callno); - ast_mutex_unlock(&iaxsl[callno]); - } else - auth_reject((void *)(long)callno); + if (iaxs[callno]) { + iaxs[callno]->authfail = failcode; + if (delayreject) { + ast_mutex_lock(&iaxsl[callno]); + if (iaxs[callno]->authid > -1) + ast_sched_del(sched, iaxs[callno]->authid); + iaxs[callno]->authid = ast_sched_add(sched, 1000, auth_reject, (void *)(long)callno); + ast_mutex_unlock(&iaxsl[callno]); + } else + auth_reject((void *)(long)callno); + } ast_mutex_unlock(&iaxsl[callno]); return 0; } |