[SOLVED] Put functions in a database

Hello

I try to do a call redirection with asterisk database. I want to be able to either

  1. DIAL(…) or
  2. GOTO(…)

Dialing works if I do it like this:
Database:
/cf/60672058 : SIP/017xxxxxxxx76@patton

extensions.conf:
exten => _606.,n,Dial(${DB(cf/${EXTEN})}) ; ** SIP/ entfällt, da in Datenbank drin für Parallel-Call

What I would like to do is:
Database:
/cf/60672058 : Dial(SIP/017xxxxxxxx76@patton)
/cf/60672059 : goto(somewhere,2,1)

extensions.conf:
exten => _606.,n,(${DB(cf/${EXTEN})})

But I get the following errors when calling …58 or …59:

[Oct 23 04:05:30] WARNING[4571][C-00000009]: pbx.c:4621 pbx_extension_helper: No application ‘${DB(cf/${EXTEN})}’ for extension (from-patton, 60672058, 10)
== Spawn extension (from-patton, 60672058, 10) exited non-zero on ‘SIP/patton-0000000c’

Any ideas?

You shoud do it a bit different:

Database:
/cf/60672058 : Dial(SIP/017xxxxxxxx76@patton)
/cf/60672059 : goto(somewhere,2,1)

extensions.conf:

exten => _606.,n,TMP=${DB(cf/${EXTEN})}
exten => _606.,n,GotoIf($["${TMP:0:4}"="goto"]?gt:dl) 
exten => _606.,n(gt),goto ${TMP:5}
exten => _606.,n(dl),Dial(${TMP})

(The goto-Line needs to be checked,probably it’s necessary to deliver ${TMP} without the brackets and put them in extensions.conf instead.)

Use the Exec application. The help text for this covers exactly this case.

Thanks !

Exec() does the job !

Dialplan:
exten => _606.,n,Exec(${DB(cf/${EXTEN})})

Database:
/cf/60…91 : Goto(incoming-kd-menue,s,1)
/cf/60…92 : Dial(SIP/07…32@patton)