Hello,
I’m trying to build IVR. So, when user call first I’m setting the PIN code from DB and asking it to input it. After user input the code I’ve checked it against the PIN code in the database and if it is correct to proceed whit checking if there are any messages for the user. If there are messages I’m trying to SET them and play them.
The problem is that instead of messages it is set the PIN code.
Bellow, I’ll share this part from the dialplan and the output in order to understand me better.
voice_en=>{
NoOp();
Set(PIN=${ODBC_PINCHECK(${CALLERID(num)})});
Set(CHANNEL(language)=en);
Playback(103);
Read(DIGIT,,4);
if("${DIGIT}" == "${PIN}") {
WaitExten(1);
if($["${ODBC_NEWMESSAGES}" != "0"]) {
Set(MESSAGES=${ODBC_GETMESSAGES(${CALLERID(num)})});
Playback(${MESSAGES});
}
else {
Playback(1475);
}
}
else {
jump voice_en;
}
Here is what is happening
-- Executing [119@internal:9] Goto("SIP/5634-00000139", "voice_en,1") in new stack
-- Goto (internal,voice_en,1)
-- Executing [voice_en@internal:1] NoOp("SIP/5634-00000139", "") in new stack
-- Executing [voice_en@internal:2] Set("SIP/5634-00000139", "PIN=1234") in new stack
-- Executing [voice_en@internal:3] Set("SIP/5634-00000139", "CHANNEL(language)=en") in new stack
-- Executing [voice_en@internal:4] Playback("SIP/5634-00000139", "103") in new stack
> 0x7f7abc01fbc0 -- Probation passed - setting RTP source address to aaa.bbb.ccc.ddd:17652
-- <SIP/5634-00000139> Playing '103.slin' (language 'en')
-- Executing [voice_en@internal:5] Read("SIP/5634-00000139", "DIGIT,,4") in new stack
-- Accepting a maximum of 4 digits.
-- User entered '1234'
-- Executing [voice_en@internal:6] GotoIf("SIP/5634-00000139", "1?7:16") in new stack
-- Goto (internal,voice_en,7)
-- Executing [voice_en@internal:7] WaitExten("SIP/5634-00000139", "1") in new stack
-- Timeout on SIP/5634-00000139, continuing...
-- Executing [voice_en@internal:8] GotoIf("SIP/5634-00000139", "1?9:13") in new stack
-- Goto (internal,voice_en,9)
-- Executing [voice_en@internal:9] Set("SIP/5634-00000139", "MESSAGES=1234") in new stack
-- Executing [voice_en@internal:10] Playback("SIP/5634-00000139", "1234") in new stack
This line is wrong:
-- Executing [voice_en@internal:9] Set("SIP/5634-00000139", "MESSAGES=1234") in new stack
1234 is the PIN code, not the amount of the messages from the database.
Please suggest me what is wrong here. Do I need to clear the PIN code somehow from SET() before trying to set new values?