Asterisk, DAHDI and TDMoE

A few years ago, I read this wiki page at voip-info.org, where I was informed of this nifty thing called TDMoE. TDMoE is TDM over Ethernet. This nifty DAHDI driver (dahdi_dynamic_eth), provides any dahdi signalling via Ethernet. So if you need to have PRI signalling between two asterisk servers in the same room. Look no further! Instead of buying expensive T1/E1 cards, to be able to talk PRI, you can just use your ethernet cards. TDMoE uses your network interface card to talk to the other asterisk box. To do this, both machines needs to know eachothers MAC addresses. Why? Because TDMoE uses it’s own ethernet type. Packets between the boxes goes through the ethernet via ethernet type 0xd00d. Inside the ethernet frame, lies a dahdi_dynamic packet, which in turn has the packet/frame from your chosen signalling standard.

But beware. You should have DAHDI compatible hardware in at least one of the asterisk boxes. This is because of timing, so you can use the timing from that card, to time the TDMoE. TDM packets needs to be sent every 1ms at a very stable rate. A normal computer without extra hardware cannot acheive 100% the correct timing requirements of DAHDI signalling protocols on it’s own. The kernel module dahdi_dummy (former ztdummy) can give you a signal close to ~99.4%(my results, testing with dahdi_test -v) of what the timing should be.

In my testing results, TDMoE works nice with dahdi_dummy, but I am unsure if this is stable over time. So better have some DAHDI hardware somewhere.

Before we start, I need to say that, by no means think that I am an expert at DAHDI or TDMoE, or that everything I write here is correct. I take no responsibility of what you do with the information on this post, or the correctness of the information here. If you see something that is plain wrong, please inform me, and I’ll update the post :)

So suddenly I came to the point where something like TDMoE would be very nice to have, and it worked like a charm. But on the ‘tutorials’ out there, almost all of them use the ’em’ signalling. So I thought I could write a bit of what you need to do, and what I did to get PRI signalling to work over ethernet with dahdi_dummy as timing source. So, to set up this, you first need to compile and install libpri, dahdi-kernel, and dahdi-tools on both machines. And then recompile asterisk, so they get dahdi and pri support.

After I did this, in my box with dahdi_dummy loaded I edited /etc/dahdi/system.conf and added the following:

dynamic=eth,eth1/00:00:01:00:00:00/0,31,0
echocanceller=mg2,1-15,17-31
bchan=1-15,17-31
dchan=16
alaw=1-15,17-31

Where 00:00:01:00:00:00 is replaced by the MAC address of the other server, and eth1 reflects the network interface I’d like to use for this. Then in /etc/asterisk/chan_dahdi.conf, I added the following:

[channels]
context=default
usecallerid=yes
hidecallerid=no
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
facilityenable=yes
canpark=yes
cancallforward=yes
callreturn=yes
echocancel=yes
echocancelwhenbridged=yes
relaxdtmf=yes
immediate=no
 
switchtype=euroisdn
context=inbound
group=0
echocancel=yes
signalling=pri_net
channel =>1-15,17-31

Here you see I set the signalling type to ‘pri_net’, which means that this will be the network side of the pri signalling. Let’s call this the pri_net server. Then i configured dahdi by modprobing dahdi, modprobing dahdi_dummy, and running dahdi_cfg -vvv

If everything worked well, you should also be able to do dahdi_test -v, and see the precision to be close to 100%. You can now configure the other server. In /etc/dahdi/system.conf on this server, I had the same setup as the pri_net server, but here you put the MAC address of the pri_net server. So they point to eachother.

dynamic=eth,eth0/00:00:01:00:00:01/0,31,1
echocanceller=mg2,1-15,17-31
bchan=1-15,17-31
dchan=16
alaw=1-15,17-31

Remember to change the MAC adress.

Then in /etc/asterisk/chan_dahdi.conf on this server, I had:

[channels]
context=default
usecallerid=yes
hidecallerid=no
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
facilityenable=yes
canpark=yes
cancallforward=yes
callreturn=yes
echocancel=yes
echocancelwhenbridged=yes
relaxdtmf=yes
immediate=no
 
switchtype=euroisdn
context=inbound
group=0
echocancel=yes
signalling=pri_cpe
channel =>1-15,17-31

Now here I set signalling to be pri_cpe, which means the customer side of the PRI line.

Now all you need to do is to modprobe dahdi, run dahdi_cfg -vv and hope for the best, and start asterisk.

If you type dahdi show status in asterisk, you should se a “OK” in the Alarms section, on your span. If you see RED, they don’t see eachother. Or if it’s Yellow, i think you have link, but the timing is not correct.

If you have problems with timing, you can check tcpdump -i eth0 ether proto 0xd00d, and you should see a buckload of packets flowing in. Also try to use the dahdi_test tool on both machines to compare timing. the pri_cpe machine will get the timing over ethernet, so it may be a bit off, if your network is not perfect.

I can now successfully make calls with DAHDI/g0/number with callerid etc. working spotless. :) Hope you can too!

[Update Jun 29, 2010: I’ve uploaded a TDMoE dissector patch for Wireshark]

Posted February 3rd, 2010 in asterisk, work.

6 comments:

  1. Eugene Blanchard:

    Does the network card have to be dedicated to TDMoE or can it be used in conjunction with normal network traffic?

  2. doug W:

    can you ues a channel bank to talk TDMoE to an asterisk server

  3. Håkon Nessjøen:

    It can be used in conjunction with normal network traffic, but I think you should try to avoid it. I either connect two servers directly for TDMoE, or use a dedicated network for that kind of traffic. This way you won’t have problems if the network is clogged.

  4. Håkon Nessjøen:

    There is products out there that does this yes. A quick search on google gave me products like “JetMux” or “SpiderMux”.

  5. jako:

    Is it possible to use TDMoE over ADSL? The switch I need to connect to use ss7.

  6. Håkon Nessjøen:

    I would not think so. I don’t think TDMoE should go over anything other than local ethernet, with just a switch in between. The latency you get over ADSL would probably add too much latency on the signalling. If you need to do SS7 over a distance, you should look into SIP-T or SIP-I i think.

Leave a response: