Ali,

$var variables do not persist outside the scope of the processing of a single SIP message. They live in the private memory of every receiver process.

Take a look at the 'htable' or 'statistics' modules.

--
Alex Balashov | Principal | Evariste Systems LLC
303 Perimeter Center North, Suite 300
Atlanta, GA 30346
United States

Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

Sent from my BlackBerry.
From: Ali Taher
Sent: Friday, June 19, 2015 09:55
To: 'Kamailio (SER) - Users Mailing List'
Reply To: Kamailio (SER) - Users Mailing List
Subject: [SR-Users] Kamailio invite counter

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