<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7652.5">
<TITLE>Why if (uri==myself) is always true? (about openser call number pstn)</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">Hello everybody,</FONT>
</P>
<P> <FONT SIZE=2 FACE="Arial">I want that openser can call a PSTN number for example: 0296487631. But in the request of INVITE, I see that the callee is always </FONT></P>
<P><FONT SIZE=2 FACE="Arial">0296487631@opensersip.test.machine ( and opensersip.test.machine is my sip server), that means the (uri==myself) is always ture. So this request of INVITE can not reache the gateway of PSTN. Anybody can give me some advices? This is my openser.cfg and I use openser+radius+mysql. </FONT></P>
<P><FONT SIZE=2 FACE="Arial">Thank you very much!!!</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Yin</FONT><SPAN LANG="pl"></SPAN>
</P>
<BR>
<BR>
<P><SPAN LANG="pl"><FONT SIZE=2 FACE="宋体">#</FONT></SPAN>
<BR><SPAN LANG="pl"><FONT SIZE=2 FACE="宋体"># $Id: openser.cfg 1827 2007-03-12 15:22:53Z bogdan_iancu $</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># simple quick-start config script</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># Please refer to the Core CookBook at </FONT></SPAN><A HREF="http://www.openser.org/dokuwiki/doku.php"><SPAN LANG="en-gb"><U><FONT COLOR="#0000FF" SIZE=2 FACE="宋体">http://www.openser.org/dokuwiki/doku.php</FONT></U></SPAN></A><SPAN LANG="en-gb"></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># for a explanation of possible statements, functions and parameters.</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># ----------- global configuration parameters ------------------------</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">debug=3 # debug level (cmd line: -dddddddddd)</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">fork=yes</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">log_stderror=no # (cmd line: -E)</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">children=4</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># Uncomment these lines to enter debugging mode </FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#fork=no</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#log_stderror=yes</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">port=5060</FONT></SPAN>
</P>
<BR>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># uncomment the following lines for TLS support</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#disable_tls = 0</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#listen = tls:your_IP:5061</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#tls_verify_server = 1</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#tls_verify_client = 1</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#tls_require_client_certificate = 0</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#tls_method = TLSv1</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#tls_certificate = "/usr/local/etc/openser/tls/user/user-cert.pem"</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#tls_private_key = "/usr/local/etc/openser/tls/user/user-privkey.pem"</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#tls_ca_list = "/usr/local/etc/openser/tls/user/user-calist.pem"</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># ------------------ module loading ----------------------------------</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#set module path</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">mpath="/usr/local/lib/openser/modules/"</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># Uncomment this if you want to use SQL database</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">loadmodule "mysql.so"</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">loadmodule "sl.so"</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">loadmodule "tm.so"</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">loadmodule "rr.so"</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">loadmodule "maxfwd.so"</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">loadmodule "usrloc.so"</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">loadmodule "registrar.so"</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">loadmodule "textops.so"</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">loadmodule "mi_fifo.so"</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># Uncomment this if you want digest authentication</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># mysql.so must be loaded !</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">loadmodule "auth.so"</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#loadmodule "auth_db.so"</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">loadmodule "auth_radius.so"</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">loadmodule "group_radius.so"</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">loadmodule "acc.so"</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># ----------------- setting module-specific parameters ---------------</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># -- mi_fifo params --</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># -- usrloc params --</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">modparam("usrloc", "db_mode", 0)</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">modparam("auth_radius|group_radius|acc", "radius_config", "/usr/local/etc/radiusclient-ng/radiusclient.conf")</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">modparam("group_radius","use_domain", 0)</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">modparam("auth_radius", "service_type", 15)</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">modparam("auth", "secret", "testing123")</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">modparam("acc", "radius_flag", 1)</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">modparam("acc", "radius_missed_flag", 2)</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">modparam("acc", "service_type", 15)</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">modparam("acc", "radius_extra", "User-Name=$fU;Sip-Src-IP=$si;Sip-Src-Port=$sp")</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># Uncomment this if you want to use SQL database </FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># for persistent storage and comment the previous line</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#modparam("usrloc", "db_mode", 2)</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># -- auth params --</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># Uncomment if you are using auth module</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#modparam("auth_db", "calculate_ha1", yes)</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># If you set "calculate_ha1" parameter to yes (which true in this config), </FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># uncomment also the following parameter)</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#modparam("auth_db", "password_column", "password")</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># -- rr params --</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># add value to ;lr param to make some broken UAs happy</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">modparam("rr", "enable_full_lr", 1)</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># ------------------------- request routing logic -------------------</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># main routing logic</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">route{</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># initial sanity checks -- messages with</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># max_forwards==0, or excessively long requests</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">if (!mf_process_maxfwd_header("10")) {</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">sl_send_reply("483","Too Many Hops");</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">exit;</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">};</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">if (msg:len >= 2048 ) {</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">sl_send_reply("513", "Message too big");</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">exit;</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">};</FONT></SPAN>
<BR><SPAN LANG="en-gb"> </SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#-------set flag for Radius Accounting</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#if (!method=="OPTIONS") setflag(3);</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#if (method=="INVITE"){</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># log (1, "INVITE MESSAGE RECEIVED - START ACC\n");</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># setflag(1);</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># setflag(2);</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">#};</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">if (method=="BYE"){</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">log (1, "BYE - STOP ACCOUNTING\n");</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">setflag(1);</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">};</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">if (method=="CANCEL"){</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">log (1, "CANCEL -STOP ACCOUNTING\n");</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">setflag(1);</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">};</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># we record-route all messages -- to make sure that</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># subsequent messages will go through our proxy; that's</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># particularly good if upstream and downstream entities</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># use different transport protocol</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">if (!method=="REGISTER")</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">record_route();</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># subsequent messages withing a dialog should take the</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># path determined by record-routing</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">if (loose_route()) {</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># mark routing logic in request</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">append_hf("P-hint: rr-enforced\r\n"); </FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">route(1);</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">};</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">if (!uri==myself) {</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># mark routing logic in request</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># append_hf("P-hint: outbound\r\n"); </FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># if you have some interdomain connections via TLS</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">#if(uri=~"@tls_domain1.net") {</FONT></SPAN>
<BR><SPAN LANG="en-gb"> </SPAN><SPAN LANG="fr"> <FONT SIZE=2 FACE="宋体"># t_relay("tls:domain1.net");</FONT></SPAN>
<BR><SPAN LANG="fr"> </SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># exit;</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">#} else if(uri=~"@tls_domain2.net") {</FONT></SPAN>
<BR><SPAN LANG="en-gb"> </SPAN><SPAN LANG="fr"> <FONT SIZE=2 FACE="宋体"># t_relay("tls:domain2.net");</FONT></SPAN>
<BR><SPAN LANG="fr"> </SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># exit;</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">#}</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># route(1);</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">if (method=="ACK") {</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">route(1);</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">exit;</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">}else </FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">if (method=="CANCEL"){</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">route(1);</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">exit;</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">}else</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">if (method=="INVITE")</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">{</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"> route(3);</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"> exit;</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">}else</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"> if (method=="REGISTER")</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"> {</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"> route(2);</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"> exit;</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"> };</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">lookup("aliases");</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">if (uri!=myself)</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">{</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"> route(1);</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"> exit;</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">};</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">if (!lookup("location"))</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">{</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"> sl_send_reply("404","Not User PSTN Found");</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"> exit;</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">};</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">route(1);</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">}</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># if the request is for other domain use UsrLoc</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># (in case, it does not work, use the following command</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># with proper names and addresses in it)</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">if (uri==myself) {</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">if (method=="REGISTER") {</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># Uncomment this if you want to use digest authentication</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">if (!radius_www_authorize("opensersip.test.machine")) {</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">www_challenge("opensersip.test.machine", "0");</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">exit;</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">};</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">save("location");</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">exit;</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">};</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"> if (method=="INVITE") {</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">if (!radius_proxy_authorize("opensersip.test.machine")){</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">proxy_challenge("opensersip.test.machine","0");</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"> exit;</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">};</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">};</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"> </FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">lookup("aliases");</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">if (!uri==myself) {</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">append_hf("P-hint: outbound alias\r\n"); </FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">route(1);</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">};</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># native SIP destinations are handled using our USRLOC DB</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">if (!lookup("location")) {</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">sl_send_reply("404", "Not SIP User Found");</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">exit;</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">};</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">append_hf("P-hint: usrloc applied\r\n"); </FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">};</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">route(1);</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">}</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">route[1] {</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># send it out now; use stateful forwarding as it works reliably</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># even for UDP2TCP</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">if (!t_relay()) {</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">sl_reply_error();</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">};</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">exit;</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">}</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">route[2] {</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># Register Message Handler</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">sl_send_reply("100","Trying");</FONT></SPAN>
<BR><SPAN LANG="en-gb"> </SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">if (!radius_www_authorize("opensersip.test.machine")) {</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">www_challenge("opensersip.test.machine", "0");</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">exit;</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">};</FONT></SPAN>
<BR><SPAN LANG="en-gb"> </SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">if (!save("location"))</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">{</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">sl_reply_error();</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">};</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">}</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体">route[3] {</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体"># Invite Message Handler</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># if (!radius_proxy_authorize("opensersip.test.machine")){</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># proxy_challenge("opensersip.test.machine","0");</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># exit;</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># }</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># lookup("aliases");</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># if (!uri==myself) {</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># append_hf("P-hint: outbound alias\r\n"); </FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># route(1);</FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="宋体"># };</FONT></SPAN>
<BR><SPAN LANG="en-gb"> </SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">if (uri=~"^sip:[0-9]{10}@") {</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">route(4);</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">exit;</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">};</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">if (!lookup("location")) {</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">if (uri=~"^sip:[0-9]{10}@") {</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">route(4);</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">exit;</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">};</FONT></SPAN>
<BR><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="宋体">sl_send_reply("404","User not Found");</FONT></SPAN>
<BR><SPAN LANG="en-gb"> </SPAN><SPAN LANG="fr"> <FONT SIZE=2 FACE="宋体">exit;</FONT></SPAN>
<BR><SPAN LANG="fr"> <FONT SIZE=2 FACE="宋体">};</FONT></SPAN>
<BR><SPAN LANG="fr"><FONT SIZE=2 FACE="宋体"> route(1);</FONT></SPAN>
<BR><SPAN LANG="fr"> <FONT SIZE=2 FACE="宋体">}</FONT></SPAN>
</P>
<P><SPAN LANG="fr"><FONT SIZE=2 FACE="宋体">route[4] {</FONT></SPAN>
<BR><SPAN LANG="fr"> <FONT SIZE=2 FACE="宋体">rewritehost("172.20.14.32");</FONT></SPAN>
<BR><SPAN LANG="fr"> <FONT SIZE=2 FACE="宋体">route(1);</FONT></SPAN>
<BR><SPAN LANG="fr"> <FONT SIZE=2 FACE="宋体">}</FONT></SPAN>
</P>
<BR>
<BR>
</BODY>
</HTML>