Module: sip-router
Branch: 3.3
Commit: b1398b2faa5a01b652a8c265b93c4846e35f97d9
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b1398b2…
Author: Anca Vamanu <anca.vamanu(a)1and1.ro>
Committer: Anca Vamanu <anca.vamanu(a)1and1.ro>
Date: Fri Jan 11 11:07:45 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.
(cherry picked from commit 5a78a8b8ec104550a37d8e2ae9005bf87d21e00f)
---
modules_k/dialog/dlg_handlers.c | 24 ++++++++++++++----------
1 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/modules_k/dialog/dlg_handlers.c b/modules_k/dialog/dlg_handlers.c
index b350ba7..f98f36b 100644
--- a/modules_k/dialog/dlg_handlers.c
+++ b/modules_k/dialog/dlg_handlers.c
@@ -805,16 +805,20 @@ int dlg_new_dialog(sip_msg_t *req, struct cell *t, const int
run_initial_cbs)
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 (run_initial_cbs)
- run_dlg_callbacks( DLGCB_SPIRALED, dlg, req, NULL,
- DLG_DIR_DOWNSTREAM, 0);
- /* get_dlg() has incremented the ref count by 1
- * - it's ok, dlg will be unref at the end of function */
- goto finish;
+ if ( dlg->state != DLG_STATE_DELETED )
+ {
+ LM_DBG("Callid '%.*s' found, must be a spiraled request\n",
+ callid.len, callid.s);
+ spiral_detected = 1;
+
+ if (run_initial_cbs)
+ run_dlg_callbacks( DLGCB_SPIRALED, dlg, req, NULL,
+ DLG_DIR_DOWNSTREAM, 0);
+ /* get_dlg() has incremented the ref count by 1
+ * - it's ok, dlg will be unref at the end of function */
+ goto finish;
+ }
+ dlg_release(dlg);
}
}
spiral_detected = 0;