Bladeren bron

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)
Anca Vamanu 12 jaren geleden
bovenliggende
commit
c750f1b978
1 gewijzigde bestanden met toevoegingen van 14 en 10 verwijderingen
  1. 14 10
      modules_k/dialog/dlg_handlers.c

+ 14 - 10
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);
         dlg = get_dlg(&callid, &ftag, &ttag, &dir);
         if (dlg)
         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;
     spiral_detected = 0;