[asterisk-users] Re: Input on Dundi

JR Richardson jmr.richardson at gmail.com
Tue Dec 12 18:37:28 MST 2006


> 1.)  When a registration server fails there doesn't seem to be an easy
> way to have clients automatically register to a new server. (our
> clients are mostly other asterisk boxes.) To solve this we are
> considering using DNS failover.

When registering with an Asterisk server to an Asterisk cluster of
servers, for the purpose of traversing a NAT or something else (to
solve a problem where direct contact cannot be performed), I would
suggest doing multiple registration to two registration servers, using
different names.

Like
registration [name1] to registration server 1
registration [name2] to registration server 2

in the outgoing dilaplan

exten => _NXXNXXXXXX,1,Dial(IAX2/server1......|j)
exten => _NXXNXXXXXX,102,Dial(IAX2/server2......

so if server one is not there the call will jump to the next server

or

exten => _NXXNXXXXXX,1,Dial(IAX2/server1&IAX2/server2.............

first server to answer will get the call.

you can do something similar calling from the cluster to the end Asterisk server
dundi lookup for [name1] if not available lookup [name2]

>
> 2.)  If you plan to do any direct routing using the fullcontact
> address like what is shown in JR's whitepaper, you may find that
> fullcontact sometimes contains private network addresses. This makes
> it impossible to route inbound calls directly to the client.
>
I recently started pulling the ipaddress and port from the database
instead of using the fullcontact field.  Aaron Daniels helped me to
get the realtime query working instead of using the mysql connect
statements.

[lookupmysql]
include => invalid

exten => _X.,1,RealTime(sippeers|name|${EXTEN}|DN_)
exten => _X.,2,GotoIf($["${DN_ipaddr}" = ""]?${EXTEN},105:${EXTEN},3)
exten => _X.,3,Set(directdial=${EXTEN}@${DN_ipaddr}:${DN_port})
exten => _X.,4,Dial(SIP/${directdial},15,rj)
exten => _X.,5,Macro(sendtovm,${EXTEN})
exten => _X.,6,Hangup

exten => _X.,105,Macro(sendtovm,${EXTEN})
exten => _X.,106,Hangup

The RealTime command pulls all the entire record from the database and
prepends all the fields with the last argument (here is have DN_)  so
when the record is pulled, all the records info is available as a
variable like DN_port and DN_ipaddr.

This is a really cool command.  Hope this helps.
-- 
JR Richardson
Engineering for the Masses


More information about the asterisk-users mailing list