Debian Codegraph @

configs/samples/extensions_minivm.conf.sample

raw
1 ; MINI-VOICEMAIL dialplan example
2 ; ---------------------------------------------------------------------------------------
3 ;
4 ; This is an example on how to use the Mini-Voicemail system to build
5 ; voicemail systems.
6 ;
7 ; This example remains for now despite using macro, with the idea that if anyone is still
8 ; using this sample, they can be encouraged to re-write it using gosub.
9 ;
10 ;.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
11 ; A macro to test the MINIVMACCOUNT dialplan function
12 ; Currently, accountcode and pincode is not used in the application
13 ; They where added to be used in dialplan scripting
14 ;
15 ;
16 [macro-minivmfunctest]
17 exten => s,1,set(account=${ARGV1})
18 exten => minivm,n,verbose(1,-------------------- Minivm Function test - Accoutn ${account} -------------)
19 exten => s,n,verbose(1,---- Has account: ${MINIVMACCOUNT(${account}:hasaccount)})
20 exten => s,n,verbose(1,---- Fullname: ${MINIVMACCOUNT(${account}:fullname)})
21 exten => s,n,verbose(1,---- Email: ${MINIVMACCOUNT(${account}:email)})
22 exten => s,n,verbose(1,---- Pager: ${MINIVMACCOUNT(${account}:pager)})
23 exten => s,n,verbose(1,---- E-mail template: ${MINIVMACCOUNT(${account}:etemplate)})
24 exten => s,n,verbose(1,---- Pager template: ${MINIVMACCOUNT(${account}:ptemplate)})
25 exten => s,n,verbose(1,---- Account code: ${MINIVMACCOUNT(${account}:accountcode)})
26 exten => s,n,verbose(1,---- Path: ${MINIVMACCOUNT(${account}:path)})
27 exten => s,n,verbose(1,---- Pincode: ${MINIVMACCOUNT(${account}:pincode)})
28 exten => s,n,verbose(1,---- Time zone: ${MINIVMACCOUNT(${account}:timezone)})
29 exten => s,n,verbose(1,---- Language: ${MINIVMACCOUNT(${account}:language)})
30 ; This requires setvar=customerclass=gold in the account configuration
31 exten => s,n,verbose(1,---- Var:customerclass: ${MINIVMACCOUNT(${account}:customerclass)})
32
33 [minivm-scenario1]
34 ; minivmtest tests the dialplan function MINIVMACCOUNT
35 ; Check the output in the console with verbose set
36 exten => minivmtest,1,answer
37 exten => minivmtest,n,wait(0.5)
38 exten => minivmtest,n,set([email protected])
39 exten => minivmtest,n,macro(minivmfunctest, ${ACCOUNT})
40 exten => minivmtest,n,playback(beep)
41 exten => minivmtest,n,hangup
42
43 ;.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
44 ; "minivm" tests a full scenario
45 ; Remember that users may hangup
46 ; This works both for users with accounts in minivm.conf and by just giving an e-mail address
47 ; without configuring an account
48 exten => minivm,1,answer
49 exten => minivm,n,wait(0.5) ; Wait for Voip channels to settle
50 exten => minivm,n,set([email protected])
51 exten => minivm,n,noop(------------------------------------------- Minivm Greet -------------)
52 exten => minivm,n,minivmgreet(${account})
53 exten => minivm,n,verbose(1,-- MINIVM_GREET_STATUS = ${MINIVM_GREET_STATUS} )
54 exten => minivm,n,noop(------------------------------------------- Minivm Record -------------)
55 exten => minivm,n,minivmRecord(${account},b)
56 exten => minivm,n,goto(minivmcleanup,1)
57
58 ; Cleanup after recording or hangup
59 exten => minivmcleanup,1,noop(------------------------------------------- Minivm Notify -------------)
60 ;Increment voicemail counter with 1. The counter will be used in the e-mail message
61 ;and in the filename
62 exten => minivmcleanup,n,gotoif($[${MINIVM_RECORD_STATUS} != SUCCESS]?minivmrecordfailure,1)
63 exten => minivmcleanup,n,set(MINIVMCOUNTER(${account}:voicemailcounter:inc)=1)
64 exten => minivmcleanup,n,set(MVM_COUNTER = ${MINIVMCOUNTER(${account}:voicemailcounter)})
65 exten => minivmcleanup,n,minivmNotify(${account})
66 exten => minivmcleanup,n,verbose(1,-- MINIVM_NOTIFY_STATUS = ${MINIVM_NOTIFY_STATUS} )
67 ; Now, clean up after sending voicemail
68 exten => minivmcleanup,n,noop(------------------------------------------- Minivm Delete -------------)
69 exten => minivmcleanup,n,minivmdelete()
70 exten => minivmcleanup,n,verbose(1,-- MINIVM_DELETE_STATUS = ${MINIVM_DELETE_STATUS} )
71
72 ;Recording failed
73 exten => minivmrecordfailure,1,playback(vm-sorry)
74 exten => minivmrecordfailure,n,wait(1)
75 exten => minivmrecordfailure,n,hangup
76
77 ; If the user hangs up during the recording, we need to clean up
78 ; And send notifications
79 exten => h,1,gotoif($[x${MINIVM_DELETE_STATUS} != x] ?h,stop)
80 exten => h,n,noop(------------------------------------------- HANGUP during voicemail recording -------------)
81 exten => h,n,goto(minivmcleanup,1)
82 exten => h,n(stop),noop(---Minivm DONE----)
83
84 ;.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
85 ; Extension to record a greeting message
86 ; Call this like:
87 ; macro(recordgreetings,[email protected])
88 ;
89 [macro-recordgreetings]
90 exten => s,1,answer
91 exten => s,n,wait(0.5)
92 exten => s,n,set(account=${ARGV1])
93 ; This file give extra options not available here, needs to be edited
94 ; Change of password does not work
95 exten => s,n(menu),background(vm-options)
96 exten => 1,1,setvar(option=u)
97 exten => 1,n,macro(minivmrec,${account},${option})
98 exten => 1,n,goto(menu)
99 exten => 2,1,setvar(option=b)
100 exten => 2,n,macro(minivmrec,${account},${option})
101 exten => 2,n,goto(menu)
102 exten => 3,1,setvar(option=n)
103 exten => 3,n,macro(minivmrec,${account},${option})
104 exten => 3,n,goto(menu)
105 exten => 4,1,setvar(option=t)
106 exten => 4,n,macro(minivmrec,${account},${option})
107 exten => 4,n,goto(menu)
108 exten => *,1,playback(vm-thankyou)
109 exten => *,n,wait(1)
110 exten => *,n,hangup
111
112 exten => i,1,playback(invalid)
113 exten => i,n,goto(menu)
114
115 [macro-minivmrec]
116 exten => s,1,gotoif(${MINIVMACCOUNT(${account}:hasaccount)}?record)
117 ; Account is not configured in minivm.conf or realtime
118 ; Phony message, add something useful here
119 exten => s,n,playback(privacy-incorrect)
120 exten => s,n,macroreturn
121 exten => record,1,minivmappmess(${ARGV1},${ARGV2})
122 exten => record,n,noop(Recording status: ${MINIVM_APPMESS_STATUS})
123 exten => record,n,macroreturn
124
125 ;.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
126 ; To set a counter and use a template for voicemail to users without accounts
127 ; use something like this
128 ;
129 ; email address is in the "account" channel variable. Set from ast_db or a script
130 ; based on called ID
131
132 exten => sendvoicemail,1,answer
133 exten => sendvoicemail,n,wait(0.5)
134 exten => sendvoicemail,n,set(domain=${CUT(account,@,2)})
135 exten => sendvoicemail,n,set(country=${CUT(domain,.,2)})
136 exten => sendvoicemail,n,minivmgreet(${account})
137 exten => sendvoicemail,n,minivmRecord(${account},b)
138 exten => sendvoicemail,n,goto(sendvmcleanup)
139
140 exten => sendvmcleanup,1,gotoif($[${MINIVM_RECORD_STATUS} != SUCCESS]?done)
141 ; The counter is set in the domain directory, so we don't create one directory per user
142 ; The counter has the email in the name of the counter, increase it
143 ; Set the MVM_COUNTER variable that we use in the template
144 exten => sendvmcleanup,n,set(MINIVMCOUNTER(${account}:voicemailcounter:inc)=1)
145 exten => sendvmcleanup,n,set(MVM_COUNTER = ${MINIVMCOUNTER(${account}:voicemailcounter)})
146 ; Increase a domain counter too, to see how many voicemails are sent to this domain
147 ; This is just for statistics
148 exten => sendvmcleanup,n,set(MINIVMCOUNTER(${domain}:${domain}-all:inc) = 1)
149
150 ; Send voicemail in e-mail with country-specific template
151 ; The template need to be defined in minivm.conf
152 ;
153 exten => sendvmcleanup,n,minivmNotify(${account}, ${country}_email)
154 exten => sendvmcleanup,n,minivmDelete()
155
156 exten => sendvmcleanup,n(done),wait(0.5)
157 exten => sendvmcleanup,n,hangup
158
159 exten => h,1,gotoif($[${MINIVM_RECORD_STATUS} = SUCCESS]?sendvmcleanup,1))