[SR-Users] User accounting

Ali Jawad ali.jawad at splendor.net
Thu Sep 6 15:25:09 CEST 2012


Hi Alex
Thanks to your pointers above, I am able to login into a custom table
insert queries as needed. However, I am not sure how to define the correct
variables, what I am doing now is the following :


sql_query("cb", "insert into registrations
(`user`,`agent`,`type`,`ip`,`unique`,`auth`)
VALUES('test','VOS','IN','8.8.8.8', 'someID' , 'register wrong ') ", "ra");

sql_result_free("ra");

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

Thanks

On Wed, Sep 5, 2012 at 3:25 PM, Alex Balashov <abalashov at evaristesys.com>wrote:

> Sure, just pull it out with the $ua or $hdr(User-Agent) PVs.
>
>
> On 09/05/2012 07:53 AM, Ali Jawad wrote:
>
>  Hi Alex
>> Sounds good, thanks for the input so far, anyway I can add the useragent
>> to the entry ?
>> Regards
>>
>> On Wed, Sep 5, 2012 at 2:49 PM, Alex Balashov <abalashov at evaristesys.com
>> <mailto:abalashov at evaristesys.**com <abalashov at evaristesys.com>>> wrote:
>>
>>     Hi Ali,
>>
>>
>>     On 09/05/2012 07:18 AM, Ali Jawad wrote:
>>
>>         Is it possible to store user logon/logout dates + user agent
>> used. I
>>         know that the info is in the location table but it is not
>>         persistent,
>>         and I am using the accounting table to store calls. But I am not
>>         sure
>>         there is a way to store logon/logout/user agent.
>>
>>
>>     By "logon" and "logout" I assume you are referring to registration,
>>     not something else.
>>
>>     You can capture a REGISTER request in the main request route and
>>     call a SQL operation via 'sqlops' to store that timestamp ($Ts)
>>     wherever you want.
>>
>>     There is no such thing as an "unregistration", technically, just a
>>     REGISTER request with an ;expires=0 parameter in the Contact header,
>>     or an Expires: 0 header.  If you look for those parameters in your
>>     processing of the REGISTER request, e.g.
>>
>>         if((is_present_hf("Expires") && $hdr(Expires) == "0") ||
>>            $hdr(Contact) =~ "expires=0")
>>
>>     you can store those times, too.
>>
>>     -- 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/
>>
>>     ______________________________**___________________
>>
>>     SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
>> list
>>     sr-users at lists.sip-router.org <mailto:sr-users at lists.sip-**router.org<sr-users at lists.sip-router.org>
>> >
>>     http://lists.sip-router.org/__**cgi-bin/mailman/listinfo/sr-__**users<http://lists.sip-router.org/__cgi-bin/mailman/listinfo/sr-__users>
>>     <http://lists.sip-router.org/**cgi-bin/mailman/listinfo/sr-**users<http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users>
>> >
>>
>>
>>
>>
>> --
>> *Ali Jawad
>> *
>> *Information Systems Manager
>>
>> CISSP - ITIL V3 - RHCE - VCP - C|EH - CCNA - MCSA
>> *
>> *Splendor Telecom (www.splendor.net <http://www.splendor.net/>)
>>
>> Beirut, Lebanon
>> Phone: +9611373725/ext 116
>> FAX: +9611375554
>>
>> *
>>
>>
>>
>> ______________________________**_________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users at lists.sip-router.org
>> http://lists.sip-router.org/**cgi-bin/mailman/listinfo/sr-**users<http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users>
>>
>>
>
> --
> 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/
>
> ______________________________**_________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/**cgi-bin/mailman/listinfo/sr-**users<http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users>
>



-- 
*
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20120906/351cd0c6/attachment.htm>


More information about the sr-users mailing list