Add example from http://www.e164.org/wiki/AsteriskExamples customised for New Zealand...
[asterisk-agi-enum.git] / pstn.conf
1 ; How should calls be handled for PSTN/POTS calls?
2 ; This will probably need to be customised for each site.
3 ;
4 ; To use this simple implementation add the following to extensions.conf:
5 ;
6 ; #include "pstn.conf"
7 ;
8
9 [pstn]
10 ;;;
11 ;;; Handle PSTN dialout
12 ;;;
13
14 ; Let the 3 digit numbers out (111, Telecom, TelstraClear, Vodafone, etc)
15 exten => _XXX,1,Dial(${TRUNK}/${ARG1})
16
17 exten => _188299.,1,Macro(enum-call,pstn-international,${ARG1:1})
18 exten => _1Z.,1,Macro(enum-call,pstn-localcall,644${ARG1:1})
19 exten => _104.,1,Macro(enum-call,pstn-localcall,64${ARG1:2})
20 exten => _102.,1,Macro(enum-call,pstn-mobile,64${ARG1:2})
21 exten => _10Z.,1,Macro(enum-call,pstn-longdistance,64${ARG1:2})
22 exten => _100644Z.,1,Macro(enum-call,pstn-localcall,${ARG1:3})
23 exten => _100642Z.,1,Macro(enum-call,pstn-mobile,${ARG1:3})
24 exten => _10064XXXXXXXX,1,Macro(enum-call,pstn-longdistance,${ARG1:3})
25 exten => _100Z.,1,Macro(enum-call,pstn-international,${ARG1:3})
26
27 [macro-enum-call]
28 exten => s,1,AGI(enum.agi,${ARG2})
29 exten => s,n,Macro(${ARG1},${ARG2})
30
31 [macro-pstn-localcall] ; local calls by PSTN is a fixed charge, voip is per minute
32 ;exten => s,1,Dial(ZAP/1/${ARG1:3},60,t)
33 ;exten => s,2,Dial(IAX2/user:pass@localprovider.co.nz/${ARG1:3},60,t)
34 ;exten => s,3,Dial(IAX2/user:pass@secondprovider.co.nz/${ARG1:3},60,t)
35 exten => s,4,Hangup
36 exten => s,101,Hangup
37 exten => s,102,Hangup
38 exten => s,103,Hangup
39
40 [macro-pstn-longdistance] ; long distance by VOIP is deffinately cheaper then PSTN in Australia
41 ;exten => s,1,StripMSD(2)
42 ;exten => s,2,Prefix(0)
43 ;exten => s,3,Dial(IAX2/user:pass@localprovider.co.nz/0${ARG1:2},60,t)
44 ;exten => s,4,Dial(IAX2/user:pass@secondprovider.co.nz/0${ARG1:2},60,t)
45 exten => s.,5,Hangup
46 ;exten => _X.,103,Hangup
47 ;exten => _X.,104,Hangup
48
49 [macro-pstn-mobile] ; Maybe be cheaper to route pstn-mobile calls differently to pstn-longdistance in some cases
50 exten => s,1,Macro(pstn-longdistance,${ARG1})
51
52 [macro-pstn-international] ; Using overseas providers for calls is usually cheaper but more lag
53 ;exten => s,1,Dial(IAX2/user:pass@provider1.com/00${ARG1},60,t)
54 ;exten => s,2,Dial(IAX2/user:pass@provider2.com/00${ARG1},60,t)
55 ;exten => s,3,Dial(ZAP/1/00${ARG1},60,t)
56 ;exten => s,4,Hangup
57 ;exten => s,102,Hangup
58 ;exten => s,103,Hangup
59 ;exten => s,104,Hangup