Upgrade 3CX to v18 and get it hosted free!

Example North American CAPI Setup

Author image

Below is an example of a capi setup on an Eicon Diva Server 4BRI (or single bri)

Example Site 1, This setup is confirmed working on a Verizon 5ESS or DMS-100 Switch

capi.conf


;
; CAPI config working fine as of 01/2006 with chan-capi_cm 0.6.3
;

[general]
nationalprefix=1
internationalprefix=011
rxgain=0.8
txgain=0.8
;rxgain=1.0
;txgain=1.0
ulaw=yes        ;set this, if you live in u-law world instead of a-law

[ISDN1]          ;this example interface gets name 'ISDN1' and may be any
;ntmode=yes      ;if isdn card operates in nt mode, set this to yes
                 ;when using NT-mode, ptp should be set in any case
incomingmsn=2781980    ;allow incoming calls to this list of MSNs/DIDs, * == any
controller=1     ;capi controller number to use
group=1          ;dialout group
;softdtmf=on      ;enable/disable software dtmf detection, recommended for AVM cards
;relaxdtmf=on     ;in addition to softdtmf, you can use relaxed dtmf detection
;accountcode=     ;Asterisk accountcode to use in CDRs
context=incoming-isdn  ;context for incoming calls
holdtype=hold    ;when Asterisk puts the call on hold, ISDN HOLD will be used. If
                 ;set to 'local' (default value), no hold is done and Asterisk may
                 ;play MOH.     
;immediate=yes   ;immediate start of pbx with extension 's' if no digits were
                 ;received on incoming call (no destination number yet)
;echosquelch=1   ;_VERY_PRIMITIVE_ echo suppression
echocancel=yes  ;EICON DIVA SERVER (CAPI) echo cancelation
                 ;(possible values: 'no', 'yes', 'force', 'g164', 'g165')
;echocancelold=yes;use facility selector 6 instead of correct 8 (necessary for older eicon drivers)
echotail=64     ;echo cancel tail setting
bridge=no      ;native bridging (CAPI line interconnect) if available
callgroup=1     ;Asterisk call group
;deflect=1234567 ;deflect incoming calls to 1234567 if all B channels are busy
devices=1        ;number of concurrent calls on this controller
                 ;(2 makes sense for single BRI, 30 for PRI)
[ISDN2]
isdnmode=msn
incomingmsn=2781984
controller=1
group=1
callgroup=1
bridge=yes      ;native bridging (CAPI line interconnect) if available
context=incoming-isdn
echocancel=yes
devices=1
[ISDN3]
controller=2
[ISDN4]
controller=3
[ISDN5]
controller=4

extensions.conf snippet


[incoming-isdn]
include => localextensions; For 88XX Transfers  
exten => 2781980,1,Set(IncomingLine=${EXTEN})
exten => 2781980,2,NoOp(${CALLERID})
exten => 2781980,3,Set(CALLERID(name)=PUMS IN TollFree)
exten => 2781980,4,Set(CALLERID(num)=${CALLERID(num):1})
exten => 2781980,5,Set(CALLFILENAME=/var/spool/asterisk/monitor/incoming/NNN2781980/In-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${CALLERID(num)}_${CALLERID(name)_${EXTEN}})
exten => 2781980,6,Goto(incoming-isdn,s,1)             
exten => 2781984,1,Set(IncomingLine=${EXTEN})
exten => 2781984,2,NoOp(${CALLERID})
exten => 2781984,3,Set(CALLERID(name)=PUMS IN TollFree2)
exten => 2781984,4,Set(CALLERID(num)=${CALLERID(num):1})   
exten => 2781984,5,Set(CALLFILENAME=/var/spool/asterisk/monitor/incoming/NNN2781984/In-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${CALLERID(num)}_${CALLERID(name)_${EXTEN}})
exten => s,1,Monitor(wav,${CALLFILENAME})
exten => s,2,GotoIfTime(17:31-6:59|mon-sun|*|*?2300in,s,13);closed after hours
exten => s,3,GotoIfTime(01:00-23:59|sat-sun|*|*?2300in,s,13);All weekends closed
exten => s,4,Dial(Zap/31,20,t);Daytime
exten => s,5,Goto(2300in,s,7);Dialplan menu is here
exten => s,10,Monitor(wav,${CALLFILENAME})
exten => s,11,GotoIfTime(17:31-6:59|mon-sun|*|*?2300in,s,13);closed after hours
exten => s,12,GotoIfTime(01:00-23:59|sat-sun|*|*?2300in,s,13);All weekends closed
exten => s,13,Dial(Zap/32,20,t);Daytime
exten => s,14,Goto(2300in,s,7);Dialplan menu is here

[isdn-out]
exten => _1NXXNXXXXXX,1,Set(CALLFILENAME=/var/spool/asterisk/monitor/outgoing/NNN2781980/Out-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${CALLERID(num)}_${CALLERID(name)}_${EXTEN})
exten => _1NXXNXXXXXX,2,Monitor(wav,${CALLFILENAME},)
exten => _1NXXNXXXXXX,3,Dial(CAPI/g1/${EXTEN}/B,,)
exten => _1NXXNXXXXXX,104,NoOp(${DIALSTATUS} ${HANGUPCAUSE})
exten => _1NXXNXXXXXX,105,Busy
exten => _1NXXNXXXXXX,4,Dial(IAX2/anotherprovider/${EXTEN})
exten => _1NXXNXXXXXX,5,NoOp(${DIALSTATUS} ${HANGUPCAUSE})
exten => _1NXXNXXXXXX,6,Congestion           

Example Site 2, This setup is confirmed working on a Verizon 5ESS or DMS-100 Switch

This site is a single voice line, with the second channel going to a zap channel for a fax machine

capi.conf


[general]
nationalprefix=1
internationalprefix=011
;rxgain=0.4
;txgain=0.4
rxgain=0.5
txgain=0.5
ulaw=yes        ;set this, if you live in u-law world instead of a-law
                 ;(2 makes sense for single BRI, 30 for PRI)

[ISDNL1]          ;this example interface gets name 'ISDN1' and may be any;name not starting with 'g' or 'contr'.
;ntmode=yes      ;if isdn card operates in nt mode, set this to yes
isdnmode=msn     ;'MSN' (point-to-multipoint) or 'DID' (direct inward dial);when using NT-mode, ptp should be set in any case
;isdnmode=did     ;'MSN' (point-to-multipoint) or 'DID' (direct inward dial);when using NT-mode, ptp should be set in any case
;incomingmsn=*    ;allow incoming calls to this list of MSNs/DIDs, * == any
incomingmsn=5912211    ;allow incoming calls to this list of MSNs/DIDs, * == any
controller=1     ;capi controller number to use
group=1,2        ;dialout group
;prefix=1        ;set a prefix to calling number on incoming calls
;softdtmf=on      ;enable/disable software dtmf detection, recommended for AVM cards
;relaxdtmf=on     ;in addition to softdtmf, you can use relaxed dtmf detection
;accountcode=     ;Asterisk accountcode to use in CDRs
context=capi-in-5912211  ;context for incoming calls
;holdtype=hold    ;when Asterisk puts the call on hold, ISDN HOLD will be used. If
                 ;set to 'local' (default value), no hold is done and Asterisk may
                 ;play MOH.
;immediate=yes   ;immediate start of pbx with extension 's' if no digits were
                 ;received on incoming call (no destination number yet)
;echosquelch=1   ;_VERY_PRIMITIVE_ echo suppression
echocancel=yes
;echocancel=yes  ;EICON DIVA SERVER (CAPI) echo cancelation
                 ;(possible values: 'no', 'yes', 'force', 'g164', 'g165') 
;echocancelold=yes;use facility selector 6 instead of correct 8 (necessary for older eicon drivers)
echotail=64     ;echo cancel tail setting
bridge=no      ;native bridging (CAPI line interconnect) if available
;callgroup=1     ;Asterisk call group
;deflect=6930821 ;deflect incoming calls to 1234567 if all B channels are busy
devices=2        ;number of concurrent calls on this controller

[ISDNL2]
isdnmode=msn
incomingmsn=6930821
controller=1
;callgroup=2
group=2,1
bridge=no      ;native bridging (CAPI line interconnect) if available
context=capi-in-6930821
echocancel=no
devices=2

extensions.conf


[capi-in-5912211]
exten => 5912211,1,Set(IncomingCID=${CALLERID(all)})
exten => 5912211,2,Set(IncomingLine=NNN${EXTEN})
exten => 5912211,3,Set(CALLERID(name)=IN 2211)
;exten => 5912211,3,capicommand(holdtype|hold)
;exten => 5912211,3,capicommand(deflect|6930821)
exten => 5912211,4,GotoIf($[["${CALLERID(num):0:1}" = "1"]?5:6);
exten => 5912211,5,Set(CALLERID(num)=${CALLERID(num):1})
exten => 5912211,6,GotoIf($[["${CALLERID(num):0:3}" = "NNN"]?16);Conditional area code jumps for auto-menu
exten => 5912211,7,GotoIf($[["${CALLERID(num):0:3}" = "NNN"]?16)
exten => 5912211,8,GotoIf($[["${CALLERID(num):0:3}" = "NNN"]?16)
exten => 5912211,9,GotoIf($[["${CALLERID(num):0:3}" = "NNN"]?16)
exten => 5912211,10,GotoIf($[["${CALLERID(num):0:3}" = "NNN"]?16)
exten => 5912211,11,GotoIf($[["${CALLERID(num):0:3}" = "NNN"]?16)
exten => 5912211,12,GotoIf($[["${CALLERID(num):0:3}" = "NNN"]?16)
exten => 5912211,13,GotoIf($[["${CALLERID(num):0:3}" = "NNN"]?16)
exten => 5912211,14,GotoIf($[["${CALLERID(num):0:3}" = "NNN"]?16)
exten => 5912211,15,GotoIf($[["${CALLERID(num):0:3}" = "NNN"]?16)
exten => 5912211,16,Goto(menuincoming,s,1)
exten => 5912211,17,Set(CALLFILENAME=/var/spool/asterisk/monitor/incoming/${IncomingLine}/In-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${CALLERID(num)}_${CALLERID(name)}_${EXTEN})
exten => 5912211,18,Monitor(wav,${CALLFILENAME})
exten => 5912211,19,Goto(menuincoming,s,11)

[capi-in-6930821]
exten => 6930821,1,Set(IncomingCID=${CALLERID(all)})
exten => 6930821,2,Set(IncomingLine=NNN${EXTEN})
exten => 6930821,3,Set(CALLERID(name)=IN ISDN FAX)
exten => 6930821,4,GotoIf($[["${CALLERID(num):0:1}" = "1"]?5:6);
exten => 6930821,5,Set(CALLERID(num)=${CALLERID(num):1})
;exten => 6930821,6,Goto(receive-fax,s,1)
exten => 6930821,6,Goto(menuincoming,s,11)

[receive-fax];Directed from above, and incoming timeout to fax line
exten => s,1,StopMonitor
exten => s,2,Goto(receive-fax-analog,s,1);at the moment, directed to an analog zap fax machine
;exten => s,2,SetVar(FAXFILE=/var/spool/asterisk-fax/${UNIQUEID})
exten => s,3,SetVar([email protected])
exten => s,4,SetVar([email protected])
exten => s,5,GotoIf($[["${INCOMINGLINE}" = "NNN6930821"]?6:receive-fax-analog,s,1)
exten => s,6,capicommand(receivefax|${FAXFILE}|+1-NNN-693-0821|AsteriskFax)
exten => s,7,Hangup
exten => h,1,system(/etc/asterisk/mailfax ${FAXFILE} ${EMAILADDR} ${CALLERID(num)}) 

[receive-fax-analog]
exten => s,1,Dial(Zap/4,,)
exten => s,2,Hangup

[menuincoming]
exten => s,1,LookupCIDName
exten => s,2,Set(CALLFILENAME=/var/spool/asterisk/monitor/incoming/${IncomingLine}/In-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${CALLERID(num)}_${CALLERID(name)}_${EXTEN})
exten => s,3,Monitor(wav,${CALLFILENAME})
exten => s,4,GotoIf($[["${INCOMINGLINE}" = "NNN6930821"]?9:5);Jumps right to night menu on second isdn channel
;snips
;priority 9 is night menu ringing
;priority 5 is menu

;Timeout will go to the fax machine if on second line
exten => t,1,GotoIf($[["${INCOMINGLINE}" = "NNN6930821"]?receive-fax,s,1:menuincoming,s,11)
exten => fax,1,Goto(receive-fax,s,1)

[capioutgoing];Regular outgoing over capi
;Standard numbers primary plan; out via capi first, teliax backup
exten => _1NXXNXXXXXX,1,SetCallerID(NNNNNNNNNN)
exten => _1NXXNXXXXXX,2,Set(CALLFILENAME=/var/spool/asterisk/monitor/outgoing/NNN5912211/Out-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${CALLERID(num)}_${CALLERID(name)}_${EXTEN})
exten => _1NXXNXXXXXX,3,Monitor(wav,${CALLFILENAME})
exten => _1NXXNXXXXXX,4,Dial(CAPI/ISDNL1/5912211:${EXTEN}/b)
exten => _1NXXNXXXXXX,5,GotoIf($[["${DIALSTATUS}" = "BUSY"]?200:6)
exten => _1NXXNXXXXXX,6,Dial(CAPI/ISDNL2/6930821:${EXTEN}/b)
exten => _1NXXNXXXXXX,7,Playback(all-circuits-busy-now)
exten => _1NXXNXXXXXX,8,Dial(IAX2/backupisp/${EXTEN},,tT)
exten => _1NXXNXXXXXX,9,GotoIf($[["${DIALSTATUS}" = "BUSY"]?200:10)
exten => _1NXXNXXXXXX,10,Dial(IAX2/backupisp/${EXTEN},,tT)
exten => _1NXXNXXXXXX,11,Congestion
exten => _1NXXNXXXXXX,200,Playback(busy-pls-hold)
exten => _1NXXNXXXXXX,201,Wait(10)
exten => _1NXXNXXXXXX,202,Playback(connecting)
exten => _1NXXNXXXXXX,203,Goto(4)
exten => _1NXXNXXXXXX,204,Busy
exten => _1NXXNXXXXXX,205,Hangup

[localfax] ;local fax machine context for outgoing faxes
exten => _1NXXNXXXXXX,1,Dial(CAPI/ISDNL2/6930821:${EXTEN}/B)
exten => _1914NXXXXXX,1,Dial(CAPI/ISDNL2/6930821:${EXTEN:4}/B)
exten => _011.,1,Dial(CAPI/g2/${EXTEN}/B)
exten => 8,1,Dial(CAPI/g1//b)
exten => 9,1,Dial(CAPI/g2//b)
;exten => s,1,Dial(CAPI/ISDNL2/6930821:/b)

That’s basically it.


Article Reviews

Write a Review

Your email address will not be published. Required fields are marked *

Required Field. Minimum 5 characters.

Required Field. Minimum 5 characters, maximum 50.

Required field.There is an error with this field.

Required Field.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

There are no reviews for this article. Be the first one to write a review.
Get 3CX - Absolutely Free!
Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.