Tim S
2018-Jan-20 17:03 UTC
[asterisk-users] Can anyone help with a quick app_record.c module improvement and can explain over-riding modules?
Just a quick and dirty thought, try the MONITOR application. Pseudo-code: Anchor-point PLAYBACK ("press or say") MONITOR (use the split audio files mode, not the mixed - this way you can roughly separate which side did the "talking") READ (audio file "1 to 5", try to grab one digit) STOPMONITOR IF (READ variable timed-out, send the incoming half of the monitor file to Google Speech) Playback (some sound effect to indicate "thinking" on the Asterisk side - user feedback is good) Check Google Speech result against a white-list IF filtered result was not a valid option PLAYBACK "I didn't understand that" GOTO to Anchor-point ELSE Goto next step using valid decoded speech data ELSE Check DTMF result against a white-list IF filtered DTMFresult was not a valid option PLAYBACK "I didn't understand that" GOTO to Anchor-point ELSE Goto next step using valid decoded DTMF data Catch-all, should never get here. /Pseudo-code Don't forget to filter your user sourced data against your white-list, always assume users are hostile, this is part of the total picture of defence-in-depth. -Tim On Sat, Jan 20, 2018 at 12:42 AM, Jonathan H <lardconcepts at gmail.com> wrote:> Hello, > > I want to start recording with a prompt of "press or say 1 to 5". If > no DMTF is pressed, I want to send the recording to Google Speech to > get the number back (got that part working already). > > If any dtmf key is pressed while Application_Record is running with > option y, then the recording terminates and sends > RECORD_STATUS of "DTMF" (A terminating DTMF was received). > > But I need to know **what** number that DTMF was, and I can't see a > way of grabbing it after the fact. > > I can see in the code where the right variables are.. > > https://github.com/asterisk/asterisk/blob/master/apps/app_record.c#L140 > dtmf_response > > https://github.com/asterisk/asterisk/blob/master/apps/app_record.c#L166 > * \param dtmf_integer the integer value of the DTMF key received > > So,3 questions I guess: > > 1: Am I going about this the right way? (unimrcp is not an option here) > 2: Can someone explain in layman's terms how a simpleton like me could > copy, hack about with and make a new module, like, for example, > app_record_alt.c, that would stick around each time I updated Asterisk > from source? > 3: Or, is anyone willing to make the simple code change to the file to > improve it to send back the DTMF to the dialplan? For free to improve > core code? If not, and I posted on the commercial list, how much would > I be looking at to modify about 6 lines of code and return an extra > variable? > > So, ultimately, I'm hoping for something like: > > Currently: > option "y" returns a RECORD_STATUS of "DTMF" if a key was press > > Hopefully: > option "z" returns a RECORD_STATUS of <dtmf-value> showing which key > was pressed. > Or possibly even DTMF_VALUE (if an app can return two variables to the > dialplan?) > > I'm sure this would benefit a lot of people. > > I posted this a few days ago in the forum at > https://community.asterisk.org/t/can-anyone-help-with-a- > quick-app-record-c-module-improvement-and-can-explain- > over-riding-modules/73221 > but no-one bit, so, I'm hoping this list can help. > > Many thanks! > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > Check out the new Asterisk community forum at: https://community.asterisk. > org/ > > New to Asterisk? Start here: > https://wiki.asterisk.org/wiki/display/AST/Getting+Started > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20180120/90b8e014/attachment.html>
Jonathan H
2018-Jan-20 17:45 UTC
[asterisk-users] Can anyone help with a quick app_record.c module improvement and can explain over-riding modules?
Oh, what a good idea! That's exactly the kind of lateral thinking I was hoping someone would come up with. I thought it was called MixMonitor, and tried to wrap my head around it but couldn't. I'll give this a go tomorrow and let you know what I come up with! Many thanks, Jonathan T On 20 January 2018 at 17:03, Tim S <tim.strommen at gmail.com> wrote:> Just a quick and dirty thought, try the MONITOR application. > > > Pseudo-code: > > Anchor-point > PLAYBACK ("press or say") > MONITOR (use the split audio files mode, not the mixed - this way you can > roughly separate which side did the "talking") > READ (audio file "1 to 5", try to grab one digit) > STOPMONITOR > IF (READ variable timed-out, send the incoming half of the monitor file to > Google Speech) > Playback (some sound effect to indicate "thinking" on the Asterisk side > - user feedback is good) > Check Google Speech result against a white-list > IF filtered result was not a valid option > PLAYBACK "I didn't understand that" > GOTO to Anchor-point > ELSE > Goto next step using valid decoded speech data > ELSE > Check DTMF result against a white-list > IF filtered DTMFresult was not a valid option > PLAYBACK "I didn't understand that" > GOTO to Anchor-point > ELSE > Goto next step using valid decoded DTMF data > Catch-all, should never get here. > > /Pseudo-code > > > Don't forget to filter your user sourced data against your white-list, > always assume users are hostile, this is part of the total picture of > defence-in-depth. > > -Tim > > > On Sat, Jan 20, 2018 at 12:42 AM, Jonathan H <lardconcepts at gmail.com> wrote: >> >> Hello, >> >> I want to start recording with a prompt of "press or say 1 to 5". If >> no DMTF is pressed, I want to send the recording to Google Speech to >> get the number back (got that part working already). >> >> If any dtmf key is pressed while Application_Record is running with >> option y, then the recording terminates and sends >> RECORD_STATUS of "DTMF" (A terminating DTMF was received). >> >> But I need to know **what** number that DTMF was, and I can't see a >> way of grabbing it after the fact. >> >> I can see in the code where the right variables are.. >> >> https://github.com/asterisk/asterisk/blob/master/apps/app_record.c#L140 >> dtmf_response >> >> https://github.com/asterisk/asterisk/blob/master/apps/app_record.c#L166 >> * \param dtmf_integer the integer value of the DTMF key received >> >> So,3 questions I guess: >> >> 1: Am I going about this the right way? (unimrcp is not an option here) >> 2: Can someone explain in layman's terms how a simpleton like me could >> copy, hack about with and make a new module, like, for example, >> app_record_alt.c, that would stick around each time I updated Asterisk >> from source? >> 3: Or, is anyone willing to make the simple code change to the file to >> improve it to send back the DTMF to the dialplan? For free to improve >> core code? If not, and I posted on the commercial list, how much would >> I be looking at to modify about 6 lines of code and return an extra >> variable? >> >> So, ultimately, I'm hoping for something like: >> >> Currently: >> option "y" returns a RECORD_STATUS of "DTMF" if a key was press >> >> Hopefully: >> option "z" returns a RECORD_STATUS of <dtmf-value> showing which key >> was pressed. >> Or possibly even DTMF_VALUE (if an app can return two variables to the >> dialplan?) >> >> I'm sure this would benefit a lot of people. >> >> I posted this a few days ago in the forum at >> >> https://community.asterisk.org/t/can-anyone-help-with-a-quick-app-record-c-module-improvement-and-can-explain-over-riding-modules/73221 >> but no-one bit, so, I'm hoping this list can help. >> >> Many thanks! >> >> -- >> _____________________________________________________________________ >> -- Bandwidth and Colocation Provided by http://www.api-digital.com -- >> >> Check out the new Asterisk community forum at: >> https://community.asterisk.org/ >> >> New to Asterisk? Start here: >> https://wiki.asterisk.org/wiki/display/AST/Getting+Started >> >> asterisk-users mailing list >> To UNSUBSCRIBE or update options visit: >> http://lists.digium.com/mailman/listinfo/asterisk-users > > > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > Check out the new Asterisk community forum at: > https://community.asterisk.org/ > > New to Asterisk? Start here: > https://wiki.asterisk.org/wiki/display/AST/Getting+Started > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users
Antony Stone
2018-Jan-20 17:53 UTC
[asterisk-users] Can anyone help with a quick app_record.c module improvement and can explain over-riding modules?
On Saturday 20 January 2018 at 18:45:49, Jonathan H wrote:> Oh, what a good idea! That's exactly the kind of lateral thinking I > was hoping someone would come up with. > > I thought it was called MixMonitor, and tried to wrap my head around > it but couldn't.MixMonitor is related, but different (and as the name suggests, automatically mixes the two channels, so I think Tim's suggestion to use Monitor is much better. Note that you may well need to use the 'b' option with Monitor, to make sure you can record when there's no bridge between two channels.> I'll give this a go tomorrow and let you know what I come up with!Please do report back - this is a useful feature. Antony.> On 20 January 2018 at 17:03, Tim S wrote: > > Just a quick and dirty thought, try the MONITOR application. > > > > > > Pseudo-code: > > > > Anchor-point > > PLAYBACK ("press or say") > > MONITOR (use the split audio files mode, not the mixed - this way you can > > roughly separate which side did the "talking") > > READ (audio file "1 to 5", try to grab one digit) > > STOPMONITOR > > IF (READ variable timed-out, send the incoming half of the monitor file > > to Google Speech) > > > > Playback (some sound effect to indicate "thinking" on the Asterisk > > side > > > > - user feedback is good) > > > > Check Google Speech result against a white-list > > IF filtered result was not a valid option > > > > PLAYBACK "I didn't understand that" > > GOTO to Anchor-point > > > > ELSE > > > > Goto next step using valid decoded speech data > > > > ELSE > > > > Check DTMF result against a white-list > > IF filtered DTMFresult was not a valid option > > > > PLAYBACK "I didn't understand that" > > GOTO to Anchor-point > > > > ELSE > > > > Goto next step using valid decoded DTMF data > > > > Catch-all, should never get here. > > > > /Pseudo-code > > > > > > Don't forget to filter your user sourced data against your white-list, > > always assume users are hostile, this is part of the total picture of > > defence-in-depth. > > > > -Tim > > > > On Sat, Jan 20, 2018 at 12:42 AM, Jonathan H wrote: > >> Hello, > >> > >> I want to start recording with a prompt of "press or say 1 to 5". If > >> no DMTF is pressed, I want to send the recording to Google Speech to > >> get the number back (got that part working already). > >> > >> If any dtmf key is pressed while Application_Record is running with > >> option y, then the recording terminates and sends > >> RECORD_STATUS of "DTMF" (A terminating DTMF was received). > >> > >> But I need to know **what** number that DTMF was, and I can't see a > >> way of grabbing it after the fact. > >> > >> I can see in the code where the right variables are.. > >> > >> https://github.com/asterisk/asterisk/blob/master/apps/app_record.c#L140 > >> dtmf_response > >> > >> https://github.com/asterisk/asterisk/blob/master/apps/app_record.c#L166 > >> * \param dtmf_integer the integer value of the DTMF key received > >> > >> So,3 questions I guess: > >> > >> 1: Am I going about this the right way? (unimrcp is not an option here) > >> 2: Can someone explain in layman's terms how a simpleton like me could > >> copy, hack about with and make a new module, like, for example, > >> app_record_alt.c, that would stick around each time I updated Asterisk > >> from source? > >> 3: Or, is anyone willing to make the simple code change to the file to > >> improve it to send back the DTMF to the dialplan? For free to improve > >> core code? If not, and I posted on the commercial list, how much would > >> I be looking at to modify about 6 lines of code and return an extra > >> variable? > >> > >> So, ultimately, I'm hoping for something like: > >> > >> Currently: > >> option "y" returns a RECORD_STATUS of "DTMF" if a key was press > >> > >> Hopefully: > >> option "z" returns a RECORD_STATUS of <dtmf-value> showing which key > >> was pressed. > >> Or possibly even DTMF_VALUE (if an app can return two variables to the > >> dialplan?) > >> > >> I'm sure this would benefit a lot of people. > >> > >> I posted this a few days ago in the forum at > >> > >> https://community.asterisk.org/t/can-anyone-help-with-a-quick-app-record > >> -c-module-improvement-and-can-explain-over-riding-modules/73221 but > >> no-one bit, so, I'm hoping this list can help. > >> > >> Many thanks!-- Schr?dinger's rule of data integrity: the condition of any backup is unknown until a restore is attempted. Please reply to the list; please *don't* CC me.
Reasonably Related Threads
- Can anyone help with a quick app_record.c module improvement and can explain over-riding modules?
- Simple speech recognition for driving IVR - "press or say one".
- Simple speech recognition for driving IVR - "press or say one".
- Can anyone help with a quick app_record.c module improvement and can explain over-riding modules?
- Simple speech recognition for driving IVR - "press or say one".