<div>Hi Robert,</div><div><br></div>Here is the routing part which I used for load balancing-<div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>route[1] {</div><div><br></div><div><br></div>
<div>          load_balance(&quot;2&quot;,&quot;sip&quot;);</div><div>        }</div><div><br></div><div>        # LB function returns negative if no suitable destination (for requested resources) is found,</div><div>        # or if all destinations are full</div>
<div>        if ($retcode&lt;0) {</div><div>             sl_send_reply(&quot;500&quot;,&quot;Service full&quot;);</div><div>             exit;</div><div>        }</div><div><br></div><div>        xlog(&quot;Selected destination is: $du\n&quot;);</div>
<div><br></div><div>        # send it out</div><div>        if (!t_relay()) {</div><div>                sl_reply_error();</div><div>        }</div><div><br></div><div><br></div><div>Regards</div><div>Tushar</div><br><div class="gmail_quote">
On Mon, Jun 13, 2011 at 7:59 AM, Tushar Jain <span dir="ltr">&lt;<a href="mailto:tusshar.jain@gmail.com">tusshar.jain@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">Hi Robert,<div><br></div><div>Thanks for looking into my problem, here I am pasting my opensips.cfg file-</div><div>____________________________________________________________________</div>
<div><br></div><div>####### Global Parameters #########</div>
</div></div><div><div><div></div><div class="h5"><div><br></div><div>debug=6</div><div>log_stderror=no</div><div>log_facility=LOG_LOCAL0</div><div><br></div><div>fork=yes</div><div>children=4</div><div><br></div><div>port=5060</div>
<div><br></div><div>listen=udp:x.x.x.x:5060</div>
<div><br></div><div>####### Modules Section ########</div><div><br></div><div>mpath=&quot;//lib/opensips/modules/&quot;</div><div><br></div><div>loadmodule &quot;db_mysql.so&quot;</div><div>loadmodule &quot;signaling.so&quot;</div>

<div>loadmodule &quot;sl.so&quot;</div><div>loadmodule &quot;tm.so&quot;</div><div>loadmodule &quot;rr.so&quot;</div><div>loadmodule &quot;maxfwd.so&quot;</div><div>loadmodule &quot;usrloc.so&quot;</div><div>loadmodule &quot;registrar.so&quot;</div>

<div>loadmodule &quot;textops.so&quot;</div><div>loadmodule &quot;mi_fifo.so&quot;</div><div>loadmodule &quot;uri.so&quot;</div><div>loadmodule &quot;xlog.so&quot;</div><div>loadmodule &quot;acc.so&quot;</div><div>loadmodule &quot;siptrace.so&quot;</div>

<div>loadmodule &quot;auth.so&quot;</div><div>loadmodule &quot;auth_db.so&quot;</div><div>loadmodule &quot;alias_db.so&quot;</div><div>loadmodule &quot;domain.so&quot;</div><div>loadmodule &quot;permissions.so&quot;</div>

<div>loadmodule &quot;group.so&quot;</div><div>loadmodule &quot;drouting.so&quot;</div><div>loadmodule &quot;avpops.so&quot;</div><div>loadmodule &quot;dialplan.so&quot;</div><div>loadmodule &quot;aaa_radius.so&quot;</div>

<div>loadmodule &quot;dialog.so&quot;</div><div>loadmodule &quot;load_balancer.so&quot;</div><div><br></div><div>#------ avpops params -----</div><div>modparam(&quot;avpops&quot;, &quot;db_url&quot;, &quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)</div>

<div>modparam(&quot;avpops&quot;, &quot;avp_table&quot;, &quot;usr_preferences&quot;)</div><div><br></div><div>#------ load the dpid field to a pseudo-variable $avp(s:dpid) ------</div><div>modparam(&quot;auth_db&quot;, &quot;load_credentials&quot;, &quot;$avp(s:rpid)=rpid ;$avp(s:countrycode)=contrycode;$avp(s:areacode)=areacode&quot;)</div>

<div>modparam(&quot;dialplan&quot;, &quot;db_url&quot;,&quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)</div><div><br></div><div>## attribute of the matched line will be store in the $avp(s:dest)</div><div>modparam(&quot;dialplan&quot;, &quot;attrs_pvar&quot;, &quot;$avp(s:dest)&quot;)</div>

<div><br></div><div># ----- drouting params -----</div><div>#modparam(&quot;drouting&quot;, &quot;sort_order&quot;, 0)</div><div>modparam(&quot;drouting&quot;, &quot;use_domain&quot;, 1)</div><div>modparam(&quot;drouting&quot;,&quot;db_url&quot;, &quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)</div>

<div>modparam(&quot;drouting&quot;, &quot;probing_interval&quot;, 60)</div><div>modparam(&quot;drouting&quot;, &quot;probing_from&quot;, &quot;sip:pinger@x.x.x.x&quot;)</div><div>modparam(&quot;drouting&quot;, &quot;probing_method&quot;, &quot;OPTIONS&quot;)</div>

<div>modparam(&quot;drouting&quot;, &quot;probing_reply_codes&quot;, &quot;501, 403, 404&quot;)</div><div><br></div><div># ----- Group ----</div></div></div><div class="im"><div>modparam(&quot;group&quot;,&quot;db_url&quot;,&quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)</div>

<div><br></div></div><div class="im"><div># ----- mi_fifo params -----</div><div>modparam(&quot;mi_fifo&quot;, &quot;fifo_name&quot;, &quot;/tmp/opensips_fifo&quot;)</div><div>modparam(&quot;mi_fifo&quot;, &quot;fifo_mode&quot;, 0666)</div>
<div>
modparam(&quot;dialog&quot;, &quot;dlg_flag&quot;, 13)</div><div>modparam(&quot;dialog&quot;, &quot;db_mode&quot;, 1)</div><div>modparam(&quot;dialog&quot;, &quot;db_url&quot;, &quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)</div>

<div>modparam(&quot;dialog&quot;, &quot;timeout_avp&quot;, &quot;$avp(i:30)&quot;)</div><div>modparam(&quot;dialog&quot;, &quot;default_timeout&quot;, 3600)</div><div><br></div><div><br></div></div><div><div></div><div class="h5">
<div># ----- Load Balancer -----</div>
<div>modparam(&quot;load_balancer&quot;, &quot;db_url&quot;,&quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)</div><div>modparam(&quot;load_balancer&quot;, &quot;probing_interval&quot;, 60)</div><div>modparam(&quot;load_balancer&quot;, &quot;probing_method&quot;, &quot;INFO&quot;)</div>

<div>modparam(&quot;load_balancer&quot;, &quot;probing_from&quot;, &quot;sip:1000@x.x.x.x&quot;)</div><div>modparam(&quot;load_balancer&quot;, &quot;db_table&quot;, &quot;load_balancer&quot;)</div><div>modparam(&quot;load_balancer&quot;, &quot;probing_reply_codes&quot;, &quot;501, 403, 404&quot;)</div>

<div><br></div><div># ----- registrar params -----</div><div>/* uncomment the next line not to allow more than 10 contacts per AOR */</div><div>#modparam(&quot;registrar&quot;, &quot;max_contacts&quot;, 10)</div><div><br>

</div><div><br></div><div># ----- usrloc params -----</div><div><br></div><div>modparam(&quot;usrloc&quot;, &quot;db_mode&quot;,   0)</div><div><br></div><div>/* uncomment the following lines if you want to enable DB persistency</div>

<div>   for location entries */</div><div>modparam(&quot;usrloc&quot;, &quot;db_mode&quot;,   2)</div><div>modparam(&quot;usrloc&quot;, &quot;db_url&quot;,<span style="white-space:pre-wrap">        </span>&quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)</div>

<div><br></div><div><br></div><div># ----- uri params -----</div><div>modparam(&quot;uri&quot;, &quot;use_uri_table&quot;, 0)</div><div><br></div><div><br></div><div># ----- acc params -----</div><div>/* what sepcial events should be accounted ? */</div>

<div>modparam(&quot;acc&quot;, &quot;early_media&quot;, 0)</div><div>modparam(&quot;acc&quot;, &quot;report_ack&quot;, 0)</div><div>modparam(&quot;acc&quot;, &quot;report_cancels&quot;, 0)</div><div>modparam(&quot;acc&quot;, &quot;detect_direction&quot;, 0)</div>

<div>modparam(&quot;acc&quot;, &quot;failed_transaction_flag&quot;, 1)</div><div>modparam(&quot;acc&quot;, &quot;log_level&quot;, 1)</div><div>modparam(&quot;acc&quot;, &quot;log_flag&quot;, 1)</div><div>modparam(&quot;acc&quot;, &quot;log_missed_flag&quot;, 1)</div>

<div>modparam(&quot;acc&quot;, &quot;db_flag&quot;, 1)</div><div>modparam(&quot;acc&quot;, &quot;db_missed_flag&quot;, 2)</div><div>modparam(&quot;acc&quot;, &quot;aaa_url&quot;, &quot;radius:/etc/radiusclient-ng/radiusclient.conf&quot;) # Point the configuration file</div>

<div>modparam(&quot;acc&quot;, &quot;service_type&quot;, 15) # Set the service_type to 15</div><div>modparam(&quot;acc&quot;, &quot;aaa_flag&quot;, 1)</div><div>modparam(&quot;acc&quot;, &quot;aaa_missed_flag&quot;, 1)</div>

<div><br></div></div></div><div><div></div><div class="h5"><div># ----- auth_db params -----</div><div>/* uncomment the following lines if you want to enable the DB based</div><div>   authentication */</div><div><br></div>
<div>modparam(&quot;auth_db&quot;, &quot;calculate_ha1&quot;, yes)</div>
<div>modparam(&quot;auth_db&quot;, &quot;password_column&quot;, &quot;password&quot;)</div><div><br></div><div>modparam(&quot;auth_db&quot;, &quot;db_url&quot;,&quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)</div>

<div>modparam(&quot;auth_db&quot;, &quot;load_credentials&quot;, &quot;&quot;)</div><div><br></div><div>####### Routing Logic ########</div><div><br></div><div># main request routing logic</div><div><br></div><div>route{</div>

<div><br></div><div><span style="white-space:pre-wrap">        </span>setflag(22);</div><div>        sip_trace();</div><div><br></div><div><span style="white-space:pre-wrap">        </span>if (!mf_process_maxfwd_header(&quot;10&quot;)) {</div>

<div><span style="white-space:pre-wrap">                </span>sl_send_reply(&quot;483&quot;,&quot;Too Many Hops&quot;);</div><div><span style="white-space:pre-wrap">                </span>exit;</div><div><span style="white-space:pre-wrap">        </span>}</div>

<div><br></div><div>#---- Sequential requests section ----#</div><div><br></div><div><span style="white-space:pre-wrap">        </span>if (has_totag()) {</div><div><span style="white-space:pre-wrap">                </span># sequential request withing a dialog should</div>

<div><span style="white-space:pre-wrap">                </span># take the path determined by record-routing</div><div><span style="white-space:pre-wrap">                </span>if (loose_route()) {</div><div><span style="white-space:pre-wrap">                        </span>if (is_method(&quot;BYE&quot;)) {</div>

<div><span style="white-space:pre-wrap">                                </span>setflag(1); # do accounting ...</div><div><span style="white-space:pre-wrap">                                </span>setflag(3); # ... even if the transaction fails</div><div><span style="white-space:pre-wrap">                                </span>} else if (is_method(&quot;INVITE&quot;)) {</div>

<div><span style="white-space:pre-wrap">                                </span># even if in most of the cases is useless, do RR for</div><div><span style="white-space:pre-wrap">                                </span># re-INVITEs alos, as some buggy clients do change route set</div>

<div><span style="white-space:pre-wrap">                                </span># during the dialog.</div><div><span style="white-space:pre-wrap">                                </span>record_route();</div><div><span style="white-space:pre-wrap">                        </span>}</div><div><span style="white-space:pre-wrap">                        </span># route it out to whatever destination was set by loose_route()</div>

<div><span style="white-space:pre-wrap">                        </span># in $du (destination URI).</div><div><span style="white-space:pre-wrap">                        </span>route(1);</div><div><span style="white-space:pre-wrap">                </span>} else {</div><div>
<span style="white-space:pre-wrap">                        </span>if ( is_method(&quot;ACK&quot;) ) {</div><div><span style="white-space:pre-wrap">                                </span>if ( t_check_trans() ) {</div><div><span style="white-space:pre-wrap">                                        </span>t_relay();</div>

<div><span style="white-space:pre-wrap">                                        </span>exit;</div><div><span style="white-space:pre-wrap">                                </span>} else {</div><div><span style="white-space:pre-wrap">                                        </span>exit;</div><div><span style="white-space:pre-wrap">                                </span>}</div>

<div><span style="white-space:pre-wrap">                        </span>}</div><div><span style="white-space:pre-wrap">                        </span>sl_send_reply(&quot;404&quot;,&quot;Not here&quot;);</div><div><span style="white-space:pre-wrap">                </span>}</div>

<div><span style="white-space:pre-wrap">                </span>exit;</div><div><span style="white-space:pre-wrap">        </span>}</div><div><br></div><div><br></div><div>#---- initial requests section ----#</div><div><br></div><div><span style="white-space:pre-wrap">        </span># CANCEL processing</div>

<div><span style="white-space:pre-wrap">        </span>if (is_method(&quot;CANCEL&quot;))</div><div><span style="white-space:pre-wrap">        </span>{</div><div><span style="white-space:pre-wrap">                        </span>if (t_check_trans())</div>
<div><span style="white-space:pre-wrap">                        </span>t_relay();</div><div><span style="white-space:pre-wrap">                </span>exit;</div><div><span style="white-space:pre-wrap">        </span>}</div><div><br></div><div><span style="white-space:pre-wrap">        </span>t_check_trans();</div>

<div><br></div><div><span style="white-space:pre-wrap">        </span>if (!(method==&quot;REGISTER&quot;) &amp;&amp; from_uri==myself) /*no multidomain version*/</div><div><span style="white-space:pre-wrap">        </span>if (!(method==&quot;REGISTER&quot;) &amp;&amp; is_from_local())  /*multidomain version*/</div>

<div><span style="white-space:pre-wrap">        </span>{</div><div><span style="white-space:pre-wrap">                </span>if (!proxy_authorize(&quot;&quot;, &quot;subscriber&quot;)) {</div><div><span style="white-space:pre-wrap">                        </span>proxy_challenge(&quot;&quot;, &quot;0&quot;);</div>

<div><span style="white-space:pre-wrap">                        </span>exit;</div><div><span style="white-space:pre-wrap">                </span>}</div><div><span style="white-space:pre-wrap">                </span>if (!db_check_from()) {</div><div><span style="white-space:pre-wrap">                        </span>sl_send_reply(&quot;403&quot;,&quot;Forbidden auth ID&quot;);</div>

<div><span style="white-space:pre-wrap">                        </span>exit;</div><div><span style="white-space:pre-wrap">                </span>}</div><div><span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">                </span>consume_credentials();</div>

<div><span style="white-space:pre-wrap">                </span># caller authenticated</div><div><span style="white-space:pre-wrap">        </span>}</div><div><br></div><div><br></div><div>#------------------ preloaded route checking ---------------------#</div>

<div><br></div><div><span style="white-space:pre-wrap">        </span>if (loose_route()) {</div><div><span style="white-space:pre-wrap">                </span>xlog(&quot;L_ERR&quot;,</div><div><span style="white-space:pre-wrap">                </span>&quot;Attempt to route with preloaded Route&#39;s [$fu/$tu/$ru/$ci]&quot;);</div>

<div><span style="white-space:pre-wrap">                </span>if (!is_method(&quot;ACK&quot;))</div><div><span style="white-space:pre-wrap">                        </span>sl_send_reply(&quot;403&quot;,&quot;Preload Route denied&quot;);</div><div><span style="white-space:pre-wrap">                </span>exit;</div>

<div><span style="white-space:pre-wrap">        </span>}</div><div><br></div><div><span style="white-space:pre-wrap">        </span># record routing</div><div><span style="white-space:pre-wrap">        </span>if (!is_method(&quot;REGISTER|MESSAGE&quot;))</div>

<div><span style="white-space:pre-wrap">                </span>record_route();</div><div><br></div><div><span style="white-space:pre-wrap">        </span># account only INVITEs</div><div><span style="white-space:pre-wrap">        </span>if (is_method(&quot;INVITE&quot;)) {</div>

<div><span style="white-space:pre-wrap">                </span>setflag(1); # do accounting</div><div><span style="white-space:pre-wrap">                </span>setflag(2); # Account Missed Calls</div><div><span style="white-space:pre-wrap">                </span>setflag(3); # Account Failed Transactions<span style="white-space:pre-wrap">        </span></div>

<div><span style="white-space:pre-wrap">                </span>}</div><div><span style="white-space:pre-wrap">        </span>if (!uri==myself)</div><div><br></div><div><br></div><div>#---- Routing to external domains ----#</div><div><br>
</div><div><br></div><div><span style="white-space:pre-wrap">        </span>## replace with following line if multi-domain support is used</div><div><span style="white-space:pre-wrap">        </span>if (!is_uri_host_local())</div>
<div><span style="white-space:pre-wrap">        </span>{</div><div><span style="white-space:pre-wrap">                </span>if(is_from_local()) {</div><div><span style="white-space:pre-wrap">                </span>route(1);</div><div><span style="white-space:pre-wrap">                </span>} else {</div>

<div><span style="white-space:pre-wrap">                        </span>sl_send_reply(&quot;403&quot;,&quot;Not here&quot;);</div><div><span style="white-space:pre-wrap">                </span>}</div><div><span style="white-space:pre-wrap">        </span>}</div>
<div><span style="white-space:pre-wrap">                </span>append_hf(&quot;P-hint: outbound\r\n&quot;); </div><div><br></div><div><span style="white-space:pre-wrap">        </span>if (is_method(&quot;PUBLISH&quot;))</div><div><span style="white-space:pre-wrap">        </span>{</div>

<div><span style="white-space:pre-wrap">                </span>sl_send_reply(&quot;$rc&quot;, &quot;Service Unavailable&quot;);</div><div><span style="white-space:pre-wrap">                </span>exit;</div><div><span style="white-space:pre-wrap">        </span>}</div>

<div><span style="white-space:pre-wrap">        </span></div><div><br></div><div><span style="white-space:pre-wrap">        </span>if (is_method(&quot;REGISTER&quot;))</div><div><span style="white-space:pre-wrap">        </span>{</div>
<div><span style="white-space:pre-wrap">                </span># authenticate the REGISTER requests (uncomment to enable auth)</div><div><span style="white-space:pre-wrap">                </span>if (!www_authorize(&quot;&quot;, &quot;subscriber&quot;))</div>

<div><span style="white-space:pre-wrap">                </span>{</div><div><span style="white-space:pre-wrap">                        </span>www_challenge(&quot;&quot;, &quot;0&quot;);</div><div><span style="white-space:pre-wrap">                        </span>exit;</div>
<div><span style="white-space:pre-wrap">                </span>}</div><div><span style="white-space:pre-wrap">                </span></div><div><span style="white-space:pre-wrap">                </span>if (!db_check_to()) </div><div><span style="white-space:pre-wrap">                </span>{</div>

<div><span style="white-space:pre-wrap">                        </span>sl_send_reply(&quot;403&quot;,&quot;Forbidden auth ID&quot;);</div><div><span style="white-space:pre-wrap">                        </span>exit;</div><div><span style="white-space:pre-wrap">                </span>}</div>

<div><br></div><div><span style="white-space:pre-wrap">                </span>if (!save(&quot;location&quot;))</div><div><span style="white-space:pre-wrap">                        </span>sl_reply_error();</div><div><br></div><div><span style="white-space:pre-wrap">                </span>exit;</div>

<div><span style="white-space:pre-wrap">        </span>}</div><div><br></div><div><span style="white-space:pre-wrap">        </span>if ($rU==NULL) {</div><div><span style="white-space:pre-wrap">                </span># request with no Username in RURI</div>

<div><span style="white-space:pre-wrap">                </span>sl_send_reply(&quot;484&quot;,&quot;Address Incomplete&quot;);</div><div><span style="white-space:pre-wrap">                </span>exit;</div><div><span style="white-space:pre-wrap">        </span>}</div>

<div><br></div><div><span style="white-space:pre-wrap">        </span># apply DB based aliases (uncomment to enable)</div><div><span style="white-space:pre-wrap">        </span>alias_db_lookup(&quot;dbaliases&quot;);</div><div><br>
</div><div><br></div><div><span style="white-space:pre-wrap">        </span>if(!dp_translate(&quot;0&quot;,&quot;$rU/$rU&quot;)){</div><div><span style="white-space:pre-wrap">        </span>  send_reply(&quot;420&quot;, &quot;Invalid Destination&quot;);</div>

<div><span style="white-space:pre-wrap">        </span>  exit;</div><div><span style="white-space:pre-wrap">        </span>}</div><div><span style="white-space:pre-wrap">        </span>xlog(&quot;$avp(s:dest)&quot;);</div><div><span style="white-space:pre-wrap">        </span>if ($avp(s:dest)==&quot;usrloc&quot;) {</div>

<div><span style="white-space:pre-wrap">        </span>  #Route to usrloc</div><div><span style="white-space:pre-wrap">        </span>  route(3);</div><div><span style="white-space:pre-wrap">        </span>}</div><div><span style="white-space:pre-wrap">        </span>if ($avp(s:dest)==&quot;pstn&quot;) {</div>

<div><span style="white-space:pre-wrap">        </span>  #route to pstn</div><div><span style="white-space:pre-wrap">        </span>  route(4);</div><div><span style="white-space:pre-wrap">        </span>}</div><div><span style="white-space:pre-wrap">        </span>if ($avp(s:dest)==&quot;media&quot;) {</div>

<div><span style="white-space:pre-wrap">        </span>  #route to media server</div><div><span style="white-space:pre-wrap">        </span>  route(5);</div><div><span style="white-space:pre-wrap">        </span>}</div><div><span style="white-space:pre-wrap">        </span>send_reply(&quot;420&quot;, &quot;Invalid Extension&quot;);</div>

<div><span style="white-space:pre-wrap">        </span>  exit;</div><div>      }</div><div><br></div><div><br></div><div><span style="white-space:pre-wrap">        </span>route[1] {</div><div><br></div><div><br></div><div>          load_balance(&quot;2&quot;,&quot;sip&quot;);</div>

<div>        }</div><div><br></div><div>        # LB function returns negative if no suitable destination (for requested resources) is found,</div><div>        # or if all destinations are full</div><div>        if ($retcode&lt;0) {</div>

<div>             sl_send_reply(&quot;500&quot;,&quot;Service full&quot;);</div><div>             exit;</div><div>        }</div><div><br></div><div>        xlog(&quot;Selected destination is: $du\n&quot;);</div><div><br>

</div><div>        # send it out</div><div>        if (!t_relay()) {</div><div>                sl_reply_error();</div><div>        }</div><div>#        }</div><div><br></div><div><br></div><div><span style="white-space:pre-wrap">        </span># for INVITEs enable some additional helper routes</div>

<div><br></div><div><br></div><div><span style="white-space:pre-wrap">                </span>if (is_method(&quot;INVITE&quot;)) {</div><div><span style="white-space:pre-wrap">                </span>t_on_branch(&quot;2&quot;);</div><div><span style="white-space:pre-wrap">                </span>t_on_reply(&quot;2&quot;);</div>

<div><span style="white-space:pre-wrap">                </span>t_on_failure(&quot;1&quot;);</div><div><span style="white-space:pre-wrap">        </span>     }</div><div><span style="white-space:pre-wrap">        </span>     if (!t_relay()) {</div>
<div><span style="white-space:pre-wrap">                </span>sl_reply_error();</div><div><span style="white-space:pre-wrap">        </span>     };</div><div><span style="white-space:pre-wrap">        </span>     exit;</div><div><br></div>
<div><br></div><div><span style="white-space:pre-wrap">        </span>xlog(&quot;Selected destination is: $du\n&quot;);</div><div><br></div><div>        # send it out</div><div><span style="white-space:pre-wrap">        </span>if (!t_relay()) {</div>

<div><span style="white-space:pre-wrap">                </span>sl_reply_error();</div><div><span style="white-space:pre-wrap">        </span>}</div><div><span style="white-space:pre-wrap">        </span>}</div><div><br></div><div>#Route for user lookups</div>

<div><br></div><div>route[3]{</div><div><span style="white-space:pre-wrap">        </span>if (!lookup(&quot;location&quot;, &quot;m&quot;)) {</div><div><span style="white-space:pre-wrap">        </span>switch ($retcode) {</div><div>
<span style="white-space:pre-wrap">        </span>case -1:</div><div><span style="white-space:pre-wrap">        </span>case -3:</div><div><span style="white-space:pre-wrap">                </span>t_newtran();</div><div><span style="white-space:pre-wrap">                </span>t_reply(&quot;404&quot;, &quot;Not Found&quot;);</div>

<div><span style="white-space:pre-wrap">                </span>exit;</div><div><span style="white-space:pre-wrap">        </span>case -2:</div><div><span style="white-space:pre-wrap">                </span>sl_send_reply(&quot;405&quot;, &quot;Method Not Allowed&quot;);</div>

<div><span style="white-space:pre-wrap">                </span>exit;<span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">        </span>}</div><div>      }</div><div><span style="white-space:pre-wrap">        </span># when routing via usrloc, log the missed calls also</div>

<div><span style="white-space:pre-wrap">        </span>setflag(2);</div><div><span style="white-space:pre-wrap">        </span>route(1);</div><div><span style="white-space:pre-wrap">        </span>}</div><div><br></div><div>route[4] {</div>
<div><span style="white-space:pre-wrap">        </span>#---- PSTN route ----#</div><div><span style="white-space:pre-wrap">        </span>if(!do_routing()){</div><div><span style="white-space:pre-wrap">                </span>send_reply(&quot;503&quot;, &quot;No rules found matching the URI prefix&quot;);</div>

<div><span style="white-space:pre-wrap">                </span>exit;</div><div><span style="white-space:pre-wrap">        </span>}</div><div><span style="white-space:pre-wrap">        </span># flag 10 - route to pstn</div><div><span style="white-space:pre-wrap">                </span>setflag(10);</div>

<div><span style="white-space:pre-wrap">                </span>route(1);</div><div><span style="white-space:pre-wrap">        </span>}</div><div><br></div><div>route[5] {</div><div><span style="white-space:pre-wrap">        </span>#---- Route to media servers ----#</div>

<div><span style="white-space:pre-wrap">        </span>xlog(&quot;route to media servers&quot;);</div><div><span style="white-space:pre-wrap">        </span>}</div><div><span style="white-space:pre-wrap">        </span>branch_route[2] {</div>

<div><span style="white-space:pre-wrap">                </span>xlog(&quot;new branch at $ru\n&quot;);</div><div><span style="white-space:pre-wrap">                </span>}</div><div><span style="white-space:pre-wrap">        </span>onreply_route[2] {</div>

<div><span style="white-space:pre-wrap">                </span>xlog(&quot;incoming reply\n&quot;);</div><div><span style="white-space:pre-wrap">                </span>}</div><div><span style="white-space:pre-wrap">        </span>failure_route[1] {</div>
<div><span style="white-space:pre-wrap">                </span>if (t_was_cancelled()) {</div><div><span style="white-space:pre-wrap">                </span>exit;</div><div><span style="white-space:pre-wrap">        </span>}</div><div><span style="white-space:pre-wrap">        </span>if(isflagset(10)){</div>

<div><span style="white-space:pre-wrap">                </span>if (use_next_gw()) {</div><div><span style="white-space:pre-wrap">                </span>xlog (&quot;next gateway $ru \n&quot;);</div><div><span style="white-space:pre-wrap">                </span>t_on_failure(&quot;1&quot;);</div>

<div><span style="white-space:pre-wrap">                </span>t_relay();</div><div><span style="white-space:pre-wrap">                </span>exit;</div><div><span style="white-space:pre-wrap">        </span>}</div><div><span style="white-space:pre-wrap">        </span>else {</div>

<div><span style="white-space:pre-wrap">                </span>t_reply(&quot;$rc&quot;, &quot;Service not available, no more gateways&quot;);</div><div><span style="white-space:pre-wrap">                </span>#t_reply(&quot;$T_reply_code&quot;);</div>

<div><span style="white-space:pre-wrap">                </span>exit;</div><div><span style="white-space:pre-wrap">                </span>}</div><div><span style="white-space:pre-wrap">        </span>}</div><div><span style="white-space:pre-wrap">        </span>}</div>

</div></div></div><div><br></div><div>Regards</div><div>Tushar</div>
</blockquote></div><br><br clear="all"><br>-- <br>Regards<br> <br>Tushar Jain<br><br> <br>&quot;two roads diverged in a wood, and I - I took the one less traveled by, and that has made all the difference&quot; <br> <br>--Robert Frost &quot; <br>

</div>