Module: sip-router
Branch: 3.2
Commit: c750f1b978563c751a884fadb23de062f9092aab
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c750f1b…
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 2a1e494..10b8ebc 100644
--- a/modules_k/dialog/dlg_handlers.c
+++ b/modules_k/dialog/dlg_handlers.c
@@ -774,16 +774,20 @@ int dlg_new_dialog(struct sip_msg *req, struct cell *t, const int
run_initial_cb
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;