Copyright © 2005-2006 Ericsson
Version: 1.0
Behaviour: gen_server.
Authors: Freek Sanders (freekisanders@gmail.com) [web site: http://www.freeksanders.tk].
idefisk_supervisor) and communicates with a given Ext-Ast-Interface instance through its process id.
Use-Case-Enquete uses Use-Case-Call (see use_case_call) to keep an intern record of created calls, legs and resources, as well as to receive messages.
Use-Case-Enquete is used to play an interactive enquete through the telephone.
The flow of enquete questions can be based on the answer to a previous question.
The flow of events in the enquete is based on the settings in the idefisk.conf file.
Use-Case-Enquete does nothing untill start_enquete/2 is called (see use_case_enquete:start_enquete/2).
When start_enquete is called, the use case creates a call and after that a leg.
Then two resources are reserved, a 'sound player' for playing the enquete, and a 'dtmf receiver' for receiving the users answers to questions.
The resources are then attached. After attaching, the leg is routed and, after answering, is also attached.
After the leg has been attached, the 'sound player' start playing (see ext_ast_interface:play/3) the first question, and the 'dtmf receiver' starts receiving (see ext_ast_interface:start_dtmf/2).
After each answer, the 'sound player' starts playing the next question.
When the enquete is finished, the call is released.
Set asterisk_ext_module to 'use_case_enquete' : {asterisk_ext_module, use_case_enquete}
Set asterisk_ext_module_start to 'true' : {asterisk_ext_module_start, true}
Set asterisk_ext_module_args to the enquete : {asterisk_ext_module_args, [EnqueteArgs::enquete_args()]}
StartId is where the id of the place where the enquete begins.
This can be a integer, atom or string.
Enquete is the enquete in the following format:
an array of tuples of one of more of the following formats:
{id, file, 'multi', DTMF_MATCH_ARRAY}
{id, file, 'single', DTMF_MATCH_ARRAY}
{id, file, 'plainsound', NEXT_ID}
{id, file, 'end'}
where NEXT_ID is the id of the tuple to be evaluated next
where DTMF_MATCH_ARRAY is an array of tuples:
{DTMF_STRING, NEXT_ID}
where DTMF_STRING is a string or regular expression which can be matched against one or more dtmf keys.
Note: with 'multi' DTMF_STRING always ends with '#', which is implicit, and does not have to be mentioned in the DTMF_STRING.
Note: with 'single' DTMF_STRING must always equal one key (i.e. not more than one).
example:
{3,"sound.mp3",'multi',[{"1",5},{"12",'light music'},{"13",7},{"132",8},{"4",'finito'}]}
Use-Case-Enquete has been implemented using the gen-server behaviour. This means that all function calls returning 'ok' (see below) are gen_server casts, which carry out their function asynchronously. An 'ok' does not mean success. If a function has success or not can only be derived from side-effects and messages printed to the command line.
For more information about the flow of events and an explanation of terms seeext_ast_interface.
dtmf_match_array() = [{DtmfString::dtmf_string(), NextId::id()}]
dtmf_string() = string()
end_file() = {Id::id(), File::file(), 'end'}
enquete() = [enquete_file()]
enquete_args() = [{StartId::id(), Enquete::enquete()}]
enquete_file() = single_dtmf_file() | multi_dtmf_file() | plainsound() | end_file()
file() = gsm_file() | mp3_file()
gsm_file() = string() | new_gsm_file()
id() = integer() | atom() | string()
mp3_file() = string()
mp3_file always ends with ".mp3".
multi_dtmf_file() = {Id::id(), File::file(), multi, DtmfMatchArray::dtmf_match_array()}
new_file() = string() | new_gsm_file()
new_file always starts with "&".
new_gsm_file() = new_file() | nil()
plainsound() = {Id::id(), File::file(), plainsound, NextId::id()}
single_dtmf_file() = {Id::id(), File::file(), single, DtmfMatchArray::dtmf_match_array()}
| die/0 | Destroys the use case. |
| start_enquete/2 | Starts a new enquete by calling DestAddr. |
die() -> ok
Destroys the use case.
Introduced in: 0.2
start_enquete(F, DestAddr) -> ok
Starts a new enquete by calling DestAddr.
Introduced in: 0.2