Also if you use CHANNEL_HANGUP_COMPLETE the data is already calculated for you:

variable_billsec: 17

variable_billmsec: 16660

variable_billusec: 16660036


Need more granularity? :)


On Tue, Jan 6, 2015 at 6:42 PM, Brian West <brian@freeswitch.org> wrote:
Use the CHANNEL_HANGUP_COMPLETE event for this purpose.

On Tue, Jan 6, 2015 at 5:34 PM, Bruce Lefko <blefko5361@gmail.com> wrote:
Hi there.

I'm trying to get the call duration in seconds using ESL, but it looks like the channel variables are not being set correctly.

In CHANNEL_HANGUP events, I see the following variables:

  'Caller-Profile-Created-Time' => '1420586926995761',
  'Caller-Channel-Created-Time' => '1420586926995761',
  'Caller-Channel-Answered-Time' => '1420586929503733',
  'Caller-Channel-Progress-Time' => '0',
  'Caller-Channel-Progress-Media-Time' => '1420586929203735',
  'Caller-Channel-Hangup-Time' => '0',

I would expect to generate the duration of the call by subtracting Caller-Channel-Answered-Time from Caller-Channel-Hangup-Time, but the hangup time is 0.  The actual call in this case was 45 seconds long.

What can I do use Freeswitch events to compute call duration?

Thanks!



_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org



--

Brian West
brian@freeswitch.org


Twitter: @FreeSWITCH , @briankwest
http://www.freeswitchbook.com
http://www.freeswitchcookbook.com

T:+19184209001 | F:+19184209002 | M:+1918424WEST (9378)
iNUM:+883 5100 1420 9001 | ISN:410*543 | Skype:briankwest




--

Brian West
brian@freeswitch.org


Twitter: @FreeSWITCH , @briankwest
http://www.freeswitchbook.com
http://www.freeswitchcookbook.com

T:+19184209001 | F:+19184209002 | M:+1918424WEST (9378)
iNUM:+883 5100 1420 9001 | ISN:410*543 | Skype:briankwest