[sr-dev] git:5.2:91436c9f: ims_dialog: bugfix for registering dialog callbacks

Henning Westerholt hw at skalatan.de
Mon Mar 30 19:10:01 CEST 2020


Module: kamailio
Branch: 5.2
Commit: 91436c9fc402f2038467a18ffa0aa00d1ade12a6
URL: https://github.com/kamailio/kamailio/commit/91436c9fc402f2038467a18ffa0aa00d1ade12a6

Author: Peter Friedrich <peter.friedrich at kapsch.net>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2020-03-30T19:09:26+02:00

ims_dialog: bugfix for registering dialog callbacks

- bugfix for registering dialog callbacks
- in Rx scenarios of parallel forking (several INVITEs with same CALLID
  and FROMTAG sent to PCSCF) and INVITE for orig and term handled in
  same PCSCF (means also INVITEs with identical  CALLID and FROMTAG) the wrong
  dialog is selected for registering the callback (i.e. the callback
  for sending STR) when 200OK from terminator is processed.
- Root cause is that dialog is searched with callid-fromtag-totag but at
  the time of dialog insertion (processing of INVITE) no totag is available.
- fix is to get ctx dialog at 200OK processing before suspending the
  transaction - save dialog until AAA is received - use this dialog for
  registering the STR callback.

(cherry picked from commit e2a1b967fd6e2cc92dc1447e1c033f6124aca446)

---

Modified: src/modules/ims_dialog/dlg_cb.c
Modified: src/modules/ims_dialog/dlg_cb.h
Modified: src/modules/ims_dialog/dlg_handlers.c

---

Diff:  https://github.com/kamailio/kamailio/commit/91436c9fc402f2038467a18ffa0aa00d1ade12a6.diff
Patch: https://github.com/kamailio/kamailio/commit/91436c9fc402f2038467a18ffa0aa00d1ade12a6.patch

---

diff --git a/src/modules/ims_dialog/dlg_cb.c b/src/modules/ims_dialog/dlg_cb.c
index 1b7caa21ce..d4d0ee356c 100644
--- a/src/modules/ims_dialog/dlg_cb.c
+++ b/src/modules/ims_dialog/dlg_cb.c
@@ -100,15 +100,10 @@ void destroy_dlg_callbacks(unsigned int types)
 	}
 }
 
-int register_dlgcb_nodlg(str *callid, str *ftag, str *ttag, 
-                        int types, dialog_cb f,
+
+int register_dlgcb_nodlg(struct dlg_cell *dlg, int types, dialog_cb f,
                         void *param, param_free_cb ff )
 {
-    struct dlg_cell *dlg;
-    
-    unsigned int dir = DLG_DIR_NONE;
-    dlg = get_dlg(callid, ftag, ttag, &dir); //increments ref count!
-    
     if (!dlg) {
         LM_ERR("Can't find dialog to register callback\n");
         return -1;
diff --git a/src/modules/ims_dialog/dlg_cb.h b/src/modules/ims_dialog/dlg_cb.h
index f0f9815c9c..13d76d5a74 100644
--- a/src/modules/ims_dialog/dlg_cb.h
+++ b/src/modules/ims_dialog/dlg_cb.h
@@ -51,8 +51,7 @@ typedef void (param_free_cb) (void *param);
 typedef int (*ims_register_dlgcb_f)(struct dlg_cell* dlg, int cb_types,
 		dialog_cb f, void *param, param_free_cb ff);
 
-typedef int (*ims_register_dlgcb_nodlg_f)(str *callid, str *ftag, str *ttag,
-		int cb_types, dialog_cb f, void *param, param_free_cb ff);
+typedef int (*ims_register_dlgcb_nodlg_f)(struct dlg_cell* dlg, int cb_types, dialog_cb f, void *param, param_free_cb ff);
 
 /* method to set a variable within a dialog */
 //typedef int (*set_dlg_variable_f)( struct dlg_cell* dlg,
@@ -103,7 +102,7 @@ void destroy_dlg_callbacks(unsigned int type);
 
 void destroy_dlg_callbacks_list(struct dlg_callback *cb);
 
-int register_dlgcb_nodlg(str *callid, str *ftag, str *ttag, int types, dialog_cb f, void *param, param_free_cb ff );
+int register_dlgcb_nodlg(struct dlg_cell* dlg, int types, dialog_cb f, void *param, param_free_cb ff);
 int register_dlgcb( struct dlg_cell* dlg, int types, dialog_cb f, void *param, param_free_cb ff);
 
 void run_create_callbacks(struct dlg_cell *dlg, struct sip_msg *msg);
diff --git a/src/modules/ims_dialog/dlg_handlers.c b/src/modules/ims_dialog/dlg_handlers.c
index b0f5b491bb..3d8dee7ff3 100644
--- a/src/modules/ims_dialog/dlg_handlers.c
+++ b/src/modules/ims_dialog/dlg_handlers.c
@@ -1965,4 +1965,3 @@ struct dlg_cell *dlg_get_msg_dialog(sip_msg_t *msg) {
     return dlg;
 }
 
-




More information about the sr-dev mailing list