Solved

All circuits are busy now, dahdi, E1

Posted on 2010-11-12
31
13,529 Views
Last Modified: 2014-03-11
Team,

I'm installing Asterisk 1.6.0.26 for the first time and i'm having some issues configuring the E1 Card, the card is a TE122 Digium.

I have a Asterisk 1.4.23  running without any issue but this one uses Zaptel not dahdi, so this is my first time using dahdi.

I don't know how to setup a trunk for it, how to configure the a2billing options to be able to make outbound calls and receive inbound calls.

So far i was able to create a trunk under asterisk named DAHDI/g1/$OUTNUM$ and at the outbound routes i made the proper relatinship.

But when i try to call any outbound number i get the message:

"All circuits are busy now, please try your call again later"

Honestly i don't know if my dahdi configs are right or not among with the chan_dahdi.conf and dahdi-channels.conf.

This is what i have in my old asterisk at zaptel.conf:

# Span 1: WCT1/0 "Digium Wildcard TE112P T1/E1 Card 0" (MASTER) 
span=1,1,0,cas,hdb3
cas=1-15:1101
dchan=16
cas=17-31:1101

# Global data

loadzone	= us
defaultzone	= us

Open in new window


And this is what i have at my system.conf in the new asterisk:

# Span 1: WCT1/0 "Wildcard TE122 Card 0" (MASTER) HDB3/CCS/CRC4 ClockSource 
span=1,1,0,cas,hdb3,crc4
# termtype: te
bchan=1-15,17-31
dchan=16
echocanceller=mg2,1-15,17-31

# Global data

loadzone	= us
defaultzone	= us

Open in new window


This is what i have in my old asterisk under the zapata file:

;
; Zapata telephony interface
;
; Configuration file

[trunkgroups]

[channels]
context=from-internal
cidsignalling=bell
cidstart=polarity
signalling=fxo_ks
group=2
channel=>32-35
language=en

;context=from-pstn
context=from-zaptel
signalling=fxs_ks
usecallerid=yes
echocancel=yes
echocancelwhenbridged=no
echotraining=400
group=3
channel=>36

;load balancer
context=from-zaptel
signalling=fxs_ks
usecallerid=yes
echocancel=yes
busydetect=yes
busycount=10
echocancelwhenbridged=no
echotraining=400
group=4
channel=>37-39

rxwink=300		; Atlas seems to use long (250ms) winks
;
; Whether or not to do distinctive ring detection on FXO lines
;
;usedistinctiveringdetection=yes

usecallerid=yes
hidecallerid=no
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
cancallforward=yes
callreturn=yes
echocancel=yes
echocancelwhenbridged=no
;;echotraining=800
rxgain=0.0
txgain=0.0
group=0
callgroup=1
pickupgroup=1
immediate=no

;faxdetect=both
faxdetect=incoming
;faxdetect=outgoing
;;faxdetect=no

;Include genzaptelconf configs
#include zapata-auto.conf

group=1

;Include AMP configs
#include zapata_additional.conf

Open in new window


This is what i have under extensions_custom.conf at my old asterisk:

; This file contains example extensions_custom.conf entries.
; extensions_custom.conf should be used to include customizations
; to AMP's Asterisk dialplan.

; All custom context should contain the string 'custom' in it's name 

; Extensions in AMP have access to the 'from-internal' context.
; The context 'from-internal-custom' is included in 'from-internal' by default

#include extensions_hud.conf

[from-internal-custom]

[macro-dialout-trunk-predial-hook]
exten => s,1,GotoIf($["${OUT_${DIAL_TRUNK}:4:4}" = "A2B/"]?custom-freepbx-a2billing,${OUTNUM},1:2)
exten => s,2,MacroExit

[custom-freepbx-a2billing]
exten => _X.,1,DeadAGI(a2billing.php|${OUT_${DIAL_TRUNK}:8})
exten => _X.,n,Hangup()



;1234,1,Playback(demo-congrats)		; extensions can dial 1234
;1234,2,Hangup()
;h,1,Hangup()
;include => custom-recordme			; extensions can also dial 5678

; custom-count2four,s,1 can be used as a custom target for
; a Digital Receptionist menu or a Call Group
;[custom-count2four]		
;s,1,SayDigits(1234)
;s,2,Hangup

; custom-recordme,5678,1 can be used as a custom target for
; a Digital Receptionist menu or a Call Group
;[custom-recordme]
;exten => 5678,1,Wait(2)
;exten => 5678,2,Record(/tmp/asterisk-recording:gsm)
;exten => 5678,3,Wait(2)
;exten => 5678,4,Playback(/tmp/asterisk-recording)
;exten => 5678,5,Wait(2)
;exten => 5678,6,Hangup 

[custom-meetme3]
exten => s,1,Answer
exten => s,n,Wait(3)
exten => s,n,CBMysql()
exten => s,n,Hangup

Open in new window


And this is what i have in the new asterisk under chan_dahdi.conf

;
; DAHDI telephony
;
; Configuration file

[trunkgroups]

[channels]

language=en
context=from-zaptel
signalling=fxs_ks
rxwink=300              ; Atlas seems to use long (250ms) winks
;
; Whether or not to do distinctive ring detection on FXO lines
;
;usedistinctiveringdetection=yes

usecallerid=yes
hidecallerid=no
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
cancallforward=yes
callreturn=yes
echocancel=yes
echocancelwhenbridged=no
;echotraining=800
rxgain=0.0
txgain=0.0
group=0
callgroup=1
pickupgroup=1
immediate=no

;faxdetect=both
faxdetect=incoming
;faxdetect=outgoing
;faxdetect=no

;Include setup-pstn configs
#include dahdi-channels.conf

group=1

;Include PBXconfig configs
#include chan_dahdi_additional.conf

Open in new window


Last but not least... dahdi-channels.conf:

; Autogenerated by /usr/sbin/dahdi_genconf on Thu Nov 11 11:10:20 2010
; If you edit this file and execute /usr/sbin/dahdi_genconf again,
; your manual changes will be LOST.
; Dahdi Channels Configurations (chan_dahdi.conf)
;
; This is not intended to be a complete chan_dahdi.conf. Rather, it is intended
; to be #include-d by /etc/chan_dahdi.conf that will include the global settings
;

; Span 1: WCT1/0 "Wildcard TE122 Card 0" (MASTER) HDB3/CCS/CRC4 ClockSource 
group=0,11
context=from-pstn
switchtype = euroisdn
signalling = pri_cpe
channel => 1-15,17-31
context = default
group = 63

Open in new window


Seems a lot of code :P....

Can you please help to configure my E1 card to be able to make outbound calls and use my a2billing too?

:)

Thank you very much in advanced

Regards

Juan
0
Comment
Question by:Juan-ito
  • 20
  • 10
31 Comments
 
LVL 36

Expert Comment

by:grblades
ID: 34127439
In dahdi-channels you have a group=0 near the top so all those channels are in group 0. However you are trying to dial as 'DAHDI/g1/$OUTNUM$' which is trying to dial using group 1. Change the 'g1' to 'g0' and give it another go.
0
 

Author Comment

by:Juan-ito
ID: 34128424
It's changed at the GUI:
 Trunks dahdi
What about these lines under chan_dahdi.con and dahdi-channels.conf should i change that lines too?

I have 2 lines under chan_dahdi.con, one with group 0 and another with group 1 is that normal?

should i delete the group 1?

And under dahdi-channels.conf i have group 0,11 and 63? what about that?

Thank you for your help
0
 
LVL 36

Expert Comment

by:grblades
ID: 34130488
No it should be fine as it is. Where you have a group=1 line in the config it just means the following lines of config are applied to that group so you can change group as much as you wish as long as it is set to the correct group just before the important config.

I think group=0,11 means the following config applies to groups 0 through to 11 or it maybe groups 0 and 11. I cant find any documentation on it at the moment and its the first time I have seen it used.

What system are you running?
I only really know plain asterisk as I write more complex dialplans and want the extra speed you get by not having the extra stuff which comes with freepbx etc...
0
 

Author Comment

by:Juan-ito
ID: 34131171
trixbox running on centos, later today i'll make testing on that config and i'll let you know the results. Thanks
0
 

Author Comment

by:Juan-ito
ID: 34132657
It's not working yet....

i get this:

Verbosity is at least 3
  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5
  == Using SIP VRTP TOS bits 136
  == Using SIP VRTP CoS mark 6
    -- Executing [4357828@from-internal:1] Macro("SIP/5230-00000003", "user-callerid,SKIPTTL,") in new stack
    -- Executing [s@macro-user-callerid:1] Set("SIP/5230-00000003", "AMPUSER=5230") in new stack
    -- Executing [s@macro-user-callerid:2] GotoIf("SIP/5230-00000003", "0?report") in new stack
    -- Executing [s@macro-user-callerid:3] ExecIf("SIP/5230-00000003", "1?Set(REALCALLERIDNUM=5230)") in new stack
    -- Executing [s@macro-user-callerid:4] Set("SIP/5230-00000003", "AMPUSER=5230") in new stack
    -- Executing [s@macro-user-callerid:5] Set("SIP/5230-00000003", "AMPUSERCIDNAME=Telecom Engineer") in new stack
    -- Executing [s@macro-user-callerid:6] GotoIf("SIP/5230-00000003", "0?report") in new stack
    -- Executing [s@macro-user-callerid:7] Set("SIP/5230-00000003", "AMPUSERCID=5230") in new stack
    -- Executing [s@macro-user-callerid:8] Set("SIP/5230-00000003", "CALLERID(all)="Telecom Engineer" <5230>") in new stack
    -- Executing [s@macro-user-callerid:9] ExecIf("SIP/5230-00000003", "0?Set(CHANNEL(language)=)") in new stack
    -- Executing [s@macro-user-callerid:10] GotoIf("SIP/5230-00000003", "1?continue") in new stack
    -- Goto (macro-user-callerid,s,19)
    -- Executing [s@macro-user-callerid:19] NoOp("SIP/5230-00000003", "Using CallerID "Telecom Engineer" <5230>") in new stack
    -- Executing [4357828@from-internal:2] Set("SIP/5230-00000003", "_NODEST=") in new stack
    -- Executing [4357828@from-internal:3] Macro("SIP/5230-00000003", "record-enable,5230,OUT,") in new stack
    -- Executing [s@macro-record-enable:1] GotoIf("SIP/5230-00000003", "1?check") in new stack
    -- Goto (macro-record-enable,s,4)
    -- Executing [s@macro-record-enable:4] AGI("SIP/5230-00000003", "recordingcheck,20101114-155417,1289775257.4") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
 recordingcheck,20101114-155417,1289775257.4: Outbound recording not enabled
    -- <SIP/5230-00000003>AGI Script recordingcheck completed, returning 0
    -- Executing [s@macro-record-enable:5] MacroExit("SIP/5230-00000003", "") in new stack
    -- Executing [4357828@from-internal:4] Macro("SIP/5230-00000003", "dialout-trunk,4,4357828,,") in new stack
    -- Executing [s@macro-dialout-trunk:1] Set("SIP/5230-00000003", "DIAL_TRUNK=4") in new stack
    -- Executing [s@macro-dialout-trunk:2] GosubIf("SIP/5230-00000003", "0?sub-pincheck,s,1") in new stack
    -- Executing [s@macro-dialout-trunk:3] GotoIf("SIP/5230-00000003", "0?disabletrunk,1") in new stack
    -- Executing [s@macro-dialout-trunk:4] Set("SIP/5230-00000003", "DIAL_NUMBER=4357828") in new stack
    -- Executing [s@macro-dialout-trunk:5] Set("SIP/5230-00000003", "DIAL_TRUNK_OPTIONS=tr") in new stack
    -- Executing [s@macro-dialout-trunk:6] Set("SIP/5230-00000003", "OUTBOUND_GROUP=OUT_4") in new stack
    -- Executing [s@macro-dialout-trunk:7] GotoIf("SIP/5230-00000003", "1?nomax") in new stack
    -- Goto (macro-dialout-trunk,s,9)
    -- Executing [s@macro-dialout-trunk:9] GotoIf("SIP/5230-00000003", "0?skipoutcid") in new stack
    -- Executing [s@macro-dialout-trunk:10] Set("SIP/5230-00000003", "DIAL_TRUNK_OPTIONS=") in new stack
    -- Executing [s@macro-dialout-trunk:11] Macro("SIP/5230-00000003", "outbound-callerid,4") in new stack
    -- Executing [s@macro-outbound-callerid:1] ExecIf("SIP/5230-00000003", "0?Set(CALLERPRES()=)") in new stack
    -- Executing [s@macro-outbound-callerid:2] ExecIf("SIP/5230-00000003", "0?Set(REALCALLERIDNUM=5230)") in new stack
    -- Executing [s@macro-outbound-callerid:3] GotoIf("SIP/5230-00000003", "1?normcid") in new stack
    -- Goto (macro-outbound-callerid,s,6)
    -- Executing [s@macro-outbound-callerid:6] Set("SIP/5230-00000003", "USEROUTCID=") in new stack
    -- Executing [s@macro-outbound-callerid:7] Set("SIP/5230-00000003", "EMERGENCYCID=") in new stack
    -- Executing [s@macro-outbound-callerid:8] Set("SIP/5230-00000003", "TRUNKOUTCID=") in new stack
    -- Executing [s@macro-outbound-callerid:9] GotoIf("SIP/5230-00000003", "1?trunkcid") in new stack
    -- Goto (macro-outbound-callerid,s,12)
    -- Executing [s@macro-outbound-callerid:12] ExecIf("SIP/5230-00000003", "0?Set(CALLERID(all)=)") in new stack
    -- Executing [s@macro-outbound-callerid:13] ExecIf("SIP/5230-00000003", "0?Set(CALLERID(all)=)") in new stack
    -- Executing [s@macro-outbound-callerid:14] ExecIf("SIP/5230-00000003", "0?Set(CALLERPRES()=prohib_passed_screen)") in new stack
    -- Executing [s@macro-dialout-trunk:12] ExecIf("SIP/5230-00000003", "0?AGI(fixlocalprefix)") in new stack
    -- Executing [s@macro-dialout-trunk:13] Set("SIP/5230-00000003", "OUTNUM=4357828") in new stack
    -- Executing [s@macro-dialout-trunk:14] Set("SIP/5230-00000003", "custom=AMP") in new stack
    -- Executing [s@macro-dialout-trunk:15] ExecIf("SIP/5230-00000003", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^))") in new stack
    -- Executing [s@macro-dialout-trunk:16] Macro("SIP/5230-00000003", "dialout-trunk-predial-hook,") in new stack
    -- Executing [s@macro-dialout-trunk-predial-hook:1] GotoIf("SIP/5230-00000003", "0?custom-freepbx-a2billing,4357828,1:2") in new stack
    -- Goto (macro-dialout-trunk-predial-hook,s,2)
    -- Executing [s@macro-dialout-trunk-predial-hook:2] MacroExit("SIP/5230-00000003", "") in new stack
    -- Executing [s@macro-dialout-trunk:17] GotoIf("SIP/5230-00000003", "0?bypass,1") in new stack
    -- Executing [s@macro-dialout-trunk:18] GotoIf("SIP/5230-00000003", "1?customtrunk") in new stack
    -- Goto (macro-dialout-trunk,s,21)
    -- Executing [s@macro-dialout-trunk:21] Set("SIP/5230-00000003", "pre_num=AMP:DAHDI/g0/") in new stack
    -- Executing [s@macro-dialout-trunk:22] Set("SIP/5230-00000003", "the_num=OUTNUM") in new stack
    -- Executing [s@macro-dialout-trunk:23] Set("SIP/5230-00000003", "post_num=") in new stack
    -- Executing [s@macro-dialout-trunk:24] GotoIf("SIP/5230-00000003", "1?outnum:skipoutnum") in new stack
    -- Goto (macro-dialout-trunk,s,25)
    -- Executing [s@macro-dialout-trunk:25] Set("SIP/5230-00000003", "the_num=4357828") in new stack
    -- Executing [s@macro-dialout-trunk:26] Dial("SIP/5230-00000003", "DAHDI/g0/4357828,300,") in new stack
[Nov 14 15:54:17] WARNING[3279]: app_dial.c:1518 dial_exec_full: Unable to create channel of type 'DAHDI' (cause 34 - Circuit/channel congestion)
  == Everyone is busy/congested at this time (1:0/1/0)
    -- Executing [s@macro-dialout-trunk:27] Goto("SIP/5230-00000003", "s-CONGESTION,1") in new stack
    -- Goto (macro-dialout-trunk,s-CONGESTION,1)
    -- Executing [s-CONGESTION@macro-dialout-trunk:1] GotoIf("SIP/5230-00000003", "1?noreport") in new stack
    -- Goto (macro-dialout-trunk,s-CONGESTION,3)
    -- Executing [s-CONGESTION@macro-dialout-trunk:3] NoOp("SIP/5230-00000003", "TRUNK Dial failed due to CONGESTION - failing through to other trunks") in new stack
    -- Executing [4357828@from-internal:5] Macro("SIP/5230-00000003", "outisbusy,") in new stack
    -- Executing [s@macro-outisbusy:1] Playback("SIP/5230-00000003", "all-circuits-busy-now,noanswer") in new stack
    -- <SIP/5230-00000003> Playing 'all-circuits-busy-now.ulaw' (language 'en')
    -- Executing [s@macro-outisbusy:2] Playback("SIP/5230-00000003", "pls-try-call-later,noanswer") in new stack
    -- <SIP/5230-00000003> Playing 'pls-try-call-later.ulaw' (language 'en')
  == Spawn extension (macro-outisbusy, s, 2) exited non-zero on 'SIP/5230-00000003' in macro 'outisbusy'
  == Spawn extension (from-internal, 4357828, 5) exited non-zero on 'SIP/5230-00000003'
    -- Executing [h@from-internal:1] Macro("SIP/5230-00000003", "hangupcall") in new stack
    -- Executing [s@macro-hangupcall:1] GotoIf("SIP/5230-00000003", "1?skiprg") in new stack
    -- Goto (macro-hangupcall,s,4)
    -- Executing [s@macro-hangupcall:4] GotoIf("SIP/5230-00000003", "1?skipblkvm") in new stack
    -- Goto (macro-hangupcall,s,7)
    -- Executing [s@macro-hangupcall:7] GotoIf("SIP/5230-00000003", "1?theend") in new stack
    -- Goto (macro-hangupcall,s,9)
    -- Executing [s@macro-hangupcall:9] Hangup("SIP/5230-00000003", "") in new stack
  == Spawn extension (macro-hangupcall, s, 9) exited non-zero on 'SIP/5230-00000003' in macro 'hangupcall'
  == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/5230-00000003'
trixbox1*CLI>

Open in new window

0
 

Author Comment

by:Juan-ito
ID: 34132823
I found this line:

WARNING[3125]: app_dial.c:1518 dial_exec_full: Unable to create channel of type 'DAHDI' (cause 34 - Circuit/channel congestion)

Open in new window


Any Ideas?

Regards
0
 

Author Comment

by:Juan-ito
ID: 34133197
by the way...

trixbox1*CLI> dahdi show status
Description                              Alarms  IRQ    bpviol CRC4   Fra Codi Options  LBO
Wildcard TE122 Card 0                    OK      0      0      0      CAS HDB3 CRC4     0 db (CSU)/0-133 feet (DSX-1)
trixbox1*CLI> dahdi show channels
   Chan Extension  Context         Language   MOH Interpret        Blocked    State
 pseudo            default         en         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-pstn       en         default                         In Service
     14            from-pstn       en         default                         In Service
     15            from-pstn       en         default                         In Service
     17            from-pstn       en         default                         In Service
     18            from-pstn       en         default                         In Service
     19            from-pstn       en         default                         In Service
     20            from-pstn       en         default                         In Service
     21            from-pstn       en         default                         In Service
     22            from-pstn       en         default                         In Service
     23            from-pstn       en         default                         In Service
     24            from-pstn       en         default                         In Service
     25            from-pstn       en         default                         In Service
     26            from-pstn       en         default                         In Service
     27            from-pstn       en         default                         In Service
     28            from-pstn       en         default                         In Service
     29            from-pstn       en         default                         In Service
     30            from-pstn       en         default                         In Service
     31            from-pstn       en         default                         In Service
trixbox1*CLI>

Open in new window

0
 

Author Comment

by:Juan-ito
ID: 34133284
this is the content of my extensions_addional.conf:

;--------------------------------------------------------------------------------;
; Do NOT edit this file as it is auto-generated by FreePBX. All modifications to ;
; this file must be done via the web gui. There are alternative files to make    ;
; custom modifications, details at: http://freepbx.org/configuration_files       ;
;--------------------------------------------------------------------------------;
;

[globals]
FMDEVSTATE = TRUE
DNDDEVSTATE = TRUE
INTERCOMCODE = nointercom
CALLFILENAME = ""
DIAL_OPTIONS = tr
TRUNK_OPTIONS = 
DIAL_OUT = 9
FAX = 
FAX_RX = system
FAX_RX_EMAIL = fax@mydomain.com
FAX_RX_FROM = freepbx@gmail.com
INCOMING = group-all
NULL = ""
OPERATOR = 
OPERATOR_XTN = 
PARKNOTIFY = SIP/200
RECORDEXTEN = ""
RINGTIMER = 15
DIRECTORY = last
AFTER_INCOMING = 
IN_OVERRIDE = forcereghours
REGTIME = 7:55-17:05
REGDAYS = mon-fri
DIRECTORY_OPTS = 
DIALOUTIDS = 1
VM_PREFIX = *
VM_OPTS = 
VM_GAIN = 
VM_DDTYPE = u
TIMEFORMAT = kM
TONEZONE = us
ALLOW_SIP_ANON = yes
VMX_CONTEXT = from-internal
VMX_PRI = 1
VMX_TIMEDEST_CONTEXT = 
VMX_TIMEDEST_EXT = dovm
VMX_TIMEDEST_PRI = 1
VMX_LOOPDEST_CONTEXT = 
VMX_LOOPDEST_EXT = dovm
VMX_LOOPDEST_PRI = 1
VMX_OPTS_TIMEOUT = 
VMX_OPTS_LOOP = 
VMX_OPTS_DOVM = 
VMX_TIMEOUT = 2
VMX_REPEAT = 1
VMX_LOOPS = 1
TRANSFER_CONTEXT = from-internal-xfer
MIXMON_FORMAT = wav
MIXMON_DIR = 
MIXMON_POST = 
RECORDING_STATE = ENABLED
OUT_2 = IAX2/CUU-peer
OUTPREFIX_2 = 
OUTMAXCHANS_2 = 
OUTCID_2 = 
OUTKEEPCID_2 = off
OUTFAIL_2 = 
OUT_3 = IAX2/HMO-peer
OUTPREFIX_3 = 
OUTMAXCHANS_3 = 
OUTCID_3 = 
OUTDISABLE_2 = off
OUTKEEPCID_3 = off
OUTFAIL_3 = 
OUTDISABLE_3 = off
OUT_5 = AMP:A2B/$OUTNUM$
OUTPREFIX_5 = 
OUTMAXCHANS_5 = 
OUTCID_5 = 
OUTKEEPCID_5 = off
OUTFAIL_5 = 
OUTDISABLE_5 = off
OUT_1 = DAHDI/g0
OUTPREFIX_1 = 
OUTMAXCHANS_1 = 
OUTCID_1 = salidanormal
OUTKEEPCID_1 = off
OUTFAIL_1 = 
OUTDISABLE_1 = off
OUT_6 = AMP:g0
OUTPREFIX_6 = 
OUTMAXCHANS_6 = 
OUT_4 = AMP:dahdi/g0/$OUTNUM$
OUTPREFIX_4 = 
OUTMAXCHANS_4 = 
OUTCID_4 = 
OUTKEEPCID_4 = off
OUTFAIL_4 = 
OUTDISABLE_4 = off
OUTCID_6 = 
OUTKEEPCID_6 = off
OUTFAIL_6 = 
OUTDISABLE_6 = off
ASTETCDIR = /etc/asterisk
ASTMODDIR = /usr/lib/asterisk/modules
ASTVARLIBDIR = /var/lib/asterisk
ASTAGIDIR = /var/lib/asterisk/agi-bin
ASTSPOOLDIR = /var/spool/asterisk
ASTRUNDIR = /var/run/asterisk
ASTLOGDIR = /var/log/asterisk
CWINUSEBUSY = true
AMPMGRUSER = admin
AMPMGRPASS = amp111
ASTVERSION = 1.6.0.26
ASTCHANDAHDI = 1
#include globals_custom.conf

;end of [globals]

[macro-speeddial-lookup]
include => macro-speeddial-lookup-custom
exten => s,1,GotoIf($["${ARG2}"=""]]?lookupsys)
exten => s,n,Set(SPEEDDIALNUMBER=)
exten => s,n(lookupuser),Set(SPEEDDIALNUMBER=${DB(AMPUSER/${ARG2}/speeddials/${ARG1})})
exten => s,n,GotoIf($["${SPEEDDIALNUMBER}"=""]?lookupsys)
exten => s,n,Noop(Found speeddial ${ARG1} for user ${ARG2}: ${SPEEDDIALNUMBER})
exten => s,n,Goto(end)
exten => s,lookupuser+101(lookupsys),Set(SPEEDDIALNUMBER=${DB(sysspeeddials/${ARG1})})
exten => s,n,GotoIf($["${SPEEDDIALNUMBER}"=""]?failed)
exten => s,n,Noop(Found system speeddial ${ARG1}: ${SPEEDDIALNUMBER})
exten => s,n,Goto(end)
exten => s,lookupsys+101(failed),Noop(No system or user speeddial found)
exten => s,n(end),Noop(End of Speeddial-lookup)

; end of [macro-speeddial-lookup]


[app-speeddial]
include => app-speeddial-custom
exten => _*0.,1,Macro(user-callerid,)
exten => _*0.,n,Set(SPEEDDIALLOCATION=${EXTEN:2})
exten => _*0.,n(lookup),Macro(speeddial-lookup,${SPEEDDIALLOCATION},${AMPUSER})
exten => _*0.,n,GotoIf($["${SPEEDDIALNUMBER}"=""]?failed)
exten => _*0.,n,Dial(Local/${SPEEDDIALNUMBER}@from-internal/n,)
exten => _*0.,lookup+101(failed),Playback(speed-dial-empty)
exten => _*0.,n,Congestion()
exten => *75,1,Goto(app-speeddial-set,s,1)

; end of [app-speeddial]


[app-speeddial-set]
include => app-speeddial-set-custom
exten => s,1,Macro(user-callerid,)
exten => s,n(setloc),Read(newlocation,speed-enterlocation,,,,)
exten => s,n(lookup),Macro(speeddial-lookup,${newlocation},${AMPUSER})
exten => s,n(lookup),GotoIf($["${SPEEDDIALNUMBER}"!=""]?conflicts)
exten => s,n(setnum),Read(newnum,speed-enternumber,,,,)
exten => s,n(success),Set(DB(AMPUSER/${AMPUSER}/speeddials/${newlocation})=${newnum})
exten => s,n,Playback(speed-dial)
exten => s,n,SayDigits(${newlocation})
exten => s,n,Playback(is-set-to)
exten => s,n,SayDigits(${newnum})
exten => s,n,Hangup
exten => s,n(conflicts),Playback(speed-dial)
exten => s,n,SayDigits(${newlocation})
exten => s,n,Playback(is-in-use)
exten => s,n,Background(press-1&to-listen-to-it&press-2&to-enter-a-diff&location&press-3&to-change&telephone-number)
exten => s,n,WaitExten(60,)
exten => 1,1,Playback(speed-dial)
exten => 1,n,SayDigits(${newlocation})
exten => 1,n,Playback(is-set-to)
exten => 1,n,SayDigits(${SPEEDDIALNUMBER})
exten => 1,n,Goto(s,conflicts)
exten => 2,1,Goto(s,setloc)
exten => 3,1,Goto(s,setnum)
exten => t,1,Congestion()

; end of [app-speeddial-set]


[ext-group]
include => ext-group-custom
exten => 936,1,Macro(user-callerid,)
exten => 936,n,GotoIf($["foo${BLKVM_OVERRIDE}" = "foo"]?skipdb)
exten => 936,n,GotoIf($["${DB(${BLKVM_OVERRIDE})}" = "TRUE"]?skipov)
exten => 936,n(skipdb),Set(__NODEST=)
exten => 936,n,Set(__BLKVM_OVERRIDE=BLKVM/${EXTEN}/${CHANNEL})
exten => 936,n,Set(__BLKVM_BASE=${EXTEN})
exten => 936,n,Set(DB(${BLKVM_OVERRIDE})=TRUE)
exten => 936,n(skipov),Set(RRNODEST=${NODEST})
exten => 936,n(skipvmblk),Set(__NODEST=${EXTEN})
exten => 936,n,Set(RecordMethod=Group)
exten => 936,n,Macro(record-enable,5701-5702-5703-4701#-4702#-4703#-3701#-3702#-3703#,${RecordMethod})
exten => 936,n,Set(RingGroupMethod=ringall)
exten => 936,n(DIALGRP),Macro(dial,20,${DIAL_OPTIONS},5701-5702-5703-4701#-4702#-4703#-3701#-3702#-3703#)
exten => 936,n,Set(RingGroupMethod=)
exten => 936,n,GotoIf($["foo${RRNODEST}" != "foo"]?nodest)
exten => 936,n,Set(__NODEST=)
exten => 936,n,dbDel(${BLKVM_OVERRIDE})
exten => 936,n,Goto(ivr-2,s,1)
exten => 936,n(nodest),Noop(SKIPPING DEST, CALL CAME FROM Q/RG: ${RRNODEST})
exten => 5400,1,Macro(user-callerid,)
exten => 5400,n,GotoIf($["foo${BLKVM_OVERRIDE}" = "foo"]?skipdb)
exten => 5400,n,GotoIf($["${DB(${BLKVM_OVERRIDE})}" = "TRUE"]?skipov)
exten => 5400,n(skipdb),Set(__NODEST=)
exten => 5400,n,Set(__BLKVM_OVERRIDE=BLKVM/${EXTEN}/${CHANNEL})
exten => 5400,n,Set(__BLKVM_BASE=${EXTEN})
exten => 5400,n,Set(DB(${BLKVM_OVERRIDE})=TRUE)
exten => 5400,n(skipov),Set(RRNODEST=${NODEST})
exten => 5400,n(skipvmblk),Set(__NODEST=${EXTEN})
exten => 5400,n,Set(RecordMethod=Group)
exten => 5400,n,Macro(record-enable,5401-5402-5403-5404-5405,${RecordMethod})
exten => 5400,n,Set(RingGroupMethod=ringall)
exten => 5400,n(DIALGRP),Macro(dial,20,${DIAL_OPTIONS},5401-5402-5403-5404-5405)
exten => 5400,n,Set(RingGroupMethod=)
exten => 5400,n,GotoIf($["foo${RRNODEST}" != "foo"]?nodest)
exten => 5400,n,Set(__NODEST=)
exten => 5400,n,dbDel(${BLKVM_OVERRIDE})
exten => 5400,n,Goto(from-did-direct,5000,1)
exten => 5400,n(nodest),Noop(SKIPPING DEST, CALL CAME FROM Q/RG: ${RRNODEST})

; end of [ext-group]


[app-cf-busy-off]
include => app-cf-busy-off-custom
exten => *91,1,Answer
exten => *91,n,Wait(1)
exten => *91,n,Macro(user-callerid,)
exten => *91,n,dbDel(CFB/${AMPUSER})
exten => *91,n,Playback(call-fwd-on-busy&de-activated)
exten => *91,n,Macro(hangupcall,)
exten => _*91.,1,Answer
exten => _*91.,n,Wait(1)
exten => _*91.,n,Set(fromext=${EXTEN:3})
exten => _*91.,n,dbDel(CFB/${fromext})
exten => _*91.,n,Playback(call-fwd-on-busy&for&extension)
exten => _*91.,n,SayDigits(${fromext})
exten => _*91.,n,Playback(cancelled)
exten => _*91.,n,Macro(hangupcall,)

; end of [app-cf-busy-off]


[app-cf-busy-off-any]
include => app-cf-busy-off-any-custom
exten => *92,1,Answer
exten => *92,n,Wait(1)
exten => *92,n,Playback(please-enter-your&extension)
exten => *92,n,Read(fromext,then-press-pound,,,,)
exten => *92,n,Wait(1)
exten => *92,n,dbDel(CFB/${fromext})
exten => *92,n,Playback(call-fwd-on-busy&for&extension)
exten => *92,n,SayDigits(${fromext})
exten => *92,n,Playback(cancelled)
exten => *92,n,Macro(hangupcall,)

; end of [app-cf-busy-off-any]


[app-cf-busy-on]
include => app-cf-busy-on-custom
exten => *90,1,Answer
exten => *90,n,Wait(1)
exten => *90,n,Macro(user-callerid,)
exten => *90,n,Playback(call-fwd-on-busy)
exten => *90,n,Playback(please-enter-your&extension)
exten => *90,n,Read(fromext,then-press-pound,,,,)
exten => *90,n,Set(fromext=${IF($["foo${fromext}"="foo"]?${AMPUSER}:${fromext})})
exten => *90,n,Wait(1)
exten => *90,n(startread),Playback(ent-target-attendant)
exten => *90,n,Read(toext,then-press-pound,,,,)
exten => *90,n,GotoIf($["foo${toext}"="foo"]?startread)
exten => *90,n,Wait(1)
exten => *90,n,Set(DB(CFB/${fromext})=${toext})
exten => *90,n,Playback(call-fwd-on-busy&for&extension)
exten => *90,n,SayDigits(${fromext})
exten => *90,n,Playback(is-set-to)
exten => *90,n,SayDigits(${toext})
exten => *90,n,Macro(hangupcall,)
exten => _*90.,1,Answer
exten => _*90.,n,Wait(1)
exten => _*90.,n,Macro(user-callerid,)
exten => _*90.,n,Set(DB(CFB/${AMPUSER})=${EXTEN:3})
exten => _*90.,n,Playback(call-fwd-on-busy&for&extension)
exten => _*90.,n,SayDigits(${AMPUSER})
exten => _*90.,n,Playback(is-set-to)
exten => _*90.,n,SayDigits(${EXTEN:3})
exten => _*90.,n,Macro(hangupcall,)

; end of [app-cf-busy-on]


[app-cf-off]
include => app-cf-off-custom
exten => *73,1,Answer
exten => *73,n,Wait(1)
exten => *73,n,Macro(user-callerid,)
exten => *73,n,dbDel(CF/${AMPUSER})
exten => *73,n,Playback(call-fwd-unconditional&de-activated)
exten => *73,n,Macro(hangupcall,)
exten => _*73.,1,Answer
exten => _*73.,n,Wait(1)
exten => _*73.,n,Set(fromext=${EXTEN:3})
exten => _*73.,n,dbDel(CF/${fromext})
exten => _*73.,n,Playback(call-fwd-unconditional&for&extension)
exten => _*73.,n,SayDigits(${fromext})
exten => _*73.,n,Playback(cancelled)
exten => _*73.,n,Macro(hangupcall,)

; end of [app-cf-off]


[app-cf-off-any]
include => app-cf-off-any-custom
exten => *74,1,Answer
exten => *74,n,Wait(1)
exten => *74,n,Playback(please-enter-your&extension)
exten => *74,n,Read(fromext,then-press-pound,,,,)
exten => *74,n,Wait(1)
exten => *74,n,dbDel(CF/${fromext})
exten => *74,n,Playback(call-fwd-unconditional&for&extension)
exten => *74,n,SayDigits(${fromext})
exten => *74,n,Playback(cancelled)
exten => *74,n,Macro(hangupcall,)

; end of [app-cf-off-any]


[app-cf-on]
include => app-cf-on-custom
exten => *72,1,Answer
exten => *72,n,Wait(1)
exten => *72,n,Macro(user-callerid,)
exten => *72,n,Playback(call-fwd-unconditional)
exten => *72,n,Playback(please-enter-your&extension)
exten => *72,n,Read(fromext,then-press-pound,,,,)
exten => *72,n,Set(fromext=${IF($["foo${fromext}"="foo"]?${AMPUSER}:${fromext})})
exten => *72,n,Wait(1)
exten => *72,n(startread),Playback(ent-target-attendant)
exten => *72,n,Read(toext,then-press-pound,,,,)
exten => *72,n,GotoIf($["foo${toext}"="foo"]?startread)
exten => *72,n,Wait(1)
exten => *72,n,Set(DB(CF/${fromext})=${toext})
exten => *72,n,Playback(call-fwd-unconditional&for&extension)
exten => *72,n,SayDigits(${fromext})
exten => *72,n,Playback(is-set-to)
exten => *72,n,SayDigits(${toext})
exten => *72,n,Macro(hangupcall,)
exten => _*72.,1,Answer
exten => _*72.,n,Wait(1)
exten => _*72.,n,Macro(user-callerid,)
exten => _*72.,n,Set(DB(CF/${AMPUSER})=${EXTEN:3})
exten => _*72.,n,Playback(call-fwd-unconditional&for&extension)
exten => _*72.,n,SayDigits(${AMPUSER})
exten => _*72.,n,Playback(is-set-to)
exten => _*72.,n,SayDigits(${EXTEN:3})
exten => _*72.,n,Macro(hangupcall,)

; end of [app-cf-on]


[app-cf-unavailable-off]
include => app-cf-unavailable-off-custom
exten => *53,1,Answer
exten => *53,n,Wait(1)
exten => *53,n,Macro(user-callerid,)
exten => *53,n,dbDel(CFU/${AMPUSER})
exten => *53,n,Playback(call-fwd-no-ans&de-activated)
exten => *53,n,Macro(hangupcall,)
exten => _*53.,1,Answer
exten => _*53.,n,Wait(1)
exten => _*53.,n,Set(fromext=${EXTEN:3})
exten => _*53.,n,dbDel(CFU/${fromext})
exten => _*53.,n,Playback(call-fwd-no-ans&for&extension)
exten => _*53.,n,SayDigits(${fromext})
exten => _*53.,n,Playback(cancelled)
exten => _*53.,n,Macro(hangupcall,)

; end of [app-cf-unavailable-off]


[app-cf-unavailable-on]
include => app-cf-unavailable-on-custom
exten => *52,1,Answer
exten => *52,n,Wait(1)
exten => *52,n,Macro(user-callerid,)
exten => *52,n,Playback(call-fwd-no-ans)
exten => *52,n,Playback(please-enter-your&extension)
exten => *52,n,Read(fromext,then-press-pound,,,,)
exten => *52,n,Set(fromext=${IF($["foo${fromext}"="foo"]?${AMPUSER}:${fromext})})
exten => *52,n,Wait(1)
exten => *52,n(startread),Playback(ent-target-attendant)
exten => *52,n,Read(toext,then-press-pound,,,,)
exten => *52,n,GotoIf($["foo${toext}"="foo"]?startread)
exten => *52,n,Wait(1)
exten => *52,n,Set(DB(CFU/${fromext})=${toext})
exten => *52,n,Playback(call-fwd-no-ans&for&extension)
exten => *52,n,SayDigits(${fromext})
exten => *52,n,Playback(is-set-to)
exten => *52,n,SayDigits(${toext})
exten => *52,n,Macro(hangupcall,)
exten => _*52.,1,Answer
exten => _*52.,n,Wait(1)
exten => _*52.,n,Macro(user-callerid,)
exten => _*52.,n,Set(DB(CFU/${AMPUSER})=${EXTEN:3})
exten => _*52.,n,Playback(call-fwd-no-ans&for&extension)
exten => _*52.,n,SayDigits(${AMPUSER})
exten => _*52.,n,Playback(is-set-to)
exten => _*52.,n,SayDigits(${EXTEN:3})
exten => _*52.,n,Macro(hangupcall,)

; end of [app-cf-unavailable-on]


[app-announcement-1]
include => app-announcement-1-custom
exten => s,1,GotoIf($["${CDR(disposition)}" = "ANSWERED"]?begin)
exten => s,n,Answer
exten => s,n,Wait(1)
exten => s,n(begin),Noop(Playing announcement Fraud)
exten => s,n,Playback(custom/FraudNew,noanswer)
exten => s,n,Goto(ext-local,vms5232,1)

; end of [app-announcement-1]


[app-recordings]
include => app-recordings-custom
exten => *77,1,Macro(user-callerid,)
exten => *77,n,Wait(2)
exten => *77,n,Macro(systemrecording,dorecord)
exten => *99,1,Macro(user-callerid,)
exten => *99,n,Wait(2)
exten => *99,n,Macro(systemrecording,docheck)

; end of [app-recordings]


[ivr-3]
include => ivr-3-custom
include => from-did-direct-ivr
include => app-directory
exten => #,1,dbDel(${BLKVM_OVERRIDE})
exten => #,n,Set(__NODEST=)
exten => #,n,Goto(app-directory,#,1)
exten => h,1,Hangup
exten => s,1,Set(MSG=custom/Agu_enlish)
exten => s,n,Set(LOOPCOUNT=0)
exten => s,n,Set(__DIR-CONTEXT=default)
exten => s,n,Set(_IVR_CONTEXT_${CONTEXT}=${IVR_CONTEXT})
exten => s,n,Set(_IVR_CONTEXT=${CONTEXT})
exten => s,n,GotoIf($["${CDR(disposition)}" = "ANSWERED"]?begin)
exten => s,n,Answer
exten => s,n,Wait(1)
exten => s,n(begin),Set(TIMEOUT(digit)=3)
exten => s,n,Set(TIMEOUT(response)=10)
exten => s,n,Set(__IVR_RETVM=)
exten => s,n,ExecIf($["${MSG}" != ""]?Background(${MSG}))
exten => s,n,WaitExten(,)
exten => hang,1,Playback(vm-goodbye)
exten => hang,n,Hangup
exten => 0,1,dbDel(${BLKVM_OVERRIDE})
exten => 0,n,Set(__NODEST=)
exten => 0,n,GotoIf($["x${IVR_CONTEXT_${CONTEXT}}" = "x"]?from-did-direct,5000,1:${IVR_CONTEXT_${CONTEXT}},return,1)
exten => 1,1,dbDel(${BLKVM_OVERRIDE})
exten => 1,n,Set(__NODEST=)
exten => 1,n,GotoIf($["x${IVR_CONTEXT_${CONTEXT}}" = "x"]?ext-group,5400,1:${IVR_CONTEXT_${CONTEXT}},return,1)
exten => i,1,Playback(invalid)
exten => i,n,Goto(loop,1)
exten => t,1,Goto(loop,1)
exten => loop,1,Set(LOOPCOUNT=$[${LOOPCOUNT} + 1])
exten => loop,n,GotoIf($[${LOOPCOUNT} > 2]?hang,1)
exten => loop,n,Goto(ivr-3,s,begin)
exten => return,1,Set(MSG=custom/Agu_enlish)
exten => return,n,Set(_IVR_CONTEXT=${CONTEXT})
exten => return,n,Set(_IVR_CONTEXT_${CONTEXT}=${IVR_CONTEXT_${CONTEXT}})
exten => return,n,Goto(ivr-3,s,begin)
exten => fax,1,Goto(ext-fax,in_fax,1)

; end of [ivr-3]


[ivr-2]
include => ivr-2-custom
include => from-did-direct-ivr
include => app-directory
exten => #,1,dbDel(${BLKVM_OVERRIDE})
exten => #,n,Set(__NODEST=)
exten => #,n,Goto(app-directory,#,1)
exten => h,1,Hangup
exten => s,1,Set(MSG=custom/Agu_spanish)
exten => s,n,Set(LOOPCOUNT=0)
exten => s,n,Set(__DIR-CONTEXT=default)
exten => s,n,Set(_IVR_CONTEXT_${CONTEXT}=${IVR_CONTEXT})
exten => s,n,Set(_IVR_CONTEXT=${CONTEXT})
exten => s,n,GotoIf($["${CDR(disposition)}" = "ANSWERED"]?begin)
exten => s,n,Answer
exten => s,n,Wait(1)
exten => s,n(begin),Set(TIMEOUT(digit)=3)
exten => s,n,Set(TIMEOUT(response)=1)
exten => s,n,Set(__IVR_RETVM=)
exten => s,n,ExecIf($["${MSG}" != ""]?Background(${MSG}))
exten => s,n,WaitExten(,)
exten => hang,1,Playback(vm-goodbye)
exten => hang,n,Hangup
exten => 0,1,dbDel(${BLKVM_OVERRIDE})
exten => 0,n,Set(__NODEST=)
exten => 0,n,GotoIf($["x${IVR_CONTEXT_${CONTEXT}}" = "x"]?from-did-direct,5000,1:${IVR_CONTEXT_${CONTEXT}},return,1)
exten => 1,1,dbDel(${BLKVM_OVERRIDE})
exten => 1,n,Set(__NODEST=)
exten => 1,n,GotoIf($["x${IVR_CONTEXT_${CONTEXT}}" = "x"]?ivr-3,s,1:${IVR_CONTEXT_${CONTEXT}},return,1)
exten => 2,1,dbDel(${BLKVM_OVERRIDE})
exten => 2,n,Set(__NODEST=)
exten => 2,n,GotoIf($["x${IVR_CONTEXT_${CONTEXT}}" = "x"]?ext-group,5400,1:${IVR_CONTEXT_${CONTEXT}},return,1)
exten => i,1,Playback(invalid)
exten => i,n,Goto(loop,1)
exten => t,1,Goto(loop,1)
exten => loop,1,Set(LOOPCOUNT=$[${LOOPCOUNT} + 1])
exten => loop,n,GotoIf($[${LOOPCOUNT} > 2]?hang,1)
exten => loop,n,Goto(ivr-2,s,begin)
exten => return,1,Set(MSG=custom/Agu_spanish)
exten => return,n,Set(_IVR_CONTEXT=${CONTEXT})
exten => return,n,Set(_IVR_CONTEXT_${CONTEXT}=${IVR_CONTEXT_${CONTEXT}})
exten => return,n,Goto(ivr-2,s,begin)
exten => fax,1,Goto(ext-fax,in_fax,1)

; end of [ivr-2]


[app-fmf-toggle]
include => app-fmf-toggle-custom
exten => *21,1,Goto(app-fmf-toggle,s,start)
exten => s,1(start),Answer
exten => s,n,Wait(1)
exten => s,n,Macro(user-callerid,)
exten => s,n,GotoIf($["${DB(AMPUSER/${AMPUSER}/followme/ddial)}" = "EXTENSION"]?activate)
exten => s,n,GotoIf($["${DB(AMPUSER/${AMPUSER}/followme/ddial)}" = "DIRECT"]?deactivate:end)
exten => s,n(deactivate),Set(DB(AMPUSER/${AMPUSER}/followme/ddial)=EXTENSION)
exten => s,n,Set(STATE=NOT_INUSE)
exten => s,n,Gosub(app-fmf-toggle,sstate,1)
exten => s,n,Playback(followme&de-activated)
exten => s,n(end),Macro(hangupcall,)
exten => s,n(activate),Set(DB(AMPUSER/${AMPUSER}/followme/ddial)=DIRECT)
exten => s,n,Set(STATE=INUSE)
exten => s,n,Gosub(app-fmf-toggle,sstate,1)
exten => s,n,Playback(followme&activated)
exten => s,n,Macro(hangupcall,)
exten => sstate,1,Set(DEVICES=${DB(AMPUSER/${AMPUSER}/device)})
exten => sstate,n,GotoIf($["${DEVICES}" = "" ]?return)
exten => sstate,n,Set(LOOPCNT=${FIELDQTY(DEVICES,&)})
exten => sstate,n,Set(ITER=1)
exten => sstate,n(begin),Set(DEVICE_STATE(Custom:FOLLOWME${CUT(DEVICES,&,${ITER})})=${STATE})
exten => sstate,n,Set(ITER=$[${ITER} + 1])
exten => sstate,n,GotoIf($[${ITER} <= ${LOOPCNT}]?begin)
exten => sstate,n(return),Return()

; end of [app-fmf-toggle]


[ext-findmefollow]
include => ext-findmefollow-custom
exten => *215000,1,Goto(app-fmf-toggle,*21,1)
exten => *215000,hint,Custom:FOLLOWME5000
exten => *215010,1,Goto(app-fmf-toggle,*21,1)
exten => *215010,hint,Custom:FOLLOWME5010
exten => *215020,1,Goto(app-fmf-toggle,*21,1)
exten => *215020,hint,Custom:FOLLOWME5020
exten => *215021,1,Goto(app-fmf-toggle,*21,1)
exten => *215021,hint,Custom:FOLLOWME5021
exten => *215022,1,Goto(app-fmf-toggle,*21,1)
exten => *215022,hint,Custom:FOLLOWME5022
exten => *215030,1,Goto(app-fmf-toggle,*21,1)
exten => *215030,hint,Custom:FOLLOWME5030
exten => *215031,1,Goto(app-fmf-toggle,*21,1)
exten => *215031,hint,Custom:FOLLOWME5031
exten => *215032,1,Goto(app-fmf-toggle,*21,1)
exten => *215032,hint,Custom:FOLLOWME5032
exten => *215100,1,Goto(app-fmf-toggle,*21,1)
exten => *215100,hint,Custom:FOLLOWME5100
exten => *215110,1,Goto(app-fmf-toggle,*21,1)
exten => *215110,hint,Custom:FOLLOWME5110
exten => *215111,1,Goto(app-fmf-toggle,*21,1)
exten => *215111,hint,Custom:FOLLOWME5111
exten => *215112,1,Goto(app-fmf-toggle,*21,1)
exten => *215112,hint,Custom:FOLLOWME5112
exten => *215113,1,Goto(app-fmf-toggle,*21,1)
exten => *215113,hint,Custom:FOLLOWME5113
exten => *215120,1,Goto(app-fmf-toggle,*21,1)
exten => *215120,hint,Custom:FOLLOWME5120
exten => *215121,1,Goto(app-fmf-toggle,*21,1)
exten => *215121,hint,Custom:FOLLOWME5121
exten => *215122,1,Goto(app-fmf-toggle,*21,1)
exten => *215122,hint,Custom:FOLLOWME5122
exten => *215123,1,Goto(app-fmf-toggle,*21,1)
exten => *215123,hint,Custom:FOLLOWME5123
exten => *215124,1,Goto(app-fmf-toggle,*21,1)
exten => *215124,hint,Custom:FOLLOWME5124
exten => *215125,1,Goto(app-fmf-toggle,*21,1)
exten => *215125,hint,Custom:FOLLOWME5125
exten => *215130,1,Goto(app-fmf-toggle,*21,1)
exten => *215130,hint,Custom:FOLLOWME5130
exten => *215131,1,Goto(app-fmf-toggle,*21,1)
exten => *215131,hint,Custom:FOLLOWME5131
exten => *215140,1,Goto(app-fmf-toggle,*21,1)
exten => *215140,hint,Custom:FOLLOWME5140
exten => *215141,1,Goto(app-fmf-toggle,*21,1)
exten => *215141,hint,Custom:FOLLOWME5141
exten => *215150,1,Goto(app-fmf-toggle,*21,1)
exten => *215150,hint,Custom:FOLLOWME5150
exten => *215200,1,Goto(app-fmf-toggle,*21,1)
exten => *215200,hint,Custom:FOLLOWME5200
exten => *215201,1,Goto(app-fmf-toggle,*21,1)
exten => *215201,hint,Custom:FOLLOWME5201
exten => *215202,1,Goto(app-fmf-toggle,*21,1)
exten => *215202,hint,Custom:FOLLOWME5202
exten => *215203,1,Goto(app-fmf-toggle,*21,1)
exten => *215203,hint,Custom:FOLLOWME5203
exten => *215210,1,Goto(app-fmf-toggle,*21,1)
exten => *215210,hint,Custom:FOLLOWME5210
exten => *215220,1,Goto(app-fmf-toggle,*21,1)
exten => *215220,hint,Custom:FOLLOWME5220
exten => *215230,1,Goto(app-fmf-toggle,*21,1)
exten => *215230,hint,Custom:FOLLOWME5230
exten => *215231,1,Goto(app-fmf-toggle,*21,1)
exten => *215231,hint,Custom:FOLLOWME5231
exten => *215232,1,Goto(app-fmf-toggle,*21,1)
exten => *215232,hint,Custom:FOLLOWME5232
exten => *215240,1,Goto(app-fmf-toggle,*21,1)
exten => *215240,hint,Custom:FOLLOWME5240
exten => *215300,1,Goto(app-fmf-toggle,*21,1)
exten => *215300,hint,Custom:FOLLOWME5300
exten => *215350,1,Goto(app-fmf-toggle,*21,1)
exten => *215350,hint,Custom:FOLLOWME5350
exten => *215401,1,Goto(app-fmf-toggle,*21,1)
exten => *215401,hint,Custom:FOLLOWME5401
exten => *215402,1,Goto(app-fmf-toggle,*21,1)
exten => *215402,hint,Custom:FOLLOWME5402
exten => *215403,1,Goto(app-fmf-toggle,*21,1)
exten => *215403,hint,Custom:FOLLOWME5403
exten => *215404,1,Goto(app-fmf-toggle,*21,1)
exten => *215404,hint,Custom:FOLLOWME5404
exten => *215405,1,Goto(app-fmf-toggle,*21,1)
exten => *215405,hint,Custom:FOLLOWME5405
exten => *215406,1,Goto(app-fmf-toggle,*21,1)
exten => *215406,hint,Custom:FOLLOWME5406
exten => *215407,1,Goto(app-fmf-toggle,*21,1)
exten => *215407,hint,Custom:FOLLOWME5407
exten => *215410,1,Goto(app-fmf-toggle,*21,1)
exten => *215410,hint,Custom:FOLLOWME5410
exten => *215420,1,Goto(app-fmf-toggle,*21,1)
exten => *215420,hint,Custom:FOLLOWME5420
exten => *215490,1,Goto(app-fmf-toggle,*21,1)
exten => *215490,hint,Custom:FOLLOWME5490
exten => *215491,1,Goto(app-fmf-toggle,*21,1)
exten => *215491,hint,Custom:FOLLOWME5491
exten => *215492,1,Goto(app-fmf-toggle,*21,1)
exten => *215492,hint,Custom:FOLLOWME5492
exten => *215493,1,Goto(app-fmf-toggle,*21,1)
exten => *215493,hint,Custom:FOLLOWME5493
exten => *215494,1,Goto(app-fmf-toggle,*21,1)
exten => *215494,hint,Custom:FOLLOWME5494
exten => *215501,1,Goto(app-fmf-toggle,*21,1)
exten => *215501,hint,Custom:FOLLOWME5501
exten => *215502,1,Goto(app-fmf-toggle,*21,1)
exten => *215502,hint,Custom:FOLLOWME5502
exten => *215510,1,Goto(app-fmf-toggle,*21,1)
exten => *215510,hint,Custom:FOLLOWME5510
exten => *215511,1,Goto(app-fmf-toggle,*21,1)
exten => *215511,hint,Custom:FOLLOWME5511
exten => *215512,1,Goto(app-fmf-toggle,*21,1)
exten => *215512,hint,Custom:FOLLOWME5512
exten => *215513,1,Goto(app-fmf-toggle,*21,1)
exten => *215513,hint,Custom:FOLLOWME5513
exten => *215514,1,Goto(app-fmf-toggle,*21,1)
exten => *215514,hint,Custom:FOLLOWME5514
exten => *215515,1,Goto(app-fmf-toggle,*21,1)
exten => *215515,hint,Custom:FOLLOWME5515
exten => *215530,1,Goto(app-fmf-toggle,*21,1)
exten => *215530,hint,Custom:FOLLOWME5530
exten => *215531,1,Goto(app-fmf-toggle,*21,1)
exten => *215531,hint,Custom:FOLLOWME5531
exten => *215532,1,Goto(app-fmf-toggle,*21,1)
exten => *215532,hint,Custom:FOLLOWME5532
exten => *215533,1,Goto(app-fmf-toggle,*21,1)
exten => *215533,hint,Custom:FOLLOWME5533
exten => *215534,1,Goto(app-fmf-toggle,*21,1)
exten => *215534,hint,Custom:FOLLOWME5534
exten => *215535,1,Goto(app-fmf-toggle,*21,1)
exten => *215535,hint,Custom:FOLLOWME5535
exten => *215701,1,Goto(app-fmf-toggle,*21,1)
exten => *215701,hint,Custom:FOLLOWME5701
exten => *215702,1,Goto(app-fmf-toggle,*21,1)
exten => *215702,hint,Custom:FOLLOWME5702
exten => *215703,1,Goto(app-fmf-toggle,*21,1)
exten => *215703,hint,Custom:FOLLOWME5703
exten => *215710,1,Goto(app-fmf-toggle,*21,1)
exten => *215710,hint,Custom:FOLLOWME5710
exten => *215800,1,Goto(app-fmf-toggle,*21,1)
exten => *215800,hint,Custom:FOLLOWME5800
exten => *215810,1,Goto(app-fmf-toggle,*21,1)
exten => *215810,hint,Custom:FOLLOWME5810
exten => *215811,1,Goto(app-fmf-toggle,*21,1)
exten => *215811,hint,Custom:FOLLOWME5811
exten => *215812,1,Goto(app-fmf-toggle,*21,1)
exten => *215812,hint,Custom:FOLLOWME5812
exten => *215910,1,Goto(app-fmf-toggle,*21,1)
exten => *215910,hint,Custom:FOLLOWME5910
exten => *215920,1,Goto(app-fmf-toggle,*21,1)
exten => *215920,hint,Custom:FOLLOWME5920
exten => FM5000,1,Goto(5000,FM5000)
exten => 5000,1,GotoIf($[ "${DB(AMPUSER/5000/followme/ddial)}" = "EXTENSION" ]?ext-local,5000,1)
exten => 5000,n(FM5000),Macro(user-callerid,)
exten => 5000,n,GotoIf($["foo${BLKVM_OVERRIDE}" = "foo"]?skipdb)
exten => 5000,n,GotoIf($["${DB(${BLKVM_OVERRIDE})}" = "TRUE"]?skipov)
exten => 5000,n(skipdb),Set(__NODEST=)
exten => 5000,n,Set(__BLKVM_OVERRIDE=BLKVM/${EXTEN}/${CHANNEL})
exten => 5000,n,Set(__BLKVM_BASE=${EXTEN})
exten => 5000,n,Set(DB(${BLKVM_OVERRIDE})=TRUE)
exten => 5000,n(skipov),Set(RRNODEST=${NODEST})
exten => 5000,n(skipvmblk),Set(__NODEST=${EXTEN})
exten => 5000,n,Set(RecordMethod=Group)
exten => 5000,n,Macro(record-enable,${DB(AMPUSER/5000/followme/grplist)},${RecordMethod})
exten => 5000,n(skipsimple),Set(RingGroupMethod=ringallv2)
exten => 5000,n,Set(_FMGRP=5000)
exten => 5000,n(DIALGRP),GotoIf($[ "${DB(AMPUSER/5000/followme/grpconf)}" = "ENABLED" ]?doconfirm)
exten => 5000,n,Macro(dial,$[ ${DB(AMPUSER/5000/followme/grptime)} + ${DB(AMPUSER/5000/followme/prering)} ],${DIAL_OPTIONS},${DB(AMPUSER/5000/followme/grplist)})
exten => 5000,n,Goto(nextstep)
exten => 5000,n(doconfirm),Macro(dial-confirm,$[ ${DB(AMPUSER/5000/followme/grptime)} + ${DB(AMPUSER/5000/followme/prering)} ],${DIAL_OPTIONS},${DB(AMPUSER/5000/followme/grplist)},5000)
exten => 5000,n(nextstep),Set(RingGroupMethod=)
exten => 5000,n,GotoIf($["foo${RRNODEST}" != "foo"]?nodest)
exten => 5000,n,Set(__NODEST=)
exten => 5000,n,dbDel(${BLKVM_OVERRIDE})
exten => 5000,n,Goto(ivr-2,s,1)
exten => 5000,n(nodest),Noop(SKIPPING DEST, CALL CAME FROM Q/RG: ${RRNODEST})

; end of [ext-findmefollow]


[fmgrps]
include => fmgrps-custom
exten => _RG-5000-.,1,Macro(dial,${DB(AMPUSER/5000/followme/grptime)},M(confirm^^^5000)${DIAL_OPTIONS},${EXTEN:8})

; end of [fmgrps]


[app-dialvm]
include => app-dialvm-custom
exten => *98,1,Answer
exten => *98,n(start),Wait(1)
exten => *98,n,Noop(app-dialvm: Asking for mailbox)
exten => *98,n,Read(MAILBOX,vm-login,,,3,2)
exten => *98,n(check),Noop(app-dialvm: Got Mailbox ${MAILBOX})
exten => *98,n,Macro(get-vmcontext,${MAILBOX})
exten => *98,n,MailBoxExists(${MAILBOX}@${VMCONTEXT})
exten => *98,n,GotoIf($["${VMBOXEXISTSSTATUS}" = "SUCCESS"]?good:bad)
exten => *98,n,Macro(hangupcall,)
exten => *98,n(good),Noop(app-dialvm: Good mailbox ${MAILBOX}@${VMCONTEXT})
exten => *98,n,VoiceMailMain(${MAILBOX}@${VMCONTEXT})
exten => *98,n,GotoIf($["${IVR_RETVM}" = "RETURN" & "${IVR_CONTEXT}" != ""]?playret)
exten => *98,n,Macro(hangupcall,)
exten => *98,n(bad),Noop(app-dialvm: BAD mailbox ${MAILBOX}@${VMCONTEXT})
exten => *98,n,Wait(1)
exten => *98,n,Noop(app-dialvm: Asking for password so people can't probe for existence of a mailbox)
exten => *98,n,Read(FAKEPW,vm-password,,,3,2)
exten => *98,n,Noop(app-dialvm: Asking for mailbox again)
exten => *98,n,Read(MAILBOX,vm-incorrect-mailbox,,,3,2)
exten => *98,n,Goto(check)
exten => *98,n,Macro(hangupcall,)
exten => *98,n(playret),Playback(beep&you-will-be-transfered-menu&silence/1)
exten => *98,n,Goto(${IVR_CONTEXT},return,1)
exten => _*98.,1,Answer
exten => _*98.,n,Wait(1)
exten => _*98.,n,Macro(get-vmcontext,${EXTEN:3})
exten => _*98.,n,VoiceMailMain(${EXTEN:3}@${VMCONTEXT})
exten => _*98.,n,GotoIf($["${IVR_RETVM}" = "RETURN" & "${IVR_CONTEXT}" != ""]?${IVR_CONTEXT},return,1)
exten => _*98.,n,Macro(hangupcall,)

; end of [app-dialvm]


[app-vmmain]
include => app-vmmain-custom
exten => *97,1,Answer
exten => *97,n,Wait(1)
exten => *97,n,Macro(user-callerid,)
exten => *97,n,Macro(get-vmcontext,${AMPUSER})
exten => *97,n(check),MailBoxExists(${AMPUSER}@${VMCONTEXT})
exten => *97,n,GotoIf($["${VMBOXEXISTSSTATUS}" = "SUCCESS"]?mbexist)
exten => *97,n,VoiceMailMain()
exten => *97,n,GotoIf($["${IVR_RETVM}" = "RETURN" & "${IVR_CONTEXT}" != ""]?playret)
exten => *97,n,Macro(hangupcall,)
exten => *97,check+101(mbexist),VoiceMailMain(${AMPUSER}@${VMCONTEXT})
exten => *97,n,GotoIf($["${IVR_RETVM}" = "RETURN" & "${IVR_CONTEXT}" != ""]?playret)
exten => *97,n,Macro(hangupcall,)
exten => *97,n(playret),Playback(beep&you-will-be-transfered-menu&silence/1)
exten => *97,n,Goto(${IVR_CONTEXT},return,1)

; end of [app-vmmain]


[app-pbdirectory]
include => app-pbdirectory-custom
exten => 411,1,Answer
exten => 411,n,Wait(1)
exten => 411,n,Goto(pbdirectory,1)
exten => pbdirectory,1,Macro(user-callerid,)
exten => pbdirectory,n,AGI(pbdirectory)
exten => pbdirectory,n,GotoIf($["${dialnumber}"=""]?hangup,1)
exten => pbdirectory,n,Noop(Got number to dial: ${dialnumber})
exten => pbdirectory,n,Dial(Local/${dialnumber}@from-internal/n,)
exten => hangup,1,Hangup

; end of [app-pbdirectory]


[app-dnd-off]
include => app-dnd-off-custom
exten => *79,1,Answer
exten => *79,n,Wait(1)
exten => *79,n,Macro(user-callerid,)
exten => *79,n,dbDel(DND/${AMPUSER})
exten => *79,n,Set(STATE=NOT_INUSE)
exten => *79,n,Gosub(app-dnd-off,sstate,1)
exten => *79,n,Playback(do-not-disturb&de-activated)
exten => *79,n,Macro(hangupcall,)
exten => sstate,1,Set(DEVICE_STATE(Custom:DND${AMPUSER})=${STATE})
exten => sstate,n,Set(DEVICES=${DB(AMPUSER/${AMPUSER}/device)})
exten => sstate,n,GotoIf($["${DEVICES}" = "" ]?return)
exten => sstate,n,Set(LOOPCNT=${FIELDQTY(DEVICES,&)})
exten => sstate,n,Set(ITER=1)
exten => sstate,n(begin),Set(DEVICE_STATE(Custom:DEVDND${CUT(DEVICES,&,${ITER})})=${STATE})
exten => sstate,n,Set(ITER=$[${ITER} + 1])
exten => sstate,n,GotoIf($[${ITER} <= ${LOOPCNT}]?begin)
exten => sstate,n(return),Return()

; end of [app-dnd-off]


[app-dnd-on]
include => app-dnd-on-custom
exten => *78,1,Answer
exten => *78,n,Wait(1)
exten => *78,n,Macro(user-callerid,)
exten => *78,n,Set(DB(DND/${AMPUSER})=YES)
exten => *78,n,Set(STATE=BUSY)
exten => *78,n,Gosub(app-dnd-on,sstate,1)
exten => *78,n,Playback(do-not-disturb&activated)
exten => *78,n,Macro(hangupcall,)
exten => sstate,1,Set(DEVICE_STATE(Custom:DND${AMPUSER})=${STATE})
exten => sstate,n,Set(DEVICES=${DB(AMPUSER/${AMPUSER}/device)})
exten => sstate,n,GotoIf($["${DEVICES}" = "" ]?return)
exten => sstate,n,Set(LOOPCNT=${FIELDQTY(DEVICES,&)})
exten => sstate,n,Set(ITER=1)
exten => sstate,n(begin),Set(DEVICE_STATE(Custom:DEVDND${CUT(DEVICES,&,${ITER})})=${STATE})
exten => sstate,n,Set(ITER=$[${ITER} + 1])
exten => sstate,n,GotoIf($[${ITER} <= ${LOOPCNT}]?begin)
exten => sstate,n(return),Return()

; end of [app-dnd-on]


[app-dnd-toggle]
include => app-dnd-toggle-custom
exten => *76,1,Answer
exten => *76,n,Wait(1)
exten => *76,n,Macro(user-callerid,)
exten => *76,n,GotoIf($["${DB(DND/${AMPUSER})}" = ""]?activate:deactivate)
exten => *76,n(activate),Set(DB(DND/${AMPUSER})=YES)
exten => *76,n,Set(STATE=BUSY)
exten => *76,n,Gosub(app-dnd-toggle,sstate,1)
exten => *76,n,Playback(do-not-disturb&activated)
exten => *76,n,Macro(hangupcall,)
exten => *76,n(deactivate),dbDel(DND/${AMPUSER})
exten => *76,n,Set(STATE=NOT_INUSE)
exten => *76,n,Gosub(app-dnd-toggle,sstate,1)
exten => *76,n,Playback(do-not-disturb&de-activated)
exten => *76,n,Macro(hangupcall,)
exten => sstate,1,Set(DEVICE_STATE(Custom:DND${AMPUSER})=${STATE})
exten => sstate,n,Set(DEVICES=${DB(AMPUSER/${AMPUSER}/device)})
exten => sstate,n,GotoIf($["${DEVICES}" = "" ]?return)
exten => sstate,n,Set(LOOPCNT=${FIELDQTY(DEVICES,&)})
exten => sstate,n,Set(ITER=1)
exten => sstate,n(begin),Set(DEVICE_STATE(Custom:DEVDND${CUT(DEVICES,&,${ITER})})=${STATE})
exten => sstate,n,Set(ITER=$[${ITER} + 1])
exten => sstate,n,GotoIf($[${ITER} <= ${LOOPCNT}]?begin)
exten => sstate,n(return),Return()

; end of [app-dnd-toggle]


[ext-dnd-hints]
include => ext-dnd-hints-custom
exten => *765000,1,Goto(app-dnd-toggle,*76,1)
exten => *765000,hint,Custom:DEVDND5000
exten => *765010,1,Goto(app-dnd-toggle,*76,1)
exten => *765010,hint,Custom:DEVDND5010
exten => *765020,1,Goto(app-dnd-toggle,*76,1)
exten => *765020,hint,Custom:DEVDND5020
exten => *765021,1,Goto(app-dnd-toggle,*76,1)
exten => *765021,hint,Custom:DEVDND5021
exten => *765022,1,Goto(app-dnd-toggle,*76,1)
exten => *765022,hint,Custom:DEVDND5022
exten => *765030,1,Goto(app-dnd-toggle,*76,1)
exten => *765030,hint,Custom:DEVDND5030
exten => *765031,1,Goto(app-dnd-toggle,*76,1)
exten => *765031,hint,Custom:DEVDND5031
exten => *765032,1,Goto(app-dnd-toggle,*76,1)
exten => *765032,hint,Custom:DEVDND5032
exten => *765100,1,Goto(app-dnd-toggle,*76,1)
exten => *765100,hint,Custom:DEVDND5100
exten => *765110,1,Goto(app-dnd-toggle,*76,1)
exten => *765110,hint,Custom:DEVDND5110
exten => *765111,1,Goto(app-dnd-toggle,*76,1)
exten => *765111,hint,Custom:DEVDND5111
exten => *765112,1,Goto(app-dnd-toggle,*76,1)
exten => *765112,hint,Custom:DEVDND5112
exten => *765113,1,Goto(app-dnd-toggle,*76,1)
exten => *765113,hint,Custom:DEVDND5113
exten => *765120,1,Goto(app-dnd-toggle,*76,1)
exten => *765120,hint,Custom:DEVDND5120
exten => *765121,1,Goto(app-dnd-toggle,*76,1)
exten => *765121,hint,Custom:DEVDND5121
exten => *765122,1,Goto(app-dnd-toggle,*76,1)
exten => *765122,hint,Custom:DEVDND5122
exten => *765123,1,Goto(app-dnd-toggle,*76,1)
exten => *765123,hint,Custom:DEVDND5123
exten => *765124,1,Goto(app-dnd-toggle,*76,1)
exten => *765124,hint,Custom:DEVDND5124
exten => *765125,1,Goto(app-dnd-toggle,*76,1)
exten => *765125,hint,Custom:DEVDND5125
exten => *765130,1,Goto(app-dnd-toggle,*76,1)
exten => *765130,hint,Custom:DEVDND5130
exten => *765131,1,Goto(app-dnd-toggle,*76,1)
exten => *765131,hint,Custom:DEVDND5131
exten => *765140,1,Goto(app-dnd-toggle,*76,1)
exten => *765140,hint,Custom:DEVDND5140
exten => *765141,1,Goto(app-dnd-toggle,*76,1)
exten => *765141,hint,Custom:DEVDND5141
exten => *765150,1,Goto(app-dnd-toggle,*76,1)
exten => *765150,hint,Custom:DEVDND5150
exten => *765200,1,Goto(app-dnd-toggle,*76,1)
exten => *765200,hint,Custom:DEVDND5200
exten => *765201,1,Goto(app-dnd-toggle,*76,1)
exten => *765201,hint,Custom:DEVDND5201
exten => *765202,1,Goto(app-dnd-toggle,*76,1)
exten => *765202,hint,Custom:DEVDND5202
exten => *765203,1,Goto(app-dnd-toggle,*76,1)
exten => *765203,hint,Custom:DEVDND5203
exten => *765210,1,Goto(app-dnd-toggle,*76,1)
exten => *765210,hint,Custom:DEVDND5210
exten => *765220,1,Goto(app-dnd-toggle,*76,1)
exten => *765220,hint,Custom:DEVDND5220
exten => *765230,1,Goto(app-dnd-toggle,*76,1)
exten => *765230,hint,Custom:DEVDND5230
exten => *765231,1,Goto(app-dnd-toggle,*76,1)
exten => *765231,hint,Custom:DEVDND5231
exten => *765232,1,Goto(app-dnd-toggle,*76,1)
exten => *765232,hint,Custom:DEVDND5232
exten => *765240,1,Goto(app-dnd-toggle,*76,1)
exten => *765240,hint,Custom:DEVDND5240
exten => *765300,1,Goto(app-dnd-toggle,*76,1)
exten => *765300,hint,Custom:DEVDND5300
exten => *765350,1,Goto(app-dnd-toggle,*76,1)
exten => *765350,hint,Custom:DEVDND5350
exten => *765401,1,Goto(app-dnd-toggle,*76,1)
exten => *765401,hint,Custom:DEVDND5401
exten => *765402,1,Goto(app-dnd-toggle,*76,1)
exten => *765402,hint,Custom:DEVDND5402
exten => *765403,1,Goto(app-dnd-toggle,*76,1)
exten => *765403,hint,Custom:DEVDND5403
exten => *765404,1,Goto(app-dnd-toggle,*76,1)
exten => *765404,hint,Custom:DEVDND5404
exten => *765405,1,Goto(app-dnd-toggle,*76,1)
exten => *765405,hint,Custom:DEVDND5405
exten => *765406,1,Goto(app-dnd-toggle,*76,1)
exten => *765406,hint,Custom:DEVDND5406
exten => *765407,1,Goto(app-dnd-toggle,*76,1)
exten => *765407,hint,Custom:DEVDND5407
exten => *765410,1,Goto(app-dnd-toggle,*76,1)
exten => *765410,hint,Custom:DEVDND5410
exten => *765420,1,Goto(app-dnd-toggle,*76,1)
exten => *765420,hint,Custom:DEVDND5420
exten => *765490,1,Goto(app-dnd-toggle,*76,1)
exten => *765490,hint,Custom:DEVDND5490
exten => *765491,1,Goto(app-dnd-toggle,*76,1)
exten => *765491,hint,Custom:DEVDND5491
exten => *765492,1,Goto(app-dnd-toggle,*76,1)
exten => *765492,hint,Custom:DEVDND5492
exten => *765493,1,Goto(app-dnd-toggle,*76,1)
exten => *765493,hint,Custom:DEVDND5493
exten => *765494,1,Goto(app-dnd-toggle,*76,1)
exten => *765494,hint,Custom:DEVDND5494
exten => *765501,1,Goto(app-dnd-toggle,*76,1)
exten => *765501,hint,Custom:DEVDND5501
exten => *765502,1,Goto(app-dnd-toggle,*76,1)
exten => *765502,hint,Custom:DEVDND5502
exten => *765510,1,Goto(app-dnd-toggle,*76,1)
exten => *765510,hint,Custom:DEVDND5510
exten => *765511,1,Goto(app-dnd-toggle,*76,1)
exten => *765511,hint,Custom:DEVDND5511
exten => *765512,1,Goto(app-dnd-toggle,*76,1)
exten => *765512,hint,Custom:DEVDND5512
exten => *765513,1,Goto(app-dnd-toggle,*76,1)
exten => *765513,hint,Custom:DEVDND5513
exten => *765514,1,Goto(app-dnd-toggle,*76,1)
exten => *765514,hint,Custom:DEVDND5514
exten => *765515,1,Goto(app-dnd-toggle,*76,1)
exten => *765515,hint,Custom:DEVDND5515
exten => *765530,1,Goto(app-dnd-toggle,*76,1)
exten => *765530,hint,Custom:DEVDND5530
exten => *765531,1,Goto(app-dnd-toggle,*76,1)
exten => *765531,hint,Custom:DEVDND5531
exten => *765532,1,Goto(app-dnd-toggle,*76,1)
exten => *765532,hint,Custom:DEVDND5532
exten => *765533,1,Goto(app-dnd-toggle,*76,1)
exten => *765533,hint,Custom:DEVDND5533
exten => *765534,1,Goto(app-dnd-toggle,*76,1)
exten => *765534,hint,Custom:DEVDND5534
exten => *765535,1,Goto(app-dnd-toggle,*76,1)
exten => *765535,hint,Custom:DEVDND5535
exten => *765701,1,Goto(app-dnd-toggle,*76,1)
exten => *765701,hint,Custom:DEVDND5701
exten => *765702,1,Goto(app-dnd-toggle,*76,1)
exten => *765702,hint,Custom:DEVDND5702
exten => *765703,1,Goto(app-dnd-toggle,*76,1)
exten => *765703,hint,Custom:DEVDND5703
exten => *765710,1,Goto(app-dnd-toggle,*76,1)
exten => *765710,hint,Custom:DEVDND5710
exten => *765800,1,Goto(app-dnd-toggle,*76,1)
exten => *765800,hint,Custom:DEVDND5800
exten => *765810,1,Goto(app-dnd-toggle,*76,1)
exten => *765810,hint,Custom:DEVDND5810
exten => *765811,1,Goto(app-dnd-toggle,*76,1)
exten => *765811,hint,Custom:DEVDND5811
exten => *765812,1,Goto(app-dnd-toggle,*76,1)
exten => *765812,hint,Custom:DEVDND5812
exten => *765910,1,Goto(app-dnd-toggle,*76,1)
exten => *765910,hint,Custom:DEVDND5910
exten => *765920,1,Goto(app-dnd-toggle,*76,1)
exten => *765920,hint,Custom:DEVDND5920

; end of [ext-dnd-hints]


[app-blacklist-check]
include => app-blacklist-check-custom
exten => s,1,GotoIf($["${BLACKLIST()}"="1"]?blacklisted)
exten => s,n,Return()
exten => s,n(blacklisted),Answer
exten => s,n,Wait(1)
exten => s,n,Zapateller()
exten => s,n,Playback(ss-noservice)
exten => s,n,Hangup

; end of [app-blacklist-check]


[app-blacklist]
include => app-blacklist-custom
exten => *30,1,Goto(app-blacklist-add,s,1)
exten => *32,1,Goto(app-blacklist-last,s,1)
exten => *31,1,Goto(app-blacklist-remove,s,1)

; end of [app-blacklist]


[app-blacklist-add]
include => app-blacklist-add-custom
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(enter-num-blacklist)
exten => s,n,Set(TIMEOUT(digit)=5)
exten => s,n,Set(TIMEOUT(response)=60)
exten => s,n,Read(blacknr,then-press-pound,,,,)
exten => s,n,SayDigits(${blacknr})
exten => s,n,Playback(if-correct-press&digits/1)
exten => s,n,Noop(Waiting for input)
exten => s,n(end),WaitExten(60,)
exten => s,n,Playback(sorry-youre-having-problems&goodbye)
exten => 1,1,Set(DB(blacklist/${blacknr})=1)
exten => 1,n,Playback(num-was-successfully&added)
exten => 1,n,Wait(1)
exten => 1,n,Hangup

; end of [app-blacklist-add]


[app-blacklist-last]
include => app-blacklist-last-custom
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Set(lastcaller=${DB(CALLTRACE/${CALLERID(number)})})
exten => s,n,GotoIf($[ $[ "${lastcaller}" = "" ] | $[ "${lastcaller}" = "unknown" ] ]?noinfo)
exten => s,n,Playback(privacy-to-blacklist-last-caller&telephone-number)
exten => s,n,SayDigits(${lastcaller})
exten => s,n,Set(TIMEOUT(digit)=3)
exten => s,n,Set(TIMEOUT(response)=7)
exten => s,n,Playback(if-correct-press&digits/1)
exten => s,n,Goto(end)
exten => s,n(noinfo),Playback(unidentified-no-callback)
exten => s,n,Hangup
exten => s,n,Noop(Waiting for input)
exten => s,n(end),WaitExten(60,)
exten => s,n,Playback(sorry-youre-having-problems&goodbye)
exten => 1,1,Set(DB(blacklist/${lastcaller})=1)
exten => 1,n,Playback(num-was-successfully)
exten => 1,n,Playback(added)
exten => 1,n,Wait(1)
exten => 1,n,Hangup

; end of [app-blacklist-last]


[app-blacklist-remove]
include => app-blacklist-remove-custom
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(entr-num-rmv-blklist)
exten => s,n,Set(TIMEOUT(digit)=5)
exten => s,n,Set(TIMEOUT(response)=60)
exten => s,n,Read(blacknr,then-press-pound,,,,)
exten => s,n,SayDigits(${blacknr})
exten => s,n,Playback(if-correct-press&digits/1)
exten => s,n,Noop(Waiting for input)
exten => s,n(end),WaitExten(60,)
exten => s,n,Playback(sorry-youre-having-problems&goodbye)
exten => 1,1,dbDel(blacklist/${blacknr})
exten => 1,n,Playback(num-was-successfully&removed)
exten => 1,n,Wait(1)
exten => 1,n,Hangup

; end of [app-blacklist-remove]


[cidlookup]
include => cidlookup-custom
exten => cidlookup_return,1,ExecIf($["${DB(cidname/${CALLERID(num)})}" != ""]?Set(CALLERID(name)=${DB(cidname/${CALLERID(num)})}))
exten => cidlookup_return,n,Return()

; end of [cidlookup]


[app-calltrace]
include => app-calltrace-custom
exten => *69,1,Goto(app-calltrace-perform,s,1)

; end of [app-calltrace]


[app-calltrace-perform]
include => app-calltrace-perform-custom
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Macro(user-callerid,)
exten => s,n,Playback(info-about-last-call&telephone-number)
exten => s,n,Set(lastcaller=${DB(CALLTRACE/${AMPUSER})})
exten => s,n,GotoIf($[ $[ "${lastcaller}" = "" ] | $[ "${lastcaller}" = "unknown" ] ]?noinfo)
exten => s,n,SayDigits(${lastcaller})
exten => s,n,Set(TIMEOUT(digit)=3)
exten => s,n,Set(TIMEOUT(response)=7)
exten => s,n,Background(to-call-this-number&press-1)
exten => s,n,Goto(fin)
exten => s,n(noinfo),Playback(from-unknown-caller)
exten => s,n,Macro(hangupcall,)
exten => s,n(fin),Noop(Waiting for input)
exten => s,n,WaitExten(60,)
exten => s,n,Playback(sorry-youre-having-problems&goodbye)
exten => 1,1,Goto(from-internal,${lastcaller},1)
exten => i,1,Playback(vm-goodbye)
exten => i,n,Macro(hangupcall,)
exten => t,1,Playback(vm-goodbye)
exten => t,n,Macro(hangupcall,)

; end of [app-calltrace-perform]


[app-directory]
include => app-directory-custom
exten => #,1,Answer
exten => #,n,Wait(1)
exten => #,n,AGI(directory,${DIR-CONTEXT},from-did-direct,${DIRECTORY:0:1}${DIRECTORY_OPTS})
exten => #,n,Playback(vm-goodbye)
exten => #,n,Hangup
exten => i,1,Playback(privacy-incorrect)

; end of [app-directory]


[app-echo-test]
include => app-echo-test-custom
exten => *43,1,Answer
exten => *43,n,Wait(1)
exten => *43,n,Playback(demo-echotest)
exten => *43,n,Echo()
exten => *43,n,Playback(demo-echodone)
exten => *43,n,Hangup

; end of [app-echo-test]


[app-speakextennum]
include => app-speakextennum-custom
exten => *65,1,Answer
exten => *65,n,Wait(1)
exten => *65,n,Macro(user-callerid,)
exten => *65,n,Playback(your)
exten => *65,n,Playback(extension)
exten => *65,n,Playback(number)
exten => *65,n,Playback(is)
exten => *65,n,SayDigits(${AMPUSER})
exten => *65,n,Wait(2)
exten => *65,n,Hangup

; end of [app-speakextennum]


[app-speakingclock]
include => app-speakingclock-custom
exten => *60,1,Answer
exten => *60,n,Wait(1)
exten => *60,n,Set(NumLoops=0)
exten => *60,n(start),Set(FutureTime=$[${EPOCH} + 11])
exten => *60,n,Playback(at-tone-time-exactly)
exten => *60,n,GotoIf($["${TIMEFORMAT}" = "kM"]?hr24format)
exten => *60,n,SayUnixTime(${FutureTime},,IM \'and\' S \'seconds\' p)
exten => *60,n,Goto(waitloop)
exten => *60,n(hr24format),SayUnixTime(${FutureTime},,kM \'and\' S \'seconds\')
exten => *60,n(waitloop),Set(TimeLeft=$[${FutureTime} - ${EPOCH}])
exten => *60,n,GotoIf($[${TimeLeft} < 1]?playbeep)
exten => *60,n,Wait(1)
exten => *60,n,Goto(waitloop)
exten => *60,n(playbeep),Playback(beep)
exten => *60,n,Wait(5)
exten => *60,n,Set(NumLoops=$[${NumLoops} + 1])
exten => *60,n,GotoIf($[${NumLoops} < 5]?start)
exten => *60,n,Playback(goodbye)
exten => *60,n,Hangup

; end of [app-speakingclock]


[ext-meetme]
include => ext-meetme-custom
exten => STARTMEETME,1,MeetMe(${MEETME_ROOMNUM},${MEETME_OPTS},${PIN})
exten => STARTMEETME,n,Hangup
exten => h,1,Hangup
exten => 5099,1,Macro(user-callerid,)
exten => 5099,n,Set(MEETME_ROOMNUM=5099)
exten => 5099,n,Set(MEETME_RECORDINGFILE=${ASTSPOOLDIR}/monitor/meetme-conf-rec-${MEETME_ROOMNUM}-${UNIQUEID})
exten => 5099,n,GotoIf($["${DIALSTATUS}" = "ANSWER"]?READPIN)
exten => 5099,n,Answer
exten => 5099,n,Wait(1)
exten => 5099,n,Set(PINCOUNT=0)
exten => 5099,n(READPIN),Read(PIN,enter-conf-pin-number,,,,)
exten => 5099,n,GotoIf($[x${PIN} = x175]?USER)
exten => 5099,n,GotoIf($[x${PIN} = x423]?ADMIN)
exten => 5099,n,Set(PINCOUNT=$[${PINCOUNT}+1])
exten => 5099,n,GotoIf($[${PINCOUNT}>3]?h)
exten => 5099,n,Playback(conf-invalidpin)
exten => 5099,n,Goto(READPIN)
exten => 5099,n(ADMIN),Set(MEETME_OPTS=aAwcIr)
exten => 5099,n,Goto(STARTMEETME,1)
exten => 5099,n(USER),Set(MEETME_OPTS=wcIr)
exten => 5099,n,Goto(STARTMEETME,1)
exten => 5099,hint,MeetMe:5099
exten => 5199,1,Macro(user-callerid,)
exten => 5199,n,Set(MEETME_ROOMNUM=5199)
exten => 5199,n,GotoIf($["${DIALSTATUS}" = "ANSWER"]?READPIN)
exten => 5199,n,Answer
exten => 5199,n,Wait(1)
exten => 5199,n,Set(PINCOUNT=0)
exten => 5199,n(READPIN),Read(PIN,enter-conf-pin-number,,,,)
exten => 5199,n,GotoIf($[x${PIN} = x157]?USER)
exten => 5199,n,Set(PINCOUNT=$[${PINCOUNT}+1])
exten => 5199,n,GotoIf($[${PINCOUNT}>3]?h)
exten => 5199,n,Playback(conf-invalidpin)
exten => 5199,n,Goto(READPIN)
exten => 5199,n(USER),Set(MEETME_OPTS=cI)
exten => 5199,n,Goto(STARTMEETME,1)
exten => 5199,hint,MeetMe:5199
exten => 5299,1,Macro(user-callerid,)
exten => 5299,n,Set(MEETME_ROOMNUM=5299)
exten => 5299,n,GotoIf($["${DIALSTATUS}" = "ANSWER"]?READPIN)
exten => 5299,n,Answer
exten => 5299,n,Wait(1)
exten => 5299,n,Set(PINCOUNT=0)
exten => 5299,n(READPIN),Read(PIN,enter-conf-pin-number,,,,)
exten => 5299,n,GotoIf($[x${PIN} = x154]?USER)
exten => 5299,n,GotoIf($[x${PIN} = x652]?ADMIN)
exten => 5299,n,Set(PINCOUNT=$[${PINCOUNT}+1])
exten => 5299,n,GotoIf($[${PINCOUNT}>3]?h)
exten => 5299,n,Playback(conf-invalidpin)
exten => 5299,n,Goto(READPIN)
exten => 5299,n(ADMIN),Set(MEETME_OPTS=aAwcI)
exten => 5299,n,Goto(STARTMEETME,1)
exten => 5299,n(USER),Set(MEETME_OPTS=wcI)
exten => 5299,n,Goto(STARTMEETME,1)
exten => 5299,hint,MeetMe:5299
exten => 5699,1,Macro(user-callerid,)
exten => 5699,n,Set(MEETME_ROOMNUM=5699)
exten => 5699,n,GotoIf($["${DIALSTATUS}" = "ANSWER"]?READPIN)
exten => 5699,n,Answer
exten => 5699,n,Wait(1)
exten => 5699,n,Set(PINCOUNT=0)
exten => 5699,n(READPIN),Read(PIN,enter-conf-pin-number,,,,)
exten => 5699,n,GotoIf($[x${PIN} = x424]?USER)
exten => 5699,n,Set(PINCOUNT=$[${PINCOUNT}+1])
exten => 5699,n,GotoIf($[${PINCOUNT}>3]?h)
exten => 5699,n,Playback(conf-invalidpin)
exten => 5699,n,Goto(READPIN)
exten => 5699,n(USER),Set(MEETME_OPTS=cI)
exten => 5699,n,Goto(STARTMEETME,1)
exten => 5699,hint,MeetMe:5699
exten => 5799,1,Macro(user-callerid,)
exten => 5799,n,Set(MEETME_ROOMNUM=5799)
exten => 5799,n,GotoIf($["${DIALSTATUS}" = "ANSWER"]?READPIN)
exten => 5799,n,Answer
exten => 5799,n,Wait(1)
exten => 5799,n,Set(PINCOUNT=0)
exten => 5799,n(READPIN),Read(PIN,enter-conf-pin-number,,,,)
exten => 5799,n,GotoIf($[x${PIN} = x452]?USER)
exten => 5799,n,GotoIf($[x${PIN} = x872]?ADMIN)
exten => 5799,n,Set(PINCOUNT=$[${PINCOUNT}+1])
exten => 5799,n,GotoIf($[${PINCOUNT}>3]?h)
exten => 5799,n,Playback(conf-invalidpin)
exten => 5799,n,Goto(READPIN)
exten => 5799,n(ADMIN),Set(MEETME_OPTS=aAwcI)
exten => 5799,n,Goto(STARTMEETME,1)
exten => 5799,n(USER),Set(MEETME_OPTS=wcI)
exten => 5799,n,Goto(STARTMEETME,1)
exten => 5799,hint,MeetMe:5799
exten => 5899,1,Macro(user-callerid,)
exten => 5899,n,Set(MEETME_ROOMNUM=5899)
exten => 5899,n,GotoIf($["${DIALSTATUS}" = "ANSWER"]?READPIN)
exten => 5899,n,Answer
exten => 5899,n,Wait(1)
exten => 5899,n,Set(PINCOUNT=0)
exten => 5899,n(READPIN),Read(PIN,enter-conf-pin-number,,,,)
exten => 5899,n,GotoIf($[x${PIN} = x410]?USER)
exten => 5899,n,Set(PINCOUNT=$[${PINCOUNT}+1])
exten => 5899,n,GotoIf($[${PINCOUNT}>3]?h)
exten => 5899,n,Playback(conf-invalidpin)
exten => 5899,n,Goto(READPIN)
exten => 5899,n(USER),Set(MEETME_OPTS=cI)
exten => 5899,n,Goto(STARTMEETME,1)
exten => 5899,hint,MeetMe:5899
exten => 5911,1,Macro(user-callerid,)
exten => 5911,n,Set(MEETME_ROOMNUM=5911)
exten => 5911,n,GotoIf($["${DIALSTATUS}" = "ANSWER"]?READPIN)
exten => 5911,n,Answer
exten => 5911,n,Wait(1)
exten => 5911,n,Set(PINCOUNT=0)
exten => 5911,n(READPIN),Read(PIN,enter-conf-pin-number,,,,)
exten => 5911,n,GotoIf($[x${PIN} = x245]?USER)
exten => 5911,n,GotoIf($[x${PIN} = x743]?ADMIN)
exten => 5911,n,Set(PINCOUNT=$[${PINCOUNT}+1])
exten => 5911,n,GotoIf($[${PINCOUNT}>3]?h)
exten => 5911,n,Playback(conf-invalidpin)
exten => 5911,n,Goto(READPIN)
exten => 5911,n(ADMIN),Set(MEETME_OPTS=aAwcI)
exten => 5911,n,Goto(STARTMEETME,1)
exten => 5911,n(USER),Set(MEETME_OPTS=wcI)
exten => 5911,n,Goto(STARTMEETME,1)
exten => 5911,hint,MeetMe:5911
exten => 5921,1,Macro(user-callerid,)
exten => 5921,n,Set(MEETME_ROOMNUM=5921)
exten => 5921,n,GotoIf($["${DIALSTATUS}" = "ANSWER"]?READPIN)
exten => 5921,n,Answer
exten => 5921,n,Wait(1)
exten => 5921,n,Set(PINCOUNT=0)
exten => 5921,n(READPIN),Read(PIN,enter-conf-pin-number,,,,)
exten => 5921,n,GotoIf($[x${PIN} = x566]?USER)
exten => 5921,n,GotoIf($[x${PIN} = x521]?ADMIN)
exten => 5921,n,Set(PINCOUNT=$[${PINCOUNT}+1])
exten => 5921,n,GotoIf($[${PINCOUNT}>3]?h)
exten => 5921,n,Playback(conf-invalidpin)
exten => 5921,n,Goto(READPIN)
exten => 5921,n(ADMIN),Set(MEETME_OPTS=aAwcI)
exten => 5921,n,Goto(STARTMEETME,1)
exten => 5921,n(USER),Set(MEETME_OPTS=wcI)
exten => 5921,n,Goto(STARTMEETME,1)
exten => 5921,hint,MeetMe:5921

; end of [ext-meetme]


[app-callwaiting-cwoff]
include => app-callwaiting-cwoff-custom
exten => *71,1,Answer
exten => *71,n,Wait(1)
exten => *71,n,Macro(user-callerid,)
exten => *71,n,dbDel(CW/${AMPUSER})
exten => *71,n,Playback(call-waiting&de-activated)
exten => *71,n,Macro(hangupcall,)

; end of [app-callwaiting-cwoff]


[app-callwaiting-cwon]
include => app-callwaiting-cwon-custom
exten => *70,1,Answer
exten => *70,n,Wait(1)
exten => *70,n,Macro(user-callerid,)
exten => *70,n,Set(DB(CW/${AMPUSER})=ENABLED)
exten => *70,n,Playback(call-waiting&activated)
exten => *70,n,Macro(hangupcall,)

; end of [app-callwaiting-cwon]


[macro-autoanswer]
include => macro-autoanswer-custom
exten => s,1,Set(DIAL=${DB(DEVICE/${ARG1}/dial)})
exten => s,n,GotoIf($["${DB(DEVICE/${ARG1}/autoanswer/macro)}" != "" ]?macro)
exten => s,n,Set(phone=${SIPPEER(${CUT(DIAL,/,2)}:useragent)})
exten => s,n,Set(SIPURI=)
exten => s,n,Set(ALERTINFO=Alert-Info: Ring Answer)
exten => s,n,Set(CALLINFO=Call-Info: <uri>\;answer-after=0)
exten => s,n,Set(SIPURI=intercom=true)
exten => s,n,Set(DOPTIONS=A(beep))
exten => s,n,Set(DTIME=5)
exten => s,n,Set(ANSWERMACRO=)
exten => s,n,ExecIf($["${phone:0:5}" = "Mitel"]?Set(CALLINFO=Call-Info: <sip:broadworks.net>\;answer-after=0))
exten => s,n,GotoIf($["${ANSWERMACRO}" != ""]?macro2)
exten => s,n,ExecIf($["${ALERTINFO}" != ""]?SipAddHeader(${ALERTINFO}))
exten => s,n,ExecIf($["${CALLINFO}" != ""]?SipAddHeader(${CALLINFO}))
exten => s,n,ExecIf($["${SIPURI}" != ""]?Set(__SIP_URI_OPTIONS=${SIPURI}))
exten => s,n+2(macro),Macro(${DB(DEVICE/${ARG1}/autoanswer/macro)},${ARG1})
exten => s,n+2(macro2),Macro(${ANSWERMACRO},${ARG1})

; end of [macro-autoanswer]


[ext-paging]
include => ext-paging-custom
exten => _PAGE.,1,GotoIf($[ ${AMPUSER} = ${EXTEN:4} ]?skipself)
exten => _PAGE.,n,GotoIf($[ ${FORCE_PAGE} != 1 ]?AVAIL)
exten => _PAGE.,n,Set(AVAILSTATUS=not checked)
exten => _PAGE.,n,Goto(SKIPCHECK)
exten => _PAGE.,n(AVAIL),ChanIsAvail(${DB(DEVICE/${EXTEN:4}/dial)},js)
exten => _PAGE.,n(SKIPCHECK),Noop(Seems to be available (state = ${AVAILSTATUS})
exten => _PAGE.,n,GotoIf($["${DB(DND/${DB(DEVICE/${EXTEN:4}/user)})}" = "YES"]?skipself)
exten => _PAGE.,n,Macro(autoanswer,${EXTEN:4})
exten => _PAGE.,n,Dial(${DIAL},${DTIME},${DOPTIONS})
exten => _PAGE.,n(skipself),Noop(Not paging originator)
exten => _PAGE.,n,Hangup
exten => _PAGE.,AVAIL+101,Noop(Channel ${AVAILCHAN} is not available (state = ${AVAILSTATUS}))

; end of [ext-paging]


[app-userlogonoff]
include => app-userlogonoff-custom
exten => *12,1,Macro(user-logoff,)
exten => *12,n,Hangup
exten => *11,1,Macro(user-logon,)
exten => *11,n,Hangup
exten => _*11.,1,Macro(user-logon,${EXTEN:3},)
exten => _*11.,n,Hangup

; end of [app-userlogonoff]


[app-pickup]
include => app-pickup-custom
exten => _**.,1,Noop(Attempt to Pickup ${EXTEN:2} by ${CALLERID(num)})
exten => _**.,n,Pickup(${EXTEN:2})
exten => _**.,n,Pickup(${EXTEN:2}@ext-local)
exten => _**.,n,Pickup(${EXTEN:2}@from-internal)
exten => _**.,n,Pickup(${EXTEN:2}@from-internal-xfer)
exten => _**.,n,Pickup(${EXTEN:2}@from-did-direct)
exten => _**.,n,Pickup(FMPR-${EXTEN:2})
exten => _**.,n,Pickup(LC-${EXTEN:2}@from-internal)
exten => _**.,n,Pickup(LC-${EXTEN:2}@from-internal-xfer)
exten => _**.,n,Pickup(FMPR-${EXTEN:2}@from-internal)
exten => _**.,n,Pickup(FMPR-${EXTEN:2}@from-internal-xfer)
exten => _**.,n,Pickup(FMPR-${EXTEN:2}@from-did-direct)
exten => _**.,n,Hangup
exten => **5701,1,Pickup(5701)
exten => **5701,n,Pickup(5701@ext-local)
exten => **5701,n,Pickup(5701@from-internal)
exten => **5701,n,Pickup(5701@from-internal-xfer)
exten => **5701,n,Pickup(5701@from-did-direct)
exten => **5701,n,Pickup(LC-5701@from-internal)
exten => **5701,n,Pickup(LC-5701@from-internal-xfer)
exten => **5701,n,Pickup(FMPR-5701)
exten => **5701,n,Pickup(FMPR-5701@from-internal)
exten => **5701,n,Pickup(FMPR-5701@from-internal-xfer)
exten => **5701,n,Pickup(FMPR-5701@from-did-direct)
exten => **5701,n,Pickup(936@from-internal)
exten => **5701,n,Pickup(936@from-internal-xfer)
exten => **5701,n,Pickup(936@ext-group)
exten => **5701,n,Hangup
exten => **5702,1,Pickup(5702)
exten => **5702,n,Pickup(5702@ext-local)
exten => **5702,n,Pickup(5702@from-internal)
exten => **5702,n,Pickup(5702@from-internal-xfer)
exten => **5702,n,Pickup(5702@from-did-direct)
exten => **5702,n,Pickup(LC-5702@from-internal)
exten => **5702,n,Pickup(LC-5702@from-internal-xfer)
exten => **5702,n,Pickup(FMPR-5702)
exten => **5702,n,Pickup(FMPR-5702@from-internal)
exten => **5702,n,Pickup(FMPR-5702@from-internal-xfer)
exten => **5702,n,Pickup(FMPR-5702@from-did-direct)
exten => **5702,n,Pickup(936@from-internal)
exten => **5702,n,Pickup(936@from-internal-xfer)
exten => **5702,n,Pickup(936@ext-group)
exten => **5702,n,Hangup
exten => **5703,1,Pickup(5703)
exten => **5703,n,Pickup(5703@ext-local)
exten => **5703,n,Pickup(5703@from-internal)
exten => **5703,n,Pickup(5703@from-internal-xfer)
exten => **5703,n,Pickup(5703@from-did-direct)
exten => **5703,n,Pickup(LC-5703@from-internal)
exten => **5703,n,Pickup(LC-5703@from-internal-xfer)
exten => **5703,n,Pickup(FMPR-5703)
exten => **5703,n,Pickup(FMPR-5703@from-internal)
exten => **5703,n,Pickup(FMPR-5703@from-internal-xfer)
exten => **5703,n,Pickup(FMPR-5703@from-did-direct)
exten => **5703,n,Pickup(936@from-internal)
exten => **5703,n,Pickup(936@from-internal-xfer)
exten => **5703,n,Pickup(936@ext-group)
exten => **5703,n,Hangup
exten => **5401,1,Pickup(5401)
exten => **5401,n,Pickup(5401@ext-local)
exten => **5401,n,Pickup(5401@from-internal)
exten => **5401,n,Pickup(5401@from-internal-xfer)
exten => **5401,n,Pickup(5401@from-did-direct)
exten => **5401,n,Pickup(LC-5401@from-internal)
exten => **5401,n,Pickup(LC-5401@from-internal-xfer)
exten => **5401,n,Pickup(FMPR-5401)
exten => **5401,n,Pickup(FMPR-5401@from-internal)
exten => **5401,n,Pickup(FMPR-5401@from-internal-xfer)
exten => **5401,n,Pickup(FMPR-5401@from-did-direct)
exten => **5401,n,Pickup(5400@from-internal)
exten => **5401,n,Pickup(5400@from-internal-xfer)
exten => **5401,n,Pickup(5400@ext-group)
exten => **5401,n,Hangup
exten => **5402,1,Pickup(5402)
exten => **5402,n,Pickup(5402@ext-local)
exten => **5402,n,Pickup(5402@from-internal)
exten => **5402,n,Pickup(5402@from-internal-xfer)
exten => **5402,n,Pickup(5402@from-did-direct)
exten => **5402,n,Pickup(LC-5402@from-internal)
exten => **5402,n,Pickup(LC-5402@from-internal-xfer)
exten => **5402,n,Pickup(FMPR-5402)
exten => **5402,n,Pickup(FMPR-5402@from-internal)
exten => **5402,n,Pickup(FMPR-5402@from-internal-xfer)
exten => **5402,n,Pickup(FMPR-5402@from-did-direct)
exten => **5402,n,Pickup(5400@from-internal)
exten => **5402,n,Pickup(5400@from-internal-xfer)
exten => **5402,n,Pickup(5400@ext-group)
exten => **5402,n,Hangup
exten => **5403,1,Pickup(5403)
exten => **5403,n,Pickup(5403@ext-local)
exten => **5403,n,Pickup(5403@from-internal)
exten => **5403,n,Pickup(5403@from-internal-xfer)
exten => **5403,n,Pickup(5403@from-did-direct)
exten => **5403,n,Pickup(LC-5403@from-internal)
exten => **5403,n,Pickup(LC-5403@from-internal-xfer)
exten => **5403,n,Pickup(FMPR-5403)
exten => **5403,n,Pickup(FMPR-5403@from-internal)
exten => **5403,n,Pickup(FMPR-5403@from-internal-xfer)
exten => **5403,n,Pickup(FMPR-5403@from-did-direct)
exten => **5403,n,Pickup(5400@from-internal)
exten => **5403,n,Pickup(5400@from-internal-xfer)
exten => **5403,n,Pickup(5400@ext-group)
exten => **5403,n,Hangup
exten => **5404,1,Pickup(5404)
exten => **5404,n,Pickup(5404@ext-local)
exten => **5404,n,Pickup(5404@from-internal)
exten => **5404,n,Pickup(5404@from-internal-xfer)
exten => **5404,n,Pickup(5404@from-did-direct)
exten => **5404,n,Pickup(LC-5404@from-internal)
exten => **5404,n,Pickup(LC-5404@from-internal-xfer)
exten => **5404,n,Pickup(FMPR-5404)
exten => **5404,n,Pickup(FMPR-5404@from-internal)
exten => **5404,n,Pickup(FMPR-5404@from-internal-xfer)
exten => **5404,n,Pickup(FMPR-5404@from-did-direct)
exten => **5404,n,Pickup(5400@from-internal)
exten => **5404,n,Pickup(5400@from-internal-xfer)
exten => **5404,n,Pickup(5400@ext-group)
exten => **5404,n,Hangup
exten => **5405,1,Pickup(5405)
exten => **5405,n,Pickup(5405@ext-local)
exten => **5405,n,Pickup(5405@from-internal)
exten => **5405,n,Pickup(5405@from-internal-xfer)
exten => **5405,n,Pickup(5405@from-did-direct)
exten => **5405,n,Pickup(LC-5405@from-internal)
exten => **5405,n,Pickup(LC-5405@from-internal-xfer)
exten => **5405,n,Pickup(FMPR-5405)
exten => **5405,n,Pickup(FMPR-5405@from-internal)
exten => **5405,n,Pickup(FMPR-5405@from-internal-xfer)
exten => **5405,n,Pickup(FMPR-5405@from-did-direct)
exten => **5405,n,Pickup(5400@from-internal)
exten => **5405,n,Pickup(5400@from-internal-xfer)
exten => **5405,n,Pickup(5400@ext-group)
exten => **5405,n,Hangup

; end of [app-pickup]


[app-zapbarge]
include => app-zapbarge-custom
exten => 888,1,Macro(user-callerid,)
exten => 888,n,Set(GROUP()=${CALLERID(number)})
exten => 888,n,Answer
exten => 888,n,Wait(1)
exten => 888,n,DAHDIBarge()
exten => 888,n,Hangup

; end of [app-zapbarge]


[app-chanspy]
include => app-chanspy-custom
exten => 555,1,Macro(user-callerid,)
exten => 555,n,Answer
exten => 555,n,Wait(1)
exten => 555,n,ChanSpy()
exten => 555,n,Hangup

; end of [app-chanspy]


[ext-test]
include => ext-test-custom
exten => 7777,1,Goto(from-pstn,${EXTEN},1)
exten => 666,1,Goto(ext-fax,in_fax,1)
exten => h,1,Macro(hangupcall,)

; end of [ext-test]


[ext-did-0001]
include => ext-did-0001-custom
exten => fax,1,Goto(ext-fax,in_fax,1)
exten => s,1,Set(__FROM_DID=${EXTEN})
exten => s,n,Gosub(app-blacklist-check,s,1)
exten => s,n,ExecIf($[ "${CALLERID(name)}" = "" ] ?Set(CALLERID(name)=${CALLERID(num)}))
exten => s,n,Set(__CALLINGPRES_SV=${CALLERPRES()})
exten => s,n,Set(CALLERPRES()=allowed_not_screened)
exten => s,n,Goto(ivr-2,s,1)

; end of [ext-did-0001]


[ext-did-0002]
include => ext-did-0002-custom
exten => fax,1,Goto(ext-fax,in_fax,1)

; end of [ext-did-0002]


[ext-did]
include => ext-did-custom
include => ext-did-0001
include => ext-did-0002
exten => fax,1,Goto(ext-fax,in_fax,1)

; end of [ext-did]


[ext-did-catchall]
include => ext-did-catchall-custom
exten => _.,1,Noop(Catch-All DID Match - Found ${EXTEN} - You probably want a DID for this.)
exten => _.,n,Goto(ext-did,s,1)

; end of [ext-did-catchall]


[ext-local]
include => ext-local-custom
exten => 5000,1,Macro(exten-vm,novm,5000)
exten => 5000,n,Goto(${IVR_CONTEXT},return,1)
exten => 5000,hint,SIP/5000&Custom:DND5000
exten => 5010,1,Macro(exten-vm,novm,5010)
exten => 5010,n,Goto(${IVR_CONTEXT},return,1)
exten => 5010,hint,SIP/5010&Custom:DND5010
exten => 5020,1,Macro(exten-vm,novm,5020)
exten => 5020,n,Goto(${IVR_CONTEXT},return,1)
exten => 5020,hint,SIP/5020&Custom:DND5020
exten => 5021,1,Macro(exten-vm,novm,5021)
exten => 5021,n,Goto(${IVR_CONTEXT},return,1)
exten => 5021,hint,SIP/5021&Custom:DND5021
exten => 5022,1,Macro(exten-vm,novm,5022)
exten => 5022,n,Goto(${IVR_CONTEXT},return,1)
exten => 5022,hint,SIP/5022&Custom:DND5022
exten => 5030,1,Macro(exten-vm,novm,5030)
exten => 5030,n,Goto(${IVR_CONTEXT},return,1)
exten => 5030,hint,SIP/5030&Custom:DND5030
exten => 5031,1,Macro(exten-vm,novm,5031)
exten => 5031,n,Goto(${IVR_CONTEXT},return,1)
exten => 5031,hint,SIP/5031&Custom:DND5031
exten => 5032,1,Macro(exten-vm,novm,5032)
exten => 5032,n,Goto(${IVR_CONTEXT},return,1)
exten => 5032,hint,SIP/5032&Custom:DND5032
exten => 5100,1,Macro(exten-vm,novm,5100)
exten => 5100,n,Goto(${IVR_CONTEXT},return,1)
exten => 5100,hint,SIP/5100&Custom:DND5100
exten => 5110,1,Macro(exten-vm,novm,5110)
exten => 5110,n,Goto(${IVR_CONTEXT},return,1)
exten => 5110,hint,SIP/5110&Custom:DND5110
exten => 5111,1,Macro(exten-vm,novm,5111)
exten => 5111,n,Goto(${IVR_CONTEXT},return,1)
exten => 5111,hint,SIP/5111&Custom:DND5111
exten => 5112,1,Macro(exten-vm,novm,5112)
exten => 5112,n,Goto(${IVR_CONTEXT},return,1)
exten => 5112,hint,SIP/5112&Custom:DND5112
exten => 5113,1,Macro(exten-vm,novm,5113)
exten => 5113,n,Goto(${IVR_CONTEXT},return,1)
exten => 5113,hint,SIP/5113&Custom:DND5113
exten => 5120,1,Macro(exten-vm,novm,5120)
exten => 5120,n,Goto(${IVR_CONTEXT},return,1)
exten => 5120,hint,SIP/5120&Custom:DND5120
exten => 5121,1,Macro(exten-vm,novm,5121)
exten => 5121,n,Goto(${IVR_CONTEXT},return,1)
exten => 5121,hint,SIP/5121&Custom:DND5121
exten => 5122,1,Macro(exten-vm,novm,5122)
exten => 5122,n,Goto(${IVR_CONTEXT},return,1)
exten => 5122,hint,SIP/5122&Custom:DND5122
exten => 5123,1,Macro(exten-vm,novm,5123)
exten => 5123,n,Goto(${IVR_CONTEXT},return,1)
exten => 5123,hint,SIP/5123&Custom:DND5123
exten => 5124,1,Macro(exten-vm,novm,5124)
exten => 5124,n,Goto(${IVR_CONTEXT},return,1)
exten => 5124,hint,SIP/5124&Custom:DND5124
exten => 5125,1,Macro(exten-vm,novm,5125)
exten => 5125,n,Goto(${IVR_CONTEXT},return,1)
exten => 5125,hint,SIP/5125&Custom:DND5125
exten => 5130,1,Macro(exten-vm,novm,5130)
exten => 5130,n,Goto(${IVR_CONTEXT},return,1)
exten => 5130,hint,SIP/5130&Custom:DND5130
exten => 5131,1,Macro(exten-vm,novm,5131)
exten => 5131,n,Goto(${IVR_CONTEXT},return,1)
exten => 5131,hint,SIP/5131&Custom:DND5131
exten => 5140,1,Macro(exten-vm,novm,5140)
exten => 5140,n,Goto(${IVR_CONTEXT},return,1)
exten => 5140,hint,SIP/5140&Custom:DND5140
exten => 5141,1,Macro(exten-vm,novm,5141)
exten => 5141,n,Goto(${IVR_CONTEXT},return,1)
exten => 5141,hint,SIP/5141&Custom:DND5141
exten => 5150,1,Macro(exten-vm,novm,5150)
exten => 5150,n,Goto(${IVR_CONTEXT},return,1)
exten => 5150,hint,SIP/5150&Custom:DND5150
exten => 5200,1,Macro(exten-vm,novm,5200)
exten => 5200,n,Goto(${IVR_CONTEXT},return,1)
exten => 5200,hint,SIP/5200&Custom:DND5200
exten => 5201,1,Macro(exten-vm,novm,5201)
exten => 5201,n,Goto(${IVR_CONTEXT},return,1)
exten => 5201,hint,SIP/5201&Custom:DND5201
exten => 5202,1,Macro(exten-vm,novm,5202)
exten => 5202,n,Goto(${IVR_CONTEXT},return,1)
exten => 5202,hint,SIP/5202&Custom:DND5202
exten => 5203,1,Macro(exten-vm,novm,5203)
exten => 5203,n,Goto(${IVR_CONTEXT},return,1)
exten => 5203,hint,SIP/5203&Custom:DND5203
exten => 5210,1,Macro(exten-vm,novm,5210)
exten => 5210,n,Goto(${IVR_CONTEXT},return,1)
exten => 5210,hint,SIP/5210&Custom:DND5210
exten => 5220,1,Macro(exten-vm,novm,5220)
exten => 5220,n,Goto(${IVR_CONTEXT},return,1)
exten => 5220,hint,SIP/5220&Custom:DND5220
exten => 5230,1,Macro(exten-vm,novm,5230)
exten => 5230,n,Goto(${IVR_CONTEXT},return,1)
exten => 5230,hint,SIP/5230&Custom:DND5230
exten => 5231,1,Macro(exten-vm,novm,5231)
exten => 5231,n,Goto(${IVR_CONTEXT},return,1)
exten => 5231,hint,SIP/5231&Custom:DND5231
exten => 5232,1,Macro(exten-vm,5232,5232)
exten => 5232,n,Goto(vmret,1)
exten => 5232,hint,SIP/5232&Custom:DND5232
exten => ${VM_PREFIX}5232,1,Macro(vm,5232,DIRECTDIAL,${IVR_RETVM})
exten => ${VM_PREFIX}5232,n,Goto(vmret,1)
exten => vmb5232,1,Macro(vm,5232,BUSY,${IVR_RETVM})
exten => vmb5232,n,Goto(vmret,1)
exten => vmu5232,1,Macro(vm,5232,NOANSWER,${IVR_RETVM})
exten => vmu5232,n,Goto(vmret,1)
exten => vms5232,1,Macro(vm,5232,NOMESSAGE,${IVR_RETVM})
exten => vms5232,n,Goto(vmret,1)
exten => 5240,1,Macro(exten-vm,novm,5240)
exten => 5240,n,Goto(${IVR_CONTEXT},return,1)
exten => 5240,hint,SIP/5240&Custom:DND5240
exten => 5300,1,Macro(exten-vm,novm,5300)
exten => 5300,n,Goto(${IVR_CONTEXT},return,1)
exten => 5300,hint,SIP/5300&Custom:DND5300
exten => 5350,1,Macro(exten-vm,novm,5350)
exten => 5350,n,Goto(${IVR_CONTEXT},return,1)
exten => 5350,hint,SIP/5350&Custom:DND5350
exten => 5401,1,Macro(exten-vm,novm,5401)
exten => 5401,n,Goto(${IVR_CONTEXT},return,1)
exten => 5401,hint,SIP/5401&Custom:DND5401
exten => 5402,1,Macro(exten-vm,novm,5402)
exten => 5402,n,Goto(${IVR_CONTEXT},return,1)
exten => 5402,hint,SIP/5402&Custom:DND5402
exten => 5403,1,Macro(exten-vm,novm,5403)
exten => 5403,n,Goto(${IVR_CONTEXT},return,1)
exten => 5403,hint,SIP/5403&Custom:DND5403
exten => 5404,1,Macro(exten-vm,novm,5404)
exten => 5404,n,Goto(${IVR_CONTEXT},return,1)
exten => 5404,hint,SIP/5404&Custom:DND5404
exten => 5405,1,Macro(exten-vm,novm,5405)
exten => 5405,n,Goto(${IVR_CONTEXT},return,1)
exten => 5405,hint,SIP/5405&Custom:DND5405
exten => 5406,1,Macro(exten-vm,novm,5406)
exten => 5406,n,Goto(${IVR_CONTEXT},return,1)
exten => 5406,hint,SIP/5406&Custom:DND5406
exten => 5407,1,Macro(exten-vm,novm,5407)
exten => 5407,n,Goto(${IVR_CONTEXT},return,1)
exten => 5407,hint,SIP/5407&Custom:DND5407
exten => 5410,1,Macro(exten-vm,novm,5410)
exten => 5410,n,Goto(${IVR_CONTEXT},return,1)
exten => 5410,hint,SIP/5410&Custom:DND5410
exten => 5420,1,Macro(exten-vm,novm,5420)
exten => 5420,n,Goto(${IVR_CONTEXT},return,1)
exten => 5420,hint,SIP/5420&Custom:DND5420
exten => 5490,1,Macro(exten-vm,novm,5490)
exten => 5490,n,Goto(${IVR_CONTEXT},return,1)
exten => 5490,hint,SIP/5490&Custom:DND5490
exten => 5491,1,Macro(exten-vm,novm,5491)
exten => 5491,n,Goto(${IVR_CONTEXT},return,1)
exten => 5491,hint,SIP/5491&Custom:DND5491
exten => 5492,1,Macro(exten-vm,novm,5492)
exten => 5492,n,Goto(${IVR_CONTEXT},return,1)
exten => 5492,hint,SIP/5492&Custom:DND5492
exten => 5493,1,Macro(exten-vm,novm,5493)
exten => 5493,n,Goto(${IVR_CONTEXT},return,1)
exten => 5493,hint,SIP/5493&Custom:DND5493
exten => 5494,1,Macro(exten-vm,novm,5494)
exten => 5494,n,Goto(${IVR_CONTEXT},return,1)
exten => 5494,hint,SIP/5494&Custom:DND5494
exten => 5501,1,Macro(exten-vm,novm,5501)
exten => 5501,n,Goto(${IVR_CONTEXT},return,1)
exten => 5501,hint,SIP/5501&Custom:DND5501
exten => 5502,1,Macro(exten-vm,novm,5502)
exten => 5502,n,Goto(${IVR_CONTEXT},return,1)
exten => 5502,hint,SIP/5502&Custom:DND5502
exten => 5510,1,Macro(exten-vm,novm,5510)
exten => 5510,n,Goto(${IVR_CONTEXT},return,1)
exten => 5510,hint,SIP/5510&Custom:DND5510
exten => 5511,1,Macro(exten-vm,novm,5511)
exten => 5511,n,Goto(${IVR_CONTEXT},return,1)
exten => 5511,hint,SIP/5511&Custom:DND5511
exten => 5512,1,Macro(exten-vm,novm,5512)
exten => 5512,n,Goto(${IVR_CONTEXT},return,1)
exten => 5512,hint,SIP/5512&Custom:DND5512
exten => 5513,1,Macro(exten-vm,novm,5513)
exten => 5513,n,Goto(${IVR_CONTEXT},return,1)
exten => 5513,hint,SIP/5513&Custom:DND5513
exten => 5514,1,Macro(exten-vm,novm,5514)
exten => 5514,n,Goto(${IVR_CONTEXT},return,1)
exten => 5514,hint,SIP/5514&Custom:DND5514
exten => 5515,1,Macro(exten-vm,novm,5515)
exten => 5515,n,Goto(${IVR_CONTEXT},return,1)
exten => 5515,hint,SIP/5515&Custom:DND5515
exten => 5530,1,Macro(exten-vm,novm,5530)
exten => 5530,n,Goto(${IVR_CONTEXT},return,1)
exten => 5530,hint,SIP/5530&Custom:DND5530
exten => 5531,1,Macro(exten-vm,novm,5531)
exten => 5531,n,Goto(${IVR_CONTEXT},return,1)
exten => 5531,hint,SIP/5531&Custom:DND5531
exten => 5532,1,Macro(exten-vm,novm,5532)
exten => 5532,n,Goto(${IVR_CONTEXT},return,1)
exten => 5532,hint,SIP/5532&Custom:DND5532
exten => 5533,1,Macro(exten-vm,novm,5533)
exten => 5533,n,Goto(${IVR_CONTEXT},return,1)
exten => 5533,hint,SIP/5533&Custom:DND5533
exten => 5534,1,Macro(exten-vm,novm,5534)
exten => 5534,n,Goto(${IVR_CONTEXT},return,1)
exten => 5534,hint,SIP/5534&Custom:DND5534
exten => 5535,1,Macro(exten-vm,novm,5535)
exten => 5535,n,Goto(${IVR_CONTEXT},return,1)
exten => 5535,hint,SIP/5535&Custom:DND5535
exten => 5701,1,Macro(exten-vm,novm,5701)
exten => 5701,n,Goto(${IVR_CONTEXT},return,1)
exten => 5701,hint,SIP/5701&Custom:DND5701
exten => 5702,1,Macro(exten-vm,novm,5702)
exten => 5702,n,Goto(${IVR_CONTEXT},return,1)
exten => 5702,hint,SIP/5702&Custom:DND5702
exten => 5703,1,Macro(exten-vm,novm,5703)
exten => 5703,n,Goto(${IVR_CONTEXT},return,1)
exten => 5703,hint,SIP/5703&Custom:DND5703
exten => 5710,1,Macro(exten-vm,novm,5710)
exten => 5710,n,Goto(${IVR_CONTEXT},return,1)
exten => 5710,hint,SIP/5710&Custom:DND5710
exten => 5800,1,Macro(exten-vm,novm,5800)
exten => 5800,n,Goto(${IVR_CONTEXT},return,1)
exten => 5800,hint,SIP/5800&Custom:DND5800
exten => 5810,1,Macro(exten-vm,novm,5810)
exten => 5810,n,Goto(${IVR_CONTEXT},return,1)
exten => 5810,hint,SIP/5810&Custom:DND5810
exten => 5811,1,Macro(exten-vm,novm,5811)
exten => 5811,n,Goto(${IVR_CONTEXT},return,1)
exten => 5811,hint,SIP/5811&Custom:DND5811
exten => 5812,1,Macro(exten-vm,novm,5812)
exten => 5812,n,Goto(${IVR_CONTEXT},return,1)
exten => 5812,hint,SIP/5812&Custom:DND5812
exten => 5910,1,Macro(exten-vm,novm,5910)
exten => 5910,n,Goto(${IVR_CONTEXT},return,1)
exten => 5910,hint,SIP/5910&Custom:DND5910
exten => 5920,1,Macro(exten-vm,novm,5920)
exten => 5920,n,Goto(${IVR_CONTEXT},return,1)
exten => 5920,hint,SIP/5920&Custom:DND5920
exten => vmret,1,GotoIf($["${IVR_RETVM}" = "RETURN" & "${IVR_CONTEXT}" != ""]?playret)
exten => vmret,n,Hangup
exten => vmret,n(playret),Playback(exited-vm-will-be-transfered&silence/1)
exten => vmret,n,Goto(${IVR_CONTEXT},return,1)

; end of [ext-local]


[from-did-direct-ivr]
include => from-did-direct-ivr-custom
exten => 5000,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5000,n,Set(__NODEST=)
exten => 5000,n,Goto(from-did-direct,5000,1)
exten => 5010,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5010,n,Set(__NODEST=)
exten => 5010,n,Goto(from-did-direct,5010,1)
exten => 5020,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5020,n,Set(__NODEST=)
exten => 5020,n,Goto(from-did-direct,5020,1)
exten => 5021,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5021,n,Set(__NODEST=)
exten => 5021,n,Goto(from-did-direct,5021,1)
exten => 5022,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5022,n,Set(__NODEST=)
exten => 5022,n,Goto(from-did-direct,5022,1)
exten => 5030,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5030,n,Set(__NODEST=)
exten => 5030,n,Goto(from-did-direct,5030,1)
exten => 5031,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5031,n,Set(__NODEST=)
exten => 5031,n,Goto(from-did-direct,5031,1)
exten => 5032,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5032,n,Set(__NODEST=)
exten => 5032,n,Goto(from-did-direct,5032,1)
exten => 5100,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5100,n,Set(__NODEST=)
exten => 5100,n,Goto(from-did-direct,5100,1)
exten => 5110,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5110,n,Set(__NODEST=)
exten => 5110,n,Goto(from-did-direct,5110,1)
exten => 5111,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5111,n,Set(__NODEST=)
exten => 5111,n,Goto(from-did-direct,5111,1)
exten => 5112,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5112,n,Set(__NODEST=)
exten => 5112,n,Goto(from-did-direct,5112,1)
exten => 5113,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5113,n,Set(__NODEST=)
exten => 5113,n,Goto(from-did-direct,5113,1)
exten => 5120,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5120,n,Set(__NODEST=)
exten => 5120,n,Goto(from-did-direct,5120,1)
exten => 5121,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5121,n,Set(__NODEST=)
exten => 5121,n,Goto(from-did-direct,5121,1)
exten => 5122,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5122,n,Set(__NODEST=)
exten => 5122,n,Goto(from-did-direct,5122,1)
exten => 5123,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5123,n,Set(__NODEST=)
exten => 5123,n,Goto(from-did-direct,5123,1)
exten => 5124,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5124,n,Set(__NODEST=)
exten => 5124,n,Goto(from-did-direct,5124,1)
exten => 5125,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5125,n,Set(__NODEST=)
exten => 5125,n,Goto(from-did-direct,5125,1)
exten => 5130,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5130,n,Set(__NODEST=)
exten => 5130,n,Goto(from-did-direct,5130,1)
exten => 5131,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5131,n,Set(__NODEST=)
exten => 5131,n,Goto(from-did-direct,5131,1)
exten => 5140,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5140,n,Set(__NODEST=)
exten => 5140,n,Goto(from-did-direct,5140,1)
exten => 5141,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5141,n,Set(__NODEST=)
exten => 5141,n,Goto(from-did-direct,5141,1)
exten => 5150,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5150,n,Set(__NODEST=)
exten => 5150,n,Goto(from-did-direct,5150,1)
exten => 5200,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5200,n,Set(__NODEST=)
exten => 5200,n,Goto(from-did-direct,5200,1)
exten => 5201,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5201,n,Set(__NODEST=)
exten => 5201,n,Goto(from-did-direct,5201,1)
exten => 5202,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5202,n,Set(__NODEST=)
exten => 5202,n,Goto(from-did-direct,5202,1)
exten => 5203,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5203,n,Set(__NODEST=)
exten => 5203,n,Goto(from-did-direct,5203,1)
exten => 5210,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5210,n,Set(__NODEST=)
exten => 5210,n,Goto(from-did-direct,5210,1)
exten => 5220,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5220,n,Set(__NODEST=)
exten => 5220,n,Goto(from-did-direct,5220,1)
exten => 5230,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5230,n,Set(__NODEST=)
exten => 5230,n,Goto(from-did-direct,5230,1)
exten => 5231,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5231,n,Set(__NODEST=)
exten => 5231,n,Goto(from-did-direct,5231,1)
exten => 5232,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5232,n,Set(__NODEST=)
exten => 5232,n,Goto(from-did-direct,5232,1)
exten => ${VM_PREFIX}5232,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => ${VM_PREFIX}5232,n,Set(__NODEST=)
exten => ${VM_PREFIX}5232,n,Macro(vm,5232,DIRECTDIAL,${IVR_RETVM})
exten => ${VM_PREFIX}5232,n,GotoIf($["${IVR_RETVM}" = "RETURN" & "${IVR_CONTEXT}" != ""]?ext-local,vmret,playret)
exten => 5240,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5240,n,Set(__NODEST=)
exten => 5240,n,Goto(from-did-direct,5240,1)
exten => 5300,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5300,n,Set(__NODEST=)
exten => 5300,n,Goto(from-did-direct,5300,1)
exten => 5350,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5350,n,Set(__NODEST=)
exten => 5350,n,Goto(from-did-direct,5350,1)
exten => 5401,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5401,n,Set(__NODEST=)
exten => 5401,n,Goto(from-did-direct,5401,1)
exten => 5402,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5402,n,Set(__NODEST=)
exten => 5402,n,Goto(from-did-direct,5402,1)
exten => 5403,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5403,n,Set(__NODEST=)
exten => 5403,n,Goto(from-did-direct,5403,1)
exten => 5404,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5404,n,Set(__NODEST=)
exten => 5404,n,Goto(from-did-direct,5404,1)
exten => 5405,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5405,n,Set(__NODEST=)
exten => 5405,n,Goto(from-did-direct,5405,1)
exten => 5406,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5406,n,Set(__NODEST=)
exten => 5406,n,Goto(from-did-direct,5406,1)
exten => 5407,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5407,n,Set(__NODEST=)
exten => 5407,n,Goto(from-did-direct,5407,1)
exten => 5410,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5410,n,Set(__NODEST=)
exten => 5410,n,Goto(from-did-direct,5410,1)
exten => 5420,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5420,n,Set(__NODEST=)
exten => 5420,n,Goto(from-did-direct,5420,1)
exten => 5490,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5490,n,Set(__NODEST=)
exten => 5490,n,Goto(from-did-direct,5490,1)
exten => 5491,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5491,n,Set(__NODEST=)
exten => 5491,n,Goto(from-did-direct,5491,1)
exten => 5492,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5492,n,Set(__NODEST=)
exten => 5492,n,Goto(from-did-direct,5492,1)
exten => 5493,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5493,n,Set(__NODEST=)
exten => 5493,n,Goto(from-did-direct,5493,1)
exten => 5494,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5494,n,Set(__NODEST=)
exten => 5494,n,Goto(from-did-direct,5494,1)
exten => 5501,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5501,n,Set(__NODEST=)
exten => 5501,n,Goto(from-did-direct,5501,1)
exten => 5502,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5502,n,Set(__NODEST=)
exten => 5502,n,Goto(from-did-direct,5502,1)
exten => 5510,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5510,n,Set(__NODEST=)
exten => 5510,n,Goto(from-did-direct,5510,1)
exten => 5511,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5511,n,Set(__NODEST=)
exten => 5511,n,Goto(from-did-direct,5511,1)
exten => 5512,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5512,n,Set(__NODEST=)
exten => 5512,n,Goto(from-did-direct,5512,1)
exten => 5513,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5513,n,Set(__NODEST=)
exten => 5513,n,Goto(from-did-direct,5513,1)
exten => 5514,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5514,n,Set(__NODEST=)
exten => 5514,n,Goto(from-did-direct,5514,1)
exten => 5515,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5515,n,Set(__NODEST=)
exten => 5515,n,Goto(from-did-direct,5515,1)
exten => 5530,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5530,n,Set(__NODEST=)
exten => 5530,n,Goto(from-did-direct,5530,1)
exten => 5531,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5531,n,Set(__NODEST=)
exten => 5531,n,Goto(from-did-direct,5531,1)
exten => 5532,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5532,n,Set(__NODEST=)
exten => 5532,n,Goto(from-did-direct,5532,1)
exten => 5533,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5533,n,Set(__NODEST=)
exten => 5533,n,Goto(from-did-direct,5533,1)
exten => 5534,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5534,n,Set(__NODEST=)
exten => 5534,n,Goto(from-did-direct,5534,1)
exten => 5535,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5535,n,Set(__NODEST=)
exten => 5535,n,Goto(from-did-direct,5535,1)
exten => 5701,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5701,n,Set(__NODEST=)
exten => 5701,n,Goto(from-did-direct,5701,1)
exten => 5702,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5702,n,Set(__NODEST=)
exten => 5702,n,Goto(from-did-direct,5702,1)
exten => 5703,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5703,n,Set(__NODEST=)
exten => 5703,n,Goto(from-did-direct,5703,1)
exten => 5710,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5710,n,Set(__NODEST=)
exten => 5710,n,Goto(from-did-direct,5710,1)
exten => 5800,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5800,n,Set(__NODEST=)
exten => 5800,n,Goto(from-did-direct,5800,1)
exten => 5810,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5810,n,Set(__NODEST=)
exten => 5810,n,Goto(from-did-direct,5810,1)
exten => 5811,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5811,n,Set(__NODEST=)
exten => 5811,n,Goto(from-did-direct,5811,1)
exten => 5812,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5812,n,Set(__NODEST=)
exten => 5812,n,Goto(from-did-direct,5812,1)
exten => 5910,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5910,n,Set(__NODEST=)
exten => 5910,n,Goto(from-did-direct,5910,1)
exten => 5920,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?dbDel(${BLKVM_OVERRIDE}))
exten => 5920,n,Set(__NODEST=)
exten => 5920,n,Goto(from-did-direct,5920,1)

; end of [from-did-direct-ivr]


[from-trunk-iax2-CUU-peer]
include => from-trunk-iax2-CUU-peer-custom
exten => _.,1,Set(GROUP()=OUT_2)
exten => _.,n,Goto(from-trunk,${EXTEN},1)

; end of [from-trunk-iax2-CUU-peer]


[from-trunk-iax2-HMO-peer]
include => from-trunk-iax2-HMO-peer-custom
exten => _.,1,Set(GROUP()=OUT_3)
exten => _.,n,Goto(from-trunk,${EXTEN},1)

; end of [from-trunk-iax2-HMO-peer]


[macro-record-enable]
include => macro-record-enable-custom
exten => s,1,GotoIf($["${BLINDTRANSFER}" = ""]?check)
exten => s,n,ResetCDR(w)
exten => s,n,StopMixMonitor()
exten => s,n(check),AGI(recordingcheck,${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},${UNIQUEID})
exten => s,n,MacroExit()
exten => s,1+998(record),MixMonitor(${MIXMON_DIR}${CALLFILENAME}.${MIXMON_FORMAT},,${MIXMON_POST})

; end of [macro-record-enable]


[outbound-allroutes]
include => outbound-allroutes-custom
include => outrt-001-CUU
include => outrt-002-HMO
include => outrt-003-TELMEX
exten => foo,1,Noop(bar)

; end of [outbound-allroutes]


[outrt-001-CUU]
include => outrt-001-CUU-custom
exten => 700,1,Macro(user-callerid,SKIPTTL,)
exten => 700,n,Set(_NODEST=)
exten => 700,n,Macro(record-enable,${AMPUSER},OUT,)
exten => 700,n,Macro(dialout-trunk,2,${EXTEN},,)
exten => 700,n,Macro(outisbusy,)
exten => 800,1,Macro(user-callerid,SKIPTTL,)
exten => 800,n,Set(_NODEST=)
exten => 800,n,Macro(record-enable,${AMPUSER},OUT,)
exten => 800,n,Macro(dialout-trunk,2,${EXTEN},,)
exten => 800,n,Macro(outisbusy,)
exten => 900,1,Macro(user-callerid,SKIPTTL,)
exten => 900,n,Set(_NODEST=)
exten => 900,n,Macro(record-enable,${AMPUSER},OUT,)
exten => 900,n,Macro(dialout-trunk,2,${EXTEN},,)
exten => 900,n,Macro(outisbusy,)
exten => 911,1,Macro(user-callerid,SKIPTTL,)
exten => 911,n,Set(_NODEST=)
exten => 911,n,Macro(record-enable,${AMPUSER},OUT,)
exten => 911,n,Macro(dialout-trunk,2,${EXTEN},,)
exten => 911,n,Macro(outisbusy,)
exten => _2XXX,1,Macro(user-callerid,SKIPTTL,)
exten => _2XXX,n,Set(_NODEST=)
exten => _2XXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _2XXX,n,Macro(dialout-trunk,2,${EXTEN},,)
exten => _2XXX,n,Macro(outisbusy,)
exten => _4XXX,1,Macro(user-callerid,SKIPTTL,)
exten => _4XXX,n,Set(_NODEST=)
exten => _4XXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _4XXX,n,Macro(dialout-trunk,2,${EXTEN},,)
exten => _4XXX,n,Macro(outisbusy,)
exten => _91800XXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _91800XXXXXXX,n,Set(_NODEST=)
exten => _91800XXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _91800XXXXXXX,n,Macro(dialout-trunk,2,${EXTEN},,)
exten => _91800XXXXXXX,n,Macro(outisbusy,)
exten => _91866XXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _91866XXXXXXX,n,Set(_NODEST=)
exten => _91866XXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _91866XXXXXXX,n,Macro(dialout-trunk,2,${EXTEN},,)
exten => _91866XXXXXXX,n,Macro(outisbusy,)
exten => _91877XXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _91877XXXXXXX,n,Set(_NODEST=)
exten => _91877XXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _91877XXXXXXX,n,Macro(dialout-trunk,2,${EXTEN},,)
exten => _91877XXXXXXX,n,Macro(outisbusy,)
exten => _91880XXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _91880XXXXXXX,n,Set(_NODEST=)
exten => _91880XXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _91880XXXXXXX,n,Macro(dialout-trunk,2,${EXTEN},,)
exten => _91880XXXXXXX,n,Macro(outisbusy,)
exten => _91888XXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _91888XXXXXXX,n,Set(_NODEST=)
exten => _91888XXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _91888XXXXXXX,n,Macro(dialout-trunk,2,${EXTEN},,)
exten => _91888XXXXXXX,n,Macro(outisbusy,)
exten => _9203XXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _9203XXXX,n,Set(_NODEST=)
exten => _9203XXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _9203XXXX,n,Macro(dialout-trunk,2,${EXTEN:1},,)
exten => _9203XXXX,n,Macro(outisbusy,)
exten => _9212XXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _9212XXXX,n,Set(_NODEST=)
exten => _9212XXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _9212XXXX,n,Macro(dialout-trunk,2,${EXTEN:1},,)
exten => _9212XXXX,n,Macro(outisbusy,)
exten => _9257XXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _9257XXXX,n,Set(_NODEST=)
exten => _9257XXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _9257XXXX,n,Macro(dialout-trunk,2,${EXTEN:1},,)
exten => _9257XXXX,n,Macro(outisbusy,)

; end of [outrt-001-CUU]


[outrt-002-HMO]
include => outrt-002-HMO-custom
exten => _3XXX,1,Macro(user-callerid,SKIPTTL,)
exten => _3XXX,n,Set(_NODEST=)
exten => _3XXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _3XXX,n,Macro(dialout-trunk,3,${EXTEN},,)
exten => _3XXX,n,Macro(outisbusy,)

; end of [outrt-002-HMO]


[outrt-003-TELMEX]
include => outrt-003-TELMEX-custom
exten => 040,1,Macro(user-callerid,SKIPTTL,)
exten => 040,n,Set(_NODEST=)
exten => 040,n,Macro(record-enable,${AMPUSER},OUT,)
exten => 040,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => 040,n,Macro(outisbusy,)
exten => 050,1,Macro(user-callerid,SKIPTTL,)
exten => 050,n,Set(_NODEST=)
exten => 050,n,Macro(record-enable,${AMPUSER},OUT,)
exten => 050,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => 050,n,Macro(outisbusy,)
exten => 060,1,Macro(user-callerid,SKIPTTL,)
exten => 060,n,Set(_NODEST=)
exten => 060,n,Macro(record-enable,${AMPUSER},OUT,)
exten => 060,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => 060,n,Macro(outisbusy,)
exten => 066,1,Macro(user-callerid,SKIPTTL,)
exten => 066,n,Set(_NODEST=)
exten => 066,n,Macro(record-enable,${AMPUSER},OUT,)
exten => 066,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => 066,n,Macro(outisbusy,)
exten => 070,1,Macro(user-callerid,SKIPTTL,)
exten => 070,n,Set(_NODEST=)
exten => 070,n,Macro(record-enable,${AMPUSER},OUT,)
exten => 070,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => 070,n,Macro(outisbusy,)
exten => 071,1,Macro(user-callerid,SKIPTTL,)
exten => 071,n,Set(_NODEST=)
exten => 071,n,Macro(record-enable,${AMPUSER},OUT,)
exten => 071,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => 071,n,Macro(outisbusy,)
exten => 072,1,Macro(user-callerid,SKIPTTL,)
exten => 072,n,Set(_NODEST=)
exten => 072,n,Macro(record-enable,${AMPUSER},OUT,)
exten => 072,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => 072,n,Macro(outisbusy,)
exten => 080,1,Macro(user-callerid,SKIPTTL,)
exten => 080,n,Set(_NODEST=)
exten => 080,n,Macro(record-enable,${AMPUSER},OUT,)
exten => 080,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => 080,n,Macro(outisbusy,)
exten => 089,1,Macro(user-callerid,SKIPTTL,)
exten => 089,n,Set(_NODEST=)
exten => 089,n,Macro(record-enable,${AMPUSER},OUT,)
exten => 089,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => 089,n,Macro(outisbusy,)
exten => _001281XXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _001281XXXXXXX,n,Set(_NODEST=)
exten => _001281XXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _001281XXXXXXX,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => _001281XXXXXXX,n,Macro(outisbusy,)
exten => _001NXXXXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _001NXXXXXXXXX,n,Set(_NODEST=)
exten => _001NXXXXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _001NXXXXXXXXX,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => _001NXXXXXXXXX,n,Macro(outisbusy,)
exten => _00NXXXXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _00NXXXXXXXXX,n,Set(_NODEST=)
exten => _00NXXXXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _00NXXXXXXXXX,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => _00NXXXXXXXXX,n,Macro(outisbusy,)
exten => _00NXXXXXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _00NXXXXXXXXXX,n,Set(_NODEST=)
exten => _00NXXXXXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _00NXXXXXXXXXX,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => _00NXXXXXXXXXX,n,Macro(outisbusy,)
exten => _00NXXXXXXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _00NXXXXXXXXXXX,n,Set(_NODEST=)
exten => _00NXXXXXXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _00NXXXXXXXXXXX,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => _00NXXXXXXXXXXX,n,Macro(outisbusy,)
exten => _01800XXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _01800XXXXXXX,n,Set(_NODEST=)
exten => _01800XXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _01800XXXXXXX,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => _01800XXXXXXX,n,Macro(outisbusy,)
exten => _01800XXXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _01800XXXXXXXX,n,Set(_NODEST=)
exten => _01800XXXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _01800XXXXXXXX,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => _01800XXXXXXXX,n,Macro(outisbusy,)
exten => _01800XXXXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _01800XXXXXXXXX,n,Set(_NODEST=)
exten => _01800XXXXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _01800XXXXXXXXX,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => _01800XXXXXXXXX,n,Macro(outisbusy,)
exten => _01ZZXXXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _01ZZXXXXXXXX,n,Set(_NODEST=)
exten => _01ZZXXXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _01ZZXXXXXXXX,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => _01ZZXXXXXXXX,n,Macro(outisbusy,)
exten => _044614XXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _044614XXXXXXX,n,Set(_NODEST=)
exten => _044614XXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _044614XXXXXXX,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => _044614XXXXXXX,n,Macro(outisbusy,)
exten => _045XXXXXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _045XXXXXXXXXX,n,Set(_NODEST=)
exten => _045XXXXXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _045XXXXXXXXXX,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => _045XXXXXXXXXX,n,Macro(outisbusy,)
exten => _ZXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _ZXXXXXX,n,Set(_NODEST=)
exten => _ZXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _ZXXXXXX,n,Macro(dialout-trunk,4,${EXTEN},,)
exten => _ZXXXXXX,n,Macro(outisbusy,)

; end of [outrt-003-TELMEX]


[app-blackhole]
include => app-blackhole-custom
exten => hangup,1,Noop(Blackhole Dest: Hangup)
exten => hangup,n,Hangup
exten => zapateller,1,Noop(Blackhole Dest: Play SIT Tone)
exten => zapateller,n,Answer
exten => zapateller,n,Zapateller()
exten => musiconhold,1,Noop(Blackhole Dest: Put caller on hold forever)
exten => musiconhold,n,Answer
exten => musiconhold,n,MusicOnHold()
exten => congestion,1,Noop(Blackhole Dest: Congestion)
exten => congestion,n,Answer
exten => congestion,n,Playtones(congestion)
exten => congestion,n,Congestion(20)
exten => congestion,n,Hangup
exten => busy,1,Noop(Blackhole Dest: Busy)
exten => busy,n,Answer
exten => busy,n,Playtones(busy)
exten => busy,n,Busy(20)
exten => busy,n,Hangup
exten => ring,1,Noop(Blackhole Dest: Ring)
exten => ring,n,Answer
exten => ring,n,Playtones(ring)
exten => ring,n,Wait(300)
exten => ring,n,Hangup

; end of [app-blackhole]


[bad-number]
include => bad-number-custom
exten => _X.,1,ResetCDR()
exten => _X.,n,NoCDR()
exten => _X.,n,Wait(1)
exten => _X.,n,Playback(silence/1&cannot-complete-as-dialed&check-number-dial-again,noanswer)
exten => _X.,n,Wait(1)
exten => _X.,n,Congestion(20)
exten => _X.,n,Hangup

; end of [bad-number]


[macro-confirm]
include => macro-confirm-custom
exten => s,1,Set(LOOPCOUNT=0)
exten => s,n,Set(__MACRO_RESULT=ABORT)
exten => s,n,Set(MSG1=${IF($["foo${ARG1}" != "foo"]?${ARG1}:"incoming-call-1-accept-2-decline")})
exten => s,n(start),Background(${MSG1},m,${CHANNEL(language)},macro-confirm)
exten => s,n,Read(INPUT,,1,,,4)
exten => s,n,GotoIf($[${LEN(${INPUT})} > 0]?${INPUT},1:t,1)
exten => 1,1,GotoIf($["${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}" = "0"]?toolate,1)
exten => 1,n,dbDel(RG/${ARG3}/${UNIQCHAN})
exten => 1,n,dbDel(${BLKVM_OVERRIDE})
exten => 1,n,Set(__MACRO_RESULT=)
exten => 1,n(exitopt1),MacroExit()
exten => 2,1,Goto(noanswer,1)
exten => 3,1,SayDigits(${CALLCONFIRMCID})
exten => 3,n,GotoIf($["${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}" = "0"]?toolate,1:s,start)
exten => t,1,GotoIf($["${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}" = "0"]?toolate,1)
exten => t,n,Set(LOOPCOUNT=$[ ${LOOPCOUNT} + 1 ])
exten => t,n,GotoIf($[ ${LOOPCOUNT} < 5 ]?s,start:noanswer,1)
exten => _X,1,Background(invalid,m,${CHANNEL(language)},macro-confirm)
exten => _X,n,GotoIf($["${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}" = "0"]?toolate,1)
exten => _X,n,Set(LOOPCOUNT=$[ ${LOOPCOUNT} + 1 ])
exten => _X,n,GotoIf($[ ${LOOPCOUNT} < 5 ]?s,start:noanswer,1)
exten => noanswer,1,Set(__MACRO_RESULT=ABORT)
exten => noanswer,n(exitnoanswer),MacroExit()
exten => toolate,1,Set(MSG2=${IF($["foo${ARG2}" != "foo"]?${ARG2}:"incoming-call-no-longer-avail")})
exten => toolate,n,Playback(${MSG2})
exten => toolate,n,Set(__MACRO_RESULT=ABORT)
exten => toolate,n(exittoolate),MacroExit()
exten => h,1,Macro(hangupcall,)

; end of [macro-confirm]


[macro-auto-confirm]
include => macro-auto-confirm-custom
exten => s,1,Set(__MACRO_RESULT=)
exten => s,n,dbDel(${BLKVM_OVERRIDE})
exten => s,n,dbDel(RG/${ARG1}/${UNIQCHAN})

; end of [macro-auto-confirm]


[macro-auto-blkvm]
include => macro-auto-blkvm-custom
exten => s,1,Set(__MACRO_RESULT=)
exten => s,n,dbDel(${BLKVM_OVERRIDE})

; end of [macro-auto-blkvm]


[sub-pincheck]
include => sub-pincheck-custom
exten => s,1,Authenticate(${ARG3},)
exten => s,n,ResetCDR()
exten => s,n,Return()

; end of [sub-pincheck]


[macro-dialout-trunk]
include => macro-dialout-trunk-custom
exten => s,1,Set(DIAL_TRUNK=${ARG1})
exten => s,n,GosubIf($[$["${ARG3}" != ""] & $["${DB(AMPUSER/${AMPUSER}/pinless)}" != "NOPASSWD"]]?sub-pincheck,s,1)
exten => s,n,GotoIf($["x${OUTDISABLE_${DIAL_TRUNK}}" = "xon"]?disabletrunk,1)
exten => s,n,Set(DIAL_NUMBER=${ARG2})
exten => s,n,Set(DIAL_TRUNK_OPTIONS=${DIAL_OPTIONS})
exten => s,n,Set(OUTBOUND_GROUP=OUT_${DIAL_TRUNK})
exten => s,n,GotoIf($["${OUTMAXCHANS_${DIAL_TRUNK}}foo" = "foo"]?nomax)
exten => s,n,GotoIf($[ ${GROUP_COUNT(OUT_${DIAL_TRUNK})} >= ${OUTMAXCHANS_${DIAL_TRUNK}} ]?chanfull)
exten => s,n(nomax),GotoIf($["${INTRACOMPANYROUTE}" = "YES"]?skipoutcid)
exten => s,n,Set(DIAL_TRUNK_OPTIONS=${TRUNK_OPTIONS})
exten => s,n,Macro(outbound-callerid,${DIAL_TRUNK})
exten => s,n(skipoutcid),ExecIf($["${PREFIX_TRUNK_${DIAL_TRUNK}}" != ""]?AGI(fixlocalprefix))
exten => s,n,Set(OUTNUM=${OUTPREFIX_${DIAL_TRUNK}}${DIAL_NUMBER})
exten => s,n,Set(custom=${CUT(OUT_${DIAL_TRUNK},:,1)})
exten => s,n,ExecIf($[$["${MOHCLASS}" != "default"] & $["${MOHCLASS}" != ""]]?Set(DIAL_TRUNK_OPTIONS=M(setmusic^${MOHCLASS})${DIAL_TRUNK_OPTIONS}))
exten => s,n(gocall),Macro(dialout-trunk-predial-hook,)
exten => s,n,GotoIf($["${PREDIAL_HOOK_RET}" = "BYPASS"]?bypass,1)
exten => s,n,GotoIf($["${custom}" = "AMP"]?customtrunk)
exten => s,n,Dial(${OUT_${DIAL_TRUNK}}/${OUTNUM},300,${DIAL_TRUNK_OPTIONS})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s,n(customtrunk),Set(pre_num=${CUT(OUT_${DIAL_TRUNK},$,1)})
exten => s,n,Set(the_num=${CUT(OUT_${DIAL_TRUNK},$,2)})
exten => s,n,Set(post_num=${CUT(OUT_${DIAL_TRUNK},$,3)})
exten => s,n,GotoIf($["${the_num}" = "OUTNUM"]?outnum:skipoutnum)
exten => s,n(outnum),Set(the_num=${OUTNUM})
exten => s,n(skipoutnum),Dial(${pre_num:4}${the_num}${post_num},300,${DIAL_TRUNK_OPTIONS})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s,n(chanfull),Noop(max channels used up)
exten => s-BUSY,1,Noop(Dial failed due to trunk reporting BUSY - giving up)
exten => s-BUSY,n,Playtones(busy)
exten => s-BUSY,n,Busy(20)
exten => s-NOANSWER,1,Noop(Dial failed due to trunk reporting NOANSWER - giving up)
exten => s-NOANSWER,n,Playtones(congestion)
exten => s-NOANSWER,n,Congestion(20)
exten => s-CANCEL,1,Noop(Dial failed due to trunk reporting CANCEL - giving up)
exten => s-CANCEL,n,Playtones(congestion)
exten => s-CANCEL,n,Congestion(20)
exten => s-CHANUNAVAIL,1,GotoIf($["x${OUTFAIL_${ARG1}}" = "x"]?noreport)
exten => s-CHANUNAVAIL,n,AGI(${OUTFAIL_${ARG1}})
exten => s-CHANUNAVAIL,n(noreport),Noop(TRUNK Dial failed due to ${DIALSTATUS} (hangupcause: ${HANGUPCAUSE}) - failing through to other trunks)
exten => _s-.,1,GotoIf($["x${OUTFAIL_${ARG1}}" = "x"]?noreport)
exten => _s-.,n,AGI(${OUTFAIL_${ARG1}})
exten => _s-.,n(noreport),Noop(TRUNK Dial failed due to ${DIALSTATUS} - failing through to other trunks)
exten => disabletrunk,1,Noop(TRUNK: ${OUT_${DIAL_TRUNK}} DISABLED - falling through to next trunk)
exten => bypass,1,Noop(TRUNK: ${OUT_${DIAL_TRUNK}} BYPASSING because dialout-trunk-predial-hook)
exten => h,1,Macro(hangupcall,)

; end of [macro-dialout-trunk]


[macro-dialout-dundi]
include => macro-dialout-dundi-custom
exten => s,1,Set(DIAL_TRUNK=${ARG1})
exten => s,n,GosubIf($[$["${ARG3}" != ""] & $["${DB(AMPUSER/${AMPUSER}/pinless)}" != "NOPASSWD"]]?sub-pincheck,s,1)
exten => s,n,GotoIf($["x${OUTDISABLE_${DIAL_TRUNK}}" = "xon"]?disabletrunk,1)
exten => s,n,Set(DIAL_NUMBER=${ARG2})
exten => s,n,Set(DIAL_TRUNK_OPTIONS=${DIAL_OPTIONS})
exten => s,n,Set(OUTBOUND_GROUP=OUT_${DIAL_TRUNK})
exten => s,n,GotoIf($["${OUTMAXCHANS_${DIAL_TRUNK}}foo" = "foo"]?nomax)
exten => s,n,GotoIf($[ ${GROUP_COUNT(OUT_${DIAL_TRUNK})} >= ${OUTMAXCHANS_${DIAL_TRUNK}} ]?chanfull)
exten => s,n(nomax),GotoIf($["${INTRACOMPANYROUTE}" = "YES"]?skipoutcid)
exten => s,n,Set(DIAL_TRUNK_OPTIONS=${TRUNK_OPTIONS})
exten => s,n,Macro(outbound-callerid,${DIAL_TRUNK})
exten => s,n(skipoutcid),ExecIf($["${PREFIX_TRUNK_${DIAL_TRUNK}}" != ""]?AGI(fixlocalprefix))
exten => s,n,Set(OUTNUM=${OUTPREFIX_${DIAL_TRUNK}}${DIAL_NUMBER})
exten => s,n,ExecIf($[$["${MOHCLASS}" != "default"] & $["${MOHCLASS}" != ""]]?Set(DIAL_TRUNK_OPTIONS=M(setmusic^${MOHCLASS})${DIAL_TRUNK_OPTIONS}))
exten => s,n(gocall),Macro(dialout-dundi-predial-hook,)
exten => s,n,GotoIf($["${PREDIAL_HOOK_RET}" = "BYPASS"]?bypass,1)
exten => s,n,GotoIf($["${custom}" = "AMP"]?customtrunk)
exten => s,n,Macro(dundi-${DIAL_TRUNK},${OUTNUM})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s,n(chanfull),Noop(max channels used up)
exten => s-BUSY,1,Noop(Dial failed due to trunk reporting BUSY - giving up)
exten => s-BUSY,n,Playtones(busy)
exten => s-BUSY,n,Busy(20)
exten => s-NOANSWER,1,Noop(Dial failed due to trunk reporting NOANSWER - giving up)
exten => s-NOANSWER,n,Playtones(congestion)
exten => s-NOANSWER,n,Congestion(20)
exten => s-CANCEL,1,Noop(Dial failed due to trunk reporting CANCEL - giving up)
exten => s-CANCEL,n,Playtones(congestion)
exten => s-CANCEL,n,Congestion(20)
exten => _s-.,1,GotoIf($["x${OUTFAIL_${ARG1}}" = "x"]?noreport)
exten => _s-.,n,AGI(${OUTFAIL_${ARG1}})
exten => _s-.,n(noreport),Noop(TRUNK Dial failed due to ${DIALSTATUS} - failing through to other trunks)
exten => disabletrunk,1,Noop(TRUNK: ${OUT_${DIAL_TRUNK}} DISABLED - falling through to next trunk)
exten => bypass,1,Noop(TRUNK: ${OUT_${DIAL_TRUNK}} BYPASSING because dialout-dundi-predial-hook)
exten => h,1,Macro(hangupcall,)

; end of [macro-dialout-dundi]


[macro-user-callerid]
include => macro-user-callerid-custom
exten => s,1,Set(AMPUSER=${IF($["foo${AMPUSER}" = "foo"]?${CALLERID(number)}:${AMPUSER})})
exten => s,n,GotoIf($["${CHANNEL:0:5}" = "Local"]?report)
exten => s,n,ExecIf($["${REALCALLERIDNUM:1:2}" = ""]?Set(REALCALLERIDNUM=${CALLERID(number)}))
exten => s,n,Set(AMPUSER=${DB(DEVICE/${REALCALLERIDNUM}/user)})
exten => s,n,Set(AMPUSERCIDNAME=${DB(AMPUSER/${AMPUSER}/cidname)})
exten => s,n,GotoIf($["x${AMPUSERCIDNAME:1:2}" = "x"]?report)
exten => s,n,Set(AMPUSERCID=${IF($["${DB_EXISTS(AMPUSER/${AMPUSER}/cidnum)}" = "1"]?${DB_RESULT}:${AMPUSER})})
exten => s,n,Set(CALLERID(all)="${AMPUSERCIDNAME}" <${AMPUSERCID}>)
exten => s,n,ExecIf($["${DB(AMPUSER/${AMPUSER}/language)}" != ""]?Set(CHANNEL(language)=${DB(AMPUSER/${AMPUSER}/language)}))
exten => s,n(report),GotoIf($[ "${ARG1}" = "SKIPTTL" ]?continue)
exten => s,n(report2),Set(__TTL=${IF($["foo${TTL}" = "foo"]?64:$[ ${TTL} - 1 ])})
exten => s,n,GotoIf($[ ${TTL} > 0 ]?continue)
exten => s,n,Wait(${RINGTIMER})
exten => s,n,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(im-sorry&an-error-has-occured&with&call-forwarding)
exten => s,n,Macro(hangupcall,)
exten => s,n,Congestion(20)
exten => s,n(continue),Noop(Using CallerID ${CALLERID(all)})
exten => h,1,Macro(hangupcall,)

; end of [macro-user-callerid]


[macro-dialout-enum]
include => macro-dialout-enum-custom
exten => s,1,GosubIf($[$["${ARG3}" != ""] & $["${DB(AMPUSER/${AMPUSER}/pinless)}" != "NOPASSWD"]]?sub-pincheck,s,1)
exten => s,n,Macro(outbound-callerid,${ARG1})
exten => s,n,Set(OUTBOUND_GROUP=OUT_${ARG1})
exten => s,n,GotoIf($["${OUTMAXCHANS_${ARG1}}foo" = "foo"]?nomax)
exten => s,n,GotoIf($[ ${GROUP_COUNT(OUT_${ARG1})} >= ${OUTMAXCHANS_${ARG1}} ]?nochans)
exten => s,n(nomax),Set(DIAL_NUMBER=${ARG2})
exten => s,n,Set(DIAL_TRUNK=${ARG1})
exten => s,n,ExecIf($["${PREFIX_TRUNK_${DIAL_TRUNK}}" != ""]?AGI(fixlocalprefix))
exten => s,n,AGI(enumlookup.agi)
exten => s,n(dialloop),GotoIf($["foo${DIALARR}"="foo"]?end)
exten => s,n,Set(TRYDIAL=${CUT(DIALARR,%,1)})
exten => s,n,Set(DIALARR=${CUT(DIALARR,%,2-)})
exten => s,n,Dial(${TRYDIAL},)
exten => s,n,Noop(Dial exited in macro-enum-dialout with ${DIALSTATUS})
exten => s,n,GotoIf($[ $[ "${DIALSTATUS}" = "CHANUNAVAIL" ] | $[ "${DIALSTATUS}" = "CONGESTION" ] ]?dialloop)
exten => s,n(dialfailed),Goto(s-${DIALSTATUS},1)
exten => s,n(nochans),Noop(max channels used up)
exten => s,n(end),Noop(Exiting macro-dialout-enum)
exten => s-BUSY,1,Noop(Trunk is reporting BUSY)
exten => s-BUSY,n,Busy(20)
exten => _s-.,1,Noop(Dial failed due to ${DIALSTATUS})

; end of [macro-dialout-enum]


[macro-outbound-callerid]
include => macro-outbound-callerid-custom
exten => s,1,ExecIf($["${CALLINGPRES_SV}" != ""]?Set(CALLERPRES()=${CALLINGPRES_SV}))
exten => s,n,ExecIf($["${REALCALLERIDNUM:1:2}" = ""]?Set(REALCALLERIDNUM=${CALLERID(number)}))
exten => s,n(start),GotoIf($[ $["${REALCALLERIDNUM}" = ""] | $["${KEEPCID}" != "TRUE"] | $["${OUTKEEPCID_${ARG1}}" = "on"] ]?normcid)
exten => s,n,Set(USEROUTCID=${REALCALLERIDNUM})
exten => s,n,GotoIf($["foo${DB(AMPUSER/${REALCALLERIDNUM}/device)}" = "foo"]?bypass)
exten => s,n(normcid),Set(USEROUTCID=${DB(AMPUSER/${AMPUSER}/outboundcid)})
exten => s,n(bypass),Set(EMERGENCYCID=${DB(DEVICE/${REALCALLERIDNUM}/emergency_cid)})
exten => s,n,Set(TRUNKOUTCID=${OUTCID_${ARG1}})
exten => s,n,GotoIf($[ $["${EMERGENCYROUTE:1:2}" = ""] | $["${EMERGENCYCID:1:2}" = ""] ]?trunkcid)
exten => s,n,Set(CALLERID(all)=${EMERGENCYCID})
exten => s,n(exit),MacroExit()
exten => s,n(trunkcid),ExecIf($["${TRUNKOUTCID:1:2}" != ""]?Set(CALLERID(all)=${TRUNKOUTCID}))
exten => s,n(usercid),ExecIf($["${USEROUTCID:1:2}" != ""]?Set(CALLERID(all)=${USEROUTCID}))
exten => s,n(hidecid),ExecIf($["${CALLERID(name)}"="hidden"]?Set(CALLERPRES()=prohib_passed_screen))

; end of [macro-outbound-callerid]


[macro-agent-add]
include => macro-agent-add-custom
exten => s,1,Wait(1)
exten => s,n,Macro(user-callerid,SKIPTTL)
exten => s,n(a3),Read(CALLBACKNUM,agent-login,,,,)
exten => s,n,GotoIf($["${CALLBACKNUM}" != ""]?a7)
exten => s,n(a5),Set(CALLBACKNUM=${AMPUSER})
exten => s,n,ExecIf($["${CALLBACKNUM}" = ""]?Set(CALLBACKNUM=${CALLERID(number)}))
exten => s,n,GotoIf($["${CALLBACKNUM}" = ""]?a3)
exten => s,n(a7),GotoIf($["${CALLBACKNUM}" = "${ARG1}"]?invalid)
exten => s,n,ExecIf($["${QREGEX}" != ""]?GotoIf($["${REGEX("${QREGEX}" ${CALLBACKNUM})}" = "0"]?invalid))
exten => s,n,ExecIf($["${ARG2}" != ""]?Authenticate(${ARG2}))
exten => s,n(a9),AddQueueMember(${ARG1},Local/${CALLBACKNUM}@from-internal/n)
exten => s,n,UserEvent(Agentlogin,Agent: ${CALLBACKNUM})
exten => s,n,Wait(1)
exten => s,n,Playback(agent-loginok&with&extension)
exten => s,n,SayDigits(${CALLBACKNUM})
exten => s,n,Hangup
exten => s,n,MacroExit()
exten => s,n(invalid),Playback(pbx-invalid)
exten => s,n,Goto(a3)

; end of [macro-agent-add]


[macro-agent-del]
include => macro-agent-del-custom
exten => s,1,Wait(1)
exten => s,n,Macro(user-callerid,SKIPTTL)
exten => s,n(a3),Read(CALLBACKNUM,agent-logoff,,,,)
exten => s,n,GotoIf($["${CALLBACKNUM}" = ""]?a5:a7)
exten => s,n(a5),Set(CALLBACKNUM=${AMPUSER})
exten => s,n,ExecIf($["${CALLBACKNUM}" = ""]?Set(CALLBACKNUM=${CALLERID(number)}))
exten => s,n,GotoIf($["${CALLBACKNUM}" = ""]?a3)
exten => s,n(a7),RemoveQueueMember(${ARG1},Local/${CALLBACKNUM}@from-internal/n)
exten => s,n,UserEvent(RefreshQueue)
exten => s,n,Wait(1)
exten => s,n,Playback(agent-loggedoff)
exten => s,n,Hangup

; end of [macro-agent-del]


[macro-systemrecording]
include => macro-systemrecording-custom
exten => s,1,Set(RECFILE=${IF($["${ARG2}" = ""]?/tmp/${AMPUSER}-ivrrecording:${ARG2})})
exten => s,n,ExecIf($["${ARG3}" != ""]?Authenticate(${ARG3}))
exten => s,n,Goto(${ARG1},1)
exten => dorecord,1,System(rm ${ASTVARLIBDIR}/sounds/${RECFILE}.*)
exten => dorecord,n,Record(${RECFILE}:wav)
exten => dorecord,n,Wait(1)
exten => dorecord,n,Goto(confmenu,1)
exten => docheck,1,Playback(beep)
exten => docheck,n(dc_start),Background(${RECFILE},m,${CHANNEL(language)},macro-systemrecording)
exten => docheck,n,Wait(1)
exten => docheck,n,Goto(confmenu,1)
exten => confmenu,1,Background(to-listen-to-it&press-1&to-rerecord-it&press-star&astcc-followed-by-pound,m,${CHANNEL(language)},macro-systemrecording)
exten => confmenu,n,Read(RECRESULT,,1,,,4)
exten => confmenu,n,GotoIf($["x${RECRESULT}"="x*"]?dorecord,1)
exten => confmenu,n,GotoIf($["x${RECRESULT}"="x1"]?docheck,2)
exten => confmenu,n,Goto(1)
exten => 1,1,Goto(docheck,dc_start)
exten => *,1,Goto(dorecord,1)
exten => t,1,Playback(goodbye)
exten => t,n,Hangup
exten => i,1,Playback(pm-invalid-option)
exten => i,n,Goto(confmenu,1)
exten => h,1,Hangup

; end of [macro-systemrecording]


[from-zaptel]
include => from-zaptel-custom
exten => _X.,1,Set(DID=${EXTEN})
exten => _X.,n,Goto(s,1)
exten => s,1,Noop(Entering from-zaptel with DID == ${DID})
exten => s,n,Ringing()
exten => s,n,Set(DID=${IF($["${DID}"= ""]?s:${DID})})
exten => s,n,Noop(DID is now ${DID})
exten => s,n,GotoIf($["${CHANNEL:0:5}"="DAHDI"]?zapok:notzap)
exten => s,n(notzap),Goto(from-pstn,${DID},1)
exten => s,n,Macro(Hangupcall,dummy)
exten => s,n(zapok),Noop(Is a Zaptel Channel)
exten => s,n,Set(CHAN=${CHANNEL:6})
exten => s,n,Set(CHAN=${CUT(CHAN,-,1)})
exten => s,n,Macro(from-zaptel-${CHAN},${DID},1)
exten => s,n,Noop(Returned from Macro from-zaptel-${CHAN})
exten => s,n,Goto(from-pstn,${DID},1)
exten => fax,1,Goto(ext-fax,in_fax,1)

; end of [from-zaptel]


[vm-callme]
include => vm-callme-custom
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n(repeat),Background(${MSG}&silence/2&vm-repeat&vm-starmain)
exten => s,n,WaitExten(15,)
exten => 5,1,Goto(s,repeat)
exten => #,1,Playback(vm-goodbye)
exten => #,n,Hangup
exten => *,1,Macro(get-vmcontext,${MBOX})
exten => *,n,VoiceMailMain(${MBOX}@${VMCONTEXT},s)
exten => i,1,Playback(pm-invalid-option)
exten => i,n,Goto(s,repeat)
exten => t,1,Playback(vm-goodbye)
exten => t,n,Hangup
exten => h,1,Hangup

; end of [vm-callme]


[macro-vm]
include => macro-vm-custom
exten => s,1,Macro(user-callerid,SKIPTTL)
exten => s,n,Set(VMGAIN=${IF($["foo${VM_GAIN}"!="foo"]?"g(${VM_GAIN})":"")})
exten => s,n,GotoIf($["foo${DB(${BLKVM_OVERRIDE})}" != "fooTRUE"]?vmx,1)
exten => s,n,Noop(CAME FROM: ${NODEST} - Blocking VM cause of key: ${DB(BLKVM_OVERRIDE)})
exten => s,n,Hangup
exten => vmx,1,GotoIf($["${ARG2}"="NOMESSAGE"]?s-${ARG2},1)
exten => vmx,n,Set(MODE=${IF($["${ARG2}"="BUSY"]?busy:unavail)})
exten => vmx,n,GotoIf($["${ARG2}" != "DIRECTDIAL"]?notdirect)
exten => vmx,n,Set(MODE=${IF($["${REGEX("[b]" ${VM_DDTYPE})}" = "1"]?busy:${MODE})})
exten => vmx,n(notdirect),Noop(Checking if ext ${ARG1} is enabled: ${DB(AMPUSER/${ARG1}/vmx/${MODE}/state)})
exten => vmx,n,GotoIf($["${DB(AMPUSER/${ARG1}/vmx/${MODE}/state)}" != "enabled"]?s-${ARG2},1)
exten => vmx,n,Macro(get-vmcontext,${ARG1})
exten => vmx,n,GotoIf($[(${STAT(f,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/temp.wav)} = 1) || (${STAT(f,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/temp.WAV)} = 1)]?tmpgreet)
exten => vmx,n,GotoIf($[(${STAT(f,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/${MODE}.wav)} = 0) && (${STAT(f,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/${MODE}.WAV)} = 0)]?nofile)
exten => vmx,n,Set(LOOPCOUNT=0)
exten => vmx,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/repeat)}" = "0"]?vmxtime)
exten => vmx,n,Set(VMX_REPEAT=${DB_RESULT})
exten => vmx,n(vmxtime),GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/timeout)}" = "0"]?vmxloops)
exten => vmx,n,Set(VMX_TIMEOUT=${DB_RESULT})
exten => vmx,n(vmxloops),GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/loops)}" = "0"]?vmxanswer)
exten => vmx,n,Set(VMX_LOOPS=${DB_RESULT})
exten => vmx,n(vmxanswer),Answer
exten => vmx,n(loopstart),Read(ACTION,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/${MODE},1,skip,${VMX_REPEAT},${VMX_TIMEOUT})
exten => vmx,n,GotoIf($["${EXISTS(${ACTION})}" = "1"]?checkopt)
exten => vmx,n(noopt),Noop(Timeout: going to timeout dest)
exten => vmx,n,Set(VMX_OPTS=${VMX_OPTS_TIMEOUT})
exten => vmx,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/vmxopts/timeout)}" = "0"]?chktime)
exten => vmx,n,Set(VMX_OPTS=${DB_RESULT})
exten => vmx,n(chktime),GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/timedest/ext)}" = "0"]?dotime)
exten => vmx,n,Set(VMX_TIMEDEST_EXT=${DB_RESULT})
exten => vmx,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/timedest/context)}" = "0"]?timepri)
exten => vmx,n,Set(VMX_TIMEDEST_CONTEXT=${DB_RESULT})
exten => vmx,n(timepri),GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/timedest/pri)}" = "0"]?dotime)
exten => vmx,n,Set(VMX_TIMEDEST_PRI=${DB_RESULT})
exten => vmx,n(dotime),Goto(${VMX_TIMEDEST_CONTEXT},${VMX_TIMEDEST_EXT},${VMX_TIMEDEST_PRI})
exten => vmx,n(checkopt),GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/${ACTION}/ext)}" = "1"]?doopt)
exten => vmx,n,GotoIf($["${ACTION}" = "0"]?o,1)
exten => vmx,n,GotoIf($["${ACTION}" = "*"]?adef,1)
exten => vmx,n,Set(LOOPCOUNT=$[${LOOPCOUNT} + 1])
exten => vmx,n,GotoIf($[${LOOPCOUNT} > ${VMX_LOOPS}]?toomany)
exten => vmx,n,Playback(pm-invalid-option&please-try-again)
exten => vmx,n,Goto(loopstart)
exten => vmx,n(toomany),Noop(Too Many invalid entries, got to invalid dest)
exten => vmx,n,Set(VMX_OPTS=${VMX_OPTS_LOOPS})
exten => vmx,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/vmxopts/loops)}" = "0"]?chkloop)
exten => vmx,n,Set(VMX_OPTS=${DB_RESULT})
exten => vmx,n(chkloop),GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/loopdest/ext)}" = "0"]?doloop)
exten => vmx,n,Set(VMX_LOOPDEST_EXT=${DB_RESULT})
exten => vmx,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/loopdest/context)}" = "0"]?looppri)
exten => vmx,n,Set(VMX_LOOPDEST_CONTEXT=${DB_RESULT})
exten => vmx,n(looppri),GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/loopdest/pri)}" = "0"]?doloop)
exten => vmx,n,Set(VMX_LOOPDEST_PRI=${DB_RESULT})
exten => vmx,n(doloop),Goto(${VMX_LOOPDEST_CONTEXT},${VMX_LOOPDEST_EXT},${VMX_LOOPDEST_PRI})
exten => vmx,n(doopt),Noop(Got a valid option: ${DB_RESULT})
exten => vmx,n,Set(VMX_EXT=${DB_RESULT})
exten => vmx,n,GotoIf($["${VMX_EXT}" != "dovm"]?getdest)
exten => vmx,n(vmxopts),Set(VMX_OPTS=${VMX_OPTS_DOVM})
exten => vmx,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/vmxopts/dovm)}" = "0"]?vmxdovm)
exten => vmx,n(vmxopts),Set(VMX_OPTS=${DB_RESULT})
exten => vmx,n(vmxdovm),Goto(dovm,1)
exten => vmx,n(getdest),GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/${ACTION}/context)}" = "0"]?vmxpri)
exten => vmx,n,Set(VMX_CONTEXT=${DB_RESULT})
exten => vmx,n(vmxpri),GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/${ACTION}/pri)}" = "0"]?vmxgoto)
exten => vmx,n,Set(VMX_PRI=${DB_RESULT})
exten => vmx,n(vmxgoto),Goto(${VMX_CONTEXT},${VMX_EXT},${VMX_PRI})
exten => vmx,n(nofile),Noop(File for mode: ${MODE} does not exist, SYSTEMSTATUS: ${SYSTEMSTATUS}, going to normal voicemail)
exten => vmx,n,Goto(s-${ARG2},1)
exten => vmx,n(tmpgreet),Noop(Temporary Greeting Detected, going to normal voicemail)
exten => vmx,n,Goto(s-${ARG2},1)
exten => dovm,1,Noop(VMX Timeout - go to voicemail)
exten => dovm,n,VoiceMail(${ARG1}@${VMCONTEXT},${VMX_OPTS}${VMGAIN})
exten => dovm,n,Goto(exit-${VMSTATUS},1)
exten => s-BUSY,1,Noop(BUSY voicemail)
exten => s-BUSY,n,Macro(get-vmcontext,${ARG1})
exten => s-BUSY,n,VoiceMail(${ARG1}@${VMCONTEXT},${VM_OPTS}b${VMGAIN})
exten => s-BUSY,n,Goto(exit-${VMSTATUS},1)
exten => s-NOMESSAGE,1,Noop(NOMESSAGE (beeb only) voicemail)
exten => s-NOMESSAGE,n,Macro(get-vmcontext,${ARG1})
exten => s-NOMESSAGE,n,VoiceMail(${ARG1}@${VMCONTEXT},s${VM_OPTS}${VMGAIN})
exten => s-NOMESSAGE,n,Goto(exit-${VMSTATUS},1)
exten => s-DIRECTDIAL,1,Noop(DIRECTDIAL voicemail)
exten => s-DIRECTDIAL,n,Macro(get-vmcontext,${ARG1})
exten => s-DIRECTDIAL,n,VoiceMail(${ARG1}@${VMCONTEXT},${VM_OPTS}${VM_DDTYPE}${VMGAIN})
exten => s-DIRECTDIAL,n,Goto(exit-${VMSTATUS},1)
exten => _s-.,1,Macro(get-vmcontext,${ARG1})
exten => _s-.,n,VoiceMail(${ARG1}@${VMCONTEXT},${VM_OPTS}u${VMGAIN})
exten => _s-.,n,Goto(exit-${VMSTATUS},1)
exten => o,1,Playback(one-moment-please)
exten => o,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/0/ext)}" = "0"]?doopdef)
exten => o,n,Set(VMX_OPDEST_EXT=${DB_RESULT})
exten => o,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/0/context)}" = "1"]?opcontext)
exten => o,n,Set(DB_RESULT=${VMX_CONTEXT})
exten => o,n(opcontext),Set(VMX_OPDEST_CONTEXT=${DB_RESULT})
exten => o,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/0/pri)}" = "1"]?oppri)
exten => o,n,Set(DB_RESULT=${VMX_PRI})
exten => o,n(oppri),Set(VMX_OPDEST_PRI=${DB_RESULT})
exten => o,n,Goto(${VMX_OPDEST_CONTEXT},${VMX_OPDEST_EXT},${VMX_OPDEST_PRI})
exten => o,n(doopdef),GotoIf($["x${OPERATOR_XTN}"="x"]?nooper:from-internal,${OPERATOR_XTN},1)
exten => o,n(nooper),GotoIf($["x${FROM_DID}"="x"]?nodid)
exten => o,n,Dial(Local/${FROM_DID}@from-pstn,)
exten => o,n,Macro(hangup,)
exten => o,n(nodid),Dial(Local/s@from-pstn,)
exten => o,n,Macro(hangup,)
exten => a,1,Macro(get-vmcontext,${ARG1})
exten => a,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/*/ext)}" = "0"]?adef,1)
exten => a,n,Set(VMX_ADEST_EXT=${DB_RESULT})
exten => a,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/*/context)}" = "1"]?acontext)
exten => a,n,Set(DB_RESULT=${VMX_CONTEXT})
exten => a,n(acontext),Set(VMX_ADEST_CONTEXT=${DB_RESULT})
exten => a,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/*/pri)}" = "1"]?apri)
exten => a,n,Set(DB_RESULT=${VMX_PRI})
exten => a,n(apri),Set(VMX_ADEST_PRI=${DB_RESULT})
exten => a,n,Goto(${VMX_ADEST_CONTEXT},${VMX_ADEST_EXT},${VMX_ADEST_PRI})
exten => adef,1,VoiceMailMain(${ARG1}@${VMCONTEXT})
exten => adef,n,GotoIf($["${ARG3}" = "RETURN"]?exit-RETURN,1)
exten => adef,n,Hangup
exten => exit-FAILED,1,Playback(im-sorry&an-error-has-occured)
exten => exit-FAILED,n,GotoIf($["${ARG3}" = "RETURN"]?exit-RETURN,1)
exten => exit-FAILED,n,Hangup
exten => exit-SUCCESS,1,GotoIf($["${ARG3}" = "RETURN"]?exit-RETURN,1)
exten => exit-SUCCESS,n,Playback(goodbye)
exten => exit-SUCCESS,n,Hangup
exten => exit-USEREXIT,1,GotoIf($["${ARG3}" = "RETURN"]?exit-RETURN,1)
exten => exit-USEREXIT,n,Playback(goodbye)
exten => exit-USEREXIT,n,Hangup
exten => exit-RETURN,1,Noop(Returning From Voicemail because macro)
exten => t,1,Hangup

; end of [macro-vm]


[from-internal-additional]
include => from-internal-additional-custom
include => app-speeddial
include => ext-group
include => grps
include => app-languages
include => vmblast-grp
include => app-cf-busy-off
include => app-cf-busy-off-any
include => app-cf-busy-on
include => app-cf-off
include => app-cf-off-any
include => app-cf-on
include => app-cf-unavailable-off
include => app-cf-unavailable-on
include => app-recordings
include => app-fmf-toggle
include => ext-findmefollow
include => fmgrps
include => app-dialvm
include => app-vmmain
include => app-pbdirectory
include => app-dnd-off
include => app-dnd-on
include => app-dnd-toggle
include => ext-dnd-hints
include => ext-queues
include => app-blacklist
include => app-calltrace
include => app-directory
include => app-echo-test
include => app-speakextennum
include => app-speakingclock
include => ext-meetme
include => app-callwaiting-cwoff
include => app-callwaiting-cwon
include => ext-paging
include => app-userlogonoff
include => app-pickup
include => app-zapbarge
include => app-chanspy
include => ext-test
include => ext-local
include => outbound-allroutes
exten => h,1,Hangup

; end of [from-internal-additional]

Open in new window


Thanks for your help

Regards
0
 

Author Comment

by:Juan-ito
ID: 34133366
Is worth to mention ... If I unplug the link cable and plug it back again the message "all circuits are busy now" disappear... but....

i get something like this:

-- <SIP/5230-00000009>AGI Script recordingcheck completed, returning 0
    -- Executing [s@macro-record-enable:5] MacroExit("SIP/5230-00000009", "") in new stack
    -- Executing [4357828@from-internal:4] Macro("SIP/5230-00000009", "dialout-trunk,1,4357828,,") in new stack
    -- Executing [s@macro-dialout-trunk:1] Set("SIP/5230-00000009", "DIAL_TRUNK=1") in new stack
    -- Executing [s@macro-dialout-trunk:2] GosubIf("SIP/5230-00000009", "0?sub-pincheck,s,1") in new stack
    -- Executing [s@macro-dialout-trunk:3] GotoIf("SIP/5230-00000009", "0?disabletrunk,1") in new stack
    -- Executing [s@macro-dialout-trunk:4] Set("SIP/5230-00000009", "DIAL_NUMBER=4357828") in new stack
    -- Executing [s@macro-dialout-trunk:5] Set("SIP/5230-00000009", "DIAL_TRUNK_OPTIONS=tr") in new stack
    -- Executing [s@macro-dialout-trunk:6] Set("SIP/5230-00000009", "OUTBOUND_GROUP=OUT_1") in new stack
    -- Executing [s@macro-dialout-trunk:7] GotoIf("SIP/5230-00000009", "1?nomax") in new stack
    -- Goto (macro-dialout-trunk,s,9)
    -- Executing [s@macro-dialout-trunk:9] GotoIf("SIP/5230-00000009", "0?skipoutcid") in new stack
    -- Executing [s@macro-dialout-trunk:10] Set("SIP/5230-00000009", "DIAL_TRUNK_OPTIONS=") in new stack
    -- Executing [s@macro-dialout-trunk:11] Macro("SIP/5230-00000009", "outbound-callerid,1") in new stack
    -- Executing [s@macro-outbound-callerid:1] ExecIf("SIP/5230-00000009", "0?Set(CALLERPRES()=)") in new stack
    -- Executing [s@macro-outbound-callerid:2] ExecIf("SIP/5230-00000009", "0?Set(REALCALLERIDNUM=5230)") in new stack
    -- Executing [s@macro-outbound-callerid:3] GotoIf("SIP/5230-00000009", "1?normcid") in new stack
    -- Goto (macro-outbound-callerid,s,6)
    -- Executing [s@macro-outbound-callerid:6] Set("SIP/5230-00000009", "USEROUTCID=") in new stack
    -- Executing [s@macro-outbound-callerid:7] Set("SIP/5230-00000009", "EMERGENCYCID=") in new stack
    -- Executing [s@macro-outbound-callerid:8] Set("SIP/5230-00000009", "TRUNKOUTCID=salidanormal") in new stack
    -- Executing [s@macro-outbound-callerid:9] GotoIf("SIP/5230-00000009", "1?trunkcid") in new stack
    -- Goto (macro-outbound-callerid,s,12)
    -- Executing [s@macro-outbound-callerid:12] ExecIf("SIP/5230-00000009", "1?Set(CALLERID(all)=salidanormal)") in new stack
    -- Executing [s@macro-outbound-callerid:13] ExecIf("SIP/5230-00000009", "0?Set(CALLERID(all)=)") in new stack
    -- Executing [s@macro-outbound-callerid:14] ExecIf("SIP/5230-00000009", "0?Set(CALLERPRES()=prohib_passed_screen)") in new stack
    -- Executing [s@macro-dialout-trunk:12] ExecIf("SIP/5230-00000009", "0?AGI(fixlocalprefix)") in new stack
    -- Executing [s@macro-dialout-trunk:13] Set("SIP/5230-00000009", "OUTNUM=4357828") in new stack
    -- Executing [s@macro-dialout-trunk:14] Set("SIP/5230-00000009", "custom=DAHDI/g0") in new stack
    -- Executing [s@macro-dialout-trunk:15] ExecIf("SIP/5230-00000009", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^))") in new stack
    -- Executing [s@macro-dialout-trunk:16] Macro("SIP/5230-00000009", "dialout-trunk-predial-hook,") in new stack
    -- Executing [s@macro-dialout-trunk-predial-hook:1] GotoIf("SIP/5230-00000009", "0?custom-freepbx-a2billing,4357828,1:2") in new stack
    -- Goto (macro-dialout-trunk-predial-hook,s,2)
    -- Executing [s@macro-dialout-trunk-predial-hook:2] MacroExit("SIP/5230-00000009", "") in new stack
    -- Executing [s@macro-dialout-trunk:17] GotoIf("SIP/5230-00000009", "0?bypass,1") in new stack
    -- Executing [s@macro-dialout-trunk:18] GotoIf("SIP/5230-00000009", "0?customtrunk") in new stack
    -- Executing [s@macro-dialout-trunk:19] Dial("SIP/5230-00000009", "DAHDI/g0/4357828,300,") in new stack
    -- Requested transfer capability: 0x00 - SPEECH
    -- Called g0/4357828
    -- Hungup 'DAHDI/1-1'
  == Spawn extension (macro-dialout-trunk, s, 19) exited non-zero on 'SIP/5230-00000009' in macro 'dialout-trunk'
  == Spawn extension (from-internal, 4357828, 4) exited non-zero on 'SIP/5230-00000009'
    -- Executing [h@from-internal:1] Macro("SIP/5230-00000009", "hangupcall") in new stack
    -- Executing [s@macro-hangupcall:1] GotoIf("SIP/5230-00000009", "1?skiprg") in new stack
    -- Goto (macro-hangupcall,s,4)
    -- Executing [s@macro-hangupcall:4] GotoIf("SIP/5230-00000009", "1?skipblkvm") in new stack
    -- Goto (macro-hangupcall,s,7)
    -- Executing [s@macro-hangupcall:7] GotoIf("SIP/5230-00000009", "1?theend") in new stack
    -- Goto (macro-hangupcall,s,9)
    -- Executing [s@macro-hangupcall:9] Hangup("SIP/5230-00000009", "") in new stack
  == Spawn extension (macro-hangupcall, s, 9) exited non-zero on 'SIP/5230-00000009' in macro 'hangupcall'
  == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/5230-00000009'
  == Primary D-Channel on span 1 up

Open in new window


I can hear anything on the phone and the call gets disconnected after a few seconds.

Regards
0
 
LVL 36

Expert Comment

by:grblades
ID: 34134533
Do incoming calls work?

What if you try dialing using DAHDI/1/456789 (without the g) so trying to dial using one specific line instead of the group?
That will at least show if its the card config o group config which is causing the problem.
0
 

Author Comment

by:Juan-ito
ID: 34137225
Incoming calls don't work, i get busy tone from an outside line when i try to call that number...

I will try without the g, the problem is that i need to do all the testing after hours cause that E1 link is being used for another PBX in production.... so i need to wait at least for 10:30 pm tonight..

Do you think we can continue testing using a loop instead the E1 link? i know that the call can't get out without the E1 link but at least keep testing and make sure that the error is not anymore in there. In that way i can keep testing without wait till midnight.

Thank you

Regards
0
 
LVL 36

Expert Comment

by:grblades
ID: 34137450
I am pretty sure the problem is with the card configuration itself.
What country are you in?
I will lookup the settings and compare them to the card configuration you have already posed.
0
 

Author Comment

by:Juan-ito
ID: 34137586
Mexico

using Telmex as my ISP

Thank you very much :)

0
 
LVL 36

Expert Comment

by:grblades
ID: 34137913
In chan_dahdi.conf comment out line 12 which reads 'signalling=fxs_ks'. Thats only used for analogue lines. It shouldnt cause any problems being there as it is not assigned to any channels but best removed anyway.

In system.conf lines 10 and 11 you have the zone set to 'us' and as you are in mexico it should be 'mx' so that it is able to correct recognise busy tones etc...

0
 
LVL 36

Accepted Solution

by:
grblades earned 500 total points
ID: 34137960
In your system.conf you have :-
span=1,1,0,cas,hdb3,crc4
# termtype: te
bchan=1-15,17-31
dchan=16

This as it is I believe to be incorrect. With cas framing you should use the cas= line instead of bchan=. See your previous server configuration for an example.
If your previous server worked then making that change should hopefully get it working.

I also found this article http://www.fonality.com/trixbox/forums/vendor-moderated-forums/sangoma/telmex-mexico-city-e1 which suggests a different configuration of using the following instead :-
span=1,0,0,ccs,hdb3
bchan=1-15,17-31
dchan=16
The 2nd digit to the span command doesnt look right to me in that example though. If you want to give it a go then try 'span=1,0,0,ccs,hdb3' aswell.

When making any of these changes you need to restart dahdi and not just asterisk. You might wish to just be 100% safe and restart the server instead.
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:Juan-ito
ID: 34138408
Done...

What about the from-zaptel config? should i leave it or change it to from-pstn ?

;
; DAHDI telephony
;
; Configuration file

[trunkgroups]

[channels]

language=en
context=from-zaptel
;context=from-pstn
;signalling=fxs_ks
rxwink=300              ; Atlas seems to use long (250ms) winks
;
; Whether or not to do distinctive ring detection on FXO lines
;
;usedistinctiveringdetection=yes

usecallerid=yes
hidecallerid=no
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
cancallforward=yes
callreturn=yes
echocancel=yes
echocancelwhenbridged=no
;echotraining=800
rxgain=0.0
txgain=0.0
group=0
callgroup=1
pickupgroup=1
immediate=no
busydetect=yes
busycount=5

;faxdetect=both
faxdetect=incoming
;faxdetect=outgoing
;faxdetect=no

;Include setup-pstn configs
#include dahdi-channels.conf

group=1

;Include PBXconfig configs
#include chan_dahdi_additional.conf

Open in new window


I also try the config from the link you post about the config for Telmex but i get this several times....

[Nov 15 10:51:30] WARNING[2985]: chan_dahdi.c:11879 pri_dchannel: PRI Error on span 0: We think we're the CPE, but they think they're the CPE too.

[Nov 15 10:51:31] WARNING[2985]: chan_dahdi.c:11879 pri_dchannel: PRI Error on span 0: We think we're the CPE, but they think they're the CPE too.

Open in new window


So i switch back to my original config, and when i try using cas i get this:

trixbox1*CLI> dahdi show status
No such command 'dahdi show status' (type 'help dahdi show' for other possible commands)
trixbox1*CLI> dahdi show channels
No such command 'dahdi show channels' (type 'help dahdi show' for other possible commands)

Open in new window


and this:

-- Executing [s@macro-dialout-trunk:19] Dial("SIP/5230-00000000", "DAHDI/g0/072,300,") in new stack
[Nov 15 11:08:56] WARNING[3174]: channel.c:4073 ast_request: No channel type registered for 'DAHDI'
[Nov 15 11:08:56] WARNING[3174]: app_dial.c:1518 dial_exec_full: Unable to create channel of type 'DAHDI' (cause 66 - Channel not implemented)
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [s@macro-dialout-trunk:20] Goto("SIP/5230-00000000", "s-CHANUNAVAIL,1") in new stack
    -- Goto (macro-dialout-trunk,s-CHANUNAVAIL,1)
    -- Executing [s-CHANUNAVAIL@macro-dialout-trunk:1] GotoIf("SIP/5230-00000000", "1?noreport") in new stack
    -- Goto (macro-dialout-trunk,s-CHANUNAVAIL,3)
    -- Executing [s-CHANUNAVAIL@macro-dialout-trunk:3] NoOp("SIP/5230-00000000", "TRUNK Dial failed due to CHANUNAVAIL (hangupcause: 66) - failing through to other trunks") in new stack
    -- Executing [072@from-internal:5] Macro("SIP/5230-00000000", "outisbusy,") in new stack
    -- Executing [s@macro-outisbusy:1] Playback("SIP/5230-00000000", "all-circuits-busy-now,noanswer") in new stack
    -- <SIP/5230-00000000> Playing 'all-circuits-busy-now.ulaw' (language 'en')
    -- Executing [s@macro-outisbusy:2] Playback("SIP/5230-00000000", "pls-try-call-later,noanswer") in new stack
    -- <SIP/5230-00000000> Playing 'pls-try-call-later.ulaw' (language 'en')
  == Spawn extension (macro-outisbusy, s, 2) exited non-zero on 'SIP/5230-00000000' in macro 'outisbusy'
  == Spawn extension (from-internal, 072, 5) exited non-zero on 'SIP/5230-00000000'
    -- Executing [h@from-internal:1] Macro("SIP/5230-00000000", "hangupcall") in new stack
    -- Executing [s@macro-hangupcall:1] GotoIf("SIP/5230-00000000", "1?skiprg") in new stack
    -- Goto (macro-hangupcall,s,4)
    -- Executing [s@macro-hangupcall:4] GotoIf("SIP/5230-00000000", "1?skipblkvm") in new stack
    -- Goto (macro-hangupcall,s,7)
    -- Executing [s@macro-hangupcall:7] GotoIf("SIP/5230-00000000", "1?theend") in new stack
    -- Goto (macro-hangupcall,s,9)
    -- Executing [s@macro-hangupcall:9] Hangup("SIP/5230-00000000", "") in new stack
  == Spawn extension (macro-hangupcall, s, 9) exited non-zero on 'SIP/5230-00000000' in macro 'hangupcall'
  == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/5230-00000000'
trixbox1*CLI>

Open in new window


using this config:

# Span 1: WCT1/0 "Wildcard TE122 Card 0" (MASTER) HDB3/CCS/CRC4 ClockSource 
span=1,1,0,cas,hdb3
cas=1-15:1101
dchan=16
cas=17-31:1101

# Global data

loadzone	= us
defaultzone	= us

Open in new window


I leave the default zone to us cause the working config has it like that and also the post about telmex is using us instead mx.

Please advice

Regards
0
 
LVL 36

Expert Comment

by:grblades
ID: 34139192
> What about the from-zaptel config? should i leave it or change it to from-pstn ?
It would need to match your asterisk dialplan. If you change the context to from-pstn then incoming calls will go to the [from-pstn] section in your asterisk extensions.conf file.

> [Nov 15 10:51:30] WARNING[2985]: chan_dahdi.c:11879 pri_dchannel: PRI Error on span 0: We think we're the CPE, but they think they're the CPE too.
CPE is Customer Premesis Equipment. The other end is called the NET. It is unlikely that the operator has their equipment setup as CPE but then again that config example had the span= line with the 2nd parameter as a 0 aswell which is what you would normally configure at the NTE end.
Just for completeness I would put that configuration back in but try setting your end to NET by editing dahdi-channels.conf and setting signaling=pri_net and give that a go.


I received your email but sorry I cant really help any more if I connect directly as the main issue for me is that I dont know how it should be setup in your country.
However if you are considering paid support then have a look at http://www.voip-info.org/wiki/view/Asterisk+consultants+Mexico for a list of consultants in your country and I am sure they will be able to help much better than I am as they probably have experience of configuring the cards in your country.

0
 

Author Comment

by:Juan-ito
ID: 34140076
let me give a try with pri_net and i'll let you know.

Thanks for your help

Regards
0
 

Author Comment

by:Juan-ito
ID: 34140866
I think the message:

> [Nov 15 10:51:30] WARNING[2985]: chan_dahdi.c:11879 pri_dchannel: PRI Error on span 0: We think we're the CPE, but they think they're the CPE too.

Is because i have a loop on the E1 card  :P

 lol    sorry my bad....

And I still receive the same error...

WARNING[3196]: app_dial.c:1518 dial_exec_full: Unable to create channel of type 'DAHDI' (cause 34 - Circuit/channel congestion)

I'm trying with this config:

system.conf
# Span 1: WCT1/0 "Wildcard TE122 Card 0" (MASTER) HDB3/CCS/CRC4 ClockSource 

span=1,0,0,ccs,hdb3
bchan=1-15,17-31
dchan=16

# Global data

loadzone	= us
defaultzone	= us

Open in new window


chan_dahdi.conf
;
; DAHDI telephony
;
; Configuration file

[trunkgroups]

[channels]

language=en
;context=from-zaptel
context=from-pstn
;signalling=fxs_ks
signalling=pri_net
rxwink=300              ; Atlas seems to use long (250ms) winks
;
; Whether or not to do distinctive ring detection on FXO lines
;
;usedistinctiveringdetection=yes

usecallerid=yes
hidecallerid=no
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
cancallforward=yes
callreturn=yes
echocancel=yes
echocancelwhenbridged=no
;echotraining=800
rxgain=0.0
txgain=0.0
group=0
callgroup=1
pickupgroup=1
immediate=no
busydetect=yes
busycount=5

;faxdetect=both
faxdetect=incoming
;faxdetect=outgoing
;faxdetect=no

;Include setup-pstn configs
#include dahdi-channels.conf

group=1

;Include PBXconfig configs
#include chan_dahdi_additional.conf

Open in new window


dahdi-channels.conf
; Autogenerated by /usr/sbin/dahdi_genconf on Thu Nov 11 11:10:20 2010
; If you edit this file and execute /usr/sbin/dahdi_genconf again,
; your manual changes will be LOST.
; Dahdi Channels Configurations (chan_dahdi.conf)
;
; This is not intended to be a complete chan_dahdi.conf. Rather, it is intended
; to be #include-d by /etc/chan_dahdi.conf that will include the global settings
;

; Span 1: WCT1/0 "Wildcard TE122 Card 0" (MASTER) HDB3/CCS/CRC4 ClockSource 
group=0,11
context=from-pstn
switchtype = euroisdn
signalling = pri_net
;signalling = pri_cpe
channel => 1-15,17-31
context = default
group = 63

Open in new window


extensions.conf
;--------------------------------------------------------------------------------;
; Do NOT edit this file as it is auto-generated by FreePBX. All modifications to ;
; this file must be done via the web gui. There are alternative files to make    ;
; custom modifications, details at: http://freepbx.org/configuration_files       ;
;--------------------------------------------------------------------------------;
;

; FreePBX
; Copyright (C) 2004 Coalescent Systems Inc (Canada)
; Copyright (C) 2006 Why Pay More 4 Less Pty Ltd (Australia)
; Copyright (C) 2007 Astrogen LLC (USA)
; Released under the GNU GPL Licence version 2.

; dialparties.agi (http://www.sprackett.com/asterisk/)
; Asterisk::AGI (http://asterisk.gnuinter.net/)
; gsm (http://www.ibiblio.org/pub/Linux/utils/compress/!INDEX.short.html)
; loligo sounds (http://www.loligo.com/asterisk/sounds/)
; mpg123 (http://voip-info.org/wiki-Asterisk+config+musiconhold.conf)

;**************************  -WARNING-  ****************************************
;                                                                              *
; This include file is to be used with extreme caution. In almost all cases    *
; any custom dialplan SHOULD be put in extensions_custom.conf which will       *
; not hurt a FreePBX generated dialplan. In some very rare and custom          *
; situations users may have a need to override what FreePBX automatically      *
; generates. If so anything in this file will do that.  If you come up with a  *
; situation where you need to modify the existing dialplan or macro, please    *
; put it here and also notify the FreePBX development team so they can take it *
; into account in the future.                                                  *
;                                                                              *
#include extensions_override_freepbx.conf
;                                                                              *
;**************************  -WARNING-  ****************************************

; include extension contexts generated from AMP
#include extensions_additional.conf

; Customizations to this dialplan should be made in extensions_custom.conf
; See extensions_custom.conf.sample for an example.
; If you need to use [macro-dialout-trunk-predial-hook], [ext-did-custom], or 
; [from-internal-custom] for example, place these in this file or they will get overwritten.
;
#include extensions_custom.conf

[from-trunk]				; just an alias since VoIP shouldn't be called PSTN
include => from-pstn

[from-pstn]
include => from-pstn-custom		; create this context in extensions_custom.conf to include customizations
include => ext-did
include => ext-did-post-custom
include => from-did-direct		; MODIFICATION (PL) for findmefollow if enabled, should be before ext-local
include => ext-did-catchall		; THIS MUST COME AFTER ext-did
exten => fax,1,Goto(ext-fax,in_fax,1)

;-------------------------------------------------------------------------------
; from-pstn-e164-us:
;
; The context is designed for providers who send calls in e164 format and is
; biased towards NPA calls, callerid and dialing rules. It will do the following:
;
;  DIDs in an NPA e164 format of +1NXXNXXXXXX will be converted to 10 digit DIDs
;
;  DIDs in any other format will be delivered as they are, including e164 non NPA
;  DIDs which means they will need the full format including the + in the inbound
;  route.
;
;  CallerID(number) presented in e164 NPA format will be trimmed to a 10 digit CID
;
;  CallerID(number) presented in e164 non-NPA (country code other than 1) will be
;  reformated from: +<CountryCode><Number> to 011<CountryCode><Number>
;
[from-pstn-e164-us]
exten => _+1NXXNXXXXXX/_+1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):2})
exten => _+1NXXNXXXXXX/_NXXNXXXXXX,2,Goto(from-pstn,${EXTEN:2},1)
exten => _+1NXXNXXXXXX/_+X.,1,Set(CALLERID(number)=011${CALLERID(number):1})
exten => _+1NXXNXXXXXX/_011X.,n,Goto(from-pstn,${EXTEN:2},1)
exten => _+1NXXNXXXXXX,1,Goto(from-pstn,${EXTEN:2},1)
exten => _[0-9+]./_+1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):2})
exten => _[0-9+]./_NXXNXXXXXX,n,Goto(from-pstn,${EXTEN},1)
exten => _[0-9+]./_+X.,1,Set(CALLERID(number)=011${CALLERID(number):1})
exten => _[0-9+]./_011X.,n,Goto(from-pstn,${EXTEN},1)
exten => _[0-9+].,1,Goto(from-pstn,${EXTEN},1)
exten => s/_+1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):2})
exten => s/_NXXNXXXXXX,n,Goto(from-pstn,${EXTEN},1)
exten => s/_+X.,1,Set(CALLERID(number)=011${CALLERID(number):1})
exten => s/_011X.,n,Goto(from-pstn,${EXTEN},1)
exten => s,1,Goto(from-pstn,${EXTEN},1)
;-------------------------------------------------------------------------------

;-------------------------------------------------------------------------------
; from-pstn-to-did
;
; The context is designed for providers who send the DID in the TO: SIP header
; only. The format of this header is:
;
; To: <sip:2125551212@172.31.74.25>
;
; So the DID must be extracted between the sip: and the @, which this does
;
[from-pstn-toheader]
exten => s,1,Goto(from-pstn,${CUT(CUT(SIP_HEADER(To),@,1),:,2)},1)
;-------------------------------------------------------------------------------


; MODIFICATION (PL) 
;
; Required to assure that direct dids go to personal ring group before local extension.
; This could be auto-generated however I it is preferred to be put here and hard coded
; so that it can be modified if ext-local should take precedence in certain situations.
; will have to decide what to do later.
;
[from-did-direct]
include => ext-findmefollow
include => ext-local



; ############################################################################
; Macros [macro]
; ############################################################################

; Rings one or more extensions.  Handles things like call forwarding and DND
; We don't call dial directly for anything internal anymore.
; ARGS: $TIMER, $OPTIONS, $EXT1, $EXT2, $EXT3, ...
; Use a Macro call such as the following: 
;  Macro(dial,$DIAL_TIMER,$DIAL_OPTIONS,$EXT1,$EXT2,$EXT3,...)
[macro-dial]
exten => s,1,GotoIf($["${MOHCLASS}" = ""]?dial)
exten => s,n,SetMusicOnHold(${MOHCLASS})
exten => s,n(dial),AGI(dialparties.agi)
exten => s,n,NoOp(Returned from dialparties with no extensions to call and DIALSTATUS: ${DIALSTATUS})

exten => s,n+2(normdial),Dial(${ds})                               ; dialparties will set the priority to 10 if $ds is not null
exten => s,n,Set(DIALSTATUS=${IF($["${DIALSTATUS_CW}"!="" ]?${DIALSTATUS_CW}:${DIALSTATUS})})
exten => s,n,GosubIf($["${SCREEN}" != ""]?${DIALSTATUS},1)

exten => s,20(huntdial),NoOp(Returned from dialparties with hunt groups to dial )
exten => s,n,Set(HuntLoop=0)
exten => s,n(a22),GotoIf($[${HuntMembers} >= 1]?a30)  ; if this is from rg-group, don't strip prefix
exten => s,n,NoOp(Returning there are no members left in the hunt group to ring)

; dialparties.agi has setup the dialstring for each hunt member in a variable labeled HuntMember0, HuntMember1 etc for each iteration
; and The total number in HuntMembers. So for each iteration, we will update the CALLTRACE Data.
;
exten => s,n+2(a30),Set(HuntMember=HuntMember${HuntLoop})
exten => s,n,GotoIf($[$["${CALLTRACE_HUNT}" != "" ] & $[$["${RingGroupMethod}" = "hunt" ] | $["${RingGroupMethod}" = "firstavailable"] | $["${RingGroupMethod}" = "firstnotonphone"]]]?a32:a35)

exten => s,n(a32),Set(CT_EXTEN=${CUT(FILTERED_DIAL,,$[${HuntLoop} + 1])})
exten => s,n,Set(DB(CALLTRACE/${CT_EXTEN})=${CALLTRACE_HUNT})
exten => s,n,Goto(s,a42)

;Set Call Trace for each hunt member we are going to call "Memory groups have multiple members to set CALL TRACE For" hence the loop
;
exten => s,n(a35),GotoIf($[$["${CALLTRACE_HUNT}" != "" ] & $["${RingGroupMethod}" = "memoryhunt" ]]?a36:a50)  
exten => s,n(a36),Set(CTLoop=0)
exten => s,n(a37),GotoIf($[${CTLoop} > ${HuntLoop}]?a42)  ; if this is from rg-group, don't strip prefix
exten => s,n,Set(CT_EXTEN=${CUT(FILTERED_DIAL,,$[${CTLoop} + 1])})
exten => s,n,Set(DB(CALLTRACE/${CT_EXTEN})=${CALLTRACE_HUNT})
exten => s,n,Set(CTLoop=$[1 + ${CTLoop}])
exten => s,n,Goto(s,a37)
        
exten => s,n(a42),Dial(${${HuntMember}}${ds})
exten => s,n,Set(HuntLoop=$[1 + ${HuntLoop}])
exten => s,n,GotoIf($[$[$["foo${RingGroupMethod}" != "foofirstavailable"] & $["foo${RingGroupMethod}" != "foofirstnotonphone"]] | $["foo${DialStatus}" = "fooBUSY"]]?a46)
exten => s,n,Set(HuntMembers=0)
exten => s,n(a46),Set(HuntMembers=$[${HuntMembers} - 1])
exten => s,n,Goto(s,a22)

exten => s,n(a50),DBdel(CALLTRACE/${CT_EXTEN})
exten => s,n,Goto(s,a42)

; For call screening
exten => NOANSWER,1,Macro(vm,${SCREEN_EXTEN},BUSY,${IVR_RETVM})
exten => NOANSWER,n,GotoIf($["${IVR_RETVM}" != "RETURN" | "${IVR_CONTEXT}" = ""]?bye)
exten => NOANSWER,n,Return
exten => NOANSWER,n(bye),Macro(hangupcall)
exten => TORTURE,1,Goto(app-blackhole,musiconhold,1)
exten => TORTURE,n,Macro(hangupcall)
exten => DONTCALL,1,Answer
exten => DONTCALL,n,Wait(1)
exten => DONTCALL,n,Zapateller()
exten => DONTCALL,n,Playback(ss-noservice)
exten => DONTCALL,n,Macro(hangupcall)

; make sure hungup calls go here so that proper cleanup occurs from call confirmed calls and the like
;
exten => h,1,Macro(hangupcall)

; Ring an extension, if the extension is busy or there is no answer send it
; to voicemail
; ARGS: $VMBOX, $EXT
[macro-exten-vm]
exten => s,1,Macro(user-callerid)

exten => s,n,Set(RingGroupMethod=none)
exten => s,n,Set(VMBOX=${ARG1})
exten => s,n,Set(EXTTOCALL=${ARG2})
exten => s,n,Set(CFUEXT=${DB(CFU/${EXTTOCALL})})
exten => s,n,Set(CFBEXT=${DB(CFB/${EXTTOCALL})})
exten => s,n,Set(RT=${IF($[$["${VMBOX}"!="novm"] | $["foo${CFUEXT}"!="foo"]]?${RINGTIMER}:"")})
exten => s,n,Macro(record-enable,${EXTTOCALL},IN)
exten => s,n,Macro(dial,${RT},${DIAL_OPTIONS},${EXTTOCALL})
exten => s,n,GotoIf($[ $["${VMBOX}" != "novm"] & $["${SCREEN}" != ""] & $["${DIALSTATUS}" = "NOANSWER"] ]?exit,return)
exten => s,n,Set(SV_DIALSTATUS=${DIALSTATUS})
exten => s,n,GosubIf($[$["${SV_DIALSTATUS}"="NOANSWER"] & $["${CFUEXT}"!=""] & $["${SCREEN}" = ""]]?docfu,1) ; check for CFU in use on no answer
exten => s,n,GosubIf($[$["${SV_DIALSTATUS}"="BUSY"] & $["${CFBEXT}"!=""]]?docfb,1) ; check for CFB in use on busy
exten => s,n,Set(DIALSTATUS=${SV_DIALSTATUS})
exten => s,n,NoOp(Voicemail is '${VMBOX}')
exten => s,n,GotoIf($["${VMBOX}" = "novm"]?s-${DIALSTATUS},1) ; no voicemail in use for this extension
exten => s,n,NoOp(Sending to Voicemail box ${EXTTOCALL})
exten => s,n,Macro(vm,${VMBOX},${DIALSTATUS},${IVR_RETVM})

; Try the Call Forward on No Answer / Unavailable number
exten => docfu,1,Set(RTCFU=${IF($["${VMBOX}"!="novm"]?${RINGTIMER}:"")})
exten => docfu,n,Dial(Local/${CFUEXT}@from-internal/n,${RTCFU},${DIAL_OPTIONS})
exten => docfu,n,Return

; Try the Call Forward on Busy number
exten => docfb,1,Set(RTCFB=${IF($["${VMBOX}"!="novm"]?${RINGTIMER}:"")})
exten => docfb,n,Dial(Local/${CFBEXT}@from-internal/n,${RTCFB},${DIAL_OPTIONS})
exten => docfb,n,Return

; Extensions with no Voicemail box reporting BUSY come here
exten => s-BUSY,1,NoOp(Extension is reporting BUSY and not passing to Voicemail)
exten => s-BUSY,n,GotoIf($["${IVR_RETVM}" = "RETURN" & "${IVR_CONTEXT}" != ""]?exit,1)
exten => s-BUSY,n,Playtones(busy)
exten => s-BUSY,n,Busy(20)

; Anything but BUSY comes here
exten => _s-.,1,Noop(IVR_RETVM: ${IVR_RETVM} IVR_CONTEXT: ${IVR_CONTEXT})
exten => _s-.,n,GotoIf($["${IVR_RETVM}" = "RETURN" & "${IVR_CONTEXT}" != ""]?exit,1)
exten => _s-.,n,Playtones(congestion)
exten => _s-.,n,Congestion(10)

; Short burst of tones then return
exten => exit,1,Playback(beep&line-busy-transfer-menu&silence/1)
exten => exit,n(return),MacroExit()

;------------------------------------------------------------------------
; [macro-simple-dial]
;------------------------------------------------------------------------
; This macro was derived from macro-exten-vm, which is what is normally used to
; ring an extension. It has been simplified and designed to never go to voicemail
; and always return regardless of the DIALSTATUS for any incomplete call.
;
; It's current primary purpose is to allow findmefollow ring an extension prior
; to trying the follow-me ringgroup that is provided.
;
; Ring an extension, if the extension is busy or there is no answer, return
; ARGS: $EXTENSION, $RINGTIME
;------------------------------------------------------------------------
[macro-simple-dial]
exten => s,1,Set(EXTTOCALL=${ARG1})
exten => s,n,Set(RT=${ARG2})
exten => s,n,Set(CFUEXT=${DB(CFU/${EXTTOCALL})})
exten => s,n,Set(CFBEXT=${DB(CFB/${EXTTOCALL})})

exten => s,n,Set(CWI_TMP=${CWIGNORE})
exten => s,n,Macro(dial,${RT},${DIAL_OPTIONS},${EXTTOCALL})
exten => s,n,Set(__CWIGNORE=${CWI_TMP})

exten => s,n,Set(PR_DIALSTATUS=${DIALSTATUS})

; if we return, thus no answer, and they have a CFU setting, then  we try that next
;
exten => s,n,GosubIf($[$["${PR_DIALSTATUS}"="NOANSWER"] & $["foo${CFUEXT}"!="foo"]]?docfu,1) ; check for CFU in use on no answer
exten => s,n,GosubIf($[$["${PR_DIALSTATUS}"="BUSY"] & $["foo${CFBEXT}"!="foo"]]?docfb,1) ; check for CFB in use on busy
exten => s,n,Set(DIALSTATUS=${PR_DIALSTATUS})

; Nothing yet, then go to the end (which will just return, but in case we decide to do something with certain
; return situations, this is left in.
;
exten => s,n,Goto(s-${DIALSTATUS},1)

; Try the Call Forward on No Answer / Unavailable number.
; We want to try CFU if set, but we want the same ring timer as was set to our call (or do we want the
; system ringtimer? - probably not). Then if no answer there (assuming it doesn't drop into their vm or
; something we return, which will have the net effect of returning to the followme setup.)
;
; want to avoid going to other follow-me settings here. So check if the CFUEXT is a user and if it is
; then direct it straight to ext-local (to avoid getting intercepted by findmefollow) otherwise send it
; to from-internal since it may be an outside line.
;
exten => docfu,1,GotoIf( $[ "foo${DB(AMPUSER/${CFUEXT}/device)}" = "foo" ]?chlocal)
exten => docfu,n,Dial(Local/${CFUEXT}@ext-local,${RT},${DIAL_OPTIONS})
exten => docfu,n,Return
exten => docfu,n(chlocal),Dial(Local/${CFUEXT}@from-internal/n,${RT},${DIAL_OPTIONS})
exten => docfu,n,Return

; Try the Call Forward on Busy number
exten => docfb,1,GotoIf( $[ "foo${DB(AMPUSER/${CFBEXT}/device)}" = "foo" ]?chlocal)
exten => docfb,n,Dial(Local/${CFBEXT}@ext-local,${RT},${DIAL_OPTIONS})
exten => docfb,n,Return
exten => docfb,n(chlocal),Dial(Local/${CFBEXT}@from-internal/n,${RT},${DIAL_OPTIONS})
exten => docfb,n,Return

; In all cases of no connection, come here and simply return, since the calling dialplan will
; decide what to do next
exten => _s-.,1,NoOp(Extension is reporting ${EXTEN})
;------------------------------------------------------------------------


; get the voicemail context for the user in ARG1
[macro-get-vmcontext]
exten => s,1,Set(VMCONTEXT=${DB(AMPUSER/${ARG1}/voicemail)})
exten => s,2,GotoIf($["foo${VMCONTEXT}" = "foo"]?200:300)
exten => s,200,Set(VMCONTEXT=default)
exten => s,300,NoOp()

; For some reason, if I don't run setCIDname, CALLERID(name) will be blank in my AGI
; ARGS: none
[macro-fixcid]
exten => s,1,Set(CALLERID(name)=${CALLERID(name)})

; Ring groups of phones
; ARGS: comma separated extension list
; 1 - Ring Group Strategy
; 2 - ringtimer
; 3 - prefix
; 4 - extension list
[macro-rg-group]
exten => s,1,Macro(user-callerid,SKIPTTL) ; already called from ringgroup
exten => s,2,GotoIf($["${CALLERID(name):0:${LEN(${RGPREFIX})}}" != "${RGPREFIX}"]?4:3)  ; check for old prefix
exten => s,3,Set(CALLERID(name)=${CALLERID(name):${LEN(${RGPREFIX})}}) ; strip off old prefix
exten => s,4,Set(RGPREFIX=${ARG3})  ; set new prefix
exten => s,5,Set(CALLERID(name)=${RGPREFIX}${CALLERID(name)})  ; add prefix to callerid name
exten => s,6,Set(RecordMethod=Group)  ; set new prefix
exten => s,7,Macro(record-enable,${MACRO_EXTEN},${RecordMethod})
exten => s,8,Set(RingGroupMethod=${ARG1})     ;
exten => s,9,Macro(dial,${ARG2},${DIAL_OPTIONS},${ARG4})
exten => s,10,Set(RingGroupMethod='')     ;


;
; Outgoing channel(s) are busy ... inform the client
; but use noanswer features like ringgroups don't break by being answered
; just to play the message.
;
[macro-outisbusy]
exten => s,1,Playback(all-circuits-busy-now,noanswer)
exten => s,n,Playback(pls-try-call-later,noanswer)
exten => s,n,Macro(hangupcall)

; What to do on hangup.                                         
[macro-hangupcall]
; Cleanup any remaining RG flag
;
exten => s,1,GotoIf($[ "x${USE_CONFIRMATION}" = "x" | "x${RINGGROUP_INDEX}" = "x" | "${CHANNEL}" != "${UNIQCHAN}"]?skiprg)
exten => s,n,Noop(Cleaning Up Confirmation Flag: RG/${RINGGROUP_INDEX}/${CHANNEL})
exten => s,n,DBDel(RG/${RINGGROUP_INDEX}/${CHANNEL})

; Cleanup any remaining BLKVM flag
;
exten => s,n(skiprg),GotoIf($[ "x${BLKVM_BASE}" = "x" | "BLKVM/${BLKVM_BASE}/${CHANNEL}" != "${BLKVM_OVERRIDE}" ]?skipblkvm)
exten => s,n,Noop(Cleaning Up Block VM Flag: ${BLKVM_OVERRIDE})
exten => s,n,DBDel(${BLKVM_OVERRIDE})

; Cleanup any remaining FollowMe DND flags
;
exten => s,n(skipblkvm),GotoIf($[ "x${FMGRP}" = "x" | "x${FMUNIQUE}" = "x" | "${CHANNEL}" != "${FMUNIQUE}" ]?theend)
exten => s,n,DBDel(FM/DND/${FMGRP}/${CHANNEL})

exten => s,n(theend),Hangup

[macro-faxreceive]
exten => s,1,Set(FAXFILE=${ASTSPOOLDIR}/fax/${UNIQUEID}.tif)
exten => s,2,Set(EMAILADDR=${FAX_RX_EMAIL})
exten => s,3,rxfax(${FAXFILE})
exten => s,103,Set(EMAILADDR=${FAX_RX_EMAIL})
exten => s,104,Goto(3)

; dialout and strip the prefix
[macro-dialout]
exten => s,1,Macro(user-callerid,SKIPTTL)
exten => s,2,GotoIf($["${ECID${CALLERID(number)}}" = ""]?5) 	;check for CID override for exten
exten => s,3,Set(CALLERID(all)=${ECID${CALLERID(number)}})
exten => s,4,Goto(7)
exten => s,5,GotoIf($["${OUTCID_${ARG1}}" = ""]?7) 		;check for CID override for trunk
exten => s,6,Set(CALLERID(all)=${OUTCID_${ARG1}})
exten => s,7,Set(length=${LEN(${DIAL_OUT_${ARG1}})})
exten => s,8,Dial(${OUT_${ARG1}}/${ARG2:${length}})
exten => s,9,Playtones(congestion)
exten => s,10,Congestion(5)
exten => s,109,Macro(outisbusy)


; dialout using default OUT trunk - no prefix
[macro-dialout-default]
exten => s,1,Macro(user-callerid,SKIPTTL)
exten => s,2,Macro(record-enable,${CALLERID(number)},OUT)
exten => s,3,Macro(outbound-callerid,${ARG1})
exten => s,4,Dial(${OUT}/${ARG1})
exten => s,5,Playtones(congestion)
exten => s,6,Congestion(5)
exten => s,105,Macro(outisbusy)

[macro-dialout-trunk-predial-hook]
; this macro intentionally left blank so it may be safely overwritten for any custom
; requirements that an installation may have.
;
; MACRO RETURN CODE: ${PREDIAL_HOOK_RET}
;                    if set to "BYPASS" then this trunk will be skipped
;
exten => s,1,MacroExit()

; This macro is for dev purposes and just dumps channel/app variables.  Useful when designing new contexts. 
[macro-dumpvars]
exten => s,1,Noop(ACCOUNTCODE=${ACCOUNTCODE})
exten => s,2,Noop(ANSWEREDTIME=${ANSWEREDTIME})
exten => s,3,Noop(BLINDTRANSFER=${BLINDTRANSFER})
exten => s,4,Noop(CALLERID=${CALLERID(all)})
exten => s,5,Noop(CALLERID(name)=${CALLERID(name)})
exten => s,6,Noop(CALLERID(number)=${CALLERID(number)})
exten => s,7,Noop(CALLINGPRES=${CALLINGPRES})
exten => s,8,Noop(CHANNEL=${CHANNEL})
exten => s,9,Noop(CONTEXT=${CONTEXT})
exten => s,10,Noop(DATETIME=${DATETIME})
exten => s,11,Noop(DIALEDPEERNAME=${DIALEDPEERNAME})
exten => s,12,Noop(DIALEDPEERNUMBER=${DIALEDPEERNUMBER})
exten => s,13,Noop(DIALEDTIME=${DIALEDTIME})
exten => s,14,Noop(DIALSTATUS=${DIALSTATUS})
exten => s,15,Noop(DNID=${DNID})
exten => s,16,Noop(EPOCH=${EPOCH})
exten => s,17,Noop(EXTEN=${EXTEN})
exten => s,18,Noop(HANGUPCAUSE=${HANGUPCAUSE})
exten => s,19,Noop(INVALID_EXTEN=${INVALID_EXTEN})
exten => s,20,Noop(LANGUAGE=${LANGUAGE})
exten => s,21,Noop(MEETMESECS=${MEETMESECS})
exten => s,22,Noop(PRIORITY=${PRIORITY})
exten => s,23,Noop(RDNIS=${RDNIS})
exten => s,24,Noop(SIPDOMAIN=${SIPDOMAIN})
exten => s,25,Noop(SIP_CODEC=${SIP_CODEC})
exten => s,26,Noop(SIPCALLID=${SIPCALLID})
exten => s,27,Noop(SIPUSERAGENT=${SIPUSERAGENT})
exten => s,29,Noop(TXTCIDNAME=${TXTCIDNAME})
exten => s,30,Noop(UNIQUEID=${UNIQUEID})
exten => s,31,Noop(TOUCH_MONITOR=${TOUCH_MONITOR})
exten => s,32,Noop(MACRO_CONTEXT=${MACRO_CONTEXT})
exten => s,33,Noop(MACRO_EXTEN=${MACRO_EXTEN})
exten => s,34,Noop(MACRO_PRIORITY=${MACRO_PRIORITY})

[macro-user-logon]
; check device type
;
exten => s,1,Set(DEVICETYPE=${DB(DEVICE/${CALLERID(number)}/type)})
exten => s,n,Answer()
exten => s,n,Wait(1)
exten => s,n,GotoIf($["${DEVICETYPE}" = "fixed"]?s-FIXED,1)
; get user's extension
;
exten => s,n,Set(AMPUSER=${ARG1})
exten => s,n,GotoIf($["${AMPUSER}" != ""]?gotpass)
exten => s,n(playagain),Read(AMPUSER,please-enter-your-extension-then-press-pound,,,4)
; get user's password and authenticate
;
exten => s,n,GotoIf($["${AMPUSER}" = ""]?s-MAXATTEMPTS,1)
exten => s,n(gotpass),GotoIf($["${DB_EXISTS(AMPUSER/${AMPUSER}/password)}" = "0"]?s-NOUSER,1)
exten => s,n,Set(AMPUSERPASS=${DB_RESULT})
exten => s,n,GotoIf($[${LEN(${AMPUSERPASS})} = 0]?s-NOPASSWORD,1)
; do not continue if the user has already logged onto this device
;
exten => s,n,Set(DEVICEUSER=${DB(DEVICE/${CALLERID(number)}/user)})
exten => s,n,GotoIf($["${DEVICEUSER}" = "${AMPUSER}"]?s-ALREADYLOGGEDON,1)
exten => s,n,Authenticate(${AMPUSERPASS})
exten => s,n,DeadAGI(user_login_out.agi,login,${CALLERID(number)},${AMPUSER})
exten => s,n,Playback(vm-goodbye)

exten => s-FIXED,1,NoOp(Device is FIXED and cannot be logged into)
exten => s-FIXED,n,Playback(ha/phone)
exten => s-FIXED,n,SayDigits(${CALLERID(number)})
exten => s-FIXED,n,Playback(is-curntly-unavail&vm-goodbye)
exten => s-FIXED,n,Hangup ;TODO should play msg indicated device cannot be logged into 

exten => s-ALREADYLOGGEDON,1,NoOp(This device has already been logged into by this user)
exten => s-ALREADYLOGGEDON,n,Playback(vm-goodbye)
exten => s-ALREADYLOGGEDON,n,Hangup ;TODO should play msg indicated device is already logged into 

exten => s-NOPASSWORD,1,NoOp(This extension does not exist or no password is set)
exten => s-NOPASSWORD,n,Playback(pbx-invalid)
exten => s-NOPASSWORD,n,Goto(s,playagain)

exten => s-MAXATTEMPTS,1,NoOp(Too many login attempts)
exten => s-MAXATTEMPTS,n,Playback(vm-goodbye)
exten => s-MAXATTEMPTS,n,Hangup

exten => s-NOUSER,1,NoOp(Invalid extension ${AMPUSER} entered)
exten => s-NOUSER,n,Playback(pbx-invalid)
exten => s-NOUSER,n,Goto(s,playagain)

[macro-user-logoff]
; check device type
;
exten => s,1,Set(DEVICETYPE=${DB(DEVICE/${CALLERID(number)}/type)})
exten => s,n,GotoIf($["${DEVICETYPE}" = "fixed"]?s-FIXED,1)
exten => s,n,DeadAGI(user_login_out.agi,logout,${CALLERID(number)})
exten => s,n(done),Playback(vm-goodbye)

exten => s-FIXED,1,NoOp(Device is FIXED and cannot be logged out of)
exten => s-FIXED,n,Playback(an-error-has-occured&vm-goodbye)
exten => s-FIXED,n,Hangup ;TODO should play msg indicated device cannot be logged into 



; Privacy Manager Macro makes sure that any calls that don't pass the privacy manager are presented
; with congestion since there have been observed cases of the call continuing if not stopped with a 
; congestion, and this provides a slightly more friendly 'sorry' message in case the user is
; legitimately trying to be cooperative. 
;
; Note: the following options are configurable in privacy.conf:
;
;	maxretries = 3 ; default value, number of retries before failing
;	minlength = 10 ; default value, number of digits to be accepted as valid CID
;
[macro-privacy-mgr]
exten => s,1,Set(KEEPCID=${CALLERID(num)})
exten => s,n,GotoIf($["foo${CALLERID(num):0:1}"="foo+"]?CIDTEST2:CIDTEST1)
exten => s,n(CIDTEST1),Set(TESTCID=${MATH(1+${CALLERID(num)})})
exten => s,n,Goto(TESTRESULT)
exten => s,n(CIDTEST2),Set(TESTCID=${MATH(1+${CALLERID(num):1})})
exten => s,n(TESTRESULT),GotoIf($["foo${TESTCID}"="foo"]?CLEARCID:PRIVMGR)
exten => s,n(CLEARCID),Set(CALLERID(num)=)
exten => s,n(PRIVMGR),PrivacyManager()
exten => s,n,GotoIf($["${PRIVACYMGRSTATUS}"="FAILED"]?fail)
exten => s,n,SetCallerPres(allowed_passed_screen); stop gap until app_privacy.c clears unavailable bit
exten => s,PRIVMGR+101(fail),Noop(STATUS: ${PRIVACYMGRSTATUS} CID: ${CALLERID(num)} ${CALLERID(name)} CALLPRES: ${CALLLINGPRES})
exten => s,n,Playback(sorry-youre-having-problems)
exten => s,n,Playback(goodbye)
exten => s,n,Playtones(congestion)
exten => s,n,Congestion(5)



; Text-To-Speech related macros
; These all follow common actions.  First try to playback a file "tts/custom-md5" 
; where "md5" is the md5() of whatever is going to be played. If that doesn't exist,
; try to playback using macro-tts-sayXXXXX (where XXXXX is text/digits/etc, same as
; the macro below). If that macro exits with MACRO_OFFSET=100, then it's done, 
; otherwise, fallback to the default asterisk method. 
;
; say text is purely for text-to-speech, there is no fallback
[macro-saytext]
exten => s,1,Noop(Trying custom SayText playback for "${ARG1}")
exten => s,n,Playback(tts/custom-${MD5(${ARG1})})
exten => s,n,GotoIf($["${PLAYBACKSTATUS}"="SUCCESS"]?done)
; call tts-saytext. This should set MACRO_OFFSET=101 if it was successful
exten => s,n(tts),Macro(tts-saytext,${ARG1},${ARG2},${ARG3})
exten => s,n,Noop(No text-to-speech handler for SayText, cannot say "${ARG1}")
exten => s,n,Goto(done)
exten => s,tts+101,Noop(tts handled saytext)

; say name is for saying names typically, but fallsback to using SayAlpha
; (saying the word letter-by-letter)
[macro-sayname]
exten => s,1,Noop(Trying custom SayName playback for "${ARG1}")
exten => s,n,Playback(tts/custom-${MD5(${ARG1})})
exten => s,n,GotoIf($["${PLAYBACKSTATUS}"="SUCCESS"]?done)
; call tts-sayalpha. This should set MACRO_OFFSET=101 if it was successful
exten => s,n(tts),Macro(tts-sayalpha,${ARG1},${ARG2},${ARG3})
exten => s,n,SayAlpha(${ARG1})
exten => s,n,Goto(done)
exten => s,tts+101,Noop(tts handled sayname)

; Say number is for saying numbers (eg "one thousand forty six") 
[macro-saynumber]
exten => s,1,Noop(Trying custom SayNumber playback for "${ARG1}")
exten => s,n,Playback(tts/custom-${MD5(${ARG1})})
exten => s,n,GotoIf($["${PLAYBACKSTATUS}"="SUCCESS"]?done)
; call tts-saynumber. This should set MACRO_OFFSET=101 if it was successful
exten => s,n(tts),Macro(tts-saynumber,${ARG1},${ARG2},${ARG3})
exten => s,n,SayNumber(${ARG1})
exten => s,n,Goto(done)
exten => s,tts+101,Noop(tts handled saynumber)

; Say digits is for saying digits one-by-one (eg, "one zero four six")
[macro-saydigits]
exten => s,1,Noop(Trying custom SayDigits playback for "${ARG1}")
exten => s,n,Playback(tts/custom-${MD5(${ARG1})})
exten => s,n,GotoIf($["${PLAYBACKSTATUS}"="SUCCESS"]?done)
; call tts-saydigits. This should set MACRO_OFFSET=101 if it was successful
exten => s,n(tts),Macro(tts-saydigits,${ARG1},${ARG2},${ARG3})
exten => s,n,SayDigits(${ARG1})
exten => s,n,Goto(done)


;
; ############################################################################
; Inbound Contexts [from]
; ############################################################################

[from-sip-external]
;give external sip users congestion and hangup
; Yes. This is _really_ meant to be _. - I know asterisk whines about it, but 
; I do know what I'm doing. This is correct.
exten => _.,1,NoOp(Received incoming SIP connection from unknown peer to ${EXTEN})
exten => _.,n,Set(DID=${IF($["${EXTEN:1:2}"=""]?s:${EXTEN})})
exten => _.,n,Goto(s,1)
exten => s,1,GotoIf($["${ALLOW_SIP_ANON}"="yes"]?from-trunk,${DID},1)
exten => s,n,Set(TIMEOUT(absolute)=15)
exten => s,n,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(ss-noservice)
exten => s,n,Playtones(congestion)
exten => s,n,Congestion(5)
exten => h,1,NoOp(Hangup)
exten => i,1,NoOp(Invalid)
exten => t,1,NoOp(Timeout)

[from-internal-xfer]
; applications are now mostly all found in from-internal-additional in _custom.conf
include => from-internal-custom
include => parkedcalls
;allow phones to dial other extensions
include => ext-fax
;allow phones to access generated contexts
;
; MODIFIED (PL)
;
; Currently the include for findmefollow is being auto-generated before ext-local which is the desired behavior.
; However, I haven't been able to do anything that I know of to force this. We need to determine if it should
; be hardcoded into here to make sure it doesn't change with some configuration. For now I will leave it out
; until we can discuss this.
;
include => ext-local-confirm
include => findmefollow-ringallv2
include => from-internal-additional
; This causes grief with '#' transfers, commenting out for the moment.
; include => bad-number
exten => s,1,Macro(hangupcall)
exten => h,1,Macro(hangupcall)

[from-internal]
include => from-internal-xfer
include => bad-number

;------------------------------------------------------------------------
; [macro-setmusic]
;------------------------------------------------------------------------
; CONTEXT:      macro-setmusic
; PURPOSE:      to turn off moh on routes where it is not desired
;
;------------------------------------------------------------------------
[macro-setmusic]
exten => s,1,NoOp(Setting Outbound Route MoH To: ${ARG1})
exten => s,2,SetMusicOnHold(${ARG1})
;------------------------------------------------------------------------

; ##########################################
; ## Ring Groups with Confirmation macros ##
; ##########################################
; Used by followme and ringgroups

;------------------------------------------------------------------------
; [macro-dial-confirm]
;------------------------------------------------------------------------
; This has now been incorporated into dialparties. It still only works with ringall
; and ringall-prim strategies. Have not investigated why it doesn't work with
; hunt and memory hunt.
;
;------------------------------------------------------------------------
[macro-dial-confirm]
; This was written to make it easy to use macro-dial-confirm instead of macro-dial in generated dialplans.
; This takes the same parameters, with an additional parameter of the ring group Number
; ARG1 is the timeout
; ARG2 is the DIAL_OPTIONS
; ARG3 is a list of xtns to call - 203-222-240-123123123#-211
; ARG4 is the ring group number

; This sets a unique value to indicate that the channel is ringing. This is used for warning slow
; users that the call has already been picked up.
;
exten => s,1,Set(DB(RG/${ARG4}/${CHANNEL})=RINGING)

; We need to keep that channel variable, because it'll change when we do this dial, so set it to
; fallthrough to every sibling.
;
exten => s,n,Set(__UNIQCHAN=${CHANNEL})

; The calling ringgroup should have set RingGroupMethod appropriately. We need to set two
; additional parameters:
;
; USE_CONFIRMATION, RINGGROUP_INDEX
;
; These are passed to inform dialparties to place external calls through the [grps] context
;
exten => s,n,Set(USE_CONFIRMATION=TRUE)
exten => s,n,Set(RINGGROUP_INDEX=${ARG4})
exten => s,n,Set(ARG4=) ; otherwise it gets passed to dialparties.agi which processes it (prob bug) 

exten => s,n,Macro(dial,${ARG1},${ARG2},${ARG3})

; delete the variable, if we are here, we are done trying to dial and it may have been left around
;
exten => s,n,DBDel(RG/${RINGGROUP_INDEX}/${CHANNEL})
exten => s,n,Set(USE_CONFIRMATION=)
exten => s,n,Set(RINGGROUP_INDEX=)
;------------------------------------------------------------------------


;------------------------------------------------------------------------
; [ext-local-confirm]
;------------------------------------------------------------------------
; If call confirm is being used in a ringgroup, then calls that do not require confirmation are sent
; to this extension instead of straight to the device.
;
; The sole purpose of sending them here is to make sure we run Macro(auto-confirm) if this
; extension answers the line. This takes care of clearing the database key that is used to inform
; other potential late comers that the extension has been answered by someone else.
;
; ALERT_INFO is deprecated in Asterisk 1.4 but still used throughout the FreePBX dialplan and
; usually set by dialparties.agi. This allows inheritance. Since no dialparties.agi here, set the
; header if it is set.
;
;------------------------------------------------------------------------
[ext-local-confirm]
exten => _LC-.,1,Noop(IN ext-local-confirm with - RT: ${RT}, RG_IDX: ${RG_IDX})
exten => _LC-.,n,GotoIf($["x${ALERT_INFO}"="x"]?godial)
exten => _LC-.,n,SIPAddHeader(Alert-Info: ${ALERT_INFO})
exten => _LC-.,n(godial),dial(${DB(DEVICE/${EXTEN:3}/dial)},${RT},M(auto-confirm^${RG_IDX})${DIAL_OPTIONS})

;------------------------------------------------------------------------
; [findmefollow-ringallv2]
;------------------------------------------------------------------------
; This context, to be included in from-internal, implements the PreRing part of findmefollow
; as well as the GroupRing part. It also communicates between the two so that if DND is set
; on the primary extension, and mastermode is enabled, then the other extensions will not ring
;
;------------------------------------------------------------------------
[findmefollow-ringallv2]
exten => _FMPR-.,1,Noop(In FMPR ${FMGRP} with ${EXTEN:5})
exten => _FMPR-.,n,Set(RingGroupMethod=)
exten => _FMPR-.,n,Set(USE_CONFIRMATION=)
exten => _FMPR-.,n,Set(RINGGROUP_INDEX=)
exten => _FMPR-.,n,Macro(simple-dial,${EXTEN:5},${FMREALPRERING})
exten => _FMPR-.,n,GotoIf($["${DIALSTATUS}" != "BUSY"]?nodnd)
exten => _FMPR-.,n,Set(DB(FM/DND/${FMGRP}/${FMUNIQUE})=DND)
exten => _FMPR-.,n(nodnd),Noop(Ending FMPR ${FMGRP} with ${EXTEN:5} and dialstatus ${DIALSTATUS})
exten => _FMPR-.,n,Hangup()

exten => _FMGL-.,1,Noop(In FMGL ${FMGRP} with ${EXTEN:5})
exten => _FMGL-.,n,GotoIf($["${DB(FM/DND/${FMGRP}/${FMUNIQUE})}" = "DND"]?dodnd)
exten => _FMGL-.,n,Wait(1)
exten => _FMGL-.,n,GotoIf($["${DB(FM/DND/${FMGRP}/${FMUNIQUE})}" = "DND"]?dodnd)
exten => _FMGL-.,n,Wait(1)
exten => _FMGL-.,n,GotoIf($["${DB(FM/DND/${FMGRP}/${FMUNIQUE})}" = "DND"]?dodnd)
exten => _FMGL-.,n,Wait(${FMPRERING})
exten => _FMGL-.,n,GotoIf($["${DB(FM/DND/${FMGRP}/${FMUNIQUE})}" = "DND"]?dodnd)
exten => _FMGL-.,n,DBDel(FM/DND/${FMGRP}/${FMUNIQUE})
exten => _FMGL-.,n(dodial),Macro(dial,${FMGRPTIME},${DIAL_OPTIONS},${EXTEN:5})
exten => _FMGL-.,n,Noop(Ending FMGL ${FMGRP} with ${EXTEN:5} and dialstatus ${DIALSTATUS})
exten => _FMGL-.,n,Hangup()
exten => _FMGL-.,n+10(dodnd),DBDel(FM/DND/${FMGRP}/${FMUNIQUE})
exten => _FMGL-.,n,GotoIf($["${FMPRIME}" = "FALSE"]?dodial)
exten => _FMGL-.,n,Noop(Got DND in FMGL ${FMGRP} with ${EXTEN:5} in ${RingGroupMethod} mode, aborting)
exten => _FMGL-.,n,Hangup()

;------------------------------------------------------------------------
; [block-cf]
;------------------------------------------------------------------------
; This context is set as a target with FORWARD_CONTEXT when Call Forwarding is set to be
; ignored in a ringgroup or other features that may take advantage of this. Server side
; CF is done in dialparties.agi but if a client device forwards a call, it will be caught
; and blocked here.
;------------------------------------------------------------------------
[block-cf]
exten => _X.,1,Noop(Blocking callforward to ${EXTEN} because CF is blocked)
exten => _X.,n,Hangup()

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

; ############################################################################
; Extension Contexts [ext]
; ############################################################################

[ext-fax]
exten => s,1,Answer
exten => s,2,Goto(in_fax,1)
exten => in_fax,1,StopPlayTones  
exten => in_fax,2,GotoIf($["${FAX_RX}" = "system"]?3:analog_fax,1)
exten => in_fax,3,Macro(faxreceive)
exten => in_fax,4,Hangup
exten => analog_fax,1,GotoIf($["${FAX_RX}" = "disabled"]?4:2)  ;if fax is disabled, just hang up
exten => analog_fax,2,Set(DIAL=${DB(DEVICE/${FAX_RX}/dial)});
exten => analog_fax,3,Dial(${DIAL},20,d)
exten => analog_fax,4,Hangup
;exten => out_fax,1,wait(7)
exten => out_fax,1,txfax(${TXFAX_NAME},caller)
exten => out_fax,2,Hangup
exten => h,1,system(/var/lib/asterisk/bin/fax-process.pl --to ${EMAILADDR} --from ${FAX_RX_FROM} --dest "${FROM_DID}" --subject "Fax from ${URIENCODE(${CALLERID(number)})} ${URIENCODE(${CALLERID(name)})}" --attachment fax_${URIENCODE(${CALLERID(number)})}.pdf --type application/pdf --file ${FAXFILE});
exten => h,2,Hangup()

;this is where parked calls go if they time-out.  Should probably re-ring
[default]
include => ext-local
exten => s,1,Playback(vm-goodbye)
exten => s,2,Macro(hangupcall)

Open in new window


Is there a patch for this error 34?

cause i just found this:

http://bbs.openvox.cn/viewthread.php?action=printable&tid=1363

and that is very similar to my issue but calls can't get in on my case ... i get busy tone when dialing my tel # from any outside phone

Thanks

Juan
0
 
LVL 36

Expert Comment

by:grblades
ID: 34143245
Error 34 is a fairly general error and can be caused by a whole range of things. As you are unable to get incoming calls (and I assume there is nothing shown on the asterisk console when you try and dial in) then it is most likely a misconfiguration of the E1 card so that it is unable to communicate with the network operator.
You can issue the command 'pri set debug on'  which turns on pri debugging but I dont really have the experience with it to understand the output that it will give but you might be able to understand enough to get an idea what might be wrong.

As the error was caused by you having a loop on the card I would change the signalling back to pri_cpe.
0
 

Author Comment

by:Juan-ito
ID: 34147544
I'm packing now the server and send it to the new location, the server should be arriving tomorrow and I'll be arriving next Friday so we can't make any more testing till Friday.

On the other hand I'll be able to test till the card work cause I'll have the E1 link just for me, i mean, not production environment at all for the new location :)

That's great for me cause I was tired to to do all the testing after hours :)

I'll keep you posted

Thank you very much for your help.

Regards

Juan
0
 

Author Comment

by:Juan-ito
ID: 34179911
Today i'll be doing some testing on this, i'll let you know the results later.

Regards

Juan
0
 

Author Comment

by:Juan-ito
ID: 34181034
Finally i was able to do some testing on the link.

I just discover that TELMEX (Carrirer) had their end configured for cas hdb3.

But when i try to us the following configuration i just can't see the dahdi channels or the status at asterisk -r interface...

span=1,1,0,cas,hdb3
cas=1-15:1101
dchan=16
cas=17-31:1101
echocanceller=mg2,1-15,17-31

# Global data

loadzone      = us
defaultzone      = us

I get this:

trixbox1*CLI> dahdi show status
No such command 'dahdi show status' (type 'help dahdi show' for other possible commands)
trixbox1*CLI>

trixbox1*CLI> dahdi show channels
No such command 'dahdi show channels' (type 'help dahdi show' for other possible commands)
trixbox1*CLI>
 
and this is my dahdi_scan:

[trixbox1.localdomain ~]# dahdi_scan
[1]
active=yes
alarms=OK
description=Wildcard TE122 Card 0
name=WCT1/0
manufacturer=Digium
devicetype=Wildcard TE122
location=PCI Bus 04 Slot 01
basechan=1
totchans=31
irq=169
type=digital-E1
syncsrc=1
lbo=0 db (CSU)/0-133 feet (DSX-1)
coding_opts=HDB3
framing_opts=CCS,CRC4
coding=HDB3
framing=
[trixbox1.localdomain ~]#

does this card support cas?

Please advice

Regards

Juan Grijalva
0
 

Author Comment

by:Juan-ito
ID: 34181287
FYI

trixbox1*CLI> dahdi show channels
No such command 'dahdi show channels' (type 'help dahdi show' for other possible commands)
trixbox1*CLI> module unload chan_dahdi.so
  == Unregistered application 'DAHDISendKeypadFacility'
trixbox1*CLI> module load chan_dahdi.so
Unable to load module chan_dahdi.so
Command 'module load chan_dahdi.so' failed.
  == Registered application 'DAHDISendKeypadFacility'
  == Parsing '/etc/asterisk/chan_dahdi.conf':   == Found
  == Parsing '/etc/asterisk/dahdi-channels.conf':   == Found
  == Parsing '/etc/asterisk/chan_dahdi_additional.conf':   == Found
  == Parsing '/etc/asterisk/users.conf':   == Found
[Nov 20 17:16:26] ERROR[3184]: chan_dahdi.c:8763 mkintf: Signalling requested on channel 1 is ISDN PRI but line is in Unknown signalling 32768 signalling
[Nov 20 17:16:26] ERROR[3184]: chan_dahdi.c:14127 build_channels: Unable to register channel '1-15,17-31'
trixbox1*CLI>


Regards

Juan Grijalva
0
 
LVL 36

Expert Comment

by:grblades
ID: 34183474
You might want to run 'dmesg' from the linux command prompt (not asterisk) and also check in /var/log/messages to see if there are any furthur errors which may help.

Sorry I dont know if these cards support cas. You could try emailing digium support as they make the cards and wrote the dahdi and asterisk software and normally offer technical support on getting their cards working with asterisk.
0
 

Author Comment

by:Juan-ito
ID: 34183756
Yes, the card support cas, i found that i'm missing the open r2 libraries for the MFC/R2 support.

I just found this articles:

Manual

and this video:

Video

Let me take a look on those... i think i'm closer now to the solution :)

Thanks

Regards

Juan
0
 

Author Comment

by:Juan-ito
ID: 34239465
Sorry for the long wait....

I was able to install openr2 libraries but i had problems with the asterisk compilation....

I'm now trying to update asterisk 1.6.0 to 1.6.2 cause version 1.6.2 supports MFC signalling...

Any help would be appreciated.

Regards

Juan
0
 
LVL 36

Expert Comment

by:grblades
ID: 34239932
It should be just a case of compiling the new version and installing over the top.

Is it compiling ok or are you getting errors?
0
 

Author Comment

by:Juan-ito
ID: 34248985
Is working now...

Thanks a lot grblades.....

I follow these steps but something goes wrong in the way... i don't know what....

1. install trixbox CE 2.8.0.4 (Asterisk 1.6.0.26)
2. Download asterisk 1.6.2.14
3. Download dahdi complet
4. Dowlonad dahdi addons
5. Follow the steps  in the next video....

http://www.youtube.com/watch?v=aN6tybIaeHA&feature=player_embedded#!

Configure your files like this link says:

http://fonality.com/trixbox/node/42618


So I just changed trixbox for elastix 2.03 configured my system.conf and chan_dahdi add my trunks outbound route and the magic it's done :)

And is working now.....

Yei.....

Thanks a lot...

Regards

Juan Grijalva
0
 

Author Closing Comment

by:Juan-ito
ID: 34249000
Changed trixbox for elastix but at the end you point me to the right direction
0
 

Expert Comment

by:fbarcenas
ID: 39922124
So after installing elastix, what modifications did you have to make to get it to work?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Ever wanted to query Cisco Call Manager CDR records from MS SQL Server? Here's how! CUCM can be configured to upload a CDR file to a given FTP server every minute. This article will show you how to set this up, schedule the import of this data an…
There are no good configuration guides for HP-H3C router to LYNC on the web. :( Big statement, but we havent been able to find one yet. We did find the following document useful, but the information was not enough to use H3C router for use as a L…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now