2
0
Эх сурвалжийг харах

ims_qos: Add suspend_transaction parameter

Stefan-Cristian Mititelu 2 жил өмнө
parent
commit
d0262f82fd

+ 19 - 0
src/modules/ims_qos/doc/ims_qos_admin.xml

@@ -513,6 +513,25 @@ modparam("ims_qos", "rs_default_bandwidth", 600)
         <programlisting format="linespecific">
 ...
 modparam("ims_qos", "rr_default_bandwidth", 2000)
+...
+        </programlisting>
+      </example>
+    </section>
+
+    <section>
+      <title><varname>suspend_transaction</varname> integer</title>
+
+      <para>If eneabled, suspends the tm transaction while doing the AAR.</para>
+
+      <para><emphasis> Default value is 1 (enabled)</emphasis></para>
+
+      <example>
+        <title><varname>suspend_transaction</varname> parameter
+        usage</title>
+
+        <programlisting format="linespecific">
+...
+modparam("ims_qos", "suspend_transaction", 2000)
 ...
         </programlisting>
       </example>

+ 34 - 15
src/modules/ims_qos/ims_qos_mod.c

@@ -142,6 +142,8 @@ int terminate_dialog_on_rx_failure =
 		1; //this specifies whether a dialog is torn down when a media rx session fails - in some cases you might not want the dialog torn down
 int delete_contact_on_rx_failure =
 		1; //If this is set we delete the contact if the associated signalling bearer is removed
+int suspend_transaction =
+		1; //If this is set we suspend the transaction and continue later
 
 
 str early_qosrelease_reason = {"QoS released", 12};
@@ -249,7 +251,8 @@ static param_export_t params[] = {{"rx_dest_realm", PARAM_STR, &rx_dest_realm},
 				&delete_contact_on_rx_failure},
 		{"regex_sdp_ip_prefix_to_maintain_in_fd", PARAM_STR,
 				&regex_sdp_ip_prefix_to_maintain_in_fd},
-		{"include_rtcp_fd", INT_PARAM, &include_rtcp_fd}, {0, 0, 0}};
+		{"include_rtcp_fd", INT_PARAM, &include_rtcp_fd},
+		{"suspend_transaction", INT_PARAM, &suspend_transaction}, {0, 0, 0}};
 
 
 /** module exports */
@@ -1234,12 +1237,17 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char *dir, char *c_id,
 	}
 	saved_t_data->dlg = dlg;
 
-	LM_DBG("Suspending SIP TM transaction\n");
-	if(tmb.t_suspend(msg, &saved_t_data->tindex, &saved_t_data->tlabel) != 0) {
-		LM_ERR("failed to suspend the TM processing\n");
-		if(auth_session)
-			cdpb.AAASessionsUnlock(auth_session->hash);
-		goto error;
+	if(suspend_transaction) {
+		LM_DBG("Suspending SIP TM transaction\n");
+		if(tmb.t_suspend(msg, &saved_t_data->tindex, &saved_t_data->tlabel)
+				!= 0) {
+			LM_ERR("failed to suspend the TM processing\n");
+			if(auth_session)
+				cdpb.AAASessionsUnlock(auth_session->hash);
+			goto error;
+		}
+	} else {
+		LM_DBG("Don't suspend SIP TM transaction\n");
 	}
 
 	LM_DBG("Sending Rx AAR");
@@ -1248,7 +1256,9 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char *dir, char *c_id,
 
 	if(!ret) {
 		LM_ERR("Failed to send AAR\n");
-		tmb.t_cancel_suspend(saved_t_data->tindex, saved_t_data->tlabel);
+		if(suspend_transaction) {
+			tmb.t_cancel_suspend(saved_t_data->tindex, saved_t_data->tlabel);
+		}
 		goto error;
 
 
@@ -1431,11 +1441,16 @@ static int w_rx_aar_register(
 		return CSCF_RETURN_ERROR;
 	}
 
-	LM_DBG("Suspending SIP TM transaction\n");
-	if(tmb.t_suspend(msg, &saved_t_data->tindex, &saved_t_data->tlabel) != 0) {
-		LM_ERR("failed to suspend the TM processing\n");
-		free_saved_transaction_global_data(saved_t_data);
-		return CSCF_RETURN_ERROR;
+	if(suspend_transaction) {
+		LM_DBG("Suspending SIP TM transaction\n");
+		if(tmb.t_suspend(msg, &saved_t_data->tindex, &saved_t_data->tlabel)
+				!= 0) {
+			LM_ERR("failed to suspend the TM processing\n");
+			free_saved_transaction_global_data(saved_t_data);
+			return CSCF_RETURN_ERROR;
+		}
+	} else {
+		LM_DBG("Don't suspend SIP TM transaction\n");
 	}
 
 	LM_DBG("Successfully suspended transaction\n");
@@ -1662,7 +1677,9 @@ static int w_rx_aar_register(
 		return CSCF_RETURN_BREAK; //on success we break - because rest of cfg file will be executed by async process
 	} else {
 		create_return_code(CSCF_RETURN_TRUE);
-		tmb.t_cancel_suspend(saved_t_data->tindex, saved_t_data->tlabel);
+		if(suspend_transaction) {
+			tmb.t_cancel_suspend(saved_t_data->tindex, saved_t_data->tlabel);
+		}
 		if(saved_t_data) {
 			free_saved_transaction_global_data(
 					saved_t_data); //no aar sent so we must free the global data
@@ -1673,7 +1690,9 @@ static int w_rx_aar_register(
 error:
 	LM_ERR("Error trying to send AAR\n");
 	if(!aar_sent) {
-		tmb.t_cancel_suspend(saved_t_data->tindex, saved_t_data->tlabel);
+		if(suspend_transaction) {
+			tmb.t_cancel_suspend(saved_t_data->tindex, saved_t_data->tlabel);
+		}
 		if(saved_t_data) {
 
 			free_saved_transaction_global_data(

+ 33 - 24
src/modules/ims_qos/rx_aar.c

@@ -76,6 +76,7 @@ extern usrloc_api_t ul;
 extern struct ims_qos_counters_h ims_qos_cnts_h;
 
 extern int authorize_video_flow;
+extern int suspend_transaction;
 
 extern str af_signaling_ip;
 extern str af_signaling_ip6;
@@ -113,19 +114,21 @@ void async_aar_callback(
 
 	LM_DBG("received AAA answer");
 
-	if(tmb.t_lookup_ident(&t, data->tindex, data->tlabel) < 0) {
-		LM_ERR("t_continue: transaction not found\n");
-		goto error;
-	} else {
-		LM_DBG("t_continue: transaction found\n");
+	if(suspend_transaction) {
+		if(tmb.t_lookup_ident(&t, data->tindex, data->tlabel) < 0) {
+			LM_ERR("t_continue: transaction not found\n");
+			goto error;
+		} else {
+			LM_DBG("t_continue: transaction found\n");
+		}
+		//we have T, lets restore our state (esp. for AVPs)
+		set_avp_list(AVP_TRACK_FROM | AVP_CLASS_URI, &t->uri_avps_from);
+		set_avp_list(AVP_TRACK_TO | AVP_CLASS_URI, &t->uri_avps_to);
+		set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER, &t->user_avps_from);
+		set_avp_list(AVP_TRACK_TO | AVP_CLASS_USER, &t->user_avps_to);
+		set_avp_list(AVP_TRACK_FROM | AVP_CLASS_DOMAIN, &t->domain_avps_from);
+		set_avp_list(AVP_TRACK_TO | AVP_CLASS_DOMAIN, &t->domain_avps_to);
 	}
-	//we have T, lets restore our state (esp. for AVPs)
-	set_avp_list(AVP_TRACK_FROM | AVP_CLASS_URI, &t->uri_avps_from);
-	set_avp_list(AVP_TRACK_TO | AVP_CLASS_URI, &t->uri_avps_to);
-	set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER, &t->user_avps_from);
-	set_avp_list(AVP_TRACK_TO | AVP_CLASS_USER, &t->user_avps_to);
-	set_avp_list(AVP_TRACK_FROM | AVP_CLASS_DOMAIN, &t->domain_avps_from);
-	set_avp_list(AVP_TRACK_TO | AVP_CLASS_DOMAIN, &t->domain_avps_to);
 
 	if(is_timeout != 0) {
 		LM_ERR("Error timeout when sending AAR message via CDP\n");
@@ -228,7 +231,9 @@ done:
 	if(aaa)
 		cdpb.AAAFreeMessage(&aaa);
 
-	tmb.t_continue(data->tindex, data->tlabel, data->act);
+	if(suspend_transaction) {
+		tmb.t_continue(data->tindex, data->tlabel, data->act);
+	}
 	free_saved_transaction_global_data(data);
 }
 
@@ -272,17 +277,19 @@ void async_aar_reg_callback(
 		   "failures flag is [%d]\n",
 			data->answers_not_received, data->failed);
 
-	if(tmb.t_lookup_ident(&t, data->tindex, data->tlabel) < 0) {
-		LM_ERR("t_continue: transaction not found\n");
-		goto error;
+	if(suspend_transaction) {
+		if(tmb.t_lookup_ident(&t, data->tindex, data->tlabel) < 0) {
+			LM_ERR("t_continue: transaction not found\n");
+			goto error;
+		}
+		//we have T, lets restore our state (esp. for AVPs)
+		set_avp_list(AVP_TRACK_FROM | AVP_CLASS_URI, &t->uri_avps_from);
+		set_avp_list(AVP_TRACK_TO | AVP_CLASS_URI, &t->uri_avps_to);
+		set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER, &t->user_avps_from);
+		set_avp_list(AVP_TRACK_TO | AVP_CLASS_USER, &t->user_avps_to);
+		set_avp_list(AVP_TRACK_FROM | AVP_CLASS_DOMAIN, &t->domain_avps_from);
+		set_avp_list(AVP_TRACK_TO | AVP_CLASS_DOMAIN, &t->domain_avps_to);
 	}
-	//we have T, lets restore our state (esp. for AVPs)
-	set_avp_list(AVP_TRACK_FROM | AVP_CLASS_URI, &t->uri_avps_from);
-	set_avp_list(AVP_TRACK_TO | AVP_CLASS_URI, &t->uri_avps_to);
-	set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER, &t->user_avps_from);
-	set_avp_list(AVP_TRACK_TO | AVP_CLASS_USER, &t->user_avps_to);
-	set_avp_list(AVP_TRACK_FROM | AVP_CLASS_DOMAIN, &t->domain_avps_from);
-	set_avp_list(AVP_TRACK_TO | AVP_CLASS_DOMAIN, &t->domain_avps_to);
 
 	if(is_timeout != 0) {
 		LM_ERR("Error timeout when sending AAR message via CDP\n");
@@ -423,7 +430,9 @@ done:
 		cdpb.AAAFreeMessage(&aaa);
 
 	if(finalReply) {
-		tmb.t_continue(data->tindex, data->tlabel, data->act);
+		if(suspend_transaction) {
+			tmb.t_continue(data->tindex, data->tlabel, data->act);
+		}
 		free_saved_transaction_global_data(data);
 	}
 	free_saved_transaction_data(local_data);