<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hello,<br>
    <br>
    using a proxy in front of the pbx has some side effects if your
    phones are behind the nat. First, for registration, you have to
    enable with Path in the proxy and the pbx has to support it. AFAIK,
    Asterisk got just recently a patch for supporting Path.<br>
    <br>
    Then, the asterisk has to be also changed a bit, because it will
    match all phone registrations coming from the same IP, which can
    create troubles if you match by source IP (not sure if this is still
    in latest Asterisks, but with some versions I run in such troubles,
    but since I was not the one handling the Asterisk, I cannot tell
    more).<br>
    <br>
    If you really need to stick to existing asterisk deployment, then
    maybe looking at next tutorial will help a bit:<br>
    <br>
<a class="moz-txt-link-freetext" href="http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb">http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb</a><br>
    <br>
    If you can redesign the platform, you may want to change the logic
    so that kamailio takes care of registration and signaling and
    asterisk of media related services. This is more scalable and easier
    to handle in long term.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 8/1/13 12:44 AM, Rafael Carvallo
      wrote:<br>
    </div>
    <blockquote
cite="mid:CABo7iV+qtP_jkiRZBYG5=QObG-CTxwkDV04Q49xW5qNqiYc8bg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div>
                  <div>Hey everyone, currently i have this configuration
                    set on kamailio:<br>
                    <br>
                    <style type="text/css">P { margin-bottom: 0.21cm; }</style>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>modparam("dispatcher",
                          "list_file", "/etc/kamailio/dispatcher.list")</font></font></p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>modparam("dispatcher",
                          "force_dst", 0) #forzado de la reescritura
                          direccion de
                          destino</font></font></p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>modparam("dispatcher",
                          "flags", 2) #banderas de funcionamiento, 2
                          significa
                          "soporte para failover"</font></font></p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>modparam("dispatcher",
                          "dst_avp", "$avp(dsdst)")</font></font></p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>modparam("dispatcher",
                          "grp_avp", "$avp(dsgrp)")</font></font></p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>modparam("dispatcher",
                          "cnt_avp", "$avp(dscnt)")</font></font></p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>modparam("dispatcher",
                          "ds_ping_method", "OPTIONS")</font></font></p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>modparam("dispatcher",
                          "ds_ping_interval", 5) #tiempo que transcurre
                          antes de
                          verificar nuevamente una salida inactiva</font></font></p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>modparam("dispatcher",
                          "ds_probing_threshhold", 5) #Numero de
                          intentos antes de
                          marcar una salida como inactiva</font></font></p>
                    <p style="margin-bottom:0cm"><br>
                    </p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>modparam("dispatcher",
                          "ds_ping_reply_codes",
                          "class=2;code=403;code=488;class=3")</font></font></p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>modparam("dispatcher",
                          "ds_probing_mode", 1)</font></font></p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>modparam("dispatcher",
                          "ds_hash_expire", 3600)</font></font></p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>modparam("dispatcher",
                          "ds_hash_initexpire", 60)</font></font></p>
                    <p style="margin-bottom:0cm"><br>
                    </p>
                    <p style="margin-bottom:0cm"><br>
                    </p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>#loadmodule
                          "dispatcher.so"</font></font></p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>#######
                          Routing Logic ########</font></font></p>
                    <p style="margin-bottom:0cm"><br>
                    </p>
                    <p style="margin-bottom:0cm"><br>
                    </p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>#
                          Main SIP request routing logic</font></font></p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>#
                          - processing of any incoming SIP request
                          starts with this route</font></font></p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>#
                          - note: this is the same as route { ... }</font></font></p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>request_route
                          {</font></font></p>
                    <p style="margin-bottom:0cm"><br>
                    </p>
                    <p style="margin-bottom:0cm"> <font face="Arial,
                        serif"><font>if
                          (is_method("SUBSCRIBE")){</font></font></p>
                    <p style="margin-bottom:0cm"> <font face="Arial,
                        serif"><font>if
                          (src_ip == 192.168.2.1 | src_ip ==
                          192.168.2.2){</font></font></p>
                    <p style="margin-bottom:0cm"> <font face="Arial,
                        serif"><font>t_relay();</font></font></p>
                    <p style="margin-bottom:0cm"> <font face="Arial,
                        serif"><font>}</font></font></p>
                    <p style="margin-bottom:0cm"><br>
                    </p>
                    <p style="margin-bottom:0cm"> <font face="Arial,
                        serif"><font>route(REGISTRAR);</font></font></p>
                    <p style="margin-bottom:0cm"><br>
                    </p>
                    <p style="margin-bottom:0cm"> <font face="Arial,
                        serif"><font>}</font></font></p>
                    <p style="margin-bottom:0cm"><br>
                    </p>
                    <p style="margin-bottom:0cm"> <font face="Arial,
                        serif"><font>if
                          (src_ip == 192.168.2.1 | src_ip ==
                          192.168.2.2){</font></font></p>
                    <p style="margin-bottom:0cm"> <font face="Arial,
                        serif"><font>t_relay();</font></font></p>
                    <p style="margin-bottom:0cm"> <font face="Arial,
                        serif"><font>}</font></font></p>
                    <p style="margin-bottom:0cm"><br>
                    </p>
                    <p style="margin-bottom:0cm"> <font face="Arial,
                        serif"><font>else{</font></font></p>
                    <p style="margin-bottom:0cm"> <font face="Arial,
                        serif"><font>route(ASTERISK);</font></font></p>
                    <p style="margin-bottom:0cm"> <font face="Arial,
                        serif"><font>}</font></font></p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>}</font></font></p>
                    <p style="margin-bottom:0cm"><br>
                    </p>
                    <p style="margin-bottom:0cm"><br>
                    </p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>route[ASTERISK]{</font></font></p>
                    <p style="margin-bottom:0cm"> <font face="Arial,
                        serif"><font>ds_select_dst("1",
                          "8");</font></font></p>
                    <p style="margin-bottom:0cm"> <font face="Arial,
                        serif"><font>t_relay();</font></font></p>
                    <p style="margin-bottom:0cm"> <font face="Arial,
                        serif"><font>exit();</font></font></p>
                    <p style="margin-bottom:0cm"><font face="Arial,
                        serif"><font>}</font></font></p>
                    <br>
                  </div>
                  <div>Everything else is left with the same basic
                    configuration it had when i installed the software.<br>
                  </div>
                  <div><br>
                  </div>
                  I want to use it kinda of a sip router, so what
                  Kamailio does is just forward the packets betwen my
                  Asterisk boxes and the Sip Phones. Currently it seems
                  to work (partially) but i have doubts about if this is
                  correctly done (it's the first time using Kamailio and
                  i need this working withing a week at most).<br>
                  <br>
                </div>
                As you can see i use the module dispatcher for
                failover/failback (this is the purpose of using
                Kamailio, a failover/failback setup). One major problem
                i've found with this setup is, if the phones are
                currently connected and working with one of my 2
                asterisk boxes and  if that box fails, Kamailio starts
                sending the traffic to the second box (as intended), but
                the phones don't try to subscribe to the new asterisk
                box, rather they just keep sending traffic (and
                obviously kamailio forwarding it).<br>
                <br>
              </div>
              Sometimes one of the phones subscribe to the new box, but
              that's not always the case, the packets reach the new
              Asterisk box, but since the phones aren't registered to
              it, they can't make calls.<br>
              <br>
            </div>
            Other times the behavior of the setup is rather weird, i can
            call some extensions and some others i can not (even though
            they are registered within the asterisk box) The traffic
            gets to the Asterisk box (as shown in the asterisk logs) but
            the call is shown as "service unavailable". I've checked a
            lot of times the Asterisk setup and it seems to be fine so i
            think it has something to do with Kamailio.<br>
            <br>
          </div>
          I know this might be a really bad configuration file, but it's
          been at most 3 days since i started using Kamailio which i
          sometimes find kinda hard to understand and i really need this
          working within a week.<br>
          <br>
        </div>
        To summarize all i want is kamailio forwarding packets between
        the currently active server and the phones so if it fails, then
        the packets go to the second one, the phones must re-subscribe
        to the new active server. <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <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>