[*] Macro to remap extensions from db
Sean A. Walberg
sean at ertw.com
Wed Sep 7 08:46:44 CDT 2005
After reading Bill's message about setting up an ITAD, I thought I'd just
try to get it working through FWD. Looking at my diaplan, I had a simple
macro that remaps a given extension into another one in the default
context, ie sean at inbound-sip => 2001 at default.
Abou to start doing that for fwd, I figured I could use the db to do this
dynamically.
Then I thought "if having one db for this is good, having multiple dbs for
it would be better". This lead me to:
[macro-remap];
; Remaps a name from a database into an extension at context and jumps to it
; ${ARG2} - Database name
; ${ARG1} - Extension
; Example:
; database put sipextensions sean 2001 at default
exten => s,1,Cut(ext=DB(${ARG2}/${ARG1}),'@',1)
exten => s,2,Cut(con=DB(${ARG2}/${ARG1}),'@',2)
exten => s,3,GotoIf($["xxx${ext}" = "xxx"]?101)
exten => s,4,Goto(${con},${ext},1)
exten => s,101,Playback(pbx-invalid) ; Extension doesn't exist
exten => s,102,Hangup
Then, in your inbound context, put:
[inbound-fwd]
exten => _X.,1,Macro(remap,${EXTEN},fwdextensions)
This will look up any incoming extensions in the fwdextensions db and send
the call there:
sergeant*CLI> database put fwdextensions 269423 2001 at default
Anything coming in now from fwd, such as 269423 at fwd.pulver.com or
269423 at 262 gets looked up in the fwdextensions db and sent there.
Sean
--
Sean A. Walberg <sean at ertw.com> http://www.ertw.com
More information about the Asterisk
mailing list