Using Asterisk in the UK
This guide describes how to get Asterisk working properly in the UK. As each telco’s standards differ, services such as caller ID work differently.
Compiling Asterisk
Due to UK caller ID specifications, you will need to make a small modification to the source.
Open up chan_zap.c, and find the line:
Change this line to read
and save the file. Now build asterisk as usual.
On asterisk > 1.2 you can avoid this by adding:
to zapata.conf
BT PRI
BT is the main carrier in the UK. Their PRI lines are, by default, ISDN30e (euroisdn). By default you will have no extra services turned on, so you will need to call up the ISDN management team and get them to turn on this feature (Be aware! It costs extra!).
In my configuration, the PRI is plugged in to span 1 on a TE410P interface. On span 2 i have a Rhino T1 ChannelBank, and spans 3 and 4 are currently unused. My zaptel.conf is below:
span=1,1,1,ccs,hdb3,crc4
span=2,0,0,esf,b8zs
span=3,0,0,esf,b8zs
span=4,0,0,esf,b8zs
bchan=1-15
dchan=16
bchan=17-31
fxols=32-55
loadzone=uk
defaultzone=uk
Even though only 8 channels are active on the PRI, all channels should be configured in zaptel.conf as shown.
The zapata.conf for the above system is shown below:
[channels]
language=en
usecallerid=yes
hidecallerid=no
callwaiting=no
callwaitingcallerid=yes
restrictcid=no
usecallingpres=no
threewaycalling=yes
callreturn=yes
transfer=yes
cancallforward=yes
echocancelwhenbridged=yes
echocancel=yes
musiconhold=default
rxgain=0.0
txgain=0.0
signalling=pri_cpe
switchtype=euroisdn
immediate=no
overlapdial=yes
pridialplan=unknown
prilocaldialplan=unknown
group=1
context = incomingfrompstn
callerid=asreceived
channel => 1-8
group=2
pickupgroup=2
callgroup=2
signalling=fxo_ls
context=dialphone
channel => 32-55
Sending Caller ID to the BT PRI
When you placed your order, you may have got a DDI allocation. If this is the case, then you may want the outgoin caller ID set to the DDI of the user making the call. You will first need to contact BT and ask them to add all your DDI numbers to the list of allowed calling id numbers. Once this is done (it takes a few hours) then you can set your outgoing callerid in extensions.conf like so:
By default, BT pass 6 digit extensions in and out of their network.
Incoming Caller ID
Again: By default, BT pass 6 digit extensions in and out of their network.
Therefore in your incoming context, incomingfrompstn in the example here, you will need to specify these 6 digit extension.
For ease of use, i have created a macro to handle dialling a channel and passing off to voicemail:
[macro-dialddi]
exten => s,1,SetCIDNum(90${CALLERIDNUM})
exten => s,2,Dial(${ARG1},20,tT)
exten => s,3,Voicemail(u${ARG2})
exten => s,4,Hangup
exten => s,103,Voicemail(b${ARG2})
exten => s,104,Hangup
To execute this for your DDI numbers, an example incomingfrompstn context is shown below:
exten => 123451,1,Macro(dialddi,Zap/32,6100)
exten => 123452,1,Macro(dialddi,Zap/33,6101)
exten => 123453,1,Macro(dialddi,Zap/34,6102)
TDM 400 FXS & BT POTS lines
(SimonHobson, 13 June 2006, mod Dirk Koopman 21 Sept 2006, mod Ben Brown 10 Sept 2008)
Set the card to UK lines spec by adding
to /etc/modprobe.conf (or possibly /etc/modprobe.d/zaptel or /etc/modules.conf depending on distro ?)
At the moment the fwringdetect logic is broken in Zaptel/DAHDI, you will need to patch wctdm.c (see https://issues.asterisk.org/jira/browse/ZAP-318)
BT do not supply Caller ID by default, you can pay extra for this as one of the “Star Services” that are available, or, you can get it free by signing up for “BT Privacy” http://www.bt.com/privacy which signs you up to the Telephone Preference Service and gives you Caller ID for free. To set up for UK Caller ID signalling use (note: I haven’t been able to verify this, it came from another forum) :
cidstart=polarity
In UK CID is sent after a polarity reversal and before the first ring. In theory one can set
to zapata.conf. It works for me.
FXO phantom ringing
I had a BIG problem with phantom ringing, after calls ended, there would immediately be an incoming call but you would get dialtone when you answer it. This was solved by adding :
to /etc/zapata.conf
This should not be done for FXS lines as this will prevent CID and answering!
Hanging Up
I you have a TDM400P that is not detecting when the caller hangs up, you need to do one of two things:
- If you are using BT you can contact BT and ask what the “Disconnect Clear Time” setting is for your phone line. Odds are it’s probably 100. Increasing it to 800 fixed the issue for me. “Disconnect Clear Time” is BT’s name for CPC.
- Alternatively you can configure battthresh=4 (versus standard 3) in the wctdm module options (see above)
To ensure Asterisk quickly detects when a caller hangs up whilst your line has not been answered, you need to enable polarity reversal hangup detection in zapata.conf:
If using a BT line only the calling party can hangup a line. If you do not configure Asterisk correctly you can have a situation where someone calls you, you hang up but they do not. If you then try to make a call it will pick up the phone line and dial whilst the original caller is still connected. There are a few solutions:
- The patch at https://issues.asterisk.org/jira/browse/ASTERISK-11797 adds dialtone detection before a new call is made.
- Make sure your dialplan follows through after the Dial command, so that if necessary it will fall through and play the congestion tone. This will also make the Zap channel busy until the caller hangs up. For example:
exten => s,2,GotoIf($[“${DIALSTATUS}” = “NOANSWER”]?4:3)
exten => s,3,GotoIf($[“${DIALSTATUS}” = “BUSY”]?102:5)
exten => s,4,Voicemail(1000|us)
exten => s,5,Playtones(congestion)
exten => s,6,Congestion
exten => s,102,Voicemail(1000|bs)
exten => s,103,Playtones(congestion)
exten => s,104,Congestion