[sr-dev] git:master:b3c301e1: uac: trigger event route for failure and timeout

Daniel-Constantin Mierla miconda at gmail.com
Thu Mar 10 10:46:09 CET 2022


Module: kamailio
Branch: master
Commit: b3c301e1c99eb90df1533724442aef7991cd36bc
URL: https://github.com/kamailio/kamailio/commit/b3c301e1c99eb90df1533724442aef7991cd36bc

Author: Stefan Mititelu <stefan-cristian.mititelu at 1and1.ro>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-03-10T10:46:04+01:00

uac: trigger event route for failure and timeout

...when $uac_req(evroute) = 2

---

Modified: src/modules/uac/doc/uac_admin.xml
Modified: src/modules/uac/uac_send.c

---

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

---

diff --git a/src/modules/uac/doc/uac_admin.xml b/src/modules/uac/doc/uac_admin.xml
index 188d1b913e..3ce59d3e11 100644
--- a/src/modules/uac/doc/uac_admin.xml
+++ b/src/modules/uac/doc/uac_admin.xml
@@ -1241,11 +1241,20 @@ failure_route[REMOTE_AUTH] {
 				<function moreinfo="none">event_route[uac:reply]</function>
 			</title>
 		<para>
-			Event route executed for the final reply of the branch for the
-			request sent with uac_req_send(). The associated $uac_req(evroute)
-			has to be set to 1. If the request is challenged for authentication
+		The associated $uac_req(evroute) can have either of the following values:
+		<itemizedlist>
+			<listitem><para>
+				<emphasis>1</emphasis> : event route executed for the <emphasis>final reply</emphasis> of the branch for the
+			request sent with uac_req_send(). If the request is challenged for authentication
 			with 401/407, then the event_route is executed twice, first for
 			401/407 and second for final reply of the transaction.
+			</para></listitem>
+			<listitem><para>
+				<emphasis>2</emphasis> : event route executed for <emphasis>failure</emphasis> of the branch for the
+			request sent with uac_req_send(). event route will execute also for timeout.
+			In order for this to work, please also enable TM module "enable_uac_fr" modparam.
+			</para></listitem>
+		</itemizedlist>
 		</para>
 		<example>
 		<title><function>event_route[uac:reply]</function> usage</title>
diff --git a/src/modules/uac/uac_send.c b/src/modules/uac/uac_send.c
index 43767c7804..887dc1b4a4 100644
--- a/src/modules/uac/uac_send.c
+++ b/src/modules/uac/uac_send.c
@@ -886,9 +886,21 @@ int uac_req_send(void)
 			return -1;
 		}
 
-		uac_r.cb_flags = TMCB_LOCAL_COMPLETED;
-		/* Callback function */
-		uac_r.cb  = uac_send_tm_callback;
+		switch (_uac_req.evroute)
+		{
+
+			case 2: 
+				uac_r.cb_flags = TMCB_ON_FAILURE;
+				/* Callback function */
+				uac_r.cb  = uac_resend_tm_callback;
+				break;
+			case 1:
+			default:
+				uac_r.cb_flags = TMCB_LOCAL_COMPLETED;
+				/* Callback function */
+				uac_r.cb  = uac_send_tm_callback;
+				break;
+		}
 		/* Callback parameter */
 		uac_r.cbp = (void*)tp;
 	}




More information about the sr-dev mailing list