Project

General

Profile

Osmo-sip-connector » History » Version 65

dexter, 02/20/2017 02:22 PM

1 1 msuraev
h1. Osmo-sip-connector
2
3 63 dexter
{{>toc}}
4
5 18 dexter
h2. Introduction
6
7 64 dexter
osmo-sip-connector translates between MNCC and SIP protocols and hereby replaces the old LCR based approach. Osmo-sip-connector does not handle RTP by itself, an external SIP-PBX server which can accept SIP-Trunks is still required. The following image illustrates how the network components are laid out:
8 1 msuraev
9 64 dexter
{{graphviz_link()
10
digraph G{
11
  rankdir = LR;
12
  MS -> BTS [label = "Um"];
13
  BTS -> "osmo-nitb" [label = "Abis"];
14
  "osmo-nitb" -> "osmo-sip-connector" [label = "MNCC"];
15
  "osmo-sip-connector" -> "Asterisk" [label = "SIP"];
16
  "BTS" -> "SIP-PBX (e.g. Asterisk)" [label = "RTP"];
17
}
18
}}
19
20
21
22
23 2 msuraev
Sample configuration:
24
25
<pre>
26
app
27
mncc
28
  socket-path /tmp/bsc_mncc
29
sip
30
  local 10.9.10.105 5069
31
  remote 10.9.10.105 5060
32
</pre>
33
34
Running osmo-sip-connector:
35
<pre>
36
osmo-sip-connector -c ~/.config/osmocom/osmo-sip-connector.cfg
37
</pre>
38
39 3 msuraev
Running NITB:
40
<pre>
41 18 dexter
./src/osmo-nitb/osmo-nitb -c ~/.config/osmocom/open-bsc.cfg -l ~/.config/osmocom/hlr.sqlite3 -d DLMUX:DRTP -m
42 1 msuraev
</pre>
43 8 dexter
44 57 dexter
The configuration above assumes that SIP server is running on the same machine. Attached is example configuration file for Kamailio https://www.kamailio.org SIP server which can be used to route calls between mobile phones. It also handles 2 special numbers 500 (routed to sip:music@iptel.org) and 600 (routed to sip:echo@iptel.org): by dialing them you can use echo test or hear nice music from your mobile.
45 17 dexter
46 8 dexter
*Note:* in attached kamailio.cfg, for 64bit systems, you may need to adjust
47
<pre>
48 38 dexter
mpath="/usr/lib/x86_64-linux-gnu/kamailio/modules/"
49 39 dexter
</pre>
50 60 dexter
51 33 dexter
N. B: Those numbers are meant only as an example for quick tests - please consider running your own Asterisk instance if you expect more than couple of calls, do not abuse http://www.iptel.org/service
52 59 dexter
53 58 dexter
54 65 dexter
h2. Howto
55 8 dexter
56 64 dexter
This howto was created and tested using Debian 8.7.1. It is assumed, that a working installation of osmo-nitb already exists. In the following steps we will show how to integrate that existing installation with Asterisk using osmo-sip-connector.
57 46 dexter
Note: All configuration files discussed below can also be found in: testnet_with_osmo-sip-connector.tar.gz
58 41 dexter
59 21 dexter
h3. Preparations
60
61 57 dexter
As we assume that we use an existing and working osmo-nitb configuration as a starting point most of the relevant dependencies are already installed. However, we still miss osmo-sip-connector and Asterisk as a major components.
62 23 dexter
63 28 dexter
* Install dependancies:
64 21 dexter
The extension we are about to make requires to install some additional packages.
65
<pre>
66
sudo apt-get install libsofia-sip-ua-glib-dev
67
sudo apt-get install asterisk
68 1 msuraev
</pre>
69 21 dexter
70 28 dexter
* Install osmo-sip-connector:
71 21 dexter
The installation of osmo-sip-connector is as straight forward as you know it already from other osmocom projects:
72
<pre>
73
git clone git://git.osmocom.org/osmo-sip-connector.git
74
cd osmo-sip-connector/
75
autoreconf -fi
76
./configure
77
make
78
sudo make install
79
</pre>
80 27 dexter
81
82 37 dexter
h3. Osmo-sip-connector configuration
83 1 msuraev
84 57 dexter
In this section we illustrate how equip osmo-nitb with a SIP-trunk interface using osmo-sip-connector. The steps are not necessarly Asterisk dependant, the result would work with any PBX software that supports sip-trunk connections.
85 40 dexter
86 28 dexter
* Osmo-nitb:
87 27 dexter
Osmo-nitb does not require any change of of its configuration. The connection between osmo-sip-connector is configured using the command line option “-M”:
88
<pre>
89 1 msuraev
osmo-nitb -c ./openbsc.cfg -d option –debug=DRLL:DCC:DMM:DRR:DRSL:DNM -M /tmp/bsc_mncc
90
</pre>
91
The “-M” option disables the internal call control handler of osmo-nitb and offers an unix domain socket, where an external call control handler can be connected. In the described situation this will be osmo-sip-connector.
92 28 dexter
93 50 dexter
* osmo-sip-connector:
94 61 dexter
Osmo-sip connector acts as a translator between the classic ISDN call control (mncc) and SIP. The configuration is rather simple.
95 28 dexter
<pre>
96
app
97
mncc
98
  socket-path /tmp/bsc_mncc
99
sip
100
  local 10.9.1.110 5069
101
  remote 10.9.1.110 5060
102
</pre>
103 57 dexter
Again, we have to setup a socket path. This path has to be the same as we provided with the commandline option “-M” for osmo-nitb earlier. For SIP we need to setup a remote and local IP-Address and port. In most cases, Asterisk and osmo-sip-connector will run on one and the same machine, so it is ovious that local and remote IP-Address are the same. The type of connection between osmo-sip-connector and Asterisk is a classic SIP-Trunk. For Asterisk it appears as just another PBX. Osmo-sip-connector is started via commandline as follows:
104 28 dexter
<pre>
105
osmo-sip-connector -c ./osmo-sip-connector.cfg
106
</pre>
107 1 msuraev
108 32 dexter
109 37 dexter
h3. Asterisk configuration
110 32 dexter
111 57 dexter
The following section will discuss a minimal Asterisk configuration that is able to route calls between mobile phones. The described case assumes a freshly installed Asterisk with virgin configuration files. In the following we will edit extensions.conf and sip.conf which can be found in the /etc/asterisk directory. The example below is not special to GSM, its rather a normal SIP-trunk configuration.
112 32 dexter
113 36 dexter
* Set up the sip-trunk towards osmo-sip-connector:
114 51 dexter
The first that has to be taken care of is the connection to osmo-sip-connector. The following lines need be appended to sip.conf:
115 32 dexter
<pre>
116
[GSM]
117
type=friend
118
host=10.9.1.110
119
dtmfmode=rfc2833
120
canreinvite=no
121
disallow=all
122
allow=gsm
123
context=gsmsubscriber
124
port=5069
125
</pre>
126 53 dexter
The connection is named GSM, this name will be used later to reference the connection when routing outgoing calls. The context name “gsmsubscriber” references the context where mobile originated calls are routed into the dialplan.
127 34 dexter
128
129 36 dexter
* Set up a dialplan to route calls:
130 57 dexter
Now Asterisk and osmo-sip-connector are connected. The following example introduces a very basic dialplan configuration to route calls between mobile phones. The following example can be added to extensions.conf:
131 34 dexter
<pre>
132
[gsmsubscriber]
133
exten=>_XXXXX,1,Dial(SIP/GSM/${EXTEN})
134
exten=>_XXXXX,n,Playback(vm-nobodyavail)
135
exten=>_XXXXX,n,HangUp
136
</pre>
137 57 dexter
The name in “[]” is the context name which we already defined in sip.conf (“gsmsubscriber”). Every incoming call, that is entering through the “GSM” connection is directly routet to “[gsmsubscriber]”. The following three lines will check if the dialed number is exactly 5 digits long. When the check passes Asterisk dials that number through the “GSM” connection. This causes the call to be routed back through the “GSM” connection back to osmo-nitb. If the subscriber is not available, the call will fail and alternatively a voice message “vm-nobodyavail” will be played. Finally the call is hung up.
138 62 dexter
139 1 msuraev
Note: In this example configuration security considerations are left out. It is up to the user to make sure that the SIP-Trunk interface is not reachable for unauthorized users. 
140 65 dexter
141
142
h3. Use Kamilo as alternative to Asterisk
Add picture from clipboard (Maximum size: 48.8 MB)