[sr-dev] git:master: evapi: docs updated with evapi_close(), new event routes and pvs

Daniel-Constantin Mierla miconda at gmail.com
Mon Mar 31 09:42:05 CEST 2014


Module: sip-router
Branch: master
Commit: 193f27a0da5e2e3da7737da0bd7b035912be59d5
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=193f27a0da5e2e3da7737da0bd7b035912be59d5

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Mon Mar 31 09:41:17 2014 +0200

evapi: docs updated with evapi_close(), new event routes and pvs

---

 modules/evapi/README              |   82 ++++++++++++++++++++++++++++++
 modules/evapi/doc/evapi_admin.xml |   99 +++++++++++++++++++++++++++++++++++++
 2 files changed, 181 insertions(+), 0 deletions(-)

diff --git a/modules/evapi/README b/modules/evapi/README
index dfec149..97e0390 100644
--- a/modules/evapi/README
+++ b/modules/evapi/README
@@ -32,6 +32,15 @@ Daniel-Constantin Mierla
 
               4.1. evapi_relay(evdata)
               4.2. evapi_async_relay(evdata)
+              4.3. evapi_close()
+
+        5. Event routes
+
+              5.1. evapi:connection-new
+              5.2. evapi:connection-closed
+              5.3. evapi:message-received
+
+        6. Exported pseudo-variables
 
    List of Examples
 
@@ -40,6 +49,7 @@ Daniel-Constantin Mierla
    1.3. evapi_relay usage
    1.4. TCP message
    1.5. evapi_async_relay usage
+   1.6. evapi_evapi usage
 
 Chapter 1. Admin Guide
 
@@ -60,6 +70,15 @@ Chapter 1. Admin Guide
 
         4.1. evapi_relay(evdata)
         4.2. evapi_async_relay(evdata)
+        4.3. evapi_close()
+
+   5. Event routes
+
+        5.1. evapi:connection-new
+        5.2. evapi:connection-closed
+        5.3. evapi:message-received
+
+   6. Exported pseudo-variables
 
 1. Overview
 
@@ -113,6 +132,7 @@ modparam("evapi", "bind_addr", "1.2.3.4:8228")
 
    4.1. evapi_relay(evdata)
    4.2. evapi_async_relay(evdata)
+   4.3. evapi_close()
 
 4.1. evapi_relay(evdata)
 
@@ -150,3 +170,65 @@ evapi_relay("{ \"event\": \"test\",\n \"data\": { \"fU\": \"$fU\" }\n}");
 evapi_relay("{ \"event\": \"suspend\",\n \"data\":"
         " { \"index\": \"$T(id_index)\", \"label\": \"$T(id_label)\" }\n}");
 ...
+
+4.3. evapi_close()
+
+   Close evapi current client connection.
+
+   This function can be used from ANY_ROUTE.
+
+   Example 1.6. evapi_evapi usage
+...
+event_route[evapi:connection-new] {
+  if($evapi(srcaddr)!="127.0.0.1") {
+    evapi_close();
+    exit;
+  }
+}
+...
+
+5. Event routes
+
+   5.1. evapi:connection-new
+   5.2. evapi:connection-closed
+   5.3. evapi:message-received
+
+5.1. evapi:connection-new
+
+   If defined, the module calls event_route[evapi:connection-new] when a
+   new client is connected.
+...
+event_route[evapi:connection-new] {
+    xlog("new connection from $evapi(srcaddr):$evapi(srcport)\n");
+}
+...
+
+5.2. evapi:connection-closed
+
+   If defined, the module calls event_route[evapi:connection-closed] when
+   a client connection is closed.
+...
+event_route[evapi:connection-closed] {
+    xlog("connection closed by $evapi(srcaddr):$evapi(srcport)\n");
+}
+...
+
+5.3. evapi:message-received
+
+   If defined, the module calls event_route[evapi:message-received] when a
+   message is received from a client.
+...
+event_route[evapi:connection-closed] {
+    xlog("received [$evapi(msg)] from $evapi(srcaddr):$evapi(srcport)\n");
+}
+...
+
+6. Exported pseudo-variables
+
+     * $evapi(srcaddr) - source ip
+     * $evapi(srcport) - source port
+     * $evapi(msg) - received event message
+     * $evapi(conidx) - internal connexion index
+
+   Exported pseudo-variables are documented at
+   http://www.kamailio.org/wiki/.
diff --git a/modules/evapi/doc/evapi_admin.xml b/modules/evapi/doc/evapi_admin.xml
index 4015b8c..ae78e2d 100644
--- a/modules/evapi/doc/evapi_admin.xml
+++ b/modules/evapi/doc/evapi_admin.xml
@@ -155,6 +155,105 @@ evapi_relay("{ \"event\": \"suspend\",\n \"data\":"
 	    </example>
 	</section>
 
+	<section id="evapi.f.evapi_close">
+	    <title>
+		<function moreinfo="none">evapi_close()</function>
+	    </title>
+	    <para>
+		Close evapi current client connection.
+		</para>
+		<para>
+		This function can be used from ANY_ROUTE.
+		</para>
+		<example>
+		<title><function>evapi_evapi</function> usage</title>
+		<programlisting format="linespecific">
+...
+event_route[evapi:connection-new] {
+  if($evapi(srcaddr)!="127.0.0.1") {
+    evapi_close();
+    exit;
+  }
+}
+...
+</programlisting>
+	    </example>
+	</section>
+
+	</section>
+
+    <section>
+    <title>Event routes</title>
+    <section>
+        <title>
+        <function moreinfo="none">evapi:connection-new</function>
+        </title>
+        <para>
+			If defined, the module calls event_route[evapi:connection-new]
+			when a new client is connected.
+        </para>
+        <programlisting  format="linespecific">
+...
+event_route[evapi:connection-new] {
+    xlog("new connection from $evapi(srcaddr):$evapi(srcport)\n");
+}
+...
+        </programlisting>
+	</section>
+    <section>
+        <title>
+        <function moreinfo="none">evapi:connection-closed</function>
+        </title>
+        <para>
+			If defined, the module calls event_route[evapi:connection-closed]
+			when a client connection is closed.
+        </para>
+        <programlisting  format="linespecific">
+...
+event_route[evapi:connection-closed] {
+    xlog("connection closed by $evapi(srcaddr):$evapi(srcport)\n");
+}
+...
+        </programlisting>
+    </section>
+    <section>
+        <title>
+        <function moreinfo="none">evapi:message-received</function>
+        </title>
+        <para>
+			If defined, the module calls event_route[evapi:message-received]
+			when a message is received from a client.
+        </para>
+        <programlisting  format="linespecific">
+...
+event_route[evapi:connection-closed] {
+    xlog("received [$evapi(msg)] from $evapi(srcaddr):$evapi(srcport)\n");
+}
+...
+        </programlisting>
+    </section>
+    </section>
+
+    <section>
+		<title>Exported pseudo-variables</title>
+		<itemizedlist>
+			<listitem><para>
+				<emphasis>$evapi(srcaddr)</emphasis> - source ip
+			</para></listitem>
+			<listitem><para>
+				<emphasis>$evapi(srcport)</emphasis> - source port
+			</para></listitem>
+			<listitem><para>
+				<emphasis>$evapi(msg)</emphasis> - received event message
+			</para></listitem>
+			<listitem><para>
+				<emphasis>$evapi(conidx)</emphasis> - internal connexion index
+			</para></listitem>
+		</itemizedlist>
+		<para>
+		Exported pseudo-variables are documented at &kamwikilink;.
+		</para>
 	</section>
+
 </chapter>
 




More information about the sr-dev mailing list