How to IVR survey ??

Joined
Sep 2, 2008
Messages
23
Points
0
Hi !!

I need to know if this could be done in elastix ?
If so, then how to do it, we need to implement a little survey after the call is finished, and create reports based on the info the clients submit trought the survey.

Thanks and best regards !!

Blackwoodie
 
Joined
Feb 4, 2013
Messages
2
Points
0
Hi, I have the same goal.

This that I could do until now:

I did a test extension 555 that says an intro; wait one bottom press and execute a phpagi script.

These are the modifications to
/etc/asterisk/extensions_custom.conf:

include => survey

[survey]

exten => 555,1,Playback("survey-intro")
;Read(variable[,filename][,maxdigits][,option][,attempts][,timeout])
exten => 555,n,Read(CALIF,"plese-press",1,,,3)
exten => 555,n,SayDigits(${CALIF})
exten => 555,n,AGI(testphp.php,${EXTEN},${CALLERID(all)},${CALLERID(num)},${CALIF})
exten => 555,n,Playback("thank-you-for-calling")
exten => 555,n,Hangup


These is the very simple script
/var/lib/asterisk/agi-bin/testphp.php
#!/usr/bin/php -q
<?
require('phpagi.php');
$agi = new AGI();

$agi->exec('NoOp "' . '***Inicio***' . '"'); // debug begining

$calificacion=$argv[4]; // the argument passed from elastix

if ( calificacion <> '0') { // if something useful was pressed

$agi->exec('NoOp "' . 'Calific: '.$calificacion . '"'); // just for debug

// open database conection
$conexion=mysql_connect("localhost","username","password")
or die ("Error en Conexion");

mysql_select_db("encuestas")
or die ("Fallo en mysql_select_db");

// query for insert
$sql ="insert into encuestas (cid_llamante, int_atiende, calificacion) " ;
$sql.="values ( '$argv[2]', '$argv[1]', '$calificacion' )" ;

//$agi->exec('NoOp "' . $sql . '"');
// do the insert
mysql_query ($sql) or die(mysql_error());

mysql_close($conexion);
}

$agi->exec('NoOp "' . "*** FIN ***" . '"'); // en debug.

?>

If I call 555 the ivr answer and do the insert. My problem is that I want to call automatically after queue. Rally don´t now how.

Can someone tell me how?
 
Joined
Sep 8, 2009
Messages
1,128
Points
38
It would be a great tool within Elastix if there were a way (an add-on possibly) to setup through the GUI a IVR multiple choice input response method from a inbound/outbound caller.

I have need from time-to-time for IVR's that could be used for polling or other means. An IVR that could allow for choice like:

a) either a "yes" or "no"

b) Multiple choice - maybe choose one of three or four choices.


I'm sure there are those that are already doing it and maybe they could share or devvelop a wiki on it.

JMHO

amphibian
 
Joined
Jul 12, 2010
Messages
20
Points
0
I'm doing the same thing, but since i don't know how to write AGI, i created custom dialplan from extensions_custom.conf. Here is what I need(very simple) and have tested:
1. calls been transferred to survey, play intro-message,
2. play question 1, get digit 1-5, save as a variable A1;
3. repeat step 2 for question 2-5.
4. connect MYSQL, and insert timeinfo, extension that transferred the call, callernum, answer 1-5 into pre-defined table.
5. close connection and hangupcall.

I checked the mysql and saw the data were saved (i need to check the extension and callernum) if all 5 questions were answered. but problem is if the customer hangup during the survey process, there will be no data saved, that i actually want to save so i know that the reps did transfer to survey but the customer didn't finish it. How do i still save data even the customer hangup before survey ends? Do I need to modify the built in hangupcall Macro? I really expect that Elastix will have a survey module on the next version.

any input is great appreciated.
 
Joined
Feb 4, 2013
Messages
2
Points
0
I think you should connect and insert at the end of step 2 but record only the answer x. After that, close connection.

1. calls been transferred to survey, play intro-message,
2. play question 1, get digit 1-5, save as a variable A1;
3. connect MYSQL, and insert timeinfo, extension that transferred the call, callernum, answer 1 into pre-defined table.
4. close connection
5. repeat step 2 for question 2-5.
6. hangupcall.
 
Joined
Jul 12, 2010
Messages
20
Points
0
thank you leoivars,

that was a great idea. i'll give a try. maybe i should change the db structure, have 1 answer at a record, add another field as reference, or should i use update for step 2-5? i think both should work, i'll try them both. thanks for the tips.
 
Joined
Jul 12, 2010
Messages
20
Points
0
sure. mine is pretty simple:

[Survey]
exten => s,1,Answer
exten => s,n,Set(mDATETIME=${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
exten => s,n,MYSQL(Connect conid asterisk survey survey asterisk)
exten => s,n,GotoIf($["${conid}" = ""]?error,1)
exten => s,n,MYSQL(Query resultid ${conid} INSERT\ INTO\ Survey\ SET\ uid=${UNIQUEID}\,calldate=\'${mDATETIME}\'\,csexten=${BRIDGE
PEER:4:4}\,language=${Lang}\,callernum=${CALLERID(num)})
exten => s,n,MYSQL(Clear ${resultid})
exten => s,n,MYSQL(Disconnect ${conid})
exten => s,n,GotoIf($["${resultid}" = "-1"]?error,1)
; calls been transferred, insert db with ext, time, callernum etc.

exten => s,n,Set(TIMEOUT(response)=6)
exten => s,n,PlayBack(survey/p-${Lang})
; please intro message

exten => s,n,Set(questionum=1)
exten => s,n(nextques),Set(tryagain=0)
exten => s,n(try1),BackGround(survey/q-${Lang}-${questionum})
exten => s,n,WaitExten()
exten => _[1-5],1,Set(ansdigit=${EXTEN})
exten => _[1-5],n,Macro(sqlupdate,${ansdigit})
exten => _[1-5],n,Goto(loop,1)
exten => i,1,Set(tryagain=${MATH(${tryagain}+1,i)})
exten => i,n,GotoIf($[${tryagain} < 2]?s,try1)
exten => i,n,Goto(loop,1)
exten => t,1,Goto(i,1)
; play questions, get answers, update sql with Macro, timeout/invalid once repeat, twice to skip (answers default were 0)

exten => loop,1,Set(questionum=${MATH(${questionum}+1,i)})
exten => loop,n,GotoIf($[${questionum}=4]?finishsurvey,1)
exten => loop,n,Goto(s,nextques)
; repeat above

exten => finishsurvey,1,BackGround(survey/e-${Lang})
exten => finishsurvey,n,Hangup

exten => error,1,Noop(Connection error)
exten => error,n,Background(survey/network_difficulty)
exten => error,n,Hangup

[macro-sqlupdate]
exten => s,1,MYSQL(Connect conid asterisk survey survey asterisk)
exten => s,n,GotoIf($["${conid}" = ""]?error,1)
exten => s,n,MYSQL(Query resultid ${conid} UPDATE\ Survey\ SET\ answer${questionum}=${ARG1}\ WHERE\ uid=${UNIQUEID})
exten => s,n,MYSQL(Clear ${resultid})
exten => s,n,MYSQL(Disconnect ${conid})
exten => s,n,MacroExit
; Macro to update sql

remove the comment line leading with ";". hope this helps.
 
Joined
May 1, 2014
Messages
1
Points
0
Hi, I'm new to elastix and I was asked to do exactly the same. Any help? I just need to be able to transfer the person to some extension and have them answer 3 questions and receive the answers via email.

I see that @fredsi posted his dialplan the thing is that I'm not sure how it works when does it really starts? how do I transfer to the survey?
 

Members online

No members online now.

Latest posts

Forum statistics

Threads
30,987
Messages
131,100
Members
17,716
Latest member
Orbit114
Top