I have pieced to gether a simple plan to retrieve data from a DB and route the caller by using that info. Admittedly I copied this from a source online. I have manipulated it to my abilities. The caller should be transferred to an IVR depending on the result of the query. So far I can get to the Hangup and or the Try again later, so I know my Query is working. So I need to send the caller to an IVR depending on the result. Thanks
exten => 9001,1,Answer()
same => n,Playback(custom/dealerid)
same => n,Read(pinnumber,beep,4,,1,10)
same => n,MYSQL(Connect connid localhost ivruser password dealers)
same => n,MYSQL(Query resultid ${connid} SELECT level from info where dealerid=${pinnumber})
same => n,MYSQL(Fetch fetchid ${resultid} level)
same => n,MYSQL(Disconnect ${connid})
same => n,NoOp(&& the value found is ${level} )
same => n,ExecIf($["${level}"="authorised"]?playback(hangup-try-again))
same => n,ExecIf($["${level}"="authorised"]?HANGUP())
same => n,PlayBack(auth-thankyou)
same => n,Hangup()
Thanks david551 I got it to work. Another question comes to mind.
I am using Playback and Read to get a 4 digit number from the caller for the query. The caller needs to wait until the playback file is done before entering their digits. I know there is the Background command to allow the caller to dial over the message. But just substituting Background for Playback the dialplan breaks. Is there a way to use Background in this instance?
Thanks
[example]
exten = s,1, verbose(1,[${EXTEN}@${CONTEXT}])
same = n, background(demo-congrats)
same = n, goto(1)
exten = i,1, verbose(1,[${EXTEN}@${CONTEXT}])
same = n, goto(s,1)
exten = _xxxx#,1, verbose(1,[${EXTEN}@${CONTEXT}])
same = n, set(ENTRY=${EXTEN})
same = n, verbose(1,[${EXTEN}@${CONTEXT}!${ENTRY}])
same = n, hangup()