فهرست منبع

tm: documentation for new event_callback parameter

Daniel-Constantin Mierla 8 سال پیش
والد
کامیت
dc9abcba9a
2فایلهای تغییر یافته به همراه57 افزوده شده و 17 حذف شده
  1. 30 0
      modules/tm/doc/params.xml
  2. 27 17
      modules/tm/doc/tm.xml

+ 30 - 0
modules/tm/doc/params.xml

@@ -1424,6 +1424,36 @@ modparam("tm", "dns_reuse_rcv_socket", 1)
 ...
 ...
 modparam("tm|usrloc", "xavp_contact", "ulattrs")
 modparam("tm|usrloc", "xavp_contact", "ulattrs")
 ...
 ...
+</programlisting>
+		</example>
+	</section>
+
+	<section id="tm.p.event_callback">
+		<title><varname>event_callback</varname> (str)</title>
+		<para>
+			The name of the function in the kemi configuration file (embedded
+			scripting language such as Lua, Python, ...) to be executed instead
+			of event_route[tm:local-request] block. The function receives
+			a string parameter with the name of the event, respectively
+			"tm:local-request".
+		</para>
+		<para>
+		<emphasis>
+			Default value is 'empty' (no function is executed for events).
+		</emphasis>
+		</para>
+		<example>
+		<title>Set <varname>event_callback</varname> parameter</title>
+		<programlisting format="linespecific">
+...
+modparam("tm", "event_callback", "ksr_tm_event")
+...
+-- event callback function implemented in Lua
+function ksr_tm_event(evname)
+	KSR.info("===== htable module triggered event: " .. evname .. "\n");
+	return 1;
+end
+...
 </programlisting>
 </programlisting>
 		</example>
 		</example>
 	</section>
 	</section>

+ 27 - 17
modules/tm/doc/tm.xml

@@ -26,6 +26,11 @@
 		<surname>Heinanen</surname>
 		<surname>Heinanen</surname>
 	        <email>[email protected]</email>
 	        <email>[email protected]</email>
 		</author>
 		</author>
+		<author>
+		<firstname>Daniel-Constantin</firstname>
+		<surname>Mierla</surname>
+	        <email>[email protected]</email>
+		</author>
 	</authorgroup>
 	</authorgroup>
 	<copyright>
 	<copyright>
 	    <year>2003</year>
 	    <year>2003</year>
@@ -35,6 +40,10 @@
 		<year>2008</year>
 		<year>2008</year>
 		<holder>Juha Heinanen</holder>
 		<holder>Juha Heinanen</holder>
 	</copyright>
 	</copyright>
+	<copyright>
+		<year>2016</year>
+		<holder>Daniel-Constantin Mierla</holder>
+	</copyright>
     </bookinfo>
     </bookinfo>
     <toc></toc>
     <toc></toc>
 
 
@@ -44,7 +53,7 @@
 	<title>Overview</title>
 	<title>Overview</title>
 	<para>
 	<para>
 	    The <acronym>TM</acronym> module enables stateful processing of SIP
 	    The <acronym>TM</acronym> module enables stateful processing of SIP
-	    transactions.  Stateful logic is costly in terms of memory and 
+	    transactions.  Stateful logic is costly in terms of memory and
 	    <acronym>CPU</acronym>. The main use is services that
 	    <acronym>CPU</acronym>. The main use is services that
 	    inherently need state. For example, transaction-based accounting
 	    inherently need state. For example, transaction-based accounting
 	    (module acc) needs to process transaction state as opposed to
 	    (module acc) needs to process transaction state as opposed to
@@ -119,7 +128,7 @@
 		registered contact then becomes one branch in the destination set.
 		registered contact then becomes one branch in the destination set.
 	  </para>
 	  </para>
 	  <para>
 	  <para>
-		The default behavior of the <acronym>TM</acronym> module, 
+		The default behavior of the <acronym>TM</acronym> module,
 		if it encounters a SIP message with multiple branches in the destination
 		if it encounters a SIP message with multiple branches in the destination
 		set, is to forward the SIP message to all the branches in parallel.
 		set, is to forward the SIP message to all the branches in parallel.
 		That means it sends the message to all the branch destinations before it
 		That means it sends the message to all the branch destinations before it
@@ -151,8 +160,8 @@
 	  </para>
 	  </para>
 	  <para>
 	  <para>
 		Every branch in the destination set is assigned a priority number,
 		Every branch in the destination set is assigned a priority number,
-		also known as the <quote>q value</quote>. The q value is a floating 
-		point number in a range 0 to 1.0. The higher the q value number, 
+		also known as the <quote>q value</quote>. The q value is a floating
+		point number in a range 0 to 1.0. The higher the q value number,
 		the more priority is given to the particular branch in the destination set.
 		the more priority is given to the particular branch in the destination set.
 		Branches with q value 1.0 have maximum priority, such branches should be always
 		Branches with q value 1.0 have maximum priority, such branches should be always
 		be tried first in serial forking. Branches with q value 0 have the lowest
 		be tried first in serial forking. Branches with q value 0 have the lowest
@@ -166,7 +175,7 @@
 		using <function>t_relay()</function>:
 		using <function>t_relay()</function>:
 	  </para>
 	  </para>
 	  <programlisting format="linespecific">
 	  <programlisting format="linespecific">
-route {
+request_route {
   seturi("sip:[email protected]");
   seturi("sip:[email protected]");
   append_branch("sip:[email protected]");
   append_branch("sip:[email protected]");
   append_branch("sip:[email protected]");
   append_branch("sip:[email protected]");
@@ -184,7 +193,7 @@ route {
 		to <function>append_branch()</function>:
 		to <function>append_branch()</function>:
 	  </para>
 	  </para>
 	  <programlisting format="linespecific">
 	  <programlisting format="linespecific">
-route {
+request_route {
   seturi("sip:[email protected]");
   seturi("sip:[email protected]");
   append_branch("sip:[email protected]", "0.5");
   append_branch("sip:[email protected]", "0.5");
   append_branch("sip:[email protected]", "0.5");
   append_branch("sip:[email protected]", "0.5");
@@ -192,7 +201,7 @@ route {
 
 
   t_relay();
   t_relay();
   break;
   break;
-}	 
+}
 </programlisting>
 </programlisting>
 	  <para>
 	  <para>
 		Here we assigned q value 0.5 to branches B and C and q value 1.0 to
 		Here we assigned q value 0.5 to branches B and C and q value 1.0 to
@@ -214,7 +223,7 @@ route {
 modparam("tm", "contacts_avp", "tm_contacts");
 modparam("tm", "contacts_avp", "tm_contacts");
 modparam("tm", "contact_flows_avp", "tm_contact_flows");
 modparam("tm", "contact_flows_avp", "tm_contact_flows");
 
 
-route {
+request_route {
   seturi("sip:[email protected]");
   seturi("sip:[email protected]");
   append_branch("sip:[email protected]", "0.5");
   append_branch("sip:[email protected]", "0.5");
   append_branch("sip:[email protected]", "0.5");
   append_branch("sip:[email protected]", "0.5");
@@ -225,7 +234,7 @@ route {
   t_next_contacts();
   t_next_contacts();
   t_relay();
   t_relay();
   break;
   break;
-}	 
+}
 </programlisting>
 </programlisting>
 	  <para>
 	  <para>
 		First of all, the tm module parameters are mandatory if the two new
 		First of all, the tm module parameters are mandatory if the two new
@@ -254,7 +263,7 @@ route {
 	  <programlisting format="linespecific">
 	  <programlisting format="linespecific">
 modparam("tm", "contacts_avp", "tm_contacts");
 modparam("tm", "contacts_avp", "tm_contacts");
 
 
-route {
+request_route {
   seturi("sip:[email protected]");
   seturi("sip:[email protected]");
   append_branch("sip:[email protected]", "0.5");
   append_branch("sip:[email protected]", "0.5");
   append_branch("sip:[email protected]", "0.5");
   append_branch("sip:[email protected]", "0.5");
@@ -305,14 +314,19 @@ failure_route["serial"]
 		And that's the whole example, we achieved combined serial/parallel
 		And that's the whole example, we achieved combined serial/parallel
 		forking based on the q value of individual branches. In real-world
 		forking based on the q value of individual branches. In real-world
 		configuration files the script writer would need to check the return
 		configuration files the script writer would need to check the return
-		value of all functions and <varname>restart_fr_on_each_reply</varname>. 
+		value of all functions and <varname>restart_fr_on_each_reply</varname>.
 		The destination set would not be configured directly in the configuration file, but
 		The destination set would not be configured directly in the configuration file, but
 		can be retrieved from the user location database. In that
 		can be retrieved from the user location database. In that
 		case registered contacts will be stored in the destination set as
 		case registered contacts will be stored in the destination set as
 		branches and their q values (provided by UAs) will be used.
 		branches and their q values (provided by UAs) will be used.
 	  </para>
 	  </para>
 	</section>
 	</section>
-    
+
+    <xi:include href="params.xml"/>
+    <xi:include href="functions.xml"/>
+    <xi:include href="api.xml"/>
+    <xi:include href="event_routes.xml"/>
+
     <section id="tm.known_issues">
     <section id="tm.known_issues">
 	<title>Known Issues</title>
 	<title>Known Issues</title>
 	<itemizedlist>
 	<itemizedlist>
@@ -346,10 +360,6 @@ failure_route["serial"]
 
 
 	</itemizedlist>
 	</itemizedlist>
     </section>
     </section>
-    
-    <xi:include href="params.xml"/>
-    <xi:include href="functions.xml"/>
-    <xi:include href="api.xml"/>
-    <xi:include href="event_routes.xml"/>
+
     </chapter>
     </chapter>
 </book>
 </book>