~ubuntu-branches/debian/sid/kamailio/sid

« back to all changes in this revision

Viewing changes to modules/app_java/kamailio_java_folder/java/Kamailio.java

  • Committer: Package Import Robot
  • Author(s): Victor Seva
  • Date: 2014-01-06 11:47:13 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20140106114713-t8xidp4arzrnyeya
Tags: 4.1.1-1
* New upstream release
* debian/patches:
  - add upstream fixes
* Added tls outbound websocket autheph dnssec modules
  - openssl exception added to their license
* removing sparc and ia64 from supported archs
  for mono module (Closes: #728915)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
import java.lang.*;
 
3
import java.io.*; 
 
4
 
 
5
import org.siprouter.*;
 
6
import org.siprouter.NativeInterface.*;
 
7
 
 
8
public class Kamailio extends NativeMethods
 
9
{
 
10
        static
 
11
        {
 
12
            System.load("/opt/kamailio/lib/kamailio/modules/app_java.so");
 
13
        }
 
14
 
 
15
        /* Constructor. Do not remove !!! */
 
16
        public Kamailio()
 
17
        {
 
18
        }
 
19
 
 
20
 
 
21
        public int child_init(int rank)
 
22
        {
 
23
            switch (rank)
 
24
            {
 
25
                case Ranks.PROC_MAIN:
 
26
                    LM_INFO("We're at PROC_MAIN\n");
 
27
                    break;
 
28
                case Ranks.PROC_TIMER:
 
29
                    LM_INFO("We're at PROC_TIMER\n");
 
30
                    break;
 
31
                case Ranks.PROC_RPC:
 
32
                    LM_INFO("We're at PROC_RPC/PROC_FIFO\n");
 
33
                    break;
 
34
                case Ranks.PROC_TCP_MAIN:
 
35
                    LM_INFO("We're at PROC_TCP_MAIN\n");
 
36
                    break;
 
37
                case Ranks.PROC_UNIXSOCK:
 
38
                    LM_INFO("We're at PROC_UNIXSOCK\n");
 
39
                    break;
 
40
                case Ranks.PROC_ATTENDANT:
 
41
                    LM_INFO("We're at PROC_ATTENDANT\n");
 
42
                    break;
 
43
                case Ranks.PROC_INIT:
 
44
                    LM_INFO("We're at PROC_INIT\n");
 
45
                    break;
 
46
                case Ranks.PROC_NOCHLDINIT:
 
47
                    LM_INFO("We're at PROC_NOCHLDINIT/PROC_MIN\n");
 
48
                    break;
 
49
                case Ranks.PROC_SIPINIT:
 
50
                    LM_INFO("We're at PROC_SIPINIT\n");
 
51
                    break;
 
52
                case Ranks.PROC_SIPRPC:
 
53
                    LM_INFO("We're at PROC_SIPRPC\n");
 
54
                    break;
 
55
            }
 
56
 
 
57
            return 1;
 
58
        }
 
59
 
 
60
        public int TestMethod()
 
61
        {
 
62
 
 
63
            LM_INFO(String.format("Msg Type: %s\n", SipMsg.getMsgType()));
 
64
 
 
65
            IPPair src = SipMsg.getSrcAddress();
 
66
            if (src != null)
 
67
            {
 
68
                LM_INFO(String.format("src address=%s, src port=%d\n", src.ip, src.port));
 
69
            }
 
70
            else
 
71
            {
 
72
                LM_ERR("IPPair src is null!");
 
73
            }
 
74
 
 
75
            IPPair dst = SipMsg.getDstAddress();
 
76
            if (dst != null)
 
77
            {
 
78
                LM_INFO(String.format("dst address=%s, dst port=%d\n", dst.ip, dst.port));
 
79
            }
 
80
            else
 
81
            {
 
82
                LM_ERR("IPPair dst is null!");
 
83
            }
 
84
 
 
85
            LM_INFO(String.format("buffer:\n%s\n", SipMsg.getBuffer().trim()));
 
86
 
 
87
            SipMsg msg = SipMsg.ParseSipMsg();
 
88
            if (msg != null)
 
89
            {
 
90
                LM_INFO("msg:\n");
 
91
                LM_INFO(String.format("\tid=%d\n", msg.id));
 
92
                LM_INFO(String.format("\tpid=%d\n", msg.pid));
 
93
                LM_INFO(String.format("\teoh='%s'\n", msg.eoh));
 
94
                LM_INFO(String.format("\tunparsed='%s'\n", msg.unparsed));
 
95
                LM_INFO(String.format("\tbuf='%s'\n", msg.buf));
 
96
                LM_INFO(String.format("\tlen=%d\n", msg.len));
 
97
                LM_INFO(String.format("\tnew_uri='%s'\n", msg.new_uri));
 
98
                LM_INFO(String.format("\tdst_uri='%s'\n", msg.dst_uri));
 
99
                LM_INFO(String.format("\tparsed_uri_ok=%d\n", msg.parsed_uri_ok));
 
100
                LM_INFO(String.format("\tparsed_orig_ruri_ok=%d\n", msg.parsed_orig_ruri_ok));
 
101
                LM_INFO(String.format("\tadd_to_branch_s='%s'\n", msg.add_to_branch_s));
 
102
                LM_INFO(String.format("\tadd_to_branch_len=%d\n", msg.add_to_branch_len));
 
103
                LM_INFO(String.format("\thash_index=%d\n", msg.hash_index));
 
104
                LM_INFO(String.format("\tmsg_flags=%d\n", msg.msg_flags));
 
105
                LM_INFO(String.format("\tset_global_address='%s'\n", msg.set_global_address));
 
106
                LM_INFO(String.format("\tset_global_port='%s'\n", msg.set_global_port));
 
107
            }
 
108
            else
 
109
            {
 
110
                LM_ERR("SipMsg msg is null!\n");
 
111
            }
 
112
 
 
113
            return 1;
 
114
        }
 
115
}
 
116
 
 
117
 
 
118
 
 
119
 
 
120
 
 
121
 
 
122
 
 
123
 
 
124
 
 
125
 
 
126
 
 
127
 
 
128
 
 
129
 
 
130