[asterisk-dev] Numbered placeholders in dialplan's SPRINTF function

Matthew Jordan mjordan at digium.com
Tue Nov 4 12:13:13 CST 2014


On Tue, Nov 4, 2014 at 5:45 AM, Olivier <oza.4h07 at gmail.com> wrote:
> Hello,
>
> If I'm not mistaken, numbered placeholders are not supported by
> dialplan's SPRINTF function.
> Though this is strictly not blocking, having them would allow concise
> expressions such as:
>
> Dial(${SPRINTF(${PJSIPFORMAT},mytrunk,123456789)})
>
> with :
>
> Set(PJSIPFORMAT="PJSIP/%2$s@%1$s")
> Set(SIPFORMAT="SIP/%2$s@%1$s")
> or
> Set(DAHDIFORMAT="DAHDI/%1$s/%2$s")
>
> What do you think of this ?
>

Well, that's definitely more of a PHP approach to things, and I think
the original implementation was focussed much more on a traditional
mechanism for formatting arguments.

I don't think there's anything wrong necessarily with that approach
per se. I would recommend writing some tests for the function if you
decide to write a patch for that feature.

-- 
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org



More information about the asterisk-dev mailing list