aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authoroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2007-05-29 19:32:57 +0000
committeroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2007-05-29 19:32:57 +0000
commit26972b3c32ea861b42486fe89fda9880d7aec7bb (patch)
treeffc7fcd09b3976d40c4c4570225cee86c244e745 /channels/chan_sip.c
parente3464b18d99f24055070736b25ef24708753e3d8 (diff)
Properly handle 408 request timeout - according to the RFC, the dialog dies if a request in a dialog gets this response.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@66503 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index d494be206..644dc4b6a 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -11926,6 +11926,7 @@ static void handle_response_invite(struct sip_pvt *p, int resp, char *rest, stru
sip_alreadygone(p);
break;
+ case 408: /* Request timeout */
case 481: /* Call leg does not exist */
/* Could be REFER caused INVITE with replaces */
ast_log(LOG_WARNING, "Re-invite to non-existing call leg on other UA. SIP dialog '%s'. Giving up.\n", p->callid);
@@ -12100,6 +12101,14 @@ static int handle_response_register(struct sip_pvt *p, int resp, char *rest, str
ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
}
break;
+ case 408: /* Request timeout */
+ if (global_regattempts_max)
+ p->registry->regattempts = global_regattempts_max+1;
+ ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
+ r->call = NULL;
+ ast_sched_del(sched, r->timeout);
+ r->timeout = -1;
+ break;
case 479: /* SER: Not able to process the URI - address is wrong in register*/
ast_log(LOG_WARNING, "Got error 479 on register to %s@%s, giving up (check config)\n", p->registry->username,p->registry->hostname);
if (global_regattempts_max)
@@ -12390,6 +12399,21 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_
ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
break;
+ case 408: /* Request timeout - terminate dialog */
+ if (sipmethod == SIP_INVITE)
+ handle_response_invite(p, resp, rest, req, seqno);
+ else if (sipmethod == SIP_REGISTER)
+ res = handle_response_register(p, resp, rest, req, ignore, seqno);
+ else if (sipmethod == SIP_BYE) {
+ ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
+ if (option_debug)
+ ast_log(LOG_DEBUG, "Got timeout on bye. Thanks for the answer. Now, kill this call\n");
+ } else {
+ if (owner)
+ ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
+ ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
+ }
+ break;
case 481: /* Call leg does not exist */
if (sipmethod == SIP_INVITE) {
handle_response_invite(p, resp, rest, req, seqno);