فهرست منبع

dialog: Set the dialog context on transaction failure

Before, the dialog context would be derived from the callid and tags. This
could select the wrong dialog in case of spirals. This patch sets the correct
dialog context by storing the it in the transaction and restoring it on a
failure. Now the correct dialog variables are available in failure_route.

(cherry picked from commit 811bb515c09e7270d1d7f8a28d280e184874e487)
(cherry picked from commit af985c5fe70dcaa6a92c5e67fff81807dbef27bc)
Alex Hermann 11 سال پیش
والد
کامیت
028140e698
1فایلهای تغییر یافته به همراه5 افزوده شده و 5 حذف شده
  1. 5 5
      modules/dialog/dlg_handlers.c

+ 5 - 5
modules/dialog/dlg_handlers.c

@@ -452,9 +452,9 @@ static void dlg_onreply(struct cell* t, int type, struct tmcb_params *param)
 		return;
 
 	unref = 0;
-	if (type==TMCB_RESPONSE_IN) {
-		/* Set the dialog context so it is available in onreply_route */
-		set_current_dialog( req, dlg);
+	if (type & (TMCB_RESPONSE_IN|TMCB_ON_FAILURE)) {
+		/* Set the dialog context so it is available in onreply_route and failure_route*/
+		set_current_dialog(req, dlg);
 		dlg_set_ctx_iuid(dlg);
 		goto done;
 	}
@@ -926,7 +926,7 @@ int dlg_set_tm_callbacks(tm_cell_t *t, sip_msg_t *req, dlg_cell_t *dlg,
 			goto error;
 		}
 		if ( d_tmb.register_tmcb( req, t,
-				TMCB_RESPONSE_IN|TMCB_RESPONSE_READY|TMCB_RESPONSE_FWDED,
+				TMCB_RESPONSE_IN|TMCB_RESPONSE_READY|TMCB_RESPONSE_FWDED|TMCB_ON_FAILURE,
 				dlg_onreply, (void*)iuid, dlg_iuid_sfree)<0 ) {
 			LM_ERR("failed to register TMCB\n");
 			goto error;
@@ -1197,7 +1197,7 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param)
 		if(iuid!=NULL)
 		{
 			/* register callback for the replies of this request */
-			if ( d_tmb.register_tmcb( req, 0, TMCB_RESPONSE_IN,
+			if ( d_tmb.register_tmcb( req, 0, TMCB_RESPONSE_IN|TMCB_ON_FAILURE,
 					dlg_onreply, (void*)iuid, dlg_iuid_sfree)<0 ) {
 				LM_ERR("failed to register TMCB (3)\n");
 				shm_free(iuid);