Browse code

ims_qos: bugfix for Rx register dialog callback

- bugfix for Rx register dialog callback
- In some scenarios like parallel forking several INVITE with identical
CALLID and FROMTAG sent to PCSCF which inserts dialogues for each INVITE.
- When 200OK is received in PCSCF the dialog callback must be registered
for the respective dialog. Currently sometimes the wrong dialog is selected
by searching with CALLID FROMTAG and TOTAG thus leading to problem
no STR is sent at BYE.
- Fix is to pickup the right dialog before suspending the transaction during
AAR/AAA processing and reuse this saved dialog.

Peter Friedrich authored on 30/03/2020 17:02:29 • Henning Westerholt committed on 30/03/2020 17:02:29
Showing 3 changed files
... ...
@@ -1095,6 +1095,13 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* dir, char *c_id, int
1095 1095
 				saved_t_data->aar_update = 1; //this is an update aar - we set this so on async_aar we know this is an update and act accordingly
1096 1096
 		}
1097 1097
 
1098
+                dlg = dlgb.get_dlg(msg);
1099
+                if (!dlg) {
1100
+                    LM_ERR("Unable to find dialog and cannot do Rx without it\n");
1101
+                    goto error;
1102
+                }
1103
+                saved_t_data->dlg = dlg;
1104
+
1098 1105
 		LM_DBG("Suspending SIP TM transaction\n");
1099 1106
 		if (tmb.t_suspend(msg, &saved_t_data->tindex, &saved_t_data->tlabel) != 0) {
1100 1107
 				LM_ERR("failed to suspend the TM processing\n");
... ...
@@ -176,8 +176,7 @@ void async_aar_callback(int is_timeout, void *param, AAAMessage *aaa, long elaps
176 176
             passed_rx_session_id->len = 0;
177 177
             STR_SHM_DUP(*passed_rx_session_id, aaa->sessionId->data, "cb_passed_rx_session_id");
178 178
             LM_DBG("passed rx session id [%.*s]", passed_rx_session_id->len, passed_rx_session_id->s);
179
-
180
-            dlgb.register_dlgcb_nodlg(&data->callid, &data->ftag, &data->ttag, DLGCB_TERMINATED | DLGCB_DESTROY | DLGCB_EXPIRED | DLGCB_RESPONSE_WITHIN | DLGCB_CONFIRMED | DLGCB_FAILED, callback_dialog, (void*) (passed_rx_session_id), free_dialog_data);
179
+            dlgb.register_dlgcb_nodlg( data->dlg, DLGCB_TERMINATED | DLGCB_DESTROY | DLGCB_EXPIRED | DLGCB_RESPONSE_WITHIN | DLGCB_CONFIRMED | DLGCB_FAILED, callback_dialog, (void*) (passed_rx_session_id), free_dialog_data);
181 180
         }
182 181
         result = CSCF_RETURN_TRUE;
183 182
     } else {
... ...
@@ -72,6 +72,7 @@ typedef struct saved_transaction {
72 72
         str ftag;
73 73
         str ttag;
74 74
 	unsigned int aar_update;
75
+        struct dlg_cell* dlg;
75 76
 } saved_transaction_t;
76 77
 
77 78
 typedef struct saved_transaction_local {