9
Tie your Trixboxes together with the use of DUNDi By Tijmen van den Brink 10XX TrixBox1 TrixBox3 TrixBox2 IP: 192.168.1.10 IP: 192.168.1.16 IP: 192.168.1.22 I A X IA X IAX 16XX 13XX DUNDi Cloud

Using DUNDi With Trixbox

  • Upload
    toxinik

  • View
    289

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Using DUNDi With Trixbox

Tie your Trixboxes together with the use of DUNDi

By Tijmen van den Brink

10XX

TrixBox1

TrixBox3TrixBox2

IP: 192.168.1.10IP: 192.168.1.16

IP: 192.168.1.22

IAX IAX

IAX

16XX

13XX

DUNDi Cloud

Page 2: Using DUNDi With Trixbox

Index 1 Introduction....................................................................................................................3

2 Trixbox 1........................................................................................................................3

2.1 dundi.conf ..............................................................................................................4 2.2 extensions_custom.conf ..........................................................................................4

2.3 iax_custom.conf......................................................................................................5 3 Trixbox 2........................................................................................................................5

3.1 dundi.conf ..............................................................................................................5

3.2 extensions_custom.conf ..........................................................................................6 3.3 iax_custom.conf......................................................................................................6

4 Trixbox 3........................................................................................................................6 4.1 dundi.conf ..............................................................................................................6

4.2 extensions_custom.conf ..........................................................................................7

4.3 iax_custom.conf......................................................................................................8 5 Generating Keys .............................................................................................................8

6 Troubleshooting..............................................................................................................8

Page 3: Using DUNDi With Trixbox

1 Introduction After a few well written documents I was still not able to do the magic I wanted. Mostly because

I was working with TrixBox and had to figure out how things were done inside the box… For everyone who likes the ease of the use of trixbox and want to tie a few boxes together I

made this mini HOWTO. It’s not perfect and there are still a few things I just don’t know (e.g.

IAX authentication) but I got it working and wanted to share it with you.

This is what I was trying to realize:

There are 3 TrixBoxes with a few local extensions registered to them. 13XX for TrixBox1, 16XX

for TrixBox2 etc….

What I am trying to achieve is that an extension say 1301 can call an extension 1601 that is registered to another Trixbox. I read about DUNDi and thought this was the most elegant way to

accomplish this.

10XX

TrixBox1

TrixBox3TrixBox2

IP: 192.168.1.10IP: 192.168.1.16

IP: 192.168.1.22

IAX IAX

IAX

16XX

13XX

DUNDi Cloud

2 Trixbox 1 Make sure you have these lines in the following files. I was working with a clean install of Trixbox so this just can’t go wrong….

Page 4: Using DUNDi With Trixbox

2.1 dundi.conf

[general]

port=4520

entityid=00:0C:29:0C:AB:C2 ; This is the mac address of eth0

cachetime=5

ttl=32

autokill=yes

[mappings]

priv => dundi-priv-local-

custom,0,IAX2,priv:[email protected]/${NUMBER},nounsolicited,nocomunsolicit,nopartial

[00:0C:29:30:77:FA] ; MAC address of TrixBox2 eth0

model = symmetric

host = 192.168.1.16

inkey = dundi

outkey = dundi

include = priv

permit = priv

qualify = yes

dynamic=yes

[00:50:BF:A6:C3:C4] ; MAC address of TrixBox3 eth0

model = symmetric

host = 192.168.1.10

inkey = dundi

outkey = dundi

include = priv

permit = priv

qualify = yes

dynamic=yes

2.2 extensions_custom.conf

#include extensions_trixbox.conf

#include extensions_hud.conf

[macro-dundi-lookup-custom]

; Goto the extension number. Check the local context first, followed by lookup

; dundi-priv-lookup is a pointer to the switch statement which will look for

; extensions on other machines. This allows the convergence of multiple

; Asterisk servers with different extension number blocks. Very cool!

;

exten => s,1,Goto(${ARG1},1)

include => dundi-priv-local-custom

include => dundi-priv-lookup-custom

[dundi-pstn-local-custom]

[dundi-priv-local-custom]

; we only have extensions 1300 -> 1399 locally

exten => _13XX,1,Macro(dial,${EXTEN})

[dundi-priv-lookup-custom]

; Check our private peers for the exten #. Search 'priv' dundi context

switch => DUNDi/priv

[dundi-priv-incoming-custom]

; when we get an incoming call from a private peer, it gets directed here

include => dundi-priv-local-custom

;------------------------------------------------------------------------------

Page 5: Using DUNDi With Trixbox

; Outgoing Calls Contexts

;------------------------------------------------------------------------------

[local-custom]

; For extensions starting with 1000 -> 1099 and 1600 -> 1699 do a dundi-lookup (private

extens)

exten => _1[06]XX,1,Macro(dundi-lookup-custom,${EXTEN})

[from-internal-custom]

include => local-custom

include => from-internal-trixbox

2.3 iax_custom.conf

[priv]

type=user

context=from-internal

disallow=all

allow=ulaw

allow=alaw

allow=gsm

3 Trixbox 2

3.1 dundi.conf

[general]

port=4520

entityid=00:0C:29:30:77:FA ; MAC address of TrixBox2 eth0

cachetime=5

ttl=32

autokill=yes

[mappings]

priv => dundi-priv-local-

custom,0,IAX2,priv:[email protected]/${NUMBER},nounsolicited,nocomunsolicit,nopartial

[00:0C:29:0C:AB:C2] ; MAC address of TrixBox1 eth0

model = symmetric

host = 192.168.1.22

inkey = dundi

outkey = dundi

include = priv

permit = priv

qualify = yes

dynamic=yes

[00:50:BF:A6:C3:C4] ; MAC address of TrixBox3 eth0

model = symmetric

host = 192.168.1.10

inkey = dundi

outkey = dundi

include = priv

permit = priv

qualify = yes

dynamic=yes

Page 6: Using DUNDi With Trixbox

3.2 extensions_custom.conf #include extensions_trixbox.conf

#include extensions_hud.conf

[macro-dundi-lookup-custom]

; Goto the extension number. Check the local context first, followed by lookup

; dundi-priv-lookup is a pointer to the switch statement which will look for

; extensions on other machines. This allows the convergence of multiple

; Asterisk servers with different extension number blocks. Very cool!

;

exten => s,1,Goto(${ARG1},1)

include => dundi-priv-local-custom

include => dundi-priv-lookup-custom

[dundi-pstn-local-custom]

[dundi-priv-local-custom]

; we only have extensions 1600 -> 1699 locally

exten => _16XX,1,Macro(dial,${EXTEN})

[dundi-priv-lookup-custom]

; Check our private peers for the exten #. Search 'priv' dundi context

switch => DUNDi/priv

[dundi-priv-incoming-custom]

; when we get an incoming call from a private peer, it gets directed here

include => dundi-priv-local-custom

;------------------------------------------------------------------------------

; Outgoing Calls Contexts

;------------------------------------------------------------------------------

[local-custom]

; For extensions starting with 1000 -> 1099 and 1300 -> 1399 do a dundi-lookup (private

extens)

exten => _1[03]XX,1,Macro(dundi-lookup-custom,${EXTEN})

[from-internal-custom]

include => local-custom

include => from-internal-trixbox

3.3 iax_custom.conf

[priv]

type=user

context=from-internal

disallow=all

allow=ulaw

allow=alaw

allow=gsm

4 Trixbox 3

4.1 dundi.conf

[general]

port=4520

entityid=00:50:BF:A6:C3:C4 ; MAC address of TrixBox3 eth0

cachetime=5

ttl=32

autokill=yes

Page 7: Using DUNDi With Trixbox

[mappings]

priv => dundi-priv-local-

custom,0,IAX2,priv:[email protected]/${NUMBER},nounsolicited,nocomunsolicit,nopartial

[00:0C:29:0C:AB:C2] ; MAC address of TrixBox1 eth0

model = symmetric

host = 192.168.1.22

inkey = dundi

outkey = dundi

include = priv

permit = priv

qualify = yes

dynamic=yes

[00:0C:29:30:77:FA] ; MAC address of TrixBox2 eth0

model = symmetric

host = 192.168.1.16

inkey = dundi

outkey = dundi

include = priv

permit = priv

qualify = yes

dynamic=yes

4.2 extensions_custom.conf

#include extensions_trixbox.conf

#include extensions_hud.conf

[macro-dundi-lookup-custom]

; Goto the extension number. Check the local context first, followed by lookup

; dundi-priv-lookup is a pointer to the switch statement which will look for

; extensions on other machines. This allows the convergence of multiple

; Asterisk servers with different extension number blocks. Very cool!

;

exten => s,1,Goto(${ARG1},1)

include => dundi-priv-local-custom

include => dundi-priv-lookup-custom

[dundi-pstn-local-custom]

[dundi-priv-local-custom]

; we only have extensions 1000 -> 1099 locally

exten => _10XX,1,Macro(dial,${EXTEN})

[dundi-priv-lookup-custom]

; Check our private peers for the exten #. Search 'priv' dundi context

switch => DUNDi/priv

[dundi-priv-incoming-custom]

; when we get an incoming call from a private peer, it gets directed here

include => dundi-priv-local-custom

;------------------------------------------------------------------------------

; Outgoing Calls Contexts

;------------------------------------------------------------------------------

[local-custom]

; For extensions starting with 1300 -> 1399 and 1600 -> 1699 do a dundi-lookup (private

extens)

exten => _1[36]XX,1,Macro(dundi-lookup-custom,${EXTEN})

[from-internal-custom]

include => local-custom

include => from-internal-trixbox

Page 8: Using DUNDi With Trixbox

4.3 iax_custom.conf

[priv]

type=user

context=from-internal

disallow=all

allow=ulaw

allow=alaw

allow=gsm

5 Generating Keys On one of the boxes generate the keys and distribute them among the trixboxes.

# cd /var/lib/asterisk/keys

# astgenkey –n dundi

dundi.key and dundi.pub are now generated and need to be copied to the other two Trixboxes. I

know this is not the most secure way but hey it’s just me playing at home ;)

After creating the keys you must reload the res_crypto.so and pbx_dundi.so modules.

trixbox1*CLI> reload res_crypto.so

trixbox1*CLI> reload pbx_dundi.so

That’s it! You should now be able to call all the extensions you “advertised”. Any comments on this document are welcome even appreciated and can be posted on the Trixbox forum.

6 Troubleshooting I did quite some troubleshooting and these commands came in handy:

trixbox1*CLI> dundi show peers

EID Host Model AvgTime Status 00:50:bf:a6:c3:c4 192.168.1.10 (S) Symmetric Unavail OK (1 ms)

00:0c:29:30:77:fa 192.168.1.16 (S) Symmetric Unavail OK (1 ms) 2 dundi peers [2 online, 0 offline, 0 unmonitored]

trixbox1*CLI> dundi lookup 1601@priv

1. 0 IAX2/priv:[email protected]/1601 (EXISTS|NOUNSLCTD|NOCOMUNSLTD) from 00:0c:29:30:77:fa, expires in 5 s

DUNDi lookup completed in 35 ms

Note that a DUNDi lookup for a local extensions doesn’t return anything.

trixbox1*CLI> dundi debug

trixbox1*CLI> iax2 debug

This is where I noticed that something went wrong with the IAX authentication so I totally

dropped the authentication issue and went on.

Page 9: Using DUNDi With Trixbox

7 Thanks to

Leif Madsen who wrote a document on DUNDi that was very helpful to me. You can

find his document on http://leifmadsen.com

Also thanks to J R Richardson who wrote “Using DUNDi with a cluster of Asterisk

Servers” You can find this document on http://www.voip-magazine.com