php - TwiML - Can I record an user AND gather keypad inputs in the same call? -


its pretty straight forward either record , transcribe user's call, or gather input user's keypad after prompting them recording. not clear me however, steps should take record users 'description' of problem (in case) , gather user input me route 'request' in same call, twiml can post data in 1 request.

has encountered scenario, , can point me in right direction if have? thanks.

i'm answering own question in case needs in future.

in particular scenario, needed prompt user press key in order route "request" being placed. needed request include description, hence need record users voice.

this not complicated sounded (i know now), need respond twiml action when gathering key presses, xml document handles voice recording. xml, in theory, use "digits" received twiml construct new action src in second xml (routing).

the first xml gather user input:

<?xml version="1.0" encoding="utf-8"?> <response>     <gather action="hxxp://example.com/pick_dish" timeout="10" finishonkey="*">         <say>please press 1 tacos, 2 pancakes, 3 pizza, etc.</say>     </gather> </response> 

then when receive $_request (php) @ hxxp://example.com/pick_dish, use digits parameter sent replace "dish_id" in our response xml so:

<?xml version="1.0" encoding="utf-8"?> <response>     <say>         please describe dish selected after beep.          press star key when finished.      </say>     <record         action="hxxp://example.com/save_dish/<dish_id>/description"         method="get"         maxlength="20"         transcribe="true"         finishonkey="*"         />     <say>i did not receive recording</say> 

the /description path save description dish_id provided.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -