[asterisk-users] Can anyone help with a quick app_record.c module improvement and can explain over-riding modules?

Tim S tim.strommen at gmail.com
Sat Jan 20 11:03:19 CST 2018


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>


More information about the asterisk-users mailing list