[Asterisk-Users] indexing tables for dialing

Luki lugosoft at gmail.com
Wed Jun 22 23:41:53 MST 2005


Ypek,

> I would like to know how can I manage to implement a table which translates
> an extension number into a phone number. Let see an example:

There are many ways of doing this. You could map the extensions to
phones in extensions.conf, via the internal database or via an
external database, or via an AGI script.

Example:
1) Make database entries:
AGENTS/3201 = 4155551212,4251113131
AGENTS/3202 = 4251110011,8881114545,7871114545

2) Define dial plan entry:
exten => _XXXX,1,Macro(dialagent,${EXTEN})

[macro-dialagent]
exten => s,1,Set(DEST=${DB(AGENTS/${ARG1})})
exten => s,n,Set(N=1)
exten => s,n(loop),Cut(D=DEST,\,,${N})
exten => s,n,GotoIf($["${DEST}" : ""]?done)
exten => s,n,Dial(SIP/${D}@outgoingtrunk,15)
exten => s,n,GotoIf($["${DIALSTATUS}" = "ANSWER"]?done)
exten => s,n,Set(N=$[${N} + 1])
exten => s,n,Goto(loop)
exten => s,n(done),NoOp(Dial Agent ${ARG1} at ${DEST} done)

This is somewhat paraphrased from my config, but I didn't test this
particular example. You certainly need to adapt it to your setup (like
define how to handle outgoing calls, etc.). This should get your
started. I believe CVS-HEAD is required for this, though.

--Luki



More information about the asterisk-users mailing list