<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=ISO-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18975"></HEAD>
<BODY bgColor=#ffffff text=#000000>
<DIV><FONT size=2 face=Arial>Thanks for your reply, Daniel.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>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><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>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><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>&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 size=2 face=Arial>&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 size=2 face=Arial>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
}</FONT></DIV>
<DIV><FONT size=2 face=Arial>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
...</FONT></DIV>
<DIV><FONT size=2 face=Arial>&nbsp;&nbsp;&nbsp; }</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>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><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>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 size=2 face=Arial>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><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>With kind regards,</FONT></DIV>
<DIV><FONT size=2 face=Arial>Pan</FONT></DIV>
<BLOCKQUOTE 
style="BORDER-LEFT: #000000 2px solid; 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: #e4e4e4; font-color: black"><B>From:</B> 
  <A title=miconda@gmail.com href="mailto:miconda@gmail.com">Daniel-Constantin 
  Mierla</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=pan@ibidium.no 
  href="mailto:pan@ibidium.no">Pan B. Christensen</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Cc:</B> <A 
  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 size=2 face=Arial>Hello,</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT size=2 face=Arial>My customer has the following database 
    design.</FONT></DIV>
    <DIV><FONT size=2 face=Arial>Voip server 1 talks to SQL server 
    1.</FONT></DIV>
    <DIV><FONT size=2 face=Arial>Voip server 2 talks to SQL server 
    2.</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT size=2 face=Arial>Voip 1 and Voip 2&nbsp;are 
    load-balanced.</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT size=2 face=Arial>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 size=2 face=Arial>Voip server 1 is not allowed to talk to SQL 
    server 2 and vice versa.</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT size=2 face=Arial>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 size=2 face=Arial>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 class=moz-txt-link-freetext href="http://www.asipto.com">http://www.asipto.com</A></PRE>
  <P>
  <HR>

  <P></P><BR>No virus found in this incoming message.<BR>Checked by AVG - 
  www.avg.com <BR>Version: 8.5.449 / Virus Database: 271.1.1/3312 - Release 
  Date: 12/12/10 19:34:00<BR></BLOCKQUOTE></BODY></HTML>