<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">hej Sajjad,<br>If you mean the "username" in Authorization header is invalid in step-3 you can do:<br>adjust your script to send "404 Not Found" since the proxy_authorize and www_ authorize return value is number and if this number is equal to <span class="emphasis"><em>-1 (invalid user)</em></span> - authentication user does
                                        not exist.<br>http://www.opensips.org/html/docs/modules/devel/auth_db.html#id250235<br><br>//Binan<br><br>--- On <b>Fri, 9/7/12, sajjad purmohseni <i>&lt;spurmohseni@yahoo.com&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: sajjad purmohseni &lt;spurmohseni@yahoo.com&gt;<br>Subject: Re: [OpenSIPS-Users] I never see 404 not found<br>To: "Muhammad Shahzad" &lt;shaheryarkh@googlemail.com&gt;, "users@lists.opensips.org" &lt;users@lists.opensips.org&gt;<br>Date: Friday, September 7, 2012, 7:45 AM<br><br><div id="yiv2079680247"><div><div style="color:#000;background-color:#fff;font-family:tahoma, new york, times, serif;font-size:10pt;"><div style="font-family:tahoma, 'new york', times, serif;font-size:10pt;"><span>Hello&nbsp;</span><span style="font-family:Arial;font-size:13px;">Muhammad; thanks for your&nbsp;pursuing;</span></div><div style="color:rgb(0, 0,
 0);font-size:13px;font-family:Arial;background-color:transparent;font-style:normal;"><span style="font-family:Arial;font-size:13px;"><br></span></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:Arial;background-color:transparent;font-style:normal;">Yes, second Invite or Register contains authentication header; this is the scenario I mean</div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:Arial;background-color:transparent;font-style:normal;"><br></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:Arial;
background-color:transparent;font-style:normal;">1&nbsp;<span class="yiv2079680247Apple-tab-span" style="white-space:pre;">                </span>client -------------------------------<span style="background-color:transparent;">Invite-----</span><span style="background-color:transparent;">-------</span><span style="background-color:transparent;">-------</span><span style="background-color:transparent;">------------&gt; &nbsp;proxy</span></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:Arial;background-color:transparent;font-style:normal;">2<span class="yiv2079680247Apple-tab-span" style="white-space:pre;">                </span>client &lt;-------------------<span style="background-color:transparent;">407 with nonce</span><span style="background-color:transparent;">-------</span><span style="background-color:transparent;">-------</span><span style="background-color:transparent;">-------</span><span style="background-color:transparent;">-------</span><span style="
background-color:transparent;">&nbsp;&nbsp;Proxy</span></div><div><span style="font-family:Arial;font-size:13px;">3</span><span class="yiv2079680247Apple-tab-span" style="font-family:Arial;font-size:13px;white-space:pre;">                </span><span style="font-family:Arial;font-size:13px;">client ------------Invite with calculated nonce</span><span style="font-family:Arial;font-size:13px;">-----</span><span style="font-family:Arial;font-size:13px;">-------</span><span style="font-family:Arial;font-size:13px;">-------&gt; Proxy</span></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:Arial;background-color:transparent;font-style:normal;"><span style="font-family:Arial;font-size:13px;">4<span class="yiv2079680247Apple-tab-span" style="white-space:pre;">                </span><span>client &lt;----------------100 giving a try---------------</span></span><span style="background-color:transparent;">-----</span><span style="background-color:transparent;">-------</span><span
 style="background-color:transparent;">------ Proxy</span></div><div style="font-family:tahoma, 'new york', times, serif;font-size:10pt;"><span style="font-size:18px;font-family:tahoma, times, serif;"></span></div><div style="font-size:10pt;"><div style="line-height:normal;font-size:16px;font-family:tahoma, 'new york', times, serif;"><span class="yiv2079680247yui_3_2_0_19_134694454405786 yiv2079680247yui_3_2_0_19_1347027985656323" style="font-family:tahoma, times, serif;font-size:13px;"><span style="font-family:Arial;">5<span class="yiv2079680247Apple-tab-span" style="white-space:pre;">                </span><span>client &lt;----------------180 ringing---------------------</span></span><span style="font-family:Arial;background-color:transparent;">-----</span><span style="font-family:Arial;background-color:transparent;">-------</span><span style="font-family:Arial;background-color:transparent;">------ Proxy</span></span></div><div style="
line-height:normal;color:rgb(0, 0, 0);font-size:13px;font-family:Arial;background-color:transparent;font-style:normal;" class="yiv2079680247yui_3_2_0_19_134702798565685"><span class="yiv2079680247yui_3_2_0_19_134694454405786 yiv2079680247yui_3_2_0_19_1347027985656323" style="font-family:tahoma, times, serif;font-size:13px;"><span style="font-family:Arial;background-color:transparent;"><br></span></span></div><div style="line-height:normal;color:rgb(0, 0, 0);font-size:13px;font-family:Arial;background-color:transparent;font-style:normal;" class="yiv2079680247yui_3_2_0_19_134702798565685"><span class="yiv2079680247yui_3_2_0_19_134694454405786 yiv2079680247yui_3_2_0_19_1347027985656323" style="font-family:tahoma, times, serif;font-size:13px;"><span style="font-family:Arial;background-color:transparent;">I mean when client uses invalid "From URI" in authentication header in the third step; proxy should send an "404 not found"; but as I see; server just sends
 407 message. As you know, if URI is valid, and calculated
 response in authentication header is invalid server sends 407 message too. This causes I cannot understand the URI binding is valid or not. I except if "from URI" binding is invalid in authentication process; server send me an 404 not found message. Is it possible and typical option in SIP proxy servers?&nbsp;</span></span></div><div style="line-height:normal;color:rgb(0, 0, 0);font-size:13px;font-family:Arial;background-color:transparent;font-style:normal;" class="yiv2079680247yui_3_2_0_19_134702798565685"><span class="yiv2079680247yui_3_2_0_19_134694454405786 yiv2079680247yui_3_2_0_19_1347027985656323" style="font-family:tahoma, times, serif;font-size:13px;"><span style="font-family:Arial;background-color:transparent;"><br></span></span></div><div style="line-height:normal;color:rgb(0, 0, 0);font-size:13px;font-family:Arial;background-color:transparent;font-style:normal;" class="yiv2079680247yui_3_2_0_19_134702798565685"><span
 class="yiv2079680247yui_3_2_0_19_134694454405786
 yiv2079680247yui_3_2_0_19_1347027985656323" style="font-family:tahoma, times, serif;font-size:13px;"><span style="font-family:Arial;background-color:transparent;">Thank you</span></span></div><div style="line-height:normal;color:rgb(0, 0, 0);font-size:13px;font-family:Arial;background-color:transparent;font-style:normal;" class="yiv2079680247yui_3_2_0_19_134702798565685"><span class="yiv2079680247yui_3_2_0_19_134694454405786" style="font-size:13px;font-family:tahoma, times, serif;"><span style="font-family:Arial;"><br class="yiv2079680247Apple-interchange-newline"></span>--------------------------------------------------</span></div><div style="line-height:normal;background-color:transparent;font-size:16px;font-family:tahoma, times, serif;"><span class="yiv2079680247yui_3_2_0_19_134694454405786" style="font-size:13px;"><span class="yiv2079680247Apple-tab-span" style="white-space:pre;">        </span>kind regards;</span></div><div
 style="line-height:normal;font-size:16px;font-family:tahoma, 'new york', times, serif;"><span class="yiv2079680247yui_3_2_0_19_134694454405790" style="font-size:13px;font-family:tahoma, times, serif;"><span class="yiv2079680247tab">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>Sajad Pourmohseni</span></div></div><div style="font-family:tahoma, 'new york', times, serif;font-size:10pt;"><span style="font-size:18px;font-family:tahoma, times, serif;">&nbsp;</span></div><div style="font-family:tahoma, 'new york', times, serif;font-size:10pt;"><br><br></div><div style="font-family:tahoma, 'new york', times, serif;font-size:10pt;"><br></div>  <div style="font-size:10pt;font-family:tahoma, 'new york', times, serif;"> <div style="font-size:12pt;font-family:'times new roman', 'new york', times, serif;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Muhammad Shahzad &lt;shaheryarkh@googlemail.com&gt;<br>
 <b><span style="font-weight:bold;">To:</span></b> sajjad purmohseni
 &lt;spurmohseni@yahoo.com&gt; <br><b><span style="font-weight:bold;">Cc:</span></b> "users@lists.opensips.org" &lt;users@lists.opensips.org&gt; <br> <b><span style="font-weight:bold;">Sent:</span></b> Friday, September 7, 2012 6:07 PM<br> <b><span style="font-weight:bold;">Subject:</span></b> Re: [OpenSIPS-Users] I never see 404 not found<br> </font> </div> <br><div id="yiv2079680247">Does second INVITE contains Proxy-Authorization header? Can you please paste SIP trace here?<div><br></div><div>Thank you.</div><div><br><br><div class="yiv2079680247gmail_quote">On Fri, Sep 7, 2012 at 2:22 PM, sajjad purmohseni <span dir="ltr">&lt;<a rel="nofollow" ymailto="mailto:spurmohseni@yahoo.com" target="_blank" href="/mc/compose?to=spurmohseni@yahoo.com">spurmohseni@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="yiv2079680247gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div style="font-size:10pt;font-family:tahoma, 'new york', times, serif;"><div><span>Hello&nbsp;</span><span style="font-size:small;font-family:Arial;">Muhammad</span><span style="font-size:13px;font-family:Arial;">&nbsp; thanks for reply.</span></div>
<div style="font-style:normal;font-size:13px;background-color:transparent;font-family:Arial;"><br></div><div>I think you mean invalidity of the "To URI"; But I am telling about invalidity of the "From URI" or the caller contact. In authentication process I expect to receive "404 not found" after sending second Invite or Register messages; but I receive 401 or 407. Is int normal action by server or it can send "404 not found" about invalid "From URI" to tell client that the contact URI is invalid?</div>
<div><span style="font-size:18px;font-family:tahoma, times, serif;"></span></div><div><div><span style="font-size:13px;font-family:tahoma, times, serif;"><br>--------------------------------------------------</span></div><div style="line-height:normal;background-color:transparent;font-size:16px;font-family:tahoma, times, serif;">
<span style="font-size:13px;"><span style="white-space:pre-wrap;">        </span>kind regards;</span></div><div style="font-family:tahoma,;line-height:normal;font-size:16px;"><span style="font-size:13px;font-family:tahoma, times, serif;"><span>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>Sajad Pourmohseni</span></div>
</div><div><span style="font-size:18px;font-family:tahoma, times, serif;">&nbsp;</span></div><div class="yiv2079680247hm yiv2079680247HOEnZb"><div><br><br></div><div><br></div>  </div><div style="font-family:tahoma,;font-size:10pt;">
<div class="yiv2079680247hm yiv2079680247HOEnZb"> </div><div style="font-size:12pt;"><div class="yiv2079680247hm yiv2079680247HOEnZb"> <div dir="ltr"> <font face="Arial"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Muhammad Shahzad &lt;<a rel="nofollow" ymailto="mailto:shaheryarkh@googlemail.com" target="_blank" href="/mc/compose?to=shaheryarkh@googlemail.com">shaheryarkh@googlemail.com</a>&gt;<br>
 <b><span style="font-weight:bold;">To:</span></b> sajjad purmohseni &lt;<a rel="nofollow" ymailto="mailto:spurmohseni@yahoo.com" target="_blank" href="/mc/compose?to=spurmohseni@yahoo.com">spurmohseni@yahoo.com</a>&gt;; OpenSIPS users mailling list &lt;<a rel="nofollow" ymailto="mailto:users@lists.opensips.org" target="_blank" href="/mc/compose?to=users@lists.opensips.org">users@lists.opensips.org</a>&gt; <br>
 <b><span style="font-weight:bold;">Sent:</span></b> Friday, September 7, 2012 1:45 PM<br> <b><span style="font-weight:bold;">Subject:</span></b> Re: [OpenSIPS-Users] I never see 404 not found<br> </font> </div></div><div><div class="yiv2079680247h5">
 <br>
<div>Yes because you have enabled proxy authentication of every method except REGISTER. Here is where you are doing this.<div><br></div><div><span># authenticate if from local subscriber (uncomment to enable auth)</span><br>

<span>&nbsp;# authenticate all initial non-REGISTER request that pretend to be</span><br>
<span>&nbsp;# generated by local subscriber (domain from FROM URI is local)</span><br>
<span>&nbsp;if (!(method=="REGISTER") &amp;&amp; from_uri==myself) /*no multidomain version*/</span><br>
<span>&nbsp;##if (!(method=="REGISTER") &amp;&amp; is_from_local())&nbsp; /*multidomain version*/</span><br>
<span>&nbsp;{</span><br>
<span>&nbsp;&nbsp;if (!proxy_authorize("", "subscriber")) {</span><br>
<span>&nbsp;&nbsp;&nbsp;proxy_challenge("", "0");</span><br>
<span>&nbsp;&nbsp;&nbsp;exit;</span><br>
<span>&nbsp;&nbsp;}</span></div><div><br></div><div>This gets called BEFORE you check for destination, which is right way to do it. The caller should authenticate itself before callee is checked.</div>
<div><br></div><div>Thank you.</div><div><br><br><div>On Thu, Sep 6, 2012 at 5:07 PM, sajjad purmohseni <span dir="ltr">&lt;<a rel="nofollow" ymailto="mailto:spurmohseni@yahoo.com" target="_blank" href="/mc/compose?to=spurmohseni@yahoo.com">spurmohseni@yahoo.com</a>&gt;</span> wrote:<br>

<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div style="font-size:12pt;font-family:tahoma,;"><div><span></span></div>

<div>Hi all</div>
<div>&nbsp;</div>
<div>I&nbsp;use sipp tool&nbsp;accompanying opensips server to&nbsp;generate normal&nbsp;SIP traffic. I successfuly enable authentication in opensips; added some users in database and performed&nbsp;authentication proccess in register and invite requests. I see valid authentication as username and passwords are valid and failure in authentication as password is invalid. After sending first invite and receiving 407 (proxy auth req) message; In my scenario an Invite message is sent with authentication header containing valid nonce. My problem is that when URI of re-Invite request is invalid I receive 407 instead of 404 (not found). </div>


<div>I'm so <span>grateful about any help.</span></div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>This is my opensips config file (opensips.cfg):</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>#<br># $Id: opensips.cfg 5503 2009-03-22 16:22:32Z bogdan_iancu $<br>#<br># OpenSIPS basic configuration script<br>#&nbsp;&nbsp;&nbsp;&nbsp; by Anca Vamanu &lt;<a rel="nofollow" ymailto="mailto:anca@voice-system.ro" target="_blank" href="/mc/compose?to=anca@voice-system.ro">anca@voice-system.ro</a>&gt;<br>

#<br># Please refer to the Core CookBook at:<br>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a rel="nofollow" target="_blank" href="http://www.opensips.org/index.php?n=Resources.DocsCookbooks">http://www.opensips.org/index.php?n=Resources.DocsCookbooks</a><br># for a explanation of possible statements, functions and parameters.<br>

#</div>
<div><br>####### Global Parameters #########</div>
<div>#debug=3<br>log_stderror=no<br>log_facility=LOG_LOCAL0</div>
<div>fork=yes<br>children=4</div>
<div>/* uncomment the following lines to enable debugging */<br>debug=6<br>#fork=no<br>#log_stderror=yes</div>
<div>/* uncomment the next line to disable TCP (default on) */<br>#disable_tcp=yes</div>
<div>/* uncomment the next line to enable the auto temporary blacklisting of <br>&nbsp;&nbsp; not available destinations (default disabled) */<br>#disable_dns_blacklist=no</div>
<div>/* uncomment the next line to enable IPv6 lookup after IPv4 dns <br>&nbsp;&nbsp; lookup failures (default disabled) */<br>#dns_try_ipv6=yes</div>
<div>/* uncomment the next line to disable the auto discovery of local aliases<br>&nbsp;&nbsp; based on revers DNS on IPs (default on) */<br>#auto_aliases=no</div>
<div>/* uncomment the following lines to enable TLS support&nbsp; (default off) */<br>#disable_tls = no<br>#listen = tls:your_IP:5061<br>#tls_verify_server = 1<br>#tls_verify_client = 1<br>#tls_require_client_certificate = 0<br>

#tls_method = TLSv1<br>#tls_certificate = "/usr/local/etc/opensips/tls/user/user-cert.pem"<br>#tls_private_key = "/usr/local/etc/opensips/tls/user/user-privkey.pem"<br>#tls_ca_list = "/usr/local/etc/opensips/tls/user/user-calist.pem"</div>


<div>port=5060</div>
<div>/* uncomment and configure the following line if you want opensips to <br>&nbsp;&nbsp; bind on a specific interface/port/proto (default bind on all available) */<br>listen=udp:<a rel="nofollow" target="_blank"  href="http://194.225.238.244:5060/">194.225.238.244:5060</a></div>


<div><br>####### Modules Section ########</div>
<div>#set module path<br>mpath="/usr/local/lib64/opensips/modules/"</div>
<div>/* uncomment next line for MySQL DB support */<br>loadmodule "db_mysql.so"<br>loadmodule "signaling.so"<br>loadmodule "sl.so"<br>loadmodule "tm.so"<br>loadmodule "rr.so"<br>

loadmodule "maxfwd.so"<br>loadmodule "usrloc.so"<br>loadmodule "registrar.so"<br>loadmodule "textops.so"<br>loadmodule "mi_fifo.so"<br>loadmodule "uri_db.so"<br>

loadmodule "uri.so"<br>loadmodule "xlog.so"<br>loadmodule "acc.so"<br>/* uncomment next lines for MySQL based authentication support <br>&nbsp;&nbsp; NOTE: a DB (like db_mysql) module must be also loaded */<br>

loadmodule "auth.so"<br>loadmodule "auth_db.so"<br>/* uncomment next line for aliases support<br>&nbsp;&nbsp; NOTE: a DB (like db_mysql) module must be also loaded */<br>#loadmodule "alias_db.so"<br>/* uncomment next line for multi-domain support<br>

&nbsp;&nbsp; NOTE: a DB (like db_mysql) module must be also loaded<br>&nbsp;&nbsp; NOTE: be sure and enable multi-domain support in all used
 modules<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (see "multi-module params" section ) */<br>#loadmodule "domain.so"<br>/* uncomment the next two lines for presence server support<br>&nbsp;&nbsp; NOTE: a DB (like db_mysql) module must be also loaded */<br>

#loadmodule "presence.so"<br>#loadmodule "presence_xml.so"</div>
<div><br># ----------------- setting module-specific parameters ---------------</div>
<div><br># ----- mi_fifo params -----<br>modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")</div>
<div><br># ----- rr params -----<br># add value to ;lr param to cope with most of the UAs<br>modparam("rr", "enable_full_lr", 1)<br># do not append from tag to the RR (no need for this script)<br>modparam("rr", "append_fromtag", 0)</div>


<div><br># ----- registrar params -----<br>modparam("registrar", "method_filtering", 1)<br>/* uncomment the next line to disable parallel forking via location */<br># modparam("registrar", "append_branches", 0)<br>

/* uncomment the next line not to allow more than 10 contacts per AOR */<br>#modparam("registrar", "max_contacts", 10)</div>
<div><br># ----- usrloc params -----<br>modparam("usrloc", "db_mode",&nbsp;&nbsp; 0)<br>/* uncomment the following lines if you want to enable DB persistency<br>&nbsp;&nbsp; for location entries */<br>#modparam("usrloc", "db_mode",&nbsp;&nbsp; 2)<br>

#modparam("usrloc", "db_url",<br>#&nbsp;"mysql://opensips:opensipsrw@localhost/opensips")</div>
<div><br># ----- uri_db params -----<br>/* by default we disable the DB support in the module as we do not need it<br>&nbsp;&nbsp; in this configuration */<br>modparam("uri_db", "use_uri_table", 0)<br>modparam("uri_db", "db_url", "")</div>


<div><br># ----- acc params -----<br>/* what sepcial events should be accounted ? */<br>modparam("acc", "early_media", 1)<br>modparam("acc", "report_ack", 1)<br>modparam("acc", "report_cancels", 1)<br>

/* by default ww do not adjust the direct of the sequential requests.<br>&nbsp;&nbsp; if you enable this parameter, be sure the enable "append_fromtag"<br>&nbsp;&nbsp; in "rr" module */<br>modparam("acc", "detect_direction", 0)<br>

/* account triggers (flags) */<br>modparam("acc", "failed_transaction_flag", 3)<br>modparam("acc", "log_flag", 1)<br>modparam("acc", "log_missed_flag", 2)<br>/* uncomment the following lines to enable DB accounting also */<br>

modparam("acc", "db_flag", 1)<br>modparam("acc", "db_missed_flag", 2)</div>
<div><br># ----- auth_db params -----<br>/* uncomment the following lines if you want to enable the DB based<br>&nbsp;&nbsp; authentication */<br>modparam("auth_db", "calculate_ha1", yes)<br>modparam("auth_db", "password_column", "password")<br>

modparam("auth_db", "db_url",<br>&nbsp;"mysql://opensips:opensipsrw@localhost/opensips")<br>modparam("auth_db", "load_credentials", "")</div>
<div><br># ----- alias_db params -----<br>/* uncomment the following lines if you want to enable the DB based<br>&nbsp;&nbsp; aliases */<br>#modparam("alias_db", "db_url",<br>#&nbsp;"mysql://opensips:opensipsrw@localhost/opensips")</div>


<div><br># ----- domain params -----<br>/* uncomment the following lines to enable multi-domain detection<br>&nbsp;&nbsp; support */<br>#modparam("domain", "db_url",<br>#&nbsp;"mysql://opensips:opensipsrw@localhost/opensips")<br>

#modparam("domain", "db_mode", 1)&nbsp;&nbsp; # Use caching</div>
<div><br># ----- multi-module params -----<br>/* uncomment the following line if you want to enable multi-domain support<br>&nbsp;&nbsp; in the modules (dafault off) */<br>#modparam("alias_db|auth_db|usrloc|uri_db", "use_domain", 1)</div>


<div><br># ----- presence params -----<br>/* uncomment the following lines if you want to enable presence */<br>#modparam("presence|presence_xml", "db_url",<br>#&nbsp;"mysql://opensips:opensipsrw@localhost/opensips")<br>

#modparam("presence_xml", "force_active", 1)<br>#modparam("presence", "server_address", "sip:<a rel="nofollow" target="_blank"  href="http://192.168.1.2:5060/">192.168.1.2:5060</a>")</div>


<div><br>####### Routing Logic ########</div>
<div><br># main request routing logic</div>
<div>route{</div>
<div>&nbsp;if (!mf_process_maxfwd_header("10")) {<br>&nbsp;&nbsp;sl_send_reply("483","Too Many Hops");<br>&nbsp;&nbsp;exit;<br>&nbsp;}</div>
<div>&nbsp;if (has_totag()) {<br>&nbsp;&nbsp;# sequential request withing a dialog should<br>&nbsp;&nbsp;# take the path determined by record-routing<br>&nbsp;&nbsp;if (loose_route()) {<br>&nbsp;&nbsp;&nbsp;if (is_method("BYE")) {<br>&nbsp;&nbsp;&nbsp;&nbsp;setflag(1); # do accounting ...<br>

&nbsp;&nbsp;&nbsp;&nbsp;setflag(3); # ... even if the transaction fails<br>&nbsp;&nbsp;&nbsp;} else if (is_method("INVITE")) {<br>&nbsp;&nbsp;&nbsp;&nbsp;# even if in most of the cases is useless, do RR for<br>&nbsp;&nbsp;&nbsp;&nbsp;# re-INVITEs alos, as some buggy clients do change route set<br>

&nbsp;&nbsp;&nbsp;&nbsp;# during the dialog.<br>&nbsp;&nbsp;&nbsp;&nbsp;record_route();<br>&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;# route it out to whatever destination was set by loose_route()<br>&nbsp;&nbsp;&nbsp;# in $du (destination URI).<br>&nbsp;&nbsp;&nbsp;route(1);<br>&nbsp;&nbsp;} else {<br>&nbsp;&nbsp;&nbsp;/* uncomment the following lines if
 you want to enable presence */<br>&nbsp;&nbsp;&nbsp;##if (is_method("SUBSCRIBE") &amp;&amp; $rd == "your.server.ip.address") {<br>&nbsp;&nbsp;&nbsp;##&nbsp;# in-dialog subscribe requests<br>&nbsp;&nbsp;&nbsp;##&nbsp;route(2);<br>&nbsp;&nbsp;&nbsp;##&nbsp;exit;<br>&nbsp;&nbsp;&nbsp;##}<br>

&nbsp;&nbsp;&nbsp;if ( is_method("ACK") ) {<br>&nbsp;&nbsp;&nbsp;&nbsp;if ( t_check_trans() ) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# non loose-route, but stateful ACK; must be an ACK after <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# a 487 or e.g. 404 from upstream server<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;t_relay();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit;<br>

&nbsp;&nbsp;&nbsp;&nbsp;} else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# ACK without matching transaction -&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# ignore and discard<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;sl_send_reply("404","Not
 here");<br>&nbsp;&nbsp;}<br>&nbsp;&nbsp;exit;<br>&nbsp;}</div>
<div>&nbsp;#initial requests</div>
<div>&nbsp;# CANCEL processing<br>&nbsp;if (is_method("CANCEL"))<br>&nbsp;{<br>&nbsp;&nbsp;if (t_check_trans())<br>&nbsp;&nbsp;&nbsp;t_relay();<br>&nbsp;&nbsp;exit;<br>&nbsp;}</div>
<div>&nbsp;t_check_trans();</div>
<div>&nbsp;# authenticate if from local subscriber (uncomment to enable auth)<br>&nbsp;# authenticate all initial non-REGISTER request that pretend to be<br>&nbsp;# generated by local subscriber (domain from FROM URI is local)<br>&nbsp;if (!(method=="REGISTER") &amp;&amp; from_uri==myself) /*no multidomain version*/<br>

&nbsp;##if (!(method=="REGISTER") &amp;&amp; is_from_local())&nbsp; /*multidomain version*/<br>&nbsp;{<br>&nbsp;&nbsp;if (!proxy_authorize("", "subscriber")) {<br>&nbsp;&nbsp;&nbsp;proxy_challenge("", "0");<br>
&nbsp;&nbsp;&nbsp;exit;<br>
&nbsp;&nbsp;}<br>&nbsp;&nbsp;if (!check_from()) {<br>&nbsp;&nbsp;&nbsp;sl_send_reply("403","Forbidden auth ID");<br>&nbsp;&nbsp;&nbsp;exit;<br>&nbsp;&nbsp;}<br>&nbsp;<br>&nbsp;&nbsp;consume_credentials();<br>&nbsp;&nbsp;# caller authenticated<br>&nbsp;}</div>
<div>&nbsp;# preloaded route checking<br>&nbsp;if (loose_route()) {<br>&nbsp;&nbsp;xlog("L_ERR",<br>&nbsp;&nbsp;"Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");<br>&nbsp;&nbsp;if (!is_method("ACK"))<br>&nbsp;&nbsp;&nbsp;sl_send_reply("403","Preload Route denied");<br>

&nbsp;&nbsp;exit;<br>&nbsp;}</div>
<div>&nbsp;# record routing<br>&nbsp;if (!is_method("REGISTER|MESSAGE"))<br>&nbsp;&nbsp;record_route();</div>
<div>&nbsp;# account only INVITEs<br>&nbsp;if (is_method("INVITE")) {<br>&nbsp;&nbsp;setflag(1); # do accounting<br>&nbsp;}<br>&nbsp;if (!uri==myself)<br>&nbsp;## replace with following line if multi-domain support is used<br>&nbsp;##if (!is_uri_host_local())<br>

&nbsp;{<br>&nbsp;&nbsp;append_hf("P-hint: outbound\r\n"); <br>&nbsp;&nbsp;# if you have some interdomain connections via TLS<br>&nbsp;&nbsp;##if($rd=="<a rel="nofollow" target="_blank" href="http://tls_domain1.net/">tls_domain1.net</a>") {<br>
&nbsp;&nbsp;##&nbsp;t_relay("tls:<a rel="nofollow" target="_blank" href="http://domain1.net/">domain1.net</a>");<br>
&nbsp;&nbsp;##&nbsp;exit;<br>&nbsp;&nbsp;##} else if($rd=="<a rel="nofollow" target="_blank" href="http://tls_domain2.net/">tls_domain2.net</a>") {<br>&nbsp;&nbsp;##&nbsp;t_relay("tls:<a rel="nofollow" target="_blank" href="http://domain2.net/">domain2.net</a>");<br>
&nbsp;&nbsp;##&nbsp;exit;<br>
&nbsp;&nbsp;##}<br>&nbsp;&nbsp;route(1);<br>&nbsp;}</div>
<div>&nbsp;# requests for my domain</div>
<div>&nbsp;## uncomment this if you want to enable presence server <br>&nbsp;##&nbsp;&nbsp; and comment the next 'if' block<br>&nbsp;##&nbsp;&nbsp; NOTE: uncomment also the definition of route[2] from&nbsp; below<br>&nbsp;##if( is_method("PUBLISH|SUBSCRIBE"))<br>

&nbsp;##&nbsp;&nbsp;route(2);</div>
<div>&nbsp;if (is_method("PUBLISH"))<br>&nbsp;{<br>&nbsp;&nbsp;sl_send_reply("503", "Service Unavailable");<br>&nbsp;&nbsp;exit;<br>&nbsp;}<br>&nbsp;</div>
<div>&nbsp;if (is_method("REGISTER"))<br>&nbsp;{<br>&nbsp;&nbsp;# authenticate the REGISTER requests (uncomment to enable auth)<br>&nbsp;&nbsp;if (!www_authorize("", "subscriber"))<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;www_challenge("", "0");<br>

&nbsp;&nbsp;&nbsp;exit;<br>&nbsp;&nbsp;}</div>
<div>&nbsp;&nbsp;if (!check_to()) <br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;sl_send_reply("403","Forbidden auth ID");<br>&nbsp;&nbsp;&nbsp;exit;<br>&nbsp;&nbsp;}</div>
<div>&nbsp;&nbsp;if (!save("location"))<br>&nbsp;&nbsp;&nbsp;sl_reply_error();</div>
<div>&nbsp;&nbsp;exit;<br>&nbsp;}</div>
<div>&nbsp;if ($rU==NULL) {<br>&nbsp;&nbsp;# request with no Username in RURI<br>&nbsp;&nbsp;sl_send_reply("484","Address Incomplete");<br>&nbsp;&nbsp;exit;<br>&nbsp;}</div>
<div>&nbsp;# apply DB based aliases (uncomment to enable)<br>&nbsp;##alias_db_lookup("dbaliases");</div>
<div>&nbsp;if (!lookup("location")) {<br>&nbsp;&nbsp;switch ($retcode) {<br>&nbsp;&nbsp;&nbsp;case -1:<br>&nbsp;&nbsp;&nbsp;case -3:<br>&nbsp;&nbsp;&nbsp;&nbsp;t_newtran();<br>&nbsp;&nbsp;&nbsp;&nbsp;t_reply("404", "Not Found");<br>&nbsp;&nbsp;&nbsp;&nbsp;exit;<br>&nbsp;&nbsp;&nbsp;case -2:<br>&nbsp;&nbsp;&nbsp;&nbsp;sl_send_reply("405", "Method Not Allowed");<br>

&nbsp;&nbsp;&nbsp;&nbsp;exit;<br>&nbsp;&nbsp;}<br>&nbsp;}</div>
<div>&nbsp;# when routing via usrloc, log the missed calls also<br>&nbsp;setflag(2);</div>
<div>&nbsp;route(1);<br>}</div>
<div><br>route[1] {<br>&nbsp;# for INVITEs enable some additional helper routes<br>&nbsp;if (is_method("INVITE")) {<br>&nbsp;&nbsp;t_on_branch("2");<br>&nbsp;&nbsp;t_on_reply("2");<br>&nbsp;&nbsp;t_on_failure("1");<br>&nbsp;}</div>


<div>&nbsp;if (!t_relay()) {<br>&nbsp;&nbsp;sl_reply_error();<br>&nbsp;};<br>&nbsp;exit;<br>}</div>
<div><br># Presence route<br>/* uncomment the whole following route for enabling presence<br>&nbsp;&nbsp; NOTE: do not forget to enable the call of this route from the main<br>&nbsp;&nbsp;&nbsp;&nbsp; route */<br>##route[2]<br>##{<br>##&nbsp;if (!t_newtran())<br>

##&nbsp;{<br>##&nbsp;&nbsp;sl_reply_error();<br>##&nbsp;&nbsp;exit;<br>##&nbsp;};<br>##<br>##&nbsp;if(is_method("PUBLISH"))<br>##&nbsp;{<br>##&nbsp;&nbsp;handle_publish();<br>##&nbsp;&nbsp;t_release();<br>##&nbsp;}<br>##&nbsp;else<br>##&nbsp;if( is_method("SUBSCRIBE"))<br>##&nbsp;{<br>

##&nbsp;&nbsp;handle_subscribe();<br>##&nbsp;&nbsp;t_release();<br>##&nbsp;}<br>##<br>##&nbsp;exit;<br>##}</div>
<div><br>branch_route[2] {<br>&nbsp;xlog("new branch at $ru\n");<br>}</div>
<div><br>onreply_route[2] {<br>&nbsp;xlog("incoming reply\n");<br>}</div>
<div><br>failure_route[1] {<br>&nbsp;if (t_was_cancelled()) {<br>&nbsp;&nbsp;exit;<br>&nbsp;}</div>
<div>&nbsp;# uncomment the following lines if you want to block client <br>&nbsp;# redirect based on 3xx replies.<br>&nbsp;##if (t_check_status("3[0-9][0-9]")) {<br>&nbsp;##t_reply("404","Not found");<br>&nbsp;##&nbsp;exit;<br>

&nbsp;##}</div>
<div>&nbsp;# uncomment the following lines if you want to redirect the failed <br>&nbsp;# calls to a different new destination<br>&nbsp;##if (t_check_status("486|408")) {<br>&nbsp;##&nbsp;sethostport("<a rel="nofollow" target="_blank"  href="http://192.168.2.100:5060/">192.168.2.100:5060</a>");<br>

&nbsp;##&nbsp;# do not set the missed call flag again<br>&nbsp;##&nbsp;t_relay();<br>&nbsp;##}<br>}</div>
<div><span style="font-size:18px;font-family:tahoma, times, serif;"></span></div>
<div><span style="font-size:18px;font-family:tahoma, times, serif;"><span style="BACKGROUND-COLOR:transparent;"></span><br><br><br></span></div></div></div><br>_______________________________________________<br>
Users mailing list<br>
<a rel="nofollow" ymailto="mailto:Users@lists.opensips.org" target="_blank" href="/mc/compose?to=Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a rel="nofollow" target="_blank" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Muhammad Shahzad<br>-----------------------------------<br>CISCO Rich Media Communication Specialist (CRMCS)<br>CISCO Certified Network Associate (CCNA)<br>

Cell: <a rel="nofollow">+92 334 422 40 88</a><br>MSN: <a rel="nofollow" ymailto="mailto:shari_786pk@hotmail.com" target="_blank" href="/mc/compose?to=shari_786pk@hotmail.com">shari_786pk@hotmail.com</a><br>Email: <a rel="nofollow" ymailto="mailto:shaheryarkh@googlemail.com" target="_blank" href="/mc/compose?to=shaheryarkh@googlemail.com">shaheryarkh@googlemail.com</a><br>

</div>
</div><br><br> </div></div></div> </div>  </div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Muhammad Shahzad<br>-----------------------------------<br>CISCO Rich Media Communication Specialist (CRMCS)<br>
CISCO Certified Network Associate (CCNA)<br>Cell: +92 334 422 40 88<br>MSN: <a rel="nofollow" ymailto="mailto:shari_786pk@hotmail.com" target="_blank" href="/mc/compose?to=shari_786pk@hotmail.com">shari_786pk@hotmail.com</a><br>Email: <a rel="nofollow" ymailto="mailto:shaheryarkh@googlemail.com" target="_blank" href="/mc/compose?to=shaheryarkh@googlemail.com">shaheryarkh@googlemail.com</a><br>

</div>
</div><br><br> </div> </div>  </div></div></div><br>-----Inline Attachment Follows-----<br><br><div class="plainMail">_______________________________________________<br>Users mailing list<br><a ymailto="mailto:Users@lists.opensips.org" href="/mc/compose?to=Users@lists.opensips.org">Users@lists.opensips.org</a><br><a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br></div></blockquote></td></tr></table>