Created
December 19, 2018 03:46
-
-
Save ambiorixg12/dcfb4c0883e85b9ce1b2c7428f887c40 to your computer and use it in GitHub Desktop.
Simple Asterisk MYSQL INSERT SURVEY
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[survey1] | |
exten=>_991,1,Answer() | |
same=>n,Playback(/var/lib/asterisk/agi-bin/survey/welcomesurvey) | |
same=>n(q1),read(q1,/var/lib/asterisk/agi-bin/survey/pregunta1,1) | |
same => n,GotoIf($[${q1}>5]?q1) | |
same=>n(q2),read(q2,/var/lib/asterisk/agi-bin/survey/pregunta2,1) | |
same => n,GotoIf($[${q2}>5]?q2) | |
same=>n(q3),read(q3,/var/lib/asterisk/agi-bin/survey/pregunta3,1) | |
same => n,GotoIf($[${q3}>5]?q3) | |
same=>n,Playback(/var/lib/asterisk/agi-bin/survey/goodbyesurvey) | |
same=>n,system(mysql --user=root --password='1932' survey -e "INSERT INTO survey.results (q1,q2,q3,did) VALUES ('${q1}','${q2}','${q3}','${EXTEN}')") | |
database; | |
create database survey; | |
use survey; | |
CREATE TABLE IF NOT EXISTS `results` ( | |
`res_id` int(11) NOT NULL AUTO_INCREMENT, | |
`q1` varchar(1) DEFAULT NULL, | |
`q2` varchar(1) DEFAULT NULL, | |
`q3` varchar(1) DEFAULT NULL, | |
`did` varchar(20) DEFAULT NULL, | |
`res_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
PRIMARY KEY (`res_id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment