> On April 2, 2014, 7:44 p.m., rmudgett wrote: > > /trunk/funcs/func_periodic_hook.c, lines 48-57 > > <https://reviewboard.asterisk.org/r/3362/diff/8/?file=56955#file56955line48> > > > > Document the (On write) hook_id. > > > > Is this the first function that has different parameters for read and > > write?
I don't know of another one off hand that has different args. > On April 2, 2014, 7:44 p.m., rmudgett wrote: > > /trunk/funcs/func_periodic_hook.c, lines 85-87 > > <https://reviewboard.asterisk.org/r/3362/diff/8/?file=56955#file56955line85> > > > > These should not be uppercase. That indicates they are macros. Hrm, I think of UPPERCASE() as a macro and UPPERCASE as a constant. That's why I did it this way. > On April 2, 2014, 7:44 p.m., rmudgett wrote: > > /trunk/funcs/func_periodic_hook.c, lines 301-302 > > <https://reviewboard.asterisk.org/r/3362/diff/8/?file=56955#file56955line301> > > > > You need to check if args.interval is NULL. Also the sscanf should be > > using "%30u" instead. Also passing a NULL string pointer to printf will > > crash on Solaris. > > > > Missing \n Ah, I thought args.interval would be guaranteed to at least be an empty string. That doesn't seem to be the case. > On April 2, 2014, 7:44 p.m., rmudgett wrote: > > /trunk/funcs/func_periodic_hook.c, lines 384-386 > > <https://reviewboard.asterisk.org/r/3362/diff/8/?file=56955#file56955line384> > > > > Maybe use ast_true() and ast_false() instead. Done - Russell ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviewboard.asterisk.org/r/3362/#review11476 ----------------------------------------------------------- On April 1, 2014, 4:43 p.m., Russell Bryant wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviewboard.asterisk.org/r/3362/ > ----------------------------------------------------------- > > (Updated April 1, 2014, 4:43 p.m.) > > > Review request for Asterisk Developers. > > > Repository: Asterisk > > > Description > ------- > > This commit introduces a new dialplan function, PERIODIC_HOOK(). > It allows you run to a dialplan hook on a channel periodically. The > original use case that inspired this was the ability to play a beep > periodically into a call being recorded. The implementation is much > more generic though and could be used for many other things. > > The implementation makes heavy use of existing Asterisk components. > It uses a combination of Local channels and ChanSpy() to run some > custom dialplan and inject any audio it generates into an active call. > > The other important bit of the implementation is how it figures out > when to trigger the beep playback. This implementation uses the > audiohook API, even though it's not actually touching the audio in any > way. It's a convenient way to get a callback and check if it's time > to kick off another beep. It would be nice if this was timer event > based instead of polling based, but unfortunately I don't see a way to > do it that won't interfere with other things. > > > Diffs > ----- > > /trunk/funcs/func_periodic_hook.c PRE-CREATION > /trunk/CHANGES 411583 > > Diff: https://reviewboard.asterisk.org/r/3362/diff/ > > > Testing > ------- > > Called the following extension (100@test), both letting it run all the way > through, as well as hanging up at various points in the middle. > > [hooks] > > exten => beep,1,Answer() > same => n,Verbose(1,Channel name: ${HOOK_CHANNEL}) > same => n,Verbose(1,Hook ID: ${HOOK_ID}) > same => n,Playback(beep) > > [test] > > exten => 100,1,Answer() > same => n,Set(BEEP_ID=${PERIODIC_HOOK(hooks,beep,5)}) > same => n,Wait(20) > same => n,Set(PERIODIC_HOOK(${BEEP_ID})=off) > same => n,Wait(20) > same => n,Set(PERIODIC_HOOK(${BEEP_ID})=on) > same => n,Wait(20) > same => n,Hangup() > > > Thanks, > > Russell Bryant > >
-- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev
