[asterisk-users] can ENUMLOOKUP query multiple DNS servers without having to replicate the same code for each server?

Remco Post remco at pipsworld.nl
Sat Jun 16 15:33:18 CDT 2007


rjcarvalho at reit.up.pt wrote:
> Hi all,
> 
> Does ENUMLOOKUP can query multiple DNS servers without having to
> replicate the same code in which the only thing replaced is the server?
> 

the enumlookup dialplan function (as opposed to the application) never
cares about your enum.conf file. The trick is to use separate enum
domains, and test them all in your dialplan using

${ENUMLOOKUP(+${ARG1:2:},sip,c,yourdomain.local) or something in a loop.

> If I use ENUMLOOKUP(${exten}), Asterisk will parse enum.conf file to
> find the list of DNS servers in order of preference to be queried, but,
> I pretend to use something like this: ${ENUMLOOKUP(+${ARG1:2:},sip,c)
> which does not seam to care about the existence of enum.conf file! May I
> force Asterisk to care about the servers I wrote in enum.conf?
> 
> To let you understand better, I wish to use just a block of code that is
> able to query multiple DNS servers, instead of repeating like in the
> following example the same code for each DNS server I wish to lookup for:
> 
> ; Start first with e164.arpa zone:
> exten => _X.,1,Set(sipcount=${ENUMLOOKUP(+${EXTEN},sip,c)}|counter=0)
> exten => _X.,2,GotoIf($["${counter}"<"${sipcount}"]?3:6)
> exten => _X.,3,Set(counter=$[${counter}+1])
> exten => _X.,4,Dial(SIP/${ENUMLOOKUP(+${EXTEN},sip,${counter})})
> exten => _X.,5,GotoIf($["${counter}"<"${sipcount}"]?3:6)
> ; ...then also try e164.org:
> exten => _X.,6,Set(sipcount=${ENUMLOOKUP(+${EXTEN},sip,c)}|counter=0)
> exten => _X.,7,GotoIf($["${counter}"<"${sipcount}"]?8:11)
> exten => _X.,8,Set(counter=$[${counter}+1])
> exten => _X.,9,Dial(SIP/${ENUMLOOKUP(+${EXTEN},sip,${counter})})
> exten => _X.,10,GotoIf($["${counter}"<"${sipcount}"]?8:11)
> ; ...in case of no route by IP, then send out PRI:
> exten => _X.,11,Dial(Zap/g1/${EXTEN})
> 
> 
> 
> Regards,
> Ricardo.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> --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


-- 

Remco Post

"I didn't write all this code, and I can't even pretend that all of it
makes sense." -- Glen Hattrup



More information about the asterisk-users mailing list