From 91436c9fc402f2038467a18ffa0aa00d1ade12a6 Mon Sep 17 00:00:00 2001 From: Peter Friedrich Date: Mon, 30 Mar 2020 19:00:58 +0200 Subject: [PATCH] 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) --- src/modules/ims_dialog/dlg_cb.c | 9 ++------- src/modules/ims_dialog/dlg_cb.h | 5 ++--- src/modules/ims_dialog/dlg_handlers.c | 1 - 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/modules/ims_dialog/dlg_cb.c b/src/modules/ims_dialog/dlg_cb.c index 1b7caa21cec..d4d0ee356ce 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 f0f9815c9c9..13d76d5a749 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 b0f5b491bb2..3d8dee7ff37 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; } -