[SR-Users] Get duration in cnxcc:call-shutdown event

Jayesh Nambiar jayesh1017 at gmail.com
Sat Jul 20 21:51:30 CEST 2013


Thanks for the quick reply Carlos. Really appreciate it.

Thanks,

--- Jayesh


On Sat, Jul 20, 2013 at 9:13 PM, Carlos Ruiz Díaz <carlos.ruizdiaz at gmail.com
> wrote:

> The lack of values in some of the standard pseudo variables is a
> limitation of the dialog module which does not provide  the necessary
> information in the event route block in cases when the call is forced to
> end.
>
> You can calculate the duration using:
>
> * $var(duration)  = $TS - $dlg(start_ts);*
> *
> *
> Regards,
> Carlos
>
>
>
>
>
> On Sat, Jul 20, 2013 at 2:07 AM, Jayesh Nambiar <jayesh1017 at gmail.com>wrote:
>
>> Hello,
>> Is there a straight forward way of getting the duration of the call in
>> cnxcc-call-shutdown event. The $DLG_lifetime returns NULL as the dialog
>> does not exist. I dont get the value of $DLG_lifetime even in dialog:end
>> event when the call ends through cnxcc module. Even the cdr flag of acc
>> module doesn't get the duration and it logs, invalid values !!
>> Currently, I am storing the timestamp in htable when the call is answered
>> and then subtract it from the current timestamp in the cnxcc:shutdown event
>> route to get the duration. Something like this:
>>
>> onreply_route[MANAGE_REPLY] {
>>     xdbg("incoming reply\n");
>>
>>     if(status=="200") {
>>         $sht(ts=>$ci) = $Ts;
>>     }
>> }
>>
>> event_route[cnxcc:call-shutdown] {
>>
>>     $var(duration) = $TS-$sht(ts=>$ci);
>>     sht_rm_name_re("ts=>$ci");
>>
>>     xlog("L_INFO", "Duration of call was $var(duration)");
>> }
>>
>>
>> Any more correct way of doing this would be very helpful.
>>
>> Thanks,
>>
>> --- Jayesh
>>
>> _______________________________________________
>> 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
>>
>>
>
>
> --
> Carlos
> http://caruizdiaz.com
> +595981146623
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20130721/394ef894/attachment.html>


More information about the sr-users mailing list