summaryrefslogtreecommitdiff
path: root/channels/sip/include/dialog.h
diff options
context:
space:
mode:
authorDavid Vossel <dvossel@digium.com>2010-06-17 18:45:32 +0000
committerDavid Vossel <dvossel@digium.com>2010-06-17 18:45:32 +0000
commita1fe641a38e4c76ff35d3446f07a1d95e387dd9f (patch)
tree610a6df1f24993cf221f2757aae553317c7f1525 /channels/sip/include/dialog.h
parentba3d1ad680ca96981537cebeb97a6045f593d033 (diff)
retransmit response to BYE requests until timer J expires
According to RFC 3261 section 17.2.2, which describes non-INVITE server transaction, when a dialog enters the Completed state it must destroy the dialog after Timer J (T1*64) fires. For a BYE transaction Asterisk terminates the dialog immediately during sip_hangup() when it should be waiting T1*64 ms. This results in some odd behavior. For instance if Asterisk receives a BYE and transmits a 200ok in response, if the endpoint never receives the 200ok it will retransmit the BYE to which Asterisk responds with a "481 Call leg/transaction does not exist" because the dialog is already gone. To resolve this I made a function called sip_scheddestroy_final(). This differs slightly from sip_schedestroy() in that it enables a flag that will prevent the destruction from ever being rescheduled or canceled afterwards. It also prevents the pvt's needdestroy flag from being set which triggers the destruction of the dialog within the do_monitor thread(). By using this function we are guaranteed destruction will not occur until the scheduled time. This allows Asterisk to respond to any possible retransmits for a dialog after we process the initial BYE request for T1*64 ms. Other changes: I removed two instances where sip_cancel_destroy is used right before calling sip_scheddestroy. sip_scheddestroy always calls sip_cancel_destroy before scheduling the new destruction so it is completely unnecessary. Review: https://reviewboard.asterisk.org/r/694/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@271262 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/sip/include/dialog.h')
-rw-r--r--channels/sip/include/dialog.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/channels/sip/include/dialog.h b/channels/sip/include/dialog.h
index 554aa5e6a..8972c02d9 100644
--- a/channels/sip/include/dialog.h
+++ b/channels/sip/include/dialog.h
@@ -36,6 +36,7 @@ struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, char *tag, char *file, int
struct sip_pvt *sip_alloc(ast_string_field callid, struct sockaddr_in *sin,
int useglobal_nat, const int intended_method, struct sip_request *req);
+void sip_scheddestroy_final(struct sip_pvt *p, int ms);
void sip_scheddestroy(struct sip_pvt *p, int ms);
int sip_cancel_destroy(struct sip_pvt *p);