modules/ims_qos: added patch for flow-description bug when request originates from...
[sip-router] / modules / app_java / doc / app_java_admin.xml
1 <?xml version="1.0" encoding='utf-8'?>
2
3 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" 
4         "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
5
6 <!-- Include general documentation entities -->
7 <!ENTITY % docentities SYSTEM "../../../docbook/entities.xml">
8 %docentities;
9
10 ]>
11
12 <!-- Module User's Guide -->
13
14 <chapter>
15     
16     <title>&adminguide;</title>
17     
18     <!-- Section Overview -->
19     <section>
20                 <title>Overview</title>
21                 <para>
22                         This module allows execution of Java compiled classes from the &kamailio;
23                         config file, exporting functions to access the SIP message from Java
24                         using the Java Native Interface (JNI).
25                 </para>
26     </section>
27         <!-- end op section Overview -->
28         
29         <!-- Section Dependencies -->
30     <section>
31                 <title>Dependencies</title>
32         <!-- Section Modules -->
33                 <section>
34                     <title>&kamailio; Modules</title>
35                     <para>
36                         The following modules must be loaded before this module:
37                         <itemizedlist>
38                             <listitem>
39                                 <para>
40                                     <emphasis>none</emphasis>.
41                                 </para>
42                             </listitem>
43                         </itemizedlist>
44                     </para>
45                 </section>
46         <!-- End of section Modules -->
47         
48         <!-- Section External Libraries or Applications -->
49                 <section>
50                     <title>External Libraries or Applications</title>
51                     <para>
52 <!--
53                         The following libraries or applications must be installed before running
54                         &kamailio; with this module loaded:
55 -->                     
56                         <itemizedlist>
57                                 <para><emphasis>The following packages are runtime libraries, required to launch</emphasis></para>
58                                 <listitem override="disc"><para><emphasis>java-common</emphasis> Base of all Java packages.</para></listitem>
59                                 <listitem override="disc"><para><emphasis>default-jre</emphasis> Standard Java or Java compatible Runtime.</para></listitem>
60                                 <listitem override="disc"><para><emphasis>gcj-jre</emphasis> Java runtime environment using GIJ/classpath.</para></listitem>
61                                 <listitem override="disc"><para><emphasis>libgcj12 (>=12)</emphasis> Java runtime library for use with gcj.</para></listitem>
62                         </itemizedlist>
63                         <itemizedlist>
64                                 <para><emphasis>The following packages are optional, required for development</emphasis></para>
65                                 <listitem override="box"><para><emphasis>ant</emphasis> Java based build tool like make.</para></listitem>
66                                 <listitem override="box"><para><emphasis>ant-contrib</emphasis> Collection of tasks, types and other tools for Apache Ant.</para></listitem>
67                                 <listitem override="box"><para><emphasis>ant-gcj</emphasis> Java based build tool like make (GCJ).</para></listitem>
68                                 <listitem override="box"><para><emphasis>default-jdk</emphasis> Standard Java or Java compatible Development Kit</para></listitem>
69                                 <listitem override="box"><para><emphasis>gcj-jdk</emphasis> gcj and classpath development tools for Java(TM)</para></listitem>
70                                 <listitem override="box"><para><emphasis>libgcj13-dev (>=12)</emphasis> Java development headers for use with gcj</para></listitem>
71                                 <listitem override="box"><para><emphasis>jdk</emphasis> JDK Development Kit (either oracle jdk or openjdk)</para></listitem>
72                         </itemizedlist>
73                     </para>
74                         <para>
75                                 The following libraries or applications must be compiled before
76                                 running &kamailio; with this module loaded:
77                                 <itemizedlist>
78                                         <para><emphasis>The following packages are runtime libraries, required to launch</emphasis></para>
79                                         <listitem override="circle"><para><emphasis>&lt;class_name&gt;</emphasis>.class</para></listitem>
80                                         <listitem override="circle"><para><emphasis>&kamailiobinary;</emphasis>.jar</para></listitem>
81                                 </itemizedlist>
82                         </para>
83                 </section>
84         <!-- end of section External Libraries or Applications -->
85     </section>
86         <!-- end of section Dependencies -->
87         
88         <!-- Section Java Runtime -->
89         <section>
90                 <title>Java runtime</title>
91                 <section>
92                         <title>JRE or JDK is required to use this module</title>
93                         <para>Java runtime library (JRE and JDK for building app_java) is required to use this module.</para>
94                 </section>
95         </section>
96         <!-- end of section Java Runtime -->
97         
98         <!-- Section Parameters -->
99         <section>
100                 <title>Parameters</title>
101
102                 <!-- class_name -->
103                 <section id="app_java.p.class_name">
104                         <title><varname>class_name</varname> (string)</title>
105                     <para>
106                         The class name should have the same compiled file name.
107                         If the value is <emphasis>"&kamailio;"</emphasis>, then the compiled file should be named as <emphasis>"&kamailio;.class"</emphasis>.
108                     </para>
109                     <para>
110                                 <emphasis>
111                                         Default value is <quote>&kamailio;</quote>.
112                                 </emphasis>
113                     </para>
114                     <example>
115                         <title>Set <varname>class_name</varname> parameter</title>
116                                 <programlisting format="linespecific">
117 ...
118 modparam("app_java", "class_name", "&kamailio;")
119 ...
120 </programlisting>
121                     </example>
122                 </section>
123
124                 <!-- child_init_method -->
125                 <section id="app_java.p.child_init_method">
126                         <title><varname>child_init_method</varname> (string)</title>
127                         <para>
128                                 TBD.
129                         </para>
130                         <para>
131                                 <emphasis>
132                                         Default value is <quote>child_init</quote>.
133                                 </emphasis>
134                         </para>
135                         <example>
136                                 <title>Set <varname>child_init_method</varname> parameter</title>
137                                 <programlisting format="linespecific">
138 ...
139 modparam("app_java", "child_init_method", "my_mod_init")
140 ...
141 </programlisting>
142                         </example>
143                 </section>
144
145                 <!-- java_options -->
146                 <section id="app_java.p.java_option">
147                         <title><varname>java_options</varname> (string)</title>
148                         <para>
149                                 Java options for Java Virtual Machine.
150                                 For more info read <ulink url="http://docs.oracle.com/javase/6/docs/technotes/tools/windows/java.html"><citetitle>java docs</citetitle></ulink>
151                         </para>
152                         <para>
153                                 <emphasis>
154                                         Default value is <quote>-Djava.compiler=NONE</quote>.
155                                 </emphasis>
156                         </para>
157                         <example>
158                                 <title>Set <varname>java_options</varname> parameter</title>
159                                 <programlisting format="linespecific">
160 ...
161 modparam("app_java", "java_options", "-Djava.compiler=NONE")
162 ...
163 </programlisting>
164                         </example>
165                         <example>
166                                 <title>Set <varname>java_options</varname> parameter (live configuration)</title>
167                                 <programlisting format="linespecific">
168 ...
169 # Assumes "application java folder" is located at /opt/kamailio/java
170 modparam("app_java", "java_options", "-Djava.compiler=NONE 
171     -Djava.class.path=/path/to/kamailio/modules:/opt/kamailio/java:
172     /opt/kamailio/java/kamailio.jar")
173 ...
174 </programlisting>
175                         </example>
176                         <example>
177                                 <title>Set <varname>java_options</varname> parameter (verbose configuration)</title>
178                                 <programlisting format="linespecific">
179 ...
180 # Assumes "application java folder" is located at /opt/kamailio/java
181 modparam("app_java", "java_options", "-verbose:gc,class,jni 
182     -Djava.compiler=NONE -Djava.class.path=/path/to/kamailio/modules:
183     /opt/kamailio/java:/opt/kamailio/java/kamailio.jar")
184 ...
185 </programlisting>
186                         </example>
187                         <example>
188                                 <title>Set <varname>java_options</varname> parameter (debug configuration)</title>
189                                 <programlisting format="linespecific">
190 ...
191 # Assumes "application java folder" is located at /opt/kamailio/java
192 modparam("app_java", "java_options", "-Xdebug -verbose:gc,class,jni 
193     -Djava.compiler=NONE -Djava.class.path=/path/to/kamailio/modules:
194     /opt/kamailio/java:/opt/kamailio/java/kamailio.jar")
195 ...
196 </programlisting>
197                         </example>
198                 </section>
199
200                 <!-- force_cmd_exec -->
201                 <section id="app_java.p.force_cmd_exec">
202                         <title><varname>force_cmd_exec</varname> (int)</title>
203                         <para>
204                                 This parameter forces execution a &kamailiobinary; comnmand with java native method <quote>KamExec</quote>.
205                                 # Note: this is an untested yet feature, may cause (but may not) a memory leaks if used from embedded languages.
206                         </para>
207                         <para>
208                                 <emphasis>
209                                         Default value is <quote>0 (off)</quote>.
210                                 </emphasis>
211                         </para>
212                         <example>
213                                 <title>Set <varname>force_cmd_exec</varname> parameter</title>
214                                 <programlisting format="linespecific">
215 ...
216 modparam("app_java", "force_cmd_exec", 1)
217 ...
218 </programlisting>
219                         </example>
220                 </section>
221         </section>
222         <!-- End of section Parameters -->
223         
224         <!-- Section Functions -->
225     <section>
226                 <title>Functions</title>
227         
228         <!-- Section Common requirements -->
229         <section>
230                 <title>
231                         Common requirements
232                 </title>
233                 <para>Each function has a required parameter <quote>method_signature</quote>. For more info
234                                 see <ulink url="http://www.rgagnon.com/javadetails/java-0286.html"
235                                                 ><citetitle>Determine the signature of a method</citetitle></ulink>.
236                                 Signature represents the variable type. The mapping between the Java type and C type
237                                 is
238                                 <programlisting format="linespecific">
239                 Type     Chararacter 
240                 boolean      Z 
241                 byte         B 
242                 char         C 
243                 double       D 
244                 float        F 
245                 int          I 
246                 long         J 
247                 object       L 
248                 short        S 
249                 void         V 
250                 Note that to specify an object, the "L" is followed by the 
251                 object's class name and ends with a semi-colon, ';' .
252                         </programlisting>
253                         </para>
254                 <para> app_java supports the following signatures:
255                                 <programlisting format="linespecific">
256                 Primitives: Z,B,C,D,F,I,J,L,S,V
257                 Objects: 
258                         Ljava/lang/Boolean;
259                         Ljava/lang/Byte;
260                         Ljava/lang/Character;
261                         Ljava/lang/Double;
262                         Ljava/lang/Float;
263                         Ljava/lang/Integer;
264                         Ljava/lang/Long;
265                         Ljava/lang/Short;
266                         Ljava/lang/String;
267                         NULL parameter: V
268
269         Each parameter passed to function will be cast according to given signature.
270         
271         Parameters are optional, ommitting a parameter meant the passed value is NULL.
272         Parameters count should be exactly the same as signature count.
273         Note 1: Arrays representation (symbol '[') is not supported yet.
274         Note 2: You shall use a correct signature, e.g. the following examples of
275         combinations are invalid:
276         java_method_exec("ExampleMethod", "ZI", "False");
277         java_method_exec("ExampleMethod", "LI", "something", "5");
278 </programlisting>
279                         </para>
280
281  
282         </section>
283         <!-- End of section Common Requirements -->
284   
285         <!-- Section java_method_exec -->
286         <section id="app_java.f.java_method_exec">
287                 <title>java_method_exec(method, method_signature, [param1[, param2[, ...]]])</title>
288                 <para>Executes a java class method <emphasis>method</emphasis>. Parameter <emphasis>method_signature</emphasis> is required.</para>
289                 <itemizedlist>
290                         <listitem>
291                                 <example>
292                                                 <title>Signature: "V"</title>
293                                         <para>&kamailio; prototype</para>
294                                         <programlisting format="linespecific">java_method_exec("ExampleMethod", "V");</programlisting>
295                                         <para>Java prototype</para>
296                                         <programlisting format="linespecific">public int ExampleMethod();</programlisting>
297                                         <para>Example of usage:</para>
298                                         <programlisting format="linespecific">
299 # &kamailio;
300 java_method_exec("ExampleMethod", "V");
301
302 # Java
303 public int ExampleMethod()
304 {
305     ... do something;
306     return 1;
307 }
308 </programlisting>
309                                 </example>
310                         </listitem>
311                         
312                         <listitem>
313                                 <example>
314                                         <title>Signature: "Ljava/lang/String;I"</title>
315                                         <para>&kamailio; prototype</para>
316                                         <programlisting format="linespecific">java_method_exec("ExampleMethod", "Ljava/lang/String;I", "Hello world", "5");</programlisting>
317                                         <para>Java prototype</para>
318                                         <programlisting format="linespecific">public int ExampleMethod(String param1, int param2);</programlisting>
319                                         <para>In the above scenario parameter 2 ("5") will be cast to integer representation.</para>
320                                         <para>Example of usage:</para>
321                                         <programlisting format="linespecific">
322 # &kamailio;
323 java_method_exec("ExampleMethod", "Ljava/lang/String;I", "$mb", "$ml");
324
325 # Java
326 public int ExampleMethod(String SipMessageBuffer, int SipMessageLenght)
327 {
328     ... do something with buffer;
329     return 1;
330 }
331 </programlisting>
332                                 </example>
333                         </listitem>
334
335                         <listitem>
336                                 <example>
337                                         <title>Signature: "ZB"</title>
338                                         <para>&kamailio; prototype</para>
339                                         <programlisting format="linespecific">java_method_exec("ExampleMethod", "ZB", "true", "0x05");</programlisting>
340                                         <para>Java prototype</para>
341                                         <programlisting format="linespecific">public int ExampleMethod(boolean param1, byte param2);</programlisting>
342                                         <para>In the above scenario parameter 1 ("true") will be cast to boolean representation.</para>
343                                         <para>Example of usage:</para>
344                                         <programlisting format="linespecific">
345 # &kamailio;
346 java_method_exec("ExampleMethod", "ZB", "true", "0x05");
347
348 # Java
349 public int ExampleMethod(boolean flagSet, byte bFlag);
350 {
351     if (flagSet)
352     {
353         ... do something with flags;
354     }
355
356     return 1;
357 }
358 </programlisting>
359                                 </example>
360                         </listitem>
361
362                 </itemizedlist>
363         </section>
364         <!-- end of section java_method_exec -->
365
366         <!-- Section java_staticmethod_method_exec -->
367         <section id="app_java.f.java_staticmethod_exec">
368                 <title>java_staticmethod_exec(method, method_signature, [param1[, param2[, ...]]])</title>
369                 <para>Executes a Java static method <emphasis>method</emphasis>. Parameter <emphasis>method_signature</emphasis> is required.</para>
370                 <itemizedlist>
371                         <listitem>
372                                 <example>
373                                         <title>Signature: "V"</title>
374                                         <para>&kamailio; prototype</para>
375                                         <programlisting format="linespecific">java_staticmethod_exec("ExampleMethod", "V");</programlisting>
376                                         <para>Java prototype</para>
377                                         <programlisting format="linespecific">public static int ExampleMethod();</programlisting>
378                                         <para>Example of usage:</para>
379                                         <programlisting format="linespecific">
380 # &kamailio;
381 java_staticmethod_exec("ExampleMethod", "V");
382
383 # Java
384 public static int ExampleMethod()
385 {
386     ... do something;
387     return 1;
388 }
389 </programlisting>
390                                 </example>
391                         </listitem>
392                         
393                         <listitem>
394                                 <example>
395                                         <title>Signature: "Ljava/lang/String;I"</title>
396                                         <para>&kamailio; prototype</para>
397                                         <programlisting format="linespecific">java_staticmethod_exec("ExampleMethod", "Ljava/lang/String;I", "Hello world", "5");</programlisting>
398                                         <para>Java prototype</para>
399                                         <programlisting format="linespecific">public static int ExampleMethod(String param1, int param2);</programlisting>
400                                         <para>In the above scenario parameter 2 ("5") will be cast to integer representation.</para>
401                                         <para>Example of usage:</para>
402                                         <programlisting format="linespecific">
403 # &kamailio;
404 java_staticmethod_exec("ExampleMethod", "Ljava/lang/String;I", "$mb", "$ml");
405
406 # Java
407 public static int ExampleMethod(String SipMessageBuffer, int SipMessageLenght)
408 {
409     ... do something with buffer;
410     return 1;
411 }
412 </programlisting>
413                                 </example>
414                         </listitem>
415                         
416                         <listitem>
417                                 <example>
418                                         <title>Signature: "ZB"</title>
419                                         <para>&kamailio; prototype</para>
420                                         <programlisting format="linespecific">java_staticmethod_exec("ExampleMethod", "ZB", "true", "0x05");</programlisting>
421                                         <para>Java prototype</para>
422                                         <programlisting format="linespecific">public static int ExampleMethod(boolean param1, byte param2);</programlisting>
423                                         <para>In the above scenario parameter 1 ("true") will be cast to boolean representation.</para>
424                                         <para>Example of usage:</para>
425                                         <programlisting format="linespecific">
426 # &kamailio;
427 java_staticmethod_exec("ExampleMethod", "ZB", "true", "0x05");
428
429 # Java
430 public static int ExampleMethod(boolean flagSet, byte bFlag);
431 {
432     if (flagSet)
433     {
434         ... do something with flags;
435     }
436
437     return 1;
438 }
439 </programlisting>
440                                 </example>
441                         </listitem>
442                         
443                 </itemizedlist>
444         </section>
445         <!-- end of section java_staticmethod_exec -->
446         
447         <!-- Section java_s_method_exec -->
448         <section id="app_java.f.java_s_method_exec">
449                 <title>java_s_method_exec(method, method_signature, [param1[, param2[, ...]]])</title>
450                 <para>Executes a Java class synchronized method <emphasis>method</emphasis>. Parameter <emphasis>method_signature</emphasis> is required.</para>
451                 <para>For more info see <ulink url="http://docs.oracle.com/javase/tutorial/essential/concurrency/syncmeth.html"><citetitle>Synchronized Methods</citetitle></ulink></para>
452                 <itemizedlist>
453                         <listitem>
454                                 <example>
455                                         <title>Signature: "V"</title>
456                                         <para>&kamailio; prototype</para>
457                                         <programlisting format="linespecific">java_s_method_exec("ExampleMethod", "V");</programlisting>
458                                         <para>Java prototype</para>
459                                         <programlisting format="linespecific">public synchronized int ExampleMethod();</programlisting>
460                                         <para>Example of usage:</para>
461                                         <programlisting format="linespecific">
462 # &kamailio;
463 java_s_method_exec("ExampleMethod", "V");
464
465 # Java
466 public synchronized int ExampleMethod()
467 {
468     ... do something;
469     return 1;
470 }
471 </programlisting>
472                                 </example>
473                         </listitem>
474                         
475                         <listitem>
476                                 <example>
477                                         <title>Signature: "Ljava/lang/String;I"</title>
478                                         <para>&kamailio; prototype</para>
479                                         <programlisting format="linespecific">java_s_method_exec("ExampleMethod", "Ljava/lang/String;I", "Hello world", "5");</programlisting>
480                                         <para>Java prototype</para>
481                                         <programlisting format="linespecific">public synchronized int ExampleMethod(String param1, int param2);</programlisting>
482                                         <para>In the above scenario parameter 2 ("5") will be cast to integer representation.</para>
483                                         <para>Example of usage:</para>
484                                         <programlisting format="linespecific">
485 # &kamailio;
486 java_s_method_exec("ExampleMethod", "Ljava/lang/String;I", "$mb", "$ml");
487
488 # Java
489 public synchronized int ExampleMethod(String SipMessageBuffer, int SipMessageLenght)
490 {
491     ... do something with buffer;
492     return 1;
493 }
494 </programlisting>
495                                 </example>
496                         </listitem>
497                         
498                         <listitem>
499                                 <example>
500                                         <title>Signature: "ZB"</title>
501                                         <para>&kamailio; prototype</para>
502                                         <programlisting format="linespecific">java_s_method_exec("ExampleMethod", "ZB", "true", "0x05");</programlisting>
503                                         <para>Java prototype</para>
504                                         <programlisting format="linespecific">public synchronized int ExampleMethod(boolean param1, byte param2);</programlisting>
505                                         <para>In the above scenario parameter 1 ("true") will be cast to boolean representation.</para>
506                                         <para>Example of usage:</para>
507                                         <programlisting format="linespecific">
508 # &kamailio;
509 java_s_method_exec("ExampleMethod", "ZB", "true", "0x05");
510
511 # Java
512 public synchronized int ExampleMethod(boolean flagSet, byte bFlag);
513 {
514     if (flagSet)
515     {
516         ... do something with flags;
517     }
518
519     return 1;
520 }
521 </programlisting>
522                                 </example>
523                         </listitem>
524                         
525                 </itemizedlist>
526         </section>
527         <!-- end of section java_s_method_exec -->
528         
529         <!-- Section java_s_staticmethod_exec -->
530         <section id="app_java.f.java_s_staticmethod_exec">
531                 <title>java_s_staticmethod_exec(method, method_signature, [param1[, param2[, ...]]])</title>
532                 <para>Executes a java synchronized static method <emphasis>method</emphasis>. Parameter <emphasis>method_signature</emphasis> is required.</para>
533                 <para>For more info see <ulink url="http://docs.oracle.com/javase/tutorial/essential/concurrency/syncmeth.html"><citetitle>Synchronized Methods</citetitle></ulink></para>
534                 <itemizedlist>
535                         <listitem>
536                                 <example>
537                                         <title>Signature: "V"</title>
538                                         <para>&kamailio; prototype</para>
539                                         <programlisting format="linespecific">java_s_staticmethod_exec("ExampleMethod", "V");</programlisting>
540                                         <para>Java prototype</para>
541                                         <programlisting format="linespecific">public static synchronized int ExampleMethod();</programlisting>
542                                         <para>Example of usage:</para>
543                                         <programlisting format="linespecific">
544 # &kamailio;
545 java_s_staticmethod_exec("ExampleMethod", "V");
546
547 # Java
548 public static synchronized int ExampleMethod()
549 {
550     ... do something;
551     return 1;
552 }
553 </programlisting>
554                                 </example>
555                         </listitem>
556                         
557                         <listitem>
558                                 <example>
559                                         <title>Signature: "Ljava/lang/String;I"</title>
560                                         <para>&kamailio; prototype</para>
561                                         <programlisting format="linespecific">java_s_staticmethod_exec("ExampleMethod", "Ljava/lang/String;I", "Hello world", "5");</programlisting>
562                                         <para>Java prototype</para>
563                                         <programlisting format="linespecific">public static synchronized int ExampleMethod(String param1, int param2);</programlisting>
564                                         <para>In the above scenario parameter 2 ("5") will be cast to integer representation.</para>
565                                         <para>Example of usage:</para>
566                                         <programlisting format="linespecific">
567 # &kamailio;
568 java_s_staticmethod_exec("ExampleMethod", "Ljava/lang/String;I", "$mb", "$ml");
569
570 # Java
571 public static synchronized int ExampleMethod(String SipMessageBuffer, int SipMessageLenght)
572 {
573     ... do something with buffer;
574     return 1;
575 }
576 </programlisting>
577                                 </example>
578                         </listitem>
579                         
580                         <listitem>
581                                 <example>
582                                         <title>Signature: "ZB"</title>
583                                         <para>&kamailio; prototype</para>
584                                         <programlisting format="linespecific">java_s_staticmethod_exec("ExampleMethod", "ZB", "true", "0x05");</programlisting>
585                                         <para>Java prototype</para>
586                                         <programlisting format="linespecific">public static synchronized int ExampleMethod(boolean param1, byte param2);</programlisting>
587                                         <para>In the above scenario parameter 1 ("true") will be cast to boolean representation.</para>
588                                         <para>Example of usage:</para>
589                                         <programlisting format="linespecific">
590 # &kamailio;
591 java_s_staticmethod_exec("ExampleMethod", "ZB", "true", "0x05");
592
593 # Java
594 public static synchronized int ExampleMethod(boolean flagSet, byte bFlag);
595 {
596     if (flagSet)
597     {
598         ... do something with flags;
599     }
600
601     return 1;
602 }
603 </programlisting>
604                                 </example>
605                         </listitem>
606                         
607                 </itemizedlist>
608         </section>
609         <!-- end of section java_s_method_exec -->
610
611     </section>
612         <!-- End of section Functions -->
613         
614         <!-- Section Java API-->
615     <section>
616                 <title>Java Module API</title>
617         <para></para>
618         
619         <!-- Section Minimal program skeleton -->
620         <section>
621                 <title>Minimal program skeleton</title>
622                 <para></para>
623                 <example>
624                         <title>Minimal program skeleton</title>
625                         <para></para>
626                         <programlisting format="linespecific">
627 import org.siprouter.*;
628 import org.siprouter.NativeInterface.*;
629
630 public class Kamailio extends NativeMethods
631 {
632     /* Here you should specify a full path to app_java.so */
633     static
634     {
635         System.load("/opt/kamailio/lib/kamailio/modules/app_java.so");
636     }
637
638     /* Constructor. Do not remove !!! */
639     public Kamailio()
640     {
641     }
642
643     /*
644         This method should be executed for each children process, immediately after forking.
645         Required. Do not remove !!!
646     */
647     public int child_init(int rank)
648     {
649         return 1;
650     }
651 }
652 </programlisting>
653                 </example>
654         </section>
655         <!-- End of section Minimal program skeleton -->
656         
657     </section>
658         <!-- End of section Java API -->
659         
660 </chapter>
661