Thanks Dirk it worked as I want! -----Original Message----- From: sr-users [mailto:sr-users-boun...@lists.sip-router.org] On Behalf Of Dirk Teurlings - SIGNET B.V. Sent: Friday, June 19, 2015 5:03 PM To: sr-users@lists.sip-router.org Subject: Re: [SR-Users] Kamailio invite counter
Hi, $var is in a scope per thread, so you will have a different counter in every thread. You should use shared memory instead: http://www.kamailio.org/wiki/cookbooks/4.2.x/pseudovariables#shv_name_-_shar ed_memory_variables Cheers, Dirk On 19-06-15 15:54, Ali Taher wrote: > Hello, > > I want to define a counter that increase in every invite. > > I tried the below : > > if (is_method("INVITE")) > > { > > $var(u)=$var(u)+1; > > xlog("L_INFO","Counter : $var(u) " ); > > } > > But the counter is reset to 1 randomly (even before restarting > kamailio > service) > > How can have a proper counter that count invite messages. > > Thanks > > Ali > > > > _______________________________________________ > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing > list sr-users@lists.sip-router.org > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users > _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users