Jeremiah Millay wrote:
Does anyone know what application I should place this function in? For example with the DB function I currently do something like this to add an entry to the asterisk database:

exten => s,n,Set(DB(AGENT/${MACRO_EXTEN:1})=${CALLERID(num)})

To delete the entries I do something like this:

exten => s,n,DBDel(AGENT/${MACRO_EXTEN:1})

DBDel is marked as deprecated in favor of the DB_DELETE function but it returns a warning when using it with a dialplan application like Set:

exten => s,n,Set(DB_DELETE(AGENT/${MACRO_EXTEN:1}))

Will return:
-- Executing [EMAIL PROTECTED]:202] Set("SIP/2146-b6f09f30", "DB_DELETE(AGENT/2109)") in new stack [Jan 23 16:51:24] WARNING[4010]: pbx.c:5827 pbx_builtin_setvar: Ignoring entry 'DB_DELETE(AGENT/2109)' with no = (and not last 'options' entry)

and it doesn't delete the database entry.

Would DB_DELETE work in an application like NoOp? Just wondering if anyone has any experience using this new function in 1.4.0.
Thanks,
Jeremiah

Online (CLI) reference:
*CLI> core show function DB_DELETE

  -= Info about function 'DB_DELETE' =-

[Syntax]
DB_DELETE(<family>/<key>)

[Synopsis]
Return a value from the database and delete it

[Description]
This function will retrieve a value from the Asterisk database
 and then remove that key from the database.  DB_RESULT
will be set to the key's value if it exists.


So here's what you do to delete a database entry in 1.4.0:
exten => s,n,Set(oldval=${DB_DELETE(AGENT/${MACRO_EXTEN:1})})

; saves the old value of that key (in your case the callerid)
; into ${oldval} and deletes it from the DB.  You can look at
; the value for the key you just deleted.
exten => s,n,NoOp(oldval : ${oldval})

Have fun!
Alvin
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to