<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hello,<br>
    <br>
    <div class="moz-cite-prefix">On 7/18/13 12:14 AM, Rafael Carvallo
      wrote:<br>
    </div>
    <blockquote
cite="mid:CABo7iVKjMG+xqoqP_1fqfwguovSU-SAPDjut6C8rAvq6z22UtA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>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.<br>
              <br>
            </div>
            <div>something like this:<br>
              <br>
            </div>
            Location A                                                
            Location B<br>
            <br>
          </div>
          network: <a moz-do-not-send="true"
            href="http://192.168.1.0/24">192.168.1.0/24</a>                            
          network: <a moz-do-not-send="true"
            href="http://192.168.2.0/24">192.168.2.0/24</a><br>
        </div>
        main asterisk server: 192.168.1.1               main asterisk
        server: 192.168.2.1<br>
        <div>backup asterisk server: 192.168.2.1            backup
          asterisk server: 192.168.1.1<br>
          <br>
          <br>
        </div>
        <div>Unless there's a failover situation the phones on Location
          A (network: <a moz-do-not-send="true"
            href="http://192.168.1.0/24">192.168.1.0/24</a>) 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.<br>
          <br>
        </div>
        <div>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.<br>
          <br>
        </div>
        <div>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.<br>
        </div>
      </div>
    </blockquote>
    Kamailio is SIP only signaling server, no h323.<br>
    <br>
    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.<br>
    <br>
    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.<br>
    <br>
    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.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
</pre>
  </body>
</html>