[asterisk-dev] [Code Review]: Add FEATURE() and FEATUREMAP() functions.

Russell Bryant reviewboard at asterisk.org
Tue Apr 24 18:56:23 CDT 2012



> On April 24, 2012, 3:48 p.m., Mark Michelson wrote:
> > /trunk/main/features.c, lines 440-446
> > <https://reviewboard.asterisk.org/r/1871/diff/2/?file=27442#file27442line440>
> >
> >     Update the documentation to reflect that other items than atxfer and blindxfer can be set. Other items to add: automon, disconnect, parkcall, and automixmon.

Good catch.  done


> On April 24, 2012, 3:48 p.m., Mark Michelson wrote:
> > /trunk/main/features.c, line 452
> > <https://reviewboard.asterisk.org/r/1871/diff/2/?file=27442#file27442line452>
> >
> >     s/ot/to/

done


> On April 24, 2012, 3:48 p.m., Mark Michelson wrote:
> > /trunk/main/features.c, line 8521
> > <https://reviewboard.asterisk.org/r/1871/diff/2/?file=27442#file27442line8521>
> >
> >     We always use width limiters on sscanf calls (usually something safe like 30) due to some vulnerability that I don't remember the details of. http://seclists.org/fulldisclosure/2009/Aug/155 has more details.

done


> On April 24, 2012, 3:48 p.m., Mark Michelson wrote:
> > /trunk/main/features.c, line 8533
> > <https://reviewboard.asterisk.org/r/1871/diff/2/?file=27442#file27442line8533>
> >
> >     I once again recommend changing the label name since this section is reached for both error and non-error situations.

Oops, I thought I removed that ... fixed for real this time


> On April 24, 2012, 3:48 p.m., Mark Michelson wrote:
> > /trunk/main/features.c, line 8548
> > <https://reviewboard.asterisk.org/r/1871/diff/2/?file=27442#file27442line8548>
> >
> >     Setting res to -1 here is redundant.

done


- Russell


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1871/#review6050
-----------------------------------------------------------


On April 21, 2012, 2:41 a.m., Russell Bryant wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1871/
> -----------------------------------------------------------
> 
> (Updated April 21, 2012, 2:41 a.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> This patch adds two new dialplan functions: FEATURE() and FEATUREMAP().
> FEATURE() is indended to be used to allow customizing general feature
> settings on a per-channel basis.  It currently allows you to set a
> custom parkingtime for a channel.
> 
> FEATUREMAP() is similar, but allows customizing the built-in feature
> mappings on a per-channel basis.  Currently you can customize the digit
> string for activating blind or attended transfers.
> 
> More options and feature mappings could be added to this over time as
> desired.
> 
> 
> Diffs
> -----
> 
>   /trunk/main/features.c 363044 
> 
> Diff: https://reviewboard.asterisk.org/r/1871/diff
> 
> 
> Testing
> -------
> 
> Using the following dialplan:
> 
> 1) Dial 101, make sure normal transfers work (I tested transferring to 100).
> 2) Dial 102, make sure transfers using channel specific feature mappings work.
> 3) Dial 101, transfer to parking and observe normal parkingtime.
> 4) Dial 103, transfer to parking and verify that the custom parkingtime is used.
> 
> 
> [featuretest]
> 
> include => parkedcalls
> 
> ; Dummy extension for a Local channel.  We'll call this and transfer it.
> exten => foo,1,Answer()
>     same => n(wait),Wait(300)
>     same => n,Goto(wait)
> 
> ; Transfer target.
> exten => 100,1,Answer()
>     same => n(wait),Wait(300)
>     same => n,Goto(wait)
> 
> ; Call this and make sure blindxfer and atxfer still work using default mappings.
> exten => 101,1,Answer()
>     same => n,Verbose(0,Regular transfer test.)
>     same => n,Verbose(0,Blind Transfer: ${FEATUREMAP(blindxfer)})
>     same => n,Verbose(0,Attended Transfer: ${FEATUREMAP(atxfer)})
>     same => n,Dial(Local/foo at featuretest,,tT)
> 
> ; Call this and make sure blindxfer and atxfer work with custom mappings.
> exten => 102,1,Answer()
>     same => n,Verbose(0,Custom transfer test.)
>     same => n,Verbose(0,Setting blindxfer to '77' and atxfer to '88')
>     same => n,Set(FEATUREMAP(blindxfer)=77)
>     same => n,Set(FEATUREMAP(atxfer)=88)
>     same => n,Verbose(0,Blind Transfer: ${FEATUREMAP(blindxfer)})
>     same => n,Verbose(0,Attended Transfer: ${FEATUREMAP(atxfer)})
>     same => n,Dial(Local/foo at featuretest,,tT)
> 
> ; Test setting a parkingtime.  Start with calling '101' and then parking.
> ; Then, call this and verify that the new parkingtime is used.
> exten => 103,1,Answer()
>     same => n,Verbose(0,Test custom parkingtime.)
>     same => n,Verbose(0,Blind Transfer: ${FEATUREMAP(blindxfer)})
>     same => n,Dial(Local/foo at featuretest,,tTU(setparkingtime^3))
> 
> 
> ; GoSub routine for setting parkingtime on a dialed channel.
> [setparkingtime]
> 
> exten => s,1,Verbose(0,Setting custom parkingtime to '${ARG1}')
>     same => n,Verbose(0,Old value: ${FEATURE(parkingtime)})
>     same => n,Set(FEATURE(parkingtime)=${ARG1})
>     same => n,Verbose(0,New value: ${FEATURE(parkingtime)})
>     same => n,Return()
> 
> 
> Thanks,
> 
> Russell
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120424/8c732d69/attachment.htm>


More information about the asterisk-dev mailing list