Module: sip-router Branch: 3.1 Commit: 176b8320934d9e05613fe909ea7960d2de54c965 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=176b8320...
Author: Anca Vamanu anca.vamanu@1and1.ro Committer: Anca Vamanu anca.vamanu@1and1.ro Date: Fri Jan 11 11:50:26 2013 +0200
dialog: fix bug when detect_spirals enabled
If detect_spirals enabled and the caller sent an Invite which received a negative response and then immediately sent another Invite with the same callid and tag, the module did not create a dialog record for the second Invite. It wrongly concluded that the Invite is spiraled. This resulted in missing CDR for that call. Behavior observed if the first Invite has a small Session-Timer interval and receives a 422 reply. When the phone sent the second Invite with a larger Session-Timer, which could have been successful, it was not recorded by the dialog module.
(manual cherry picked from commit 5a78a8b8ec104550a37d8e2ae9005bf87d21e00f)
---
modules_k/dialog/dlg_handlers.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/modules_k/dialog/dlg_handlers.c b/modules_k/dialog/dlg_handlers.c index bc79f7b..c506699 100644 --- a/modules_k/dialog/dlg_handlers.c +++ b/modules_k/dialog/dlg_handlers.c @@ -693,15 +693,18 @@ int dlg_new_dialog(struct sip_msg *msg, struct cell *t) dlg = get_dlg(&callid, &ftag, &ttag, &dir); if (dlg) { - LM_DBG("Callid '%.*s' found, must be a spiraled request\n", - callid.len, callid.s); - spiral_detected = 1; + if ( dlg->state!=DLG_STATE_DELETED ) { + LM_DBG("Callid '%.*s' found, must be a spiraled request\n", + callid.len, callid.s); + spiral_detected = 1;
- run_dlg_callbacks( DLGCB_SPIRALED, dlg, msg, DLG_DIR_DOWNSTREAM, 0); + run_dlg_callbacks( DLGCB_SPIRALED, dlg, msg, DLG_DIR_DOWNSTREAM, 0);
- // get_dlg with del==0 has incremented the ref count by 1 + // get_dlg with del==0 has incremented the ref count by 1 + unref_dlg(dlg, 1); + goto finish; + } unref_dlg(dlg, 1); - goto finish; } } spiral_detected = 0;