<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hello,<br>
    <br>
    one option you can do is to write to db immediately when a call is
    active (see dialog module parameters) and do a query to the other
    server database in addition to counting the local instance active
    calls.<br>
    <br>
    Another one, different, is to use memcache for a communication
    system between two or more instances.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    On 12/13/10 2:37 PM, Pan B. Christensen wrote:
    <blockquote cite="mid:DFEDE8C256A2484999BC1313B73F0CA8@rtPC"
      type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      <meta name="GENERATOR" content="MSHTML 8.00.6001.18975">
      <div><font face="Arial" size="2">Thanks for your reply, Daniel.</font></div>
      <div>&nbsp;</div>
      <div><font face="Arial" size="2">The purpose is to do busy
          forwarding without querying the client&nbsp;when the user already
          has &gt;= X active calls. X will normally be 1 (call waiting
          inactive) or 2 (call waiting active). Advanced users may
          possibly set&nbsp;a higher value.&nbsp;Counting the number of calls&nbsp;on
          the&nbsp;server and doing busy forwarding based on that rather than
          waiting for a "486 Busy here" from the client has&nbsp;several
          advantages.</font></div>
      <div>&nbsp;</div>
      <div><font face="Arial" size="2">Currently, I've written code to
          do this with the dispatcher module, and it's working great
          with only one server. Here's a code snippet:</font></div>
      <div>&nbsp;</div>
      <div><font face="Arial" size="2">&nbsp;&nbsp;&nbsp; $var(dlg_busy) = 0;<br>
          &nbsp;&nbsp;&nbsp; get_profile_size("busy", "$avp(s:uid)", "$var(dlg_busy)");<br>
          &nbsp;&nbsp;&nbsp;&nbsp;if ( $var(dlg_busy) &gt;= $avp(s:busy_level) ) {<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ($avp(s:cfb_status) == "on") {<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $rU = $avp(s:cfb_number);</font></div>
      <div><font face="Arial" size="2">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; xlog("L_INFO",
          "-------------------- $avp(s:uid) has $var(dlg_busy) active
          calls. Treshold $avp(s:busy_level). Forwarding on busy to $rU
          --------------------\n");<br>
          &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; route(10);</font></div>
      <div><font face="Arial" size="2">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</font></div>
      <div><font face="Arial" size="2">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ...</font></div>
      <div><font face="Arial" size="2">&nbsp;&nbsp;&nbsp; }</font></div>
      <div>&nbsp;</div>
      <div><font face="Arial" size="2">Based on your reply, I guess one
          way to solve this would be to write the get_profile_size
          function in sqlops, query the two dialog databases and add the
          numbers. This would still require the customer to change their
          database design. Is there an easier&nbsp;or better way to do this?</font></div>
      <div>&nbsp;</div>
      <div><font face="Arial" size="2">I also wote code to do busy
          forwarding if the client replies with 486 (do not disturb
          activated), 603 (call rejected) etc.</font></div>
      <div><font face="Arial" size="2">This code works for normal busy
          forwarding if Polycom is set to&nbsp;1&nbsp;call per line key (default
          is 8). We'll then have to provision the $avp(s:busy_level)
          variable to&nbsp;the clients&nbsp;instead of handling it
          server-side.&nbsp;If&nbsp;a user now wants to change the setting, he'll
          have to reboot his phone after&nbsp;doing so. Changing the <font
            face="Arial"><font face="Arial">reg.x.callsPerLineKey</font></font>&nbsp;setting
          in the phone also limits the number of outgoing calls the user
          can make. We'll also have to make code for all the other
          hardphones the customer is planning to use plus make guides on
          how to change the setting for all kinds of softphones.&nbsp;We want
          to avoid all this.</font></div>
      <div>&nbsp;</div>
      <div>&nbsp;</div>
      <div><font face="Arial" size="2">With kind regards,</font></div>
      <div><font face="Arial" size="2">Pan</font></div>
      <blockquote style="border-left: 2px solid rgb(0, 0, 0);
        padding-left: 5px; padding-right: 0px; margin-left: 5px;
        margin-right: 0px;">
        <div style="font: 10pt arial;">----- Original Message ----- </div>
        <div style="font: 10pt arial; background: none repeat scroll 0%
          0% rgb(228, 228, 228);"><b>From:</b> <a
            moz-do-not-send="true" title="miconda@gmail.com"
            href="mailto:miconda@gmail.com">Daniel-Constantin Mierla</a>
        </div>
        <div style="font: 10pt arial;"><b>To:</b> <a
            moz-do-not-send="true" title="pan@ibidium.no"
            href="mailto:pan@ibidium.no">Pan B. Christensen</a> </div>
        <div style="font: 10pt arial;"><b>Cc:</b> <a
            moz-do-not-send="true" title="sr-users@lists.sip-router.org"
            href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
        </div>
        <div style="font: 10pt arial;"><b>Sent:</b> Monday, December 13,
          2010 12:26 PM</div>
        <div style="font: 10pt arial;"><b>Subject:</b> Re: [SR-Users]
          Dialog module with 2 servers and 2 separate databases.</div>
        <div><br>
        </div>
        <br>
        <br>
        On 12/10/10 2:17 PM, Pan B. Christensen wrote:
        <blockquote cite="mid:83EDE75437344FC18DB84EF19DA6032C@rtPC"
          type="cite">
          <meta name="GENERATOR" content="MSHTML 8.00.6001.18975">
          <style></style>
          <div><font face="Arial" size="2">Hello,</font></div>
          <div>&nbsp;</div>
          <div><font face="Arial" size="2">My customer has the following
              database design.</font></div>
          <div><font face="Arial" size="2">Voip server 1 talks to SQL
              server 1.</font></div>
          <div><font face="Arial" size="2">Voip server 2 talks to SQL
              server 2.</font></div>
          <div>&nbsp;</div>
          <div><font face="Arial" size="2">Voip 1 and Voip 2&nbsp;are
              load-balanced.</font></div>
          <div>&nbsp;</div>
          <div><font face="Arial" size="2">Each SQL server has two
              databases. Database 1&nbsp;contains semi-static data like call
              forwarding&nbsp;properties for users&nbsp;and is read-only. This is
              replicated from a third SQL server which the web interface
              writes to. Database 2 is read/write, is not replicated and
              contains data that&nbsp;is updated frequently like user
              location and now dialog info.</font></div>
          <div>&nbsp;</div>
          <div><font face="Arial" size="2">Voip server 1 is not allowed
              to talk to SQL server 2 and vice versa.</font></div>
          <div>&nbsp;</div>
          <div><font face="Arial" size="2">I'm using forward() to send
              authenticated REGISTERs to the other server so that it'll
              write this to RAM and&nbsp;its own SQL server. Thus, both
              servers are aware of clients authenticated&nbsp;and registered
              by the other server.</font></div>
          <div>&nbsp;</div>
          <div><font face="Arial" size="2">How can I make&nbsp;both
              servers&nbsp;be aware of active calls on the other server?</font></div>
        </blockquote>
        what is the purpose?<br>
        <br>
        Practically, it is not possible to track a call in two
        instances, because, unlike registration where is just a storage
        of mappings between contact and aor, call states of dialog
        module involve more processing logic, including timeouts and
        sending BYEs.<br>
        <br>
        Cheers,<br>
        Daniel<br>
        <br>
        <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
Kamailio (OpenSER) Advanced Training
Jan 24-26, 2011, Irvine, CA, USA
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a></pre>
        <p> </p>
        <hr> <br>
        No virus found in this incoming message.<br>
        Checked by AVG - <a class="moz-txt-link-abbreviated" href="http://www.avg.com">www.avg.com</a> <br>
        Version: 8.5.449 / Virus Database: 271.1.1/3312 - Release Date:
        12/12/10 19:34:00<br>
      </blockquote>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
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
Kamailio (OpenSER) Advanced Training
Jan 24-26, 2011, Irvine, CA, USA
<a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a></pre>
  </body>
</html>