extensions_minivm.conf.sample 7.3 KB

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