Table of contents
Project initiation
The CallWeb Robot is a fully featured interactive voice response system using all CallWeb features in conjunction with the Asterisk PBX system.
Therefore, a CallWeb Robot project initiation starts with the creation of a CallWeb CATI-like project using the project initiation checklist. Yet, a Robot project is not quite a CATI project, so here are the differences:
Concerning the .scw questionnaire file:
Concerning the Asterisk context file:
Concerning running the Robot project:
Typical Asterisk script
What follows is a typical asterisk script (technically, scripts are called "contexts" in Asterisk jargon). It starts with a greeting followed by an invitation to select a language; then, it asks a single question and stores the answer in Q1. Along the way, the case call history is updated to reflect the circumstances.
; ------------------------------------------------ FRANÇAIS [oplus_petitemusique_f] exten => s,1,Answer exten => s,n,Set(CDR(userfield)=${number}) exten => s,n,AMD(3500|1500|300|5000|120|50|5|256) exten => s,n,GotoIf($["${AMDSTATUS}" = "AMD_MACHINE"]?machine,1) exten => s,n,GotoIf($["${AMDSTATUS}" = "AMD_PERSON"]?talk,1) exten => s,n,GotoIf($["${AMDSTATUS}" = "AMD_NOTSURE"]?uncertain,1) exten => s,n,GotoIf($["${AMDSTATUS}" = "AMD_HANGUP"]?h,1) exten => uncertain,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "uncertain") exten => uncertain,n,Goto(oplus_petitemusique_f_hangup,s,1) exten => machine,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "machine") exten => machine,n,Goto(oplus_petitemusique_f_hangup,s,1) exten => h,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "hung_up") exten => h,n,Goto(oplus_petitemusique_f_hangup,s,1) exten => fax,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "fax") exten => fax,2,Goto(oplus_petitemusique_f_hangup,s,1) exten => failed,1,set(CODE=-1) exten => failed,n,Set(CODE=${IF($[ ${OutgoingSpoolFailedReason} = 0 ]?"no_service":${CODE})}) exten => failed,n,Set(CODE=${IF($[ ${OutgoingSpoolFailedReason} = 1 ]?"no_service":${CODE})}) exten => failed,n,Set(CODE=${IF($[ ${OutgoingSpoolFailedReason} = 3 ]?"ring_no_answer":${CODE})}) exten => failed,n,Set(CODE=${IF($[ ${OutgoingSpoolFailedReason} = 5 ]?"busy":${CODE})}) exten => failed,n,Set(CODE=${IF($[ ${OutgoingSpoolFailedReason} = 8 ]?"out_line_unavailable":${CODE})}) exten => failed,n,Set(CODE=${IF($[ ${CODE} = -1 ]?"failed${CODE}":${CODE})}) exten => failed,n,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "${CODE}") exten => failed,n,Goto(oplus_petitemusique_f_hangup,s,1) exten => talk,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "response") exten => talk,n,Goto(oplus_petitemusique_f,s,21) exten => s,21,Playback(custom/dar/fr/dar-1-intro-f) exten => s,22,Background(custom/dar/fr/dar-2-langue-f) exten => 1,1,SetLanguage(fr) exten => 1,2,Goto(oplus_petitemusique_f_question,s,1) exten => 2,1,SetLanguage(en) exten => 2,2,Goto(oplus_petitemusique_e_question,s,1) exten => i,1,SetLanguage(fr) exten => i,2,Goto(oplus_petitemusique_f_question,s,1) exten => t,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "time_out_1") exten => t,2,Goto(oplus_petitemusique_f_hangup,s,1) exten => h,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "hung_up") exten => h,2,Goto(oplus_petitemusique_f_hangup,s,1) [oplus_petitemusique_f_question] exten => s,1,Set(LOOPCOUNT=0) exten => s,2,Playback(custom/dar/dar-3-please) exten => s,3,Background(custom/dar/dar-4-question) exten => 1,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "complete" Q1 1) exten => 1,2,Goto(oplus_petitemusique_f_end,s,1) exten => 2,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "complete" Q1 2) exten => 2,2,Goto(oplus_petitemusique_f_end,s,1) exten => 0,1,Goto(oplus_petitemusique_f_question,s,1) exten => i,1,Set(LOOPCOUNT=$[${LOOPCOUNT} + 1]) exten => i,2,GotoIf($[${LOOPCOUNT} > 9]?h,3) exten => i,3,Goto(oplus_petitemusique_f_question,s,2) exten => t,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "time_out_2") exten => t,2,Goto(oplus_petitemusique_f_hangup,s,1) exten => h,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "hung_up") exten => h,2,Goto(oplus_petitemusique_f_hangup,s,1) exten => h,3,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "excess_loop") exten => h,4,Goto(oplus_petitemusique_f_hangup,s,1) [oplus_petitemusique_f_end] exten => s,1,Playback(custom/dar/dar-5-merci) exten => s,2,Goto(oplus_petitemusique_f_hangup,s,1) [oplus_petitemusique_f_hangup] ; Cette section coupe la communication sans déclencher l'extension "h" ; et donc sans ajouter d'appel à l'historique d'appels exten => s,1,system(/usr/bin/cwASTstocke.sh ${interviewer} "released") exten => s,n,Hangup ; ------------------------------------------------ ANGLAIS [oplus_petitemusique_e] exten => s,1,Answer exten => s,n,Set(CDR(userfield)=${number}) exten => s,n,AMD(3500|1500|300|5000|120|50|5|256) exten => s,n,GotoIf($["${AMDSTATUS}" = "AMD_MACHINE"]?machine,1) exten => s,n,GotoIf($["${AMDSTATUS}" = "AMD_PERSON"]?talk,1) exten => s,n,GotoIf($["${AMDSTATUS}" = "AMD_NOTSURE"]?uncertain,1) exten => s,n,GotoIf($["${AMDSTATUS}" = "AMD_HANGUP"]?h,1) exten => uncertain,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "uncertain") exten => uncertain,n,Goto(oplus_petitemusique_e_hangup,s,1) exten => machine,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "machine") exten => machine,n,Goto(oplus_petitemusique_e_hangup,s,1) exten => h,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "hung_up") exten => h,n,Goto(oplus_petitemusique_e_hangup,s,1) exten => fax,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "fax") exten => fax,2,Goto(oplus_petitemusique_e_hangup,s,1) exten => failed,1,set(CODE=-1) exten => failed,n,Set(CODE=${IF($[ ${OutgoingSpoolFailedReason} = 0 ]?"no_service":${CODE})}) exten => failed,n,Set(CODE=${IF($[ ${OutgoingSpoolFailedReason} = 1 ]?"no_service":${CODE})}) exten => failed,n,Set(CODE=${IF($[ ${OutgoingSpoolFailedReason} = 3 ]?"ring_no_answer":${CODE})}) exten => failed,n,Set(CODE=${IF($[ ${OutgoingSpoolFailedReason} = 5 ]?"busy":${CODE})}) exten => failed,n,Set(CODE=${IF($[ ${OutgoingSpoolFailedReason} = 8 ]?"out_line_unavailable":${CODE})}) exten => failed,n,Set(CODE=${IF($[ ${CODE} = -1 ]?"failed${CODE}":${CODE})}) exten => failed,n,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "${CODE}") exten => failed,n,Goto(oplus_petitemusique_e_hangup,s,1) exten => talk,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "response") exten => talk,n,Goto(oplus_petitemusique_e,s,21) exten => s,21,Playback(custom/dar/fr/dar-1-intro-e) exten => s,22,Background(custom/dar/fr/dar-2-langue-e) exten => 1,1,SetLanguage(en) exten => 1,2,Goto(oplus_petitemusique_e_question,s,1) exten => 2,1,SetLanguage(fr) exten => 2,2,Goto(oplus_petitemusique_f_question,s,1) exten => i,1,SetLanguage(en) exten => i,2,Goto(oplus_petitemusique_e_question,s,1) exten => t,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "time_out_1") exten => t,2,Goto(oplus_petitemusique_e_hangup,s,1) exten => h,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "hung_up") exten => h,2,Goto(oplus_petitemusique_e_hangup,s,1) [oplus_petitemusique_e_question] exten => s,1,Set(LOOPCOUNT=0) exten => s,2,Playback(custom/dar/dar-3-please) exten => s,3,Background(custom/dar/dar-4-question) exten => 1,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "complete" Q1 1) exten => 1,2,Goto(oplus_petitemusique_e_end,s,1) exten => 2,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "complete" Q1 2) exten => 2,2,Goto(oplus_petitemusique_e_end,s,1) exten => 0,1,Goto(oplus_petitemusique_e_question,s,1) exten => i,1,Set(LOOPCOUNT=$[${LOOPCOUNT} + 1]) exten => i,2,GotoIf($[${LOOPCOUNT} > 9]?h,3) exten => i,3,Goto(oplus_petitemusique_e_question,s,2) exten => t,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "time_out_2") exten => t,2,Goto(oplus_petitemusique_e_hangup,s,1) exten => h,1,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "hung_up") exten => h,2,Goto(oplus_petitemusique_e_hangup,s,1) exten => h,3,system(/usr/bin/cwASTstocke.sh ${prefixe} ${projet} ${telkey} ${interviewer} ${nlignes} "excess_loop") exten => h,4,Goto(oplus_petitemusique_e_hangup,s,1) [oplus_petitemusique_e_end] exten => s,1,Playback(custom/dar/dar-5-merci) exten => s,2,Goto(oplus_petitemusique_e_hangup,s,1) [oplus_petitemusique_e_hangup] ; Cette section coupe la communication sans déclencher l'extension "h" ; et donc sans ajouter d'appel à l'historique d'appels exten => s,1,system(/usr/bin/cwASTstocke.sh ${interviewer} "released") exten => s,n,Hangup
Technical inner workings
For the technically oriented who want to know more about the inner-workings of the system, here is the sequence followed by the Robot system:
Sending robot calls to human agents
It is possible to refer robot calls to a human agent. Respondents are invited to press a certain key to talk to an agent. Once this key is pressed, the Asterisk server looks for an available agent for up to five seconds before asking the respondent whether they want to wait any longer or return to the robot script (this message is stored in the "all_agent_busy" sound file).
At the other end of the call, the agent logs in using the interviewer access script so that their time is accounted for in BASEtemps. They choose the project(s) from which they wish to receive calls. They are then put in a waiting queue. When a call is sent their way, the system automatically pops-up the questionnaire of the caller. If a call sent to an agent remains unanswered, the Asterisk server logs that agent out to avoid sending more calls to an agent who is unavailable.
The following are required for this function:
Appendix A
Recent changes and additions
Appendix B
Detailed installation instructions
The following instructions were put together in the context of a full re-installation of an Asterisk-CallWeb system.
Appendix C
Project initiation checklist
The following checklist is offered as a guide to control that all steps of the project installation process have been completed.