[Kamailio-Users] [SR-Dev] k/o xlog and pv modules for srouter

Andrei Pelinescu-Onciul andrei at iptel.org
Tue Dec 16 12:25:59 CET 2008


On Dec 10, 2008 at 19:17, Daniel-Constantin Mierla <miconda at gmail.com> wrote:
> Hello,
> 
> I have uploaded xlog and (stripped) pv Kamailio/Openser modules to 
> sip-router.org site at:
> http://sip-router.org/pub/tmp/miconda/
> 
> If you are willing to test them, then just get the branch "master"  from 
> git and merge with "daniel/pv". Details about GIT repository:
> http://sip-router.org/2008/11/18/git-repository-online/
> 
> The pv module does not include yet the pseudo-variables and 
> transformations dependent of K/O extensions (e.g., branch, script flags, 
> ...). Probably one important to decide upon is the AVP (to start a new 
> discussion about it separately). The ones missing now will be gradually 
> activated as dependent code is sorted out. Testing and feedback is welcome.


The attached patch adds AVP support to it (for sip-router).
Tested andrei/script_vars merged with daniel/pv  with the attached pvar.cfg
(includes ser style avp, kamailio scriptvar pvars and kamailio avp pvars)
 and ser's xlog.

I'll do another merge into master soon, so that it could be tested
directly.


Andrei
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pv-sr.patch
Type: text/x-diff
Size: 5627 bytes
Desc: not available
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20081216/9767c304/attachment.patch>
-------------- next part --------------
# do not return the Server: header field in a response
server_signature=0
# do not return the Warning: header field in a response
sip_warning=0

#listen= sctp:(10.36.2.56,10.36.2.58):5080 127.0.0.1
#listen=(eth0)
#listen=___MY_IP___
#listen=___XMLRPC_IP___
alias="example.com"
children=2

#loadmodule "modules/ctl/ctl.so"
# ser xlog
loadmodule "modules/xlog/xlog.so"
loadmodule "modules/pv/pv.so"
# k xlog
#loadmodule "modules/x_xlog/xlog.so"
#modparam("ctl", "binrpc", "tcp:3012")               # tcp any , port 3012
#modparam("ctl", "binrpc", "udp:*:3012")             # udp any , port 3012
disable_tls=0
memlog=1
memdbg=100 # disable verbose mallocs
use_dns_cache=on
dns_try_naptr=on
use_dst_blacklist=on

tcp_defer_accept=10
tcp_syncnt=1

route {
	xlog("L_ALERT", "plain string" " test\n");
	$avp(fu.stest)="avp_test1";
	xlog("L_ALERT", "1. avp  %$fu.stest \n");
	$fu.stest="test2_" + "avp_test2";
	$avp(tmp)="tmp_"+$fu.stest;
	xlog("L_ALERT", "2. avp  fu.stest=%$fu.stest , tmp=%$tmp\n");
	if ($tmp!="tmp_"+$fu.stest || "test2_avp_test2"!=$fu.stest ||
		$tmp!="tmp_test2_avp_test2")
		xlog("L_CRIT", "BUG: sanity check 1 failed: fu.stest=%$fu.stest ,"
				" tmp=%$tmp\n");
	$iavp=1+2+3+4+5;
	$fu.stest=($fu.stest+$iavp)+"-"+1;
	if ($iavp!=15 || $fu.stest!="test2_avp_test215-1")
		xlog("L_CRIT", "BUG: sanity check 2 failed: $iavp=%$iavp ,"
				" $fu.stest=%$fu.stest\n");
	$(var(foo))=$iavp+100;
	xlog("L_ALERT", "%%$iavp=  %$iavp  \n");
	xlog("L_ALERT", "%%$f.iavp=  %$f.iavp  \n");
	xlog("L_ALERT", "%%$fr.iavp=  %$fr.iavp  \n");
	xlog("L_ALERT", "%%$fu.iavp=  %$fu.iavp  \n");
	xlog("L_ALERT", "3. avp  %$fu.stest \n");
	if (2+1>0+1)
		xlog("L_ALERT", "IF1\n");
	if ($iavp>($iavp-1))
		xlog("L_ALERT", "IF2\n");
	if (($iavp=-1+$iavp)<2)
		xlog("L_ALERT", "IF3, %%$iavp = %$iavp\n");
	if ($tmp=="tmp_test2_avp_test2")
		xlog("L_ALERT", "IF4, %%$tmp = %$tmp\n");
	else
		xlog("L_ALERT", "ELSEIF4 if failed: %%$tmp = %$tmp\n");
	$tmp="host="+ at ruri.host;
	xlog("L_ALERT", "uri: %$tmp\n");
	if ($tmp+"xxx" == "host="+ at ruri.host+"xxx")
		xlog("L_ALERT", "IF5 (select):tmp=\"%$tmp\"\n");
	if (method=="INVITE")
		xlog("L_ALERT", "IF6 (method==INVITE)\n");
	$tmp="INV";
	if (method==$tmp+"ITE")
		xlog("L_ALERT", "IF7 (method==%$tmp)\n");
	if (method=="INVITE" !=0 )
		xlog("L_ALERT", "IF8 (method==INVITE !=0)\n");
	$tmp=$tmp+"I"+"T"+"E";
	if (method==$tmp)
		xlog("L_ALERT", "IF9 (method==%$tmp)\n");
	if (method=="I"+"NV"+"ITE")
		xlog("L_ALERT", "IF10\n");
	# more optimizations tests
	$var(x)=$iavp;
	$iavp2=1+$var(x)+2+3;
	$iavp=1+2+3+$iavp;
	$iavp3=(2+1)*$iavp*(1+1)-20;
	$iavp4=$iavp-5-10;
	$iavp6=(1+4)+($iavp+5);
	$iavp5=(3+3)+(4+$(avp(iavp))  );
	xlog("L_ALERT", "$iavp=%$iavp $iavp2=%$iavp2 $iavp3=%$iavp3"
					" $iavp4=%$iavp4 $iavp5=%$iavp5 $iavp6=%$iavp6\n");
	drop;
}




More information about the sr-users mailing list