Hello,

On 7/18/13 12:14 AM, Rafael Carvallo wrote:
Hi everyone, currently i am running 2 Asterisk Servers that share the same dialplan and sip users, also they connect through DUNDi. Right now i need that the users on certain network register to one of the 2 servers and in case it fails, then kamailio should tell the phone to log in to the backup server. After the main server for that location is restored the phones should connect again to the main server.

something like this:

Location A                                                 Location B

network: 192.168.1.0/24                             network: 192.168.2.0/24
main asterisk server: 192.168.1.1               main asterisk server: 192.168.2.1
backup asterisk server: 192.168.2.1            backup asterisk server: 192.168.1.1


Unless there's a failover situation the phones on Location A (network: 192.168.1.0/24) should login to their main server, same with Location B , as soon the problem is fixed they should failback to their main server again, as i said both asterisk server share the same dialplan and sip-users.

I don't want to let kamailio handle the user registration, i just need it to tell the phones which asterisk server should they contact based on their IP and main/backup server status. I tried to do it using DNS-SRV instead of Kamalio, it worked, but the phones never failback, also, DNS-SRV doesn't tell what server should be used based on the network the request came from.

I've been trying to do this and really need help, any example would be appreciated, thanks in advance. Also i'd like to know if this is possible using H.323 protocol suit instead of SIP.
Kamailio is SIP only signaling server, no h323.

Now, regarding the registration, if you run Asterisk with the patch for Path support, you can forward registration from kamailio, after adding the Path header (see path module) to the appropriate asterisk.

To select the asterisk you can group your users with group module (or other modules such as mtree, htable or simply in database and use sql_query() to see which group an user belong to). Based on the group an user belongs to, you use dispatcher module with a specific setid. Say group 1 will use setid 1 and group 2 will use setid 2.

For each setid in dispatcher, you have to store the addresses of the two asterisk boxes, with highest priority to the asterisk that should be used first. dispatcher can do OPTIONS keepalives to detect when an asterisk is down and mark it as inactive until in comes back alive.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda