Installation

Version 5 (Adrian Georgescu, 12/18/2008 04:18 pm)

1 3 Adrian Georgescu
2 3 Adrian Georgescu
== Installation ==
3 3 Adrian Georgescu
4 1 Adrian Georgescu
You need to setup the following components:
5 1 Adrian Georgescu
6 1 Adrian Georgescu
 * OpenSIPS callcontrol module, version >=1.5
7 1 Adrian Georgescu
 * Call Control application (this project)
8 1 Adrian Georgescu
 * CDRTool rating engine, version >=6.7.0
9 1 Adrian Georgescu
10 1 Adrian Georgescu
=== OpenSIPS configuration ===
11 1 Adrian Georgescu
{{{
12 2 Adrian Georgescu
loadmodule "mi_fifo.so"
13 2 Adrian Georgescu
loadmodule "mi_datagram.so"
14 2 Adrian Georgescu
loadmodule "sl.so"
15 2 Adrian Georgescu
loadmodule "tm.so"
16 2 Adrian Georgescu
loadmodule "dialog.so"
17 1 Adrian Georgescu
loadmodule "call_control.so"
18 2 Adrian Georgescu
19 2 Adrian Georgescu
modparam("call_control", "disable", 0)
20 1 Adrian Georgescu
21 1 Adrian Georgescu
route {
22 1 Adrian Georgescu
...
23 1 Adrian Georgescu
    if ((method=="INVITE" && !has_totag())) {
24 4 Adrian Georgescu
        # you need to call this function at the first INVITE
25 1 Adrian Georgescu
        call_control();
26 1 Adrian Georgescu
        switch ($retcode) {
27 1 Adrian Georgescu
        case 2:
28 1 Adrian Georgescu
            # Call with no limit
29 1 Adrian Georgescu
        case 1:
30 1 Adrian Georgescu
            # Call with a limit under callcontrol management (either prepaid or postpaid)
31 1 Adrian Georgescu
            break;
32 1 Adrian Georgescu
        case -1:
33 1 Adrian Georgescu
            # Not enough credit (prepaid call)
34 1 Adrian Georgescu
            xlog("L_INFO", "Call control: not enough credit for prepaid call\n");
35 1 Adrian Georgescu
            acc_rad_request("402");
36 1 Adrian Georgescu
            sl_send_reply("402", "Not enough credit");
37 1 Adrian Georgescu
            exit;
38 1 Adrian Georgescu
            break;
39 1 Adrian Georgescu
        case -2:
40 1 Adrian Georgescu
            # Locked by call in progress (prepaid call)
41 1 Adrian Georgescu
            xlog("L_INFO", "Call control: prepaid call locked by another call in progress\n");
42 1 Adrian Georgescu
            acc_rad_request("403");
43 1 Adrian Georgescu
            sl_send_reply("403", "Call locked by another call in progress");
44 1 Adrian Georgescu
            exit;
45 1 Adrian Georgescu
            break;
46 1 Adrian Georgescu
        default:
47 1 Adrian Georgescu
            # Internal error (message parsing, communication, ...)
48 1 Adrian Georgescu
            xlog("L_INFO", "Call control: internal server error\n");
49 1 Adrian Georgescu
            acc_rad_request("500");
50 1 Adrian Georgescu
            sl_send_reply("500", "Internal server error");
51 1 Adrian Georgescu
            exit;
52 1 Adrian Georgescu
        }
53 1 Adrian Georgescu
    }
54 1 Adrian Georgescu
...
55 1 Adrian Georgescu
}
56 1 Adrian Georgescu
}}}
57 1 Adrian Georgescu
58 1 Adrian Georgescu
=== Call Control configuration ===
59 1 Adrian Georgescu
60 1 Adrian Georgescu
For all configuration options and their description see [source:config.ini.sample config.ini.sample]
61 1 Adrian Georgescu
62 1 Adrian Georgescu
{{{
63 1 Adrian Georgescu
[CallControl]
64 1 Adrian Georgescu
; how to detect sessions that have media timeout without BYE
65 1 Adrian Georgescu
timeout_detection=dialog
66 1 Adrian Georgescu
67 1 Adrian Georgescu
[CDRTool]
68 1 Adrian Georgescu
; connection to cdrtool rating engine for MaxSessionTime() and DebitBalance()
69 5 Adrian Georgescu
address = cdrtool.hostname
70 1 Adrian Georgescu
71 1 Adrian Georgescu
[OpenSIPS]
72 1 Adrian Georgescu
; connection to OpenSIPS call_control module
73 1 Adrian Georgescu
; socket_path = /var/run/opensips/socket
74 5 Adrian Georgescu
max_connections = 10
75 1 Adrian Georgescu
}}}
76 1 Adrian Georgescu
77 1 Adrian Georgescu
=== CDRTool rating engine configuration ===
78 1 Adrian Georgescu
79 1 Adrian Georgescu
{{{
80 1 Adrian Georgescu
$RatingEngine=array( "socketIP"           => "0",
81 1 Adrian Georgescu
                     "socketPort"         => "9024",
82 5 Adrian Georgescu
                     "cdr_source"         => "opensips_radius"
83 1 Adrian Georgescu
                     );
84 1 Adrian Georgescu
}}}
85 1 Adrian Georgescu
86 1 Adrian Georgescu
See the documentation of CDRTool project for how to setup the rating tables.
87 1 Adrian Georgescu
88 1 Adrian Georgescu
=== Prepaid engine API ===
89 1 Adrian Georgescu
90 1 Adrian Georgescu
http://download.ag-projects.com/CDRTool/doc/PREPAID.txt
91 1 Adrian Georgescu
92 1 Adrian Georgescu
Overview of ongoing sessions, generation of prepaid cards and prepaid       
93 1 Adrian Georgescu
accounts can be managed from CDRTool rating tables web interface.
94 1 Adrian Georgescu
95 4 Adrian Georgescu
=== Monitoring active sessions ===
96 1 Adrian Georgescu
{{{
97 1 Adrian Georgescu
/etc/init.d/callcontrol sessions
98 4 Adrian Georgescu
}}}
99 4 Adrian Georgescu
100 4 Adrian Georgescu
=== Display details about an active sessions ===
101 4 Adrian Georgescu
{{{
102 1 Adrian Georgescu
/etc/init.d/callcontrol session id
103 4 Adrian Georgescu
}}}
104 4 Adrian Georgescu
105 4 Adrian Georgescu
=== Terminating a session ===
106 4 Adrian Georgescu
{{{
107 1 Adrian Georgescu
/etc/init.d/callcontrol terminate id
108 1 Adrian Georgescu
}}}