Project

General

Profile

Howto » History » Version 2

laforge, 05/11/2018 11:30 AM
move howto from main page

1 1 laforge
h2. Howto
2
3
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.
4
5
Note: All configuration files discussed below can also be found in the attachement section
6
7
h3. Preparations
8
9
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.
10
11
* Install dependancies:
12
The extension we are about to make requires to install some additional packages.
13
<pre>
14
sudo apt-get install libsofia-sip-ua-glib-dev
15
sudo apt-get install asterisk
16
</pre>
17
18
* Install osmo-sip-connector:
19
The installation of osmo-sip-connector is as straight forward as you know it already from other osmocom projects:
20
<pre>
21
git clone git://git.osmocom.org/osmo-sip-connector.git
22
cd osmo-sip-connector/
23
autoreconf -fi
24
./configure
25
make
26
sudo make install
27
</pre>
28
29
30
h3. Osmo-sip-connector configuration
31
32
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.
33
34
* Osmo-nitb:
35
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”:
36
<pre>
37
osmo-nitb -c ./openbsc.cfg -d option –debug=DRLL:DCC:DMM:DRR:DRSL:DNM -M /tmp/bsc_mncc
38
</pre>
39
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.
40
41
* osmo-sip-connector:
42
Osmo-sip connector acts as a translator between the classic ISDN call control (mncc) and SIP. The configuration is rather simple.
43
<pre>
44
app
45
mncc
46
  socket-path /tmp/bsc_mncc
47
sip
48
  local 10.9.1.110 5069
49
  remote 10.9.1.110 5060
50
</pre>
51
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:
52
<pre>
53
osmo-sip-connector -c ./osmo-sip-connector.cfg
54
</pre>
55
56
57
h3. Asterisk configuration
58
59
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.
60
61
* Set up the sip-trunk towards osmo-sip-connector:
62
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:
63
<pre>
64
[GSM]
65
type=friend
66
host=10.9.1.110
67
dtmfmode=rfc2833
68
canreinvite=no
69
disallow=all
70
allow=gsm
71
context=gsmsubscriber
72
port=5069
73
</pre>
74
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.
75
76
77
* Set up a dialplan to route calls:
78
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:
79
<pre>
80
[gsmsubscriber]
81
exten=>_XXXXX,1,Dial(SIP/GSM/${EXTEN})
82
exten=>_XXXXX,n,Playback(vm-nobodyavail)
83
exten=>_XXXXX,n,HangUp
84
</pre>
85
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.
86
87
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. 
88
89
90
h3. Use Kamailio as an alternative to Asterisk
91
92
As already mentioned above it is also possible to use other SIP-PBX server than Astersik. One popular example is Kamailio. The attached kamailio.cfg matches the osmo-sip-connector configuration and conditions discussed above.
93
94
The configuration implements a 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.
95
96
*Note:* in attached kamailio.cfg, for 64bit systems, you may need to adjust
97
<pre>
98
mpath="/usr/lib/x86_64-linux-gnu/kamailio/modules/"
99
</pre>
100
101
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
102
103
See also https://www.kamailio.org
104 2 laforge
105
h2. Attachments
Add picture from clipboard (Maximum size: 48.8 MB)