Browse Source

async: documentation for async_task_route()

Daniel-Constantin Mierla 11 năm trước cách đây
mục cha
commit
272b23738d
2 tập tin đã thay đổi với 83 bổ sung2 xóa
  1. 36 0
      modules/async/README
  2. 47 2
      modules/async/doc/async_admin.xml

+ 36 - 0
modules/async/README

@@ -31,12 +31,14 @@ Daniel-Constantin Mierla
 
               4.1. async_route(routename, seconds)
               4.2. async_sleep(seconds)
+              4.3. async_task_route(routename)
 
    List of Examples
 
    1.1. Set workers parameter
    1.2. async_sleep usage
    1.3. async_sleep usage
+   1.4. async_task_route usage
 
 Chapter 1. Admin Guide
 
@@ -56,6 +58,7 @@ Chapter 1. Admin Guide
 
         4.1. async_route(routename, seconds)
         4.2. async_sleep(seconds)
+        4.3. async_task_route(routename)
 
 1. Overview
 
@@ -107,6 +110,7 @@ modparam("async", "workers", 2)
 
    4.1. async_route(routename, seconds)
    4.2. async_sleep(seconds)
+   4.3. async_task_route(routename)
 
 4.1. async_route(routename, seconds)
 
@@ -157,3 +161,35 @@ async_sleep("4");
 send_reply("404", "Not found");
 exit;
 ...
+
+4.3. async_task_route(routename)
+
+   Continue the processing of the SIP request with the route[routename] in
+   one of the processes from core asynchronous framework. The core
+   parameter async_workers has to be set to enable asynchronous framework.
+   The task is executed as soon as a process from asynchronous framework
+   is idle, there is no wait time for the task like for async_route(...).
+
+   In case of internal errors, the function returns false, otherwise the
+   function exits the execution of the script at that moment (return 0
+   behaviour).
+
+   The routename parameter can be a static string or a dynamic string
+   value with config variables.
+
+   Since the SIP request handling is resumed in another process, the
+   config file execution state is practically lost. Therefore beware that
+   the execution of config after resume will end once the route[routename]
+   is finished.
+
+   This function can be used from REQUEST_ROUTE.
+
+   Example 1.4. async_task_route usage
+...
+async_task_rroute("RESUME");
+...
+route[RESUME] {
+   send_reply("404", "Not found");
+   exit;
+}
+...

+ 47 - 2
modules/async/doc/async_admin.xml

@@ -90,7 +90,7 @@ modparam("async", "workers", 2)
 
 	<section>
 	<title>Functions</title>
-	<section>
+	<section id="async.f.async_route">
 	    <title>
 		<function moreinfo="none">async_route(routename, seconds)</function>
 	    </title>
@@ -133,7 +133,7 @@ route[RESUME] {
 	    </example>
 	</section>
 
-	<section>
+	<section id="async.f.async_sleep">
 	    <title>
 		<function moreinfo="none">async_sleep(seconds)</function>
 	    </title>
@@ -158,6 +158,51 @@ async_sleep("4");
 send_reply("404", "Not found");
 exit;
 ...
+</programlisting>
+	    </example>
+	</section>
+
+	<section id="async.f.async_task_route">
+	    <title>
+		<function moreinfo="none">async_task_route(routename)</function>
+	    </title>
+	    <para>
+		Continue the processing of the SIP request with the route[routename]
+		in one of the processes from core asynchronous framework. The core
+		parameter async_workers has to be set to enable asynchronous
+		framework. The task is executed as soon as a process from asynchronous
+		framework is idle, there is no wait time for the task like for
+		async_route(...).
+		</para>
+		<para>
+		In case of internal errors, the function returns false, otherwise the
+		function exits the execution of the script at that moment (return
+		0 behaviour).
+		</para>
+		<para>
+		The routename parameter can be a static string or a dynamic string
+		value with config variables.
+		</para>
+		<para>
+		Since the SIP request handling is resumed in another process,
+		the config file execution state is practically lost. Therefore beware
+		that the execution of config after resume will end once the
+		route[routename] is finished.
+		</para>
+		<para>
+		This function can be used from REQUEST_ROUTE.
+		</para>
+		<example>
+		<title><function>async_task_route</function> usage</title>
+		<programlisting format="linespecific">
+...
+async_task_rroute("RESUME");
+...
+route[RESUME] {
+   send_reply("404", "Not found");
+   exit;
+}
+...
 </programlisting>
 	    </example>
 	</section>