Olivier
2013-Apr-09 14:26 UTC
[asterisk-users] Feature request: What about a new DB_IFEXISTS function ?
Hello, What about having a new DB_IFEXISTS function in Asterisk ? It would accept two arguments : one being family/Key just as DB function, and the other being a default value which would be returned if family/key value does not exist. Thoughts ? Regards -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20130409/0fe4728c/attachment.htm>
Satish Barot
2013-Apr-10 07:12 UTC
[asterisk-users] Feature request: What about a new DB_IFEXISTS function ?
On Tue, Apr 9, 2013 at 7:56 PM, Olivier <oza_4h07 at yahoo.fr> wrote:> > Hello, > > What about having a new DB_IFEXISTS function in Asterisk ? > > It would accept two arguments : one being family/Key just as DB function, > and the other being a default value which would be returned if family/key > value does not exist. > > Thoughts ? > > Regards >You can achieve the same functionality using IF function. Something like, ... same => n,Set(foo=${IF($[ "${DB(family/key)}" ""]?defaultval:${DB(family/key)})}) --Satish Barot Ahmedabad, India. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20130410/467abbc5/attachment.htm>
Olivier
2013-Apr-10 09:05 UTC
[asterisk-users] Feature request: What about a new DB_IFEXISTS function ?
2013/4/10 Satish Barot <satish4asterisk at gmail.com>> > On Tue, Apr 9, 2013 at 7:56 PM, Olivier <oza_4h07 at yahoo.fr> wrote: > >> >> Hello, >> >> What about having a new DB_IFEXISTS function in Asterisk ? >> >> It would accept two arguments : one being family/Key just as DB function, >> and the other being a default value which would be returned if family/key >> value does not exist. >> >> Thoughts ? >> >> Regards >> > > You can achieve the same functionality using IF function. Something like, > ... > same => n,Set(foo=${IF($[ "${DB(family/key)}" > ""]?defaultval:${DB(family/key)})}) >Yes, of course, but having a dedicated function for frequent pattern is convenient.> > --Satish Barot > Ahmedabad, India. > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > New to Asterisk? Join us for a live introductory webinar every Thurs: > http://www.asterisk.org/hello > > 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/20130410/57cae796/attachment-0001.htm>