<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 03/12/2012 11:00 AM, Sasa Vilic wrote:
    <blockquote cite="mid:4F5DBB45.1090807@gmail.com" type="cite">
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
      <div class="moz-text-flowed" style="font-family: -moz-fixed;
        font-size: 14px;" lang="x-western">Hello, <br>
        <br>
        I have read here about load balancing between multiple gateways
        by using carrierroute module, but there is one particular
        question for which I found no answer. <br>
        <br>
        Let's say I have two asterisk servers (X und Y), that are my
        gateways to PSTN. Let we do it simple. Let's say that each
        gateway supports only one outgoing call at the time and there is
        no incoming calls from PSTN. Now: <br>
        <br>
        Bob calls one number and Kamailio uses X gateway. <br>
        Alice calls other number and Kamailio uses Y gateway. <br>
        Alice terminates the call. <br>
        Alice place a new call, but Bob's call is still in progress. <br>
        If we were used round robin algorithm, Kamailio would then use X
        gateway, but X gateway is currently occupied. What shell happen
        now? <br>
        And what if Alice didn't tear down call ordinary? What if it her
        SIP client simply crashed? (Then kamailio would think that there
        is now free gateway) <br>
        <br>
        So the main question is: can kamailio know/detect, how much
        calls are going over one particular gateway and what can be done
        when limit for this gateway is reached? <br>
        <br>
      </div>
    </blockquote>
    <br>
    Hello,<br>
    <br>
    Carrierroute module support load balancing based on weights(so it
    can be non-uniform distribution).Keep in mind that this works on
    large numbers of calls, so on the long run we will have 50-50% load
    on the servers (given enough calls). For small number of calls (like
    your example) the carrierroute module has no way of determining to
    route on the other gateway. <br>
    <br>
    As others suggested, you can use failure_route to route between
    gateways. Carrierroute module supports this over the failure route
    table. <br>
    <br>
    Cheers,<br>
    Marius<br>
    <blockquote cite="mid:4F5DBB45.1090807@gmail.com" type="cite">
      <div class="moz-text-flowed" style="font-family: -moz-fixed;
        font-size: 14px;" lang="x-western"> Thank you in advance. <br>
        <br>
        Kind Regards, <br>
        Sasa Vilic <br>
      </div>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Zbihlei Marius

Head of
Linux Development Services Romania

1&amp;1 Internet Development srl    Tel KA: 754-9152
Str Mircea Eliade 18            Tel RO: +40-31-223-9152
Sect 1, Bucuresti               mailto: <a class="moz-txt-link-abbreviated" href="mailto:marius.zbihlei@1and1.ro">marius.zbihlei@1and1.ro</a>
71295, Romania
</pre>
  </body>
</html>