[SR-Users] How to do accounting for Kamailio-generated BYEs?

Yufei Tao yufei.tao at redembedded.com
Wed Feb 29 14:45:19 CET 2012


OK now I've upgraded to Kamailio 3.2 and it all works: sql_query (to
insert BYE into acc table) in event_route() doesn't crash anymore.


On 29/02/12 09:31, Yufei Tao wrote:
> Hi
>
> To summarize my questions:
>
> 1. What is the correct way to account for Kamailio internally-generated
> BYEs?
> 2. Using sql_query inside event_route() crashes Kamailio - is this a bug
> or unexpected usage?
>
> Thanks very much!
> Yufei
>
> On 28/02/12 17:06, Yufei Tao wrote:
>> Hi
>>
>> Thanks for your reply!
>>
>> I already set the accounting flag like you say. And all normal BYEs are
>> inserted into the acc table fine. Just internally generated BYEs don't
>> get inserted in acc table.
>>
>> I've done a bit googling and added event_route:
>>
>> event_route[tm:local-request]
>> {
>>   if (is_method("BYE")) {
>>     xlog("L_INFO", "event_route: BYE: callid=$ci, cseq=$cs - internally
>> generated\n");
>>
>>     setflag(FLT_ACC); # do accounting ...
>>     setflag(FLT_ACCFAILED); # ... even if the transaction fails
>>   }
>> }
>>
>> When I have two clients in a call, I disconnect the network for both
>> clients, so no RTP either direction, which triggered mediaproxy to send
>> dlg_bye_dlg to Kamailio, which sent BYE to both clients. I can see from
>> the log that event_route did get executed, and BYE sent to both clients,
>> but still BYE isn't inserted to acc table.
>>
>> The code inside event_route() above is copied from my route[WITHINDLG],
>> which for client-generated BYEs operates correctly (inserts BYEs into
>> acc table). But in event_route it didn't work.
>>
>> I also tried to use sql_query to insert BYE into acc table in
>> event_route and it causes Kamailio to crash. Using sql_query to select *
>> from acc also causes Kamailio to crash.
>>
>> Any idea where I've done wrong? I'm very much lost.
>>
>> Thank you!
>> Yufei
>>
>>> ----------------------------------------------------------------------
>>>
>>> Message: 1
>>> Date: Mon, 27 Feb 2012 13:21:50 -0500
>>> From: Alex Balashov <abalashov at evaristesys.com>
>>> Subject: Re: [SR-Users] How to do accounting for Kamailio-generated
>>>     BYEs?
>>> To: sr-users at lists.sip-router.org
>>> Message-ID: <4F4BC9BE.8000704 at evaristesys.com>
>>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>>
>>> On 02/27/2012 12:58 PM, Yufei Tao wrote:
>>>> Hi
>>>>
>>>> I've got a mediaproxy that detects no media, and sends dlg_end_dlg to
>>>> Kamailio via mi_datagram socket. Then Kamailio sends BYE to both calling
>>>> parties. It all works fine. But my question is, how to do accounting for
>>>> these Kamailio-generated BYEs? They don't appear in the acc table.
>>> In the loose_route() section of the config script, set the accounting
>>> flag for BYEs, e.g.
>>>
>>>     if(is_method("BYE"))
>>>         setflag(xx);
>>>
>>>
--
Yufei Tao
Red Embedded

This E-mail and any attachments hereto are strictly confidential and intended solely for the addressee. If you are not the intended addressee please notify the sender by return and delete the message.

You must not disclose, forward or copy this E-mail or attachments to any third party without the prior consent of the sender.

Red Embedded Design, Company Number 06688253 Registered in England: The Waterfront, Salts Mill Rd, Saltaire, BD17 7EZ



More information about the sr-users mailing list