[SR-Users] User accounting

Alex Balashov abalashov at evaristesys.com
Thu Sep 6 15:30:10 CEST 2012


On 09/06/2012 09:25 AM, Ali Jawad wrote:

> How do I get the variables for username,agent and IP.

This information comes from pseudovariables ("PVs"), which are basically 
parts of the SIP message that are parsed by Kamailio and exposed inside 
the config script environment as read-only (and in a cases, mutable) 
variables.

Take a look at the full list here:

    http://www.kamailio.org/dokuwiki/doku.php/pseudovariables:3.1.x

The ones you are looking for are:

(1) $au - for authentication username, or $fU for From URI user part.

(2) $ua - user agent identifier, if present.  A good way to check if it 
is present is to check for the existence of the User-Agent header, which 
is not a mandatory header:

    $var(ua) = '';

    if(is_present_hf("User-Agent"))
       $var(ua) = $ua;

    # Log $var(ua)...

(3) $si - source IP of the request being processed.

-- Alex

-- 
Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
Tel: +1-678-954-0670
Fax: +1-404-961-1892
Web: http://www.evaristesys.com/, http://www.alexbalashov.com/



More information about the sr-users mailing list