[OpenSIPS-Users] howto get NAPTR lookup

Dilip dilip.m at renovau.com
Fri Nov 21 07:38:56 CET 2008


Hello,

I want to use ENUM with openser. My ENUM url is _xyz.com_
I m forwarding the call on enum url (i.e xyz.com) but, I m getting prob 
in that.
Here, I have attached my openser.cfg file and dispatcher.list file.

Whats wrong with it ?? please guide me for that.


Thanks & Regards,

Urmi


************************************************************************

*Openser.cfg file ::*

************************************************************************

#openser version 1.1
# ----------- global configuration parameters ------------------------

debug=9          # debug level (cmd line: -dddddddddd
fork=yes
log_stderror=yes  # (cmd line: -E)
#log_facility=LOG_LOCAL5
check_via=no    # (cmd. line: -v)
dns=no          # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)


listen=udp:x.x.x.x
port=3030
children=8
#fifo="/tmp/openser_fifo"

#unix_sock_children=2

# ------------------ module loading ----------------------------------
mpath="/usr/local/lib/openser/modules"

loadmodule "mysql.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "xlog.so"
loadmodule "uri.so"
loadmodule "acc.so"
loadmodule "auth.so"
loadmodule "auth_radius.so"
loadmodule "dispatcher.so"
loadmodule "nathelper.so"
loadmodule "enum.so"
# ----------------- setting module-specific parameters ---------------
#------------------ registrar testing---------------------------------
modparam("registrar", "default_expires", 2250000)

#------------------Dialog Module--------------------------------------

# -- usrloc params --
modparam("dispatcher", "list_file", "/usr/local/etc/openser/dispatcher.list")
modparam("usrloc","db_url","mysql://openser:openserrw@localhost/openser")
modparam("usrloc","db_mode", 3)
modparam("usrloc", "timer_interval", 30)
#modparam("usrloc", "expires_column", "225000")
#modparam("usrloc", "cseq_delay", 60)
#modparam("usrloc", "timer_interval", 30)
#modparam("usrloc","desc_time_order", 1)
#modparam("usrloc", "matching_mode", 1)
#modparam("registrar", "desc_time_order", 1)
modparam("usrloc", "desc_time_order", 0)     # urmi :: for q-value change
#modparam("registrar", "max_contacts", 1)

################################## ENUM ######################
modparam("enum", "domain_suffix", "e164.arpa.")		#urmi

# -- acc params --

#################################################################################

modparam("acc", "log_flag",           1)
modparam("acc", "log_missed_flag",    2)

modparam("acc", "service_type", 15)
modparam("acc|auth_radius", "radius_config","/etc/radiusclient-ng/radiusclient.conf")
modparam("acc", "radius_flag",        1)
modparam("acc", "radius_missed_flag", 1)

modparam("acc", "radius_extra", "
                                       Called-Station-Id=$tu;
                                       Calling-Station-Id=$fu;
                                       Canonical-URI=$tu;
						User-Name=$au;
                                        Sip-User-Realm=$ar; 
                                      Source-IP=$si;
                                        Source-Port=$sp;
                                      From-Header=$hdr(from);
                                        User-Agent=$hdr(user-agent);
                                        Contact=$hdr(contact);
                                        ENUM-TLD=$avp(s:enum_tld);
						Event=$hdr(event)")
	


# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)

# -------------------------  request routing logic -------------------

# main routing logic

route{
	xdbg("\n\n---- Start -----\n\n");
	if (!mf_process_maxfwd_header("10")) {
        	sl_send_reply("483","Too Many Hops");
        	exit;
	};

	if (msg:len >=  2048 ) {
		sl_send_reply("513", "Message too big");
		exit;
	};
    
	if (!method=="REGISTER"){
		record_route();
	};

        if (loose_route()){
            xdbg("\n\n---- Loose route  ----\n\n");
        	xdbg("\n\n-------- Stop Accounting   --------\n\n");
           	setflag(1);	#Stop accounting
	   	route(1);
            exit;
        };

	if ((src_ip=="xyz.com") ) { 	
 		xdbg("\n\n---- From sip proxy server -----\n\n");
		route(2);
		exit;
 	};


	if (method=="REGISTER"){
		xdbg("\n\n---- Register  ----\n\n");
		route(3);
		exit;
	};
	if (method=="INVITE")
	{
         	xdbg("\n\n-------- Start Accounting   --------\n\n");

        	if (nat_uac_test("19"))
        	{
        	        xdbg("\n\n-------- Nated  --------\n\n");
                	fix_nated_contact();
                	force_rport();
        	};

		xdbg("\n\n---- Invite  INSIDE.............----\n\n");

		if (!radius_www_authorize("")) 
		{
			www_challenge("", "0");
			exit;
		};

		acc_rad_request("Start");	
		
		xdbg("\n\n---- AFTER RADIUS  ----\n\n");
 	};


	if (uri=~"^sip:[1-9][0-9]*") { # temp  for austrlia
#		strip(1);
		xdbg("\n\n---- urmi----\n\n");
		xdbg("\n\n---- urmi----\n\n");
		xdbg("\n\n---- urmi----\n\n");
		prefix("+");
	}; 

	if (uri=~"sip:\+[0-9]+")
	{
		if ( !enum_query("e164.arpa.") )
		{
#	         enum_query("e164.arpa.");
	         enum_query("nrenum.net.");
#	         enum_query("xyz.com");   #running
		};
	};



  	ds_select_dst("1", "0");
	forward();
	exit;
}

# generic forward
route[1] 
{
	if (!t_relay()) {
	    sl_reply_error();
	};
}

route[2]
{
	if (lookup("location"))
	{
		route(1);
	}else{
		sl_send_reply("404", "Not Found");
		xdbg("\n\n-------- To sip proxy ---urmi  --------\n\n");
          ds_select_dst("3", "0");
          forward();

	};
}

#Register
route[3]
{
	if (nat_uac_test("18"))
	{
	        xdbg("\n\n-------- Nated  --------\n\n");
		fix_nated_register();
		force_rport();	
	};

	if (!radius_www_authorize(""))
	{
	xdbg("\n\n--- Inside Route 3  ----\n\n");
		www_challenge("", "0");
		exit;
	};

	save("location");
}


************************************************************************

*dispatcher.list file ::*

************************************************************************

1 sip:xyz.com


************************************************************************

*Problem on OpenSER ::*

************************************************************************

2(31443) enum_query(): order 1, pref 10, flen 1, flags 'u', slen 7, 
services 'E2U+sip', rlen 36, regexp '!^.*$!sip:61262223557 at aarnet.edu.au!'

2(31443) reg_replace(): pattern: '^.*$', replacement: 
'sip:61262223557 at aarnet.edu.au', string: '+61590077777'

2(31443) enum_query(): resulted in replacement: 
'sip:61262223557 at aarnet.edu.au'

2(31443) rewrite_uri: Rewriting Request-URI with 
'sip:61262223557 at aarnet.edu.au'

2(31443) DISPATCHER:ds_select_dst: set index [1->0]

2(31443) DISPATCHER:ds_select_dst: alg hash [2930033304]

2(31443) DISPATCHER:ds_select_dst: selected [0-1/0/0] <sip:xyz.com>

2(31443) DEBUG: mk_proxy: doing DNS lookup...

2(31443) DEBUG:sip_resolvehost2: no port, no proto -> do NAPTR lookup!

2(31443) get_record: lookup(xyz.com, 35) failed

2(31443) DEBUG:sip_resolvehost2: no valid NAPTR record found for 
xyz.com, trying direct SRV lookup...

2(31443) get_record: lookup(_sip._udp.xyz.com, 33) failed

2(31443) DEBUG:sip_resolvehost2: no valid SRV record found for 
_sip._udp.xyz.com, trying A record lookup...

2(31443) ERROR: mk_proxy: could not resolve hostname: "xyz.com"

*************************************************************


Bogdan-Andrei Iancu wrote:
> Hi Urmi,
>
> looking at the logs you sent, there is first an ENUM lookup (which has 
> nothing to do with the xyz.com domain) and then a forward (via 
> dispatcher) to the xyz.com domain.
>
> I'm not sure I understand your question here.....
>
> Regards,
> Bogdan
>
> dilip.m at renovau.com wrote:
>> Hello Bogdan,
>>
>> Thanks 4 ur quick reply.
>>
>> Many of our calls are done through this ENUM url (i.exyz.com). That  
>> means, if its not hv DNS entries, than how its possible.
>>
>> Any thing left in our openser.cfg file. Can u please tell me, the  
>> solution of this ??
>>
>> Thanks & Regards,
>> Urmi
>>
>>
>>
>> Quoting Bogdan-Andrei Iancu <bogdan at voice-system.ro>:
>>
>>  
>>> Hi Urmi,
>>>
>>> I see here 2 queries:
>>>
>>> 1) an enum one - and the number you are looking has no enum record
>>>
>>> 2) a DNS lookup (NAPTR, SRV, A) for xyz.com domain - and it looks there
>>> are no entries in DNS for it.
>>>
>>> Regards,
>>> Bogdan
>>>
>>> dilip.m at renovau.com wrote:
>>>    
>>>> Hello,
>>>>
>>>> I want to use ENUM with openser + CDRTool.  xyz is my ENUM url.
>>>> When I m firing the call, I m getting the following error on 
>>>> openser ::
>>>>
>>>> --------------------------------------------------------------------------------------------- 
>>>>
>>>>  2(31823) get_record: lookup(0.0.5.2.7.3.3.3.0.3.1.e164.arpa., 35) 
>>>> failed
>>>>  2(31823) enum_query(): No NAPTR record found for    
>>>> 0.0.5.2.7.3.3.3.0.3.1.e164.arpa..
>>>>  2(31823) get_record: lookup(0.0.5.2.7.3.3.3.0.3.1.e164.arpa., 35) 
>>>> failed
>>>>  2(31823) enum_query(): No NAPTR record found for    
>>>> 0.0.5.2.7.3.3.3.0.3.1.e164.arpa..
>>>>  2(31823) DISPATCHER:ds_select_dst: set index [1->0]
>>>>  2(31823) DISPATCHER:ds_select_dst: alg hash [450732010]
>>>>  2(31823) DISPATCHER:ds_select_dst: selected [0-1/0/0] <sip:xyz.com>
>>>>  2(31823) DEBUG: mk_proxy: doing DNS lookup...
>>>>  2(31823) DEBUG:sip_resolvehost2: no port, no proto -> do NAPTR 
>>>> lookup!
>>>>  2(31823) get_record: lookup(xyz.com, 35) failed
>>>>  2(31823) DEBUG:sip_resolvehost2: no valid NAPTR record found 
>>>> for    xyz.com, trying direct SRV lookup...
>>>>  2(31823) get_record: lookup(_sip._udp.xyz.com, 33) failed
>>>>  2(31823) DEBUG:sip_resolvehost2: no valid SRV record found for    
>>>> _sip._udp.xyz.com, trying A record lookup...
>>>>  2(31823) ERROR: mk_proxy: could not resolve hostname: "xyz.com"
>>>> --------------------------------------------------------------------------------------------- 
>>>>
>>>>
>>>>  openser.cfg file :::
>>>>
>>>> loadmodule "enum.so"
>>>>
>>>> modparam("enum", "domain_suffix", "e164.arpa.")         #urmi
>>>>
>>>> modparam("acc", "radius_extra", "
>>>>                                        Called-Station-Id=$tu;
>>>>                                        Calling-Station-Id=$fu;
>>>>                                        Canonical-URI=$tu;
>>>>                                         User-Name=$au;
>>>>                                         Sip-User-Realm=$ar;
>>>>                                       Source-IP=$si;
>>>>                                         Source-Port=$sp;
>>>>                                       From-Header=$hdr(from);
>>>>                                         User-Agent=$hdr(user-agent);
>>>>                                         Contact=$hdr(contact);
>>>>                                         ENUM-TLD=$avp(s:enum_tld);
>>>>                                         Event=$hdr(event)")
>>>>
>>>>
>>>> route
>>>> {
>>>>
>>>>         if (uri=~"^sip:1[1-9][0-9]*"){
>>>>         #       strip(2);
>>>>                 prefix("+");
>>>>         };
>>>>
>>>>         if (uri=~"sip:\+[0-9]+")
>>>>         {
>>>>                 xdbg("\n\n---- urmi second if ENUM uri----\n\n");
>>>>
>>>>                 if ( !enum_query("e164.arpa.") )
>>>>                 {
>>>> #                enum_query("nrenum.net.");
>>>>                  enum_query("e164.arpa.");
>>>>                 };
>>>>         };
>>>>
>>>> }
>>>> ----------------------------------------------------------------------------------------------------------------- 
>>>>
>>>> Can you please hepl me out in this.
>>>>
>>>>
>>>> Thanks in advance.
>>>> Urmi
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at lists.opensips.org
>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>
>>>>
>>>>       
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>   
>
>




More information about the Users mailing list