Zap Trunk Help: Dahdi + AEX800 + Ubuntu

Hello,
This is my first post on this forum.
To start I would like to say that I have done a ton of googling and am so lost now that I need to ask for help.

So far this is what i have done:

  • Installed: DAHDI
  • Ran: sudo /etc/init.d/dahdi start
  • Ran: sudo dahdi_genconf
  • Edited: /etc/dahdi/system.conf and added my country info.
  • Added include /etc/asterisk/dahdi-channels.conf to /etc/asterisk/chan_dahdi.conf
  • Ran: sudo /etc/init.d/dahdi restart
  • Ran: sudo dahdi_tool
  • Ran: sudo ln -s /etc/asterisk/dahdi-channels.conf /etc/asterisk/zapata.conf

Dahdi_tool shows both of my AEX800 cards.
I have one with dual FXO and the other Half and Half.
/etc/asterisk/dahdi-channels.conf shows all 12 of my fxo channels and all 4 of my fxs channels.

I’m not sure if the symbolic link to zapata.conf is needed. I added that in desperation because FreePBX said that it is referencing zapata.conf.
I found a walk through here: http://wiki.contribs.org/FreePBX/DAHDI

Nothing seems to be working.

I have a SipStation sip trunk and I can make calls all day long on that.
I have added the zap trunk.
I tried with just using channel 1 and with g0.
I tried with all different types of dial rules.

I created an outbound route with a dial pattern of 9|.
Trunk 0 is set to ZAP/1 or ZAP/g0 depending on weather I have the channel set to 1 or g0.

I can’t get this system to make a call on an analog line.

I’m going to spam the rest of this with config files and output from asterisk CLI.

Please help,
Cody

Here is my /etc/dahdi/system.conf

Span 1: WCTDM/0 “Wildcard AEX800 Board 1” (MASTER)

fxsks=1
echocanceller=mg2,1
fxsks=2
echocanceller=mg2,2
fxsks=3
echocanceller=mg2,3
fxsks=4
echocanceller=mg2,4
fxsks=5
echocanceller=mg2,5
fxsks=6
echocanceller=mg2,6
fxsks=7
echocanceller=mg2,7
fxsks=8
echocanceller=mg2,8

Span 2: WCTDM/1 “Wildcard AEX800 Board 2”

fxsks=9
echocanceller=mg2,9
fxsks=10
echocanceller=mg2,10
fxsks=11
echocanceller=mg2,11
fxsks=12
echocanceller=mg2,12
fxoks=13
echocanceller=mg2,13
fxoks=14
echocanceller=mg2,14
fxoks=15
echocanceller=mg2,15
fxoks=16
echocanceller=mg2,16

Global data

loadzone = us
defaultzone = us

Here is the first entry in /etc/asterisk/dahdi-channels.conf

; Span 1: WCTDM/0 “Wildcard AEX800 Board 1” (MASTER)
;;; line="1 WCTDM/0/0 FXSKS (SWEC: MG2)"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 1
callerid=
group=
context=default

This is the output from asterisk -vvvvvr

– <SIP/350-00000016>AGI Script fixlocalprefix completed, returning 0
– Executing [[email protected]:13] Set(“SIP/350-00000016”, “OUTNUM=15553217654”) in new stack
– Executing [[email protected]:14] Set(“SIP/350-00000016”, “custom=ZAP/g0”) in new stack
– Executing [[email protected]:15] ExecIf(“SIP/350-00000016”, “0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^))”) in new stack
– Executing [[email protected]:16] Macro(“SIP/350-00000016”, “dialout-trunk-predial-hook,”) in new stack
– Executing [[email protected]:1] MacroExit(“SIP/350-00000016”, “”) in new stack
– Executing [[email protected]:17] GotoIf(“SIP/350-00000016”, “0?bypass,1”) in new stack
– Executing [[email protected]:18] GotoIf(“SIP/350-00000016”, “0?customtrunk”) in new stack
– Executing [[email protected]:19] Dial(“SIP/350-00000016”, “ZAP/g0/15553217654,300,”) in new stack
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [[email protected]:20] NoOp(“SIP/350-00000016”, “Dial failed for some reason with DIALSTATUS = CHANUNAVAIL and HANGUPCAUSE = 66”) in new stack
– Executing [[email protected]:21] Goto(“SIP/350-00000016”, “s-CHANUNAVAIL,1”) in new stack
– Goto (macro-dialout-trunk,s-CHANUNAVAIL,1)
– Executing [[email protected]:1] Set(“SIP/350-00000016”, “RC=66”) in new stack
– Executing [[email protected]:2] Goto(“SIP/350-00000016”, “66,1”) in new stack
– Goto (macro-dialout-trunk,66,1)
– Executing [[email protected]:1] Goto(“SIP/350-00000016”, “continue,1”) in new stack
– Goto (macro-dialout-trunk,continue,1)
– Executing [[email protected]:1] GotoIf(“SIP/350-00000016”, “1?noreport”) in new stack
– Goto (macro-dialout-trunk,continue,3)
– Executing [[email protected]:3] NoOp(“SIP/350-00000016”, “TRUNK Dial failed due to CHANUNAVAIL HANGUPCAUSE: 66 - failing through to other trunks”) in new stack
– Executing [co[email protected]:4] Set(“SIP/350-00000016”, “CALLERID(number)=350”) in new stack
– Executing [[email protected]:5] Macro(“SIP/350-00000016”, “outisbusy,”) in new stack
– Executing [[email protected]:1] Progress(“SIP/350-00000016”, “”) in new stack
– Executing [[email protected]:2] Playback(“SIP/350-00000016”, “all-circuits-busy-now,noanswer”) in new stack
– <SIP/350-00000016> Playing ‘all-circuits-busy-now.gsm’ (language ‘en’)
– Executing [[email protected]:3] Playback(“SIP/350-00000016”, “pls-try-call-later,noanswer”) in new stack
– <SIP/350-00000016> Playing ‘pls-try-call-later.gsm’ (language ‘en’)

Congratulations on getting this far!

I recommend that you install a stable distribution of Asterisk such as AsteriskNow or PBX in a Flash rather than re-invent the wheel. It will save you many hours of frustration as you are finding out.

From your configs, ch 1-12 are FXO ports to connect to the PSTN and 13-16 are FXS ports to connect to POTS phones.

Some things to check, does /etc/amportal.conf have this line: “ZAP2DAHDICOMPAT=true” if not add it.

There are 3 files that concern FreePBX and Dahdi in addition to /etc/asterisk/dahdi_channels.conf:

/etc/asterisk/chan_dahdi.conf <= general settings and includes to the following files
/etc/asterisk/chan_dahdi_extensions.conf <= FreePBX creates FXS extensions here
/etc/asterisk/chan_dahdi_customs.conf <= you create FXO and PRI trunks here

At this time, you have to manually create FXO and PRI trunks or use /etc/asterisk/dahdi_channels.conf. There isn’t a mechanism in FreePBX to create FXO or PRI configs. The problem is that dahdigenconf also creates FXS extensions which can conflict with FreePBX’s /etc/asterisk/chan_dahdi_additional.conf. This is an area that needs to be worked out by the FreePBX team and the dahdi driver team.

The difference between channel 1 and g0 is that g0 stands for group 0, you can put a whack of channels together under one group. The idea is that the first available channel in that group gets used first.

From the asterisk cli> type

CLI> dahdi show channels

If nothing shows up or the command is not found then there is a conflict between the hardware and software configs. The hardware config file is /etc/dahdi/system.conf and the software configs are in /etc/asterisk.

The first place to look when troubleshooting dahdi is the Asterisk log file /var/log/asterisk/full, try the following command to see clues as to why it is not working. From the linux prompt:

cat /var/log/asterisk/full | grep chan_dahdi.c

That should show all the lines that reference the dahdi.c driver. The other option is to view the log file line by line through a text editor but be aware that it can be a HUGE file.

Here’s more info than you care to know about troubleshooting dahdi

Thanks for the response.

I added the “ZAP2DAHDICOMPAT=true”

I created the:
chan_dahdi_extensions.conf
chan_dahdi_customs.conf

I’ve attached channel 1 from extensions.conf so you can see it.
Is it correct?
The other How-to said i should replace from-pstn with from-zaptel
And it specifies both the group and the context twice…
Is that normal?

The channel was auto generated by running dahdi_genconf.

I’ve also attached the out put from grep chan_dahdi.c below.
I know that the Red Alarm on channels 2-12 are normal due to not having a line plugged in to the card for those ports.
Other than that… Do you see any problems with that output?

I’ve also attached the output from: dahdi show channels.
What is the pseudo?

Lastly I’ve attached my chan_dahdi.conf.
Can you look that over as well to see if I goofed it up?

I’ve read the whole article @ http://www.cadvision.com/blanchas/Asterisk/TestingDahdiHW.html
It really helped a lot but I still seem to be missing something because I am still getting the “All circuits are busy now, please try your call again later.”

Thanks a lot!
I really appreciate all the help you’ve given me.
I feel that I am all most there.
Thank you,
Cody

Here is my what channel 1 looks like in my /etc/asterisk/dahdi-channels.conf:

signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 1
callerid=
group=
context=default

Output from the CLI> dahdi show channel:

Chan Extension Context Language MOH Interpret Blocked State
pseudo default default In Service
1 from-pstn en default In Service
2 from-pstn en default In Service
3 from-pstn en default In Service
4 from-pstn en default In Service
5 from-pstn en default In Service
6 from-pstn en default In Service
7 from-pstn en default In Service
8 from-pstn en default In Service
9 from-pstn en default In Service
10 from-pstn en default In Service
11 from-pstn en default In Service
12 from-pstn en default In Service
13 from-internal en default In Service
14 from-internal en default In Service
15 from-internal en default In Service
16 from-internal en default In Service

Here is the output from tail -f /var/log/asterisk/full | grep chan_dahdi.c and a restart of asterisk:

[Apr 22 19:53:35] VERBOSE[2640] chan_dahdi.c: == Unregistered channel -2
[Apr 22 19:53:35] VERBOSE[2640] chan_dahdi.c: == Unregistered channel 1
[Apr 22 19:53:35] VERBOSE[2640] chan_dahdi.c: == Unregistered channel 2
[Apr 22 19:53:35] VERBOSE[2640] chan_dahdi.c: == Unregistered channel 3
[Apr 22 19:53:35] VERBOSE[2640] chan_dahdi.c: == Unregistered channel 4
[Apr 22 19:53:35] VERBOSE[2640] chan_dahdi.c: == Unregistered channel 5
[Apr 22 19:53:35] VERBOSE[2640] chan_dahdi.c: == Unregistered channel 6
[Apr 22 19:53:35] VERBOSE[2640] chan_dahdi.c: == Unregistered channel 7
[Apr 22 19:53:35] VERBOSE[2640] chan_dahdi.c: == Unregistered channel 8
[Apr 22 19:53:35] VERBOSE[2640] chan_dahdi.c: == Unregistered channel 9
[Apr 22 19:53:35] VERBOSE[2640] chan_dahdi.c: == Unregistered channel 10
[Apr 22 19:53:35] VERBOSE[2640] chan_dahdi.c: == Unregistered channel 11
[Apr 22 19:53:35] VERBOSE[2640] chan_dahdi.c: == Unregistered channel 12
[Apr 22 19:53:35] VERBOSE[2640] chan_dahdi.c: == Unregistered channel 13
[Apr 22 19:53:35] VERBOSE[2640] chan_dahdi.c: == Unregistered channel 14
[Apr 22 19:53:35] VERBOSE[2640] chan_dahdi.c: == Unregistered channel 15
[Apr 22 19:53:35] VERBOSE[2640] chan_dahdi.c: == Unregistered channel 16
[Apr 22 19:53:39] VERBOSE[2661] config.c: == Parsing ‘/etc/asterisk/chan_dahdi.conf’: [Apr 22 19:53:39] VERBOSE[2661] config.c: == Found
[Apr 22 19:53:39] VERBOSE[2661] config.c: == Parsing ‘/etc/asterisk/chan_dahdi_customs.conf’: [Apr 22 19:53:39] VERBOSE[2661] config.c: == Found
[Apr 22 19:53:39] VERBOSE[2661] chan_dahdi.c: – Registered channel 1, FXS Kewlstart signalling
[Apr 22 19:53:39] DEBUG[2661] chan_dahdi.c: Channel ‘1’ configured.
[Apr 22 19:53:39] WARNING[2661] chan_dahdi.c: Detected alarm on channel 2: Red Alarm
[Apr 22 19:53:39] VERBOSE[2661] chan_dahdi.c: – Registered channel 2, FXS Kewlstart signalling
[Apr 22 19:53:39] DEBUG[2661] chan_dahdi.c: Channel ‘2’ configured.
[Apr 22 19:53:39] WARNING[2661] chan_dahdi.c: Detected alarm on channel 3: Red Alarm
[Apr 22 19:53:39] VERBOSE[2661] chan_dahdi.c: – Registered channel 3, FXS Kewlstart signalling
[Apr 22 19:53:39] DEBUG[2661] chan_dahdi.c: Channel ‘3’ configured.
[Apr 22 19:53:39] WARNING[2661] chan_dahdi.c: Detected alarm on channel 4: Red Alarm
[Apr 22 19:53:39] VERBOSE[2661] chan_dahdi.c: – Registered channel 4, FXS Kewlstart signalling
[Apr 22 19:53:39] DEBUG[2661] chan_dahdi.c: Channel ‘4’ configured.
[Apr 22 19:53:39] WARNING[2661] chan_dahdi.c: Detected alarm on channel 5: Red Alarm
[Apr 22 19:53:39] VERBOSE[2661] chan_dahdi.c: – Registered channel 5, FXS Kewlstart signalling
[Apr 22 19:53:39] DEBUG[2661] chan_dahdi.c: Channel ‘5’ configured.
[Apr 22 19:53:39] WARNING[2661] chan_dahdi.c: Detected alarm on channel 6: Red Alarm
[Apr 22 19:53:39] VERBOSE[2661] chan_dahdi.c: – Registered channel 6, FXS Kewlstart signalling
[Apr 22 19:53:39] DEBUG[2661] chan_dahdi.c: Channel ‘6’ configured.
[Apr 22 19:53:39] WARNING[2661] chan_dahdi.c: Detected alarm on channel 7: Red Alarm
[Apr 22 19:53:39] VERBOSE[2661] chan_dahdi.c: – Registered channel 7, FXS Kewlstart signalling
[Apr 22 19:53:39] DEBUG[2661] chan_dahdi.c: Channel ‘7’ configured.
[Apr 22 19:53:39] WARNING[2661] chan_dahdi.c: Detected alarm on channel 8: Red Alarm
[Apr 22 19:53:39] VERBOSE[2661] chan_dahdi.c: – Registered channel 8, FXS Kewlstart signalling
[Apr 22 19:53:39] DEBUG[2661] chan_dahdi.c: Channel ‘8’ configured.
[Apr 22 19:53:39] WARNING[2661] chan_dahdi.c: Detected alarm on channel 9: Red Alarm
[Apr 22 19:53:39] VERBOSE[2661] chan_dahdi.c: – Registered channel 9, FXS Kewlstart signalling
[Apr 22 19:53:39] DEBUG[2661] chan_dahdi.c: Channel ‘9’ configured.
[Apr 22 19:53:39] WARNING[2661] chan_dahdi.c: Detected alarm on channel 10: Red Alarm
[Apr 22 19:53:39] VERBOSE[2661] chan_dahdi.c: – Registered channel 10, FXS Kewlstart signalling
[Apr 22 19:53:39] DEBUG[2661] chan_dahdi.c: Channel ‘10’ configured.
[Apr 22 19:53:39] WARNING[2661] chan_dahdi.c: Detected alarm on channel 11: Red Alarm
[Apr 22 19:53:39] VERBOSE[2661] chan_dahdi.c: – Registered channel 11, FXS Kewlstart signalling
[Apr 22 19:53:39] DEBUG[2661] chan_dahdi.c: Channel ‘11’ configured.
[Apr 22 19:53:39] WARNING[2661] chan_dahdi.c: Detected alarm on channel 12: Red Alarm
[Apr 22 19:53:39] VERBOSE[2661] chan_dahdi.c: – Registered channel 12, FXS Kewlstart signalling
[Apr 22 19:53:39] DEBUG[2661] chan_dahdi.c: Channel ‘12’ configured.
[Apr 22 19:53:39] VERBOSE[2661] chan_dahdi.c: – Registered channel 13, FXO Kewlstart signalling
[Apr 22 19:53:39] DEBUG[2661] chan_dahdi.c: Channel ‘13’ configured.
[Apr 22 19:53:39] VERBOSE[2661] chan_dahdi.c: – Registered channel 14, FXO Kewlstart signalling
[Apr 22 19:53:39] DEBUG[2661] chan_dahdi.c: Channel ‘14’ configured.
[Apr 22 19:53:39] VERBOSE[2661] chan_dahdi.c: – Registered channel 15, FXO Kewlstart signalling
[Apr 22 19:53:39] DEBUG[2661] chan_dahdi.c: Channel ‘15’ configured.
[Apr 22 19:53:39] VERBOSE[2661] chan_dahdi.c: – Registered channel 16, FXO Kewlstart signalling
[Apr 22 19:53:39] DEBUG[2661] chan_dahdi.c: Channel ‘16’ configured.
[Apr 22 19:53:39] VERBOSE[2661] chan_dahdi.c: – Automatically generated pseudo channel
[Apr 22 19:53:39] WARNING[2661] chan_dahdi.c: Ignoring any changes to ‘userbase’ (on reload) at line 23.
[Apr 22 19:53:39] WARNING[2661] chan_dahdi.c: Ignoring any changes to ‘vmsecret’ (on reload) at line 31.
[Apr 22 19:53:39] WARNING[2661] chan_dahdi.c: Ignoring any changes to ‘hassip’ (on reload) at line 35.
[Apr 22 19:53:39] WARNING[2661] chan_dahdi.c: Ignoring any changes to ‘hasiax’ (on reload) at line 39.
[Apr 22 19:53:39] WARNING[2661] chan_dahdi.c: Ignoring any changes to ‘hasmanager’ (on reload) at line 47.

There were some bugs in Dahdi that kept the tools from compiling properly on my Ubuntu boxes. I use a Xorcom Astribank. Their drivers have been in Dahdi since birth. I complained to Xorcom, they tested and submitted info to the developers about the problem which was related to newer Kernels like the one in Ubuntu.

It seems to be fixed in this recent dahdi release:

http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/releases/dahdi-linux-complete-2.3.0+2.3.0.tar.gz

There is an excellent video on installing dahdi and hardware on 888 Voip Store’s site.

http://www.voipstore.com/configuring-a-xorcom-astribank-with-trixbox-ce/

It’s done with a xorcom astribank on TrixBox but it is generic enough to use with FreePBX and your own build

NOTES:

  • USE METHOD 2 in the presentation for NON Trix boxes
  • He mistakenly refers to dahdi_cfg as dahdi_gencfg don’t try to use dahdi_gencfg there is no such

Follow his steps and then you have to do some manual file creation and edits.

You may need to create chan_dahdi_custom.conf - see below

My chan_dahdi.conf looks like this.

;# Flash Operator Panel will parse this file for dahdi trunk buttons
;# AMPLABEL will be used for the display labels on the buttons

;# %c Dahdi Channel number
;# %n Line number
;# %N Line number, but restart counter
;# Example:
;# ;AMPLABEL:Channel %c - Button %n

;# For Dahdi/* buttons use the following
;# (where x=number of buttons to dislpay)
;# ;AMPWILDCARDLABEL(12):T1Trunk
; include dahdi extensions defined in FreePBX
;# AMPLABEL:Channel %c - Button %n
[channels]
#include chan_dahdi_custom.conf
#include chan_dahdi_additional.conf

This is what my chan_dahdi_custom.conf looks like for the PRI

signalling=pri_cpe
switchtype=national
group=0
context=from-pstn
usecallerid=yes
echocancel=yes
channel => 1-23

Yours should probably look like this depending on which channels are the FXO ports as a group they will act like a 12 channel trunk

signalling=fxs_ks
group=0
context=from-pstn
usecallerid=yes
echocancel=yes
channel => 1-12

Hope this helps or gives you some hints.

  • Some things to check, does /etc/amportal.conf have this line: “ZAP2DAHDICOMPAT=true” if not add it.

He helped me “get a clue” on Dahdi during the original, Xorcom install which was done before the video came out and the developers fixed Dahdi for the newer kernel(s).

He may also be right about a more stable release if he is referring to Ubuntu and rolling your own Asterisk but I build my systems on some very small form factor hardware that wouldn’t work without the superior driver support of Ubuntu.

The only distro I can run on my fit-pc2i based systems is Ubuntu 9.10. My larger systems are on ITX boards that are optimized for Home Entertainment and they also snarl at Centos and the so-called stable distros.

BUT if you want clean, easy builds, he’s right use Centos 5.x. Anything I build for an enterprise level system is Centos all the way.

I do not have the dahdi command. In the asterisk log file, I do not find any message that is related to dahdi.
In the dmesg, I do see dahdi is loaded and configured.

What could be the problem? please help!

hi blanchae,
thanks a lot, your mentions really solve my problem, i forget the line

/etc/amportal.conf have this line: “ZAP2DAHDICOMPAT=true” if not add it.

every time.

just thank you.

parham