Project

General

Profile

Osmo-sip-connector » History » Version 39

dexter, 02/06/2017 03:48 PM

1 1 msuraev
h1. Osmo-sip-connector
2
3 18 dexter
h2. Introduction
4
5 1 msuraev
osmo-sip-connector translates between MNCC and SIP protocols. It does not handle RTP by itself but with the help of external SIP server it can be used for tests.
6 2 msuraev
7
Sample configuration:
8
9
<pre>
10
app
11
mncc
12
  socket-path /tmp/bsc_mncc
13
sip
14
  local 10.9.10.105 5069
15
  remote 10.9.10.105 5060
16
</pre>
17
18
Running osmo-sip-connector:
19
<pre>
20
osmo-sip-connector -c ~/.config/osmocom/osmo-sip-connector.cfg
21
</pre>
22
23 3 msuraev
Running NITB:
24
<pre>
25
./src/osmo-nitb/osmo-nitb -c ~/.config/osmocom/open-bsc.cfg -l ~/.config/osmocom/hlr.sqlite3 -d DLMUX:DRTP -m
26
</pre>
27
28 4 msuraev
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.
29 2 msuraev
30 7 neels
*Note:* in attached kamailio.cfg, for 64bit systems, you may need to adjust
31
<pre>
32
mpath="/usr/lib/x86_64-linux-gnu/kamailio/modules/"
33
</pre>
34
35 2 msuraev
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
36 8 dexter
37
38 18 dexter
h2. Asterisk howto
39 8 dexter
40 20 dexter
This howto was created and tested using Debian 8.7.1. It is assumed that there is already a working installation of osmo-nitb already exists. In the following steps we will show how to integrate an existing installation with asterisk using osmo-sip-connector. The following image illustrates how the network components wile be laid out:
41 17 dexter
42 8 dexter
{{graphviz_link()
43
digraph G{
44 38 dexter
  rankdir = LR;
45 39 dexter
  MS -> BTS [label = "Um"];
46 13 dexter
  BTS -> "osmo-nitb" [label = "A.bis"];
47 33 dexter
  "osmo-nitb" -> "osmo-sip-connector" [label = "MNCC"];
48
  "osmo-sip-connector" -> "asterisk" [label = "SIP"];
49
  "BTS" -> "asterisk" [label = "RTP"];
50 8 dexter
}
51
}}
52 21 dexter
53
h3. Preparations
54
55 24 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.
56 23 dexter
57 28 dexter
* Install dependancies:
58 21 dexter
The extension we are about to make requires to install some additional packages.
59
<pre>
60
sudo apt-get install libsofia-sip-ua-glib-dev
61
sudo apt-get install asterisk
62 1 msuraev
</pre>
63 21 dexter
64 28 dexter
* Install osmo-sip-connector:
65 21 dexter
The installation of osmo-sip-connector is as straight forward as you know it already from other osmocom projects:
66
<pre>
67
git clone git://git.osmocom.org/osmo-sip-connector.git
68
cd osmo-sip-connector/
69
autoreconf -fi
70
./configure
71
make
72
sudo make install
73
</pre>
74 27 dexter
75
76 37 dexter
h3. Osmo-sip-connector configuration
77 27 dexter
78 28 dexter
* Osmo-nitb:
79 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”:
80
<pre>
81 1 msuraev
osmo-nitb -c ./openbsc.cfg -d option –debug=DRLL:DCC:DMM:DRR:DRSL:DNM -M /tmp/bsc_mncc
82
</pre>
83
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.
84 28 dexter
85
* osmo-sip-connector
86
Osmo-sip connector acts as a translator between the classic ISDN mncc and SIP. The configuration is rather simple.
87
<pre>
88
app
89
mncc
90
  socket-path /tmp/bsc_mncc
91
sip
92
  local 10.9.1.110 5069
93
  remote 10.9.1.110 5060
94
</pre>
95 30 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:
96 28 dexter
<pre>
97
osmo-sip-connector -c ./osmo-sip-connector.cfg
98
</pre>
99 1 msuraev
100 32 dexter
101 37 dexter
h3. Asterisk configuration
102 32 dexter
103 35 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.
104 32 dexter
105 36 dexter
* Set up the sip-trunk towards osmo-sip-connector:
106 32 dexter
The first that has to be taken care of is the connection to osmo-sip-connector. Two connections have to be created. One for outgoing and one for incoming calls. The following lines need be appended to sip.conf:
107
<pre>
108
[GSM]
109
type=friend
110
host=10.9.1.110
111
dtmfmode=rfc2833
112
canreinvite=no
113
disallow=all
114
allow=gsm
115
context=gsmsubscriber
116
port=5069
117
</pre>
118
The connection are named GSM, as we will reference to this connection later it is recommended to keep the name short. The context name “gsmsubscriber” references the context where mobile originated calls are routed into the dialplan.
119 34 dexter
120
121 36 dexter
* Set up a dialplan to route calls:
122 34 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:
123
<pre>
124
[gsmsubscriber]
125
exten=>_XXXXX,1,Dial(SIP/GSM/${EXTEN})
126
exten=>_XXXXX,n,Playback(vm-nobodyavail)
127
exten=>_XXXXX,n,HangUp
128
</pre>
129
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 and if so, just dial it through the “GSM” connection. This causes the call to be routet 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.
Add picture from clipboard (Maximum size: 48.8 MB)