[Freeswitch-users] Wait for ANSWER/HANGUP events in Mod lua

Sami Montour smontour at verizon.net
Sun Aug 18 19:54:24 MSD 2013


Hi Karsten,

Thank you for the reply. You are correct. I am trying to retrieve billing
information from a basic call. I am calling lua script in the dialplan. When
a call comes in, FS hands it over to lua script for processing.

 

<include>

<extension>

  <condition field="destination_number" expression="^(15[0-9][0-9])$">

   <action application="lua" data="fs_billing.lua"/>

  </condition>

</extension>

</include>

 

I did the same thing with ESL where I listened for CHANNEL_ANSWER and
CHANNEL_HANGUP events then fetched answer and hangup times and that worked
just fine. I would like to do the same thing with lua. 

 

Thanks

 

From: freeswitch-users-bounces at lists.freeswitch.org
[mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Karsten
Horsmann
Sent: Sunday, August 18, 2013 10:19 AM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] Wait for ANSWER/HANGUP events in Mod lua

 

Hi Sam,

 

you should be more verbose what you currently doing. There a many ways to
call an lua script in FS (in the dialplan, as startup-script, as
dialplan-binding etc).

Sounds like you want to fetch some kind of billing informations.

 

2013/8/17 Sami Montour <smontour at verizon.net>

I am using Mod lua for call processing on the FreeSwitch. I would like to
wait for some events such as CHANNEL_ANSWER and CHANNEL_HANGUP  in order to
get the answer time and hangup time. Basically, something like

 

Wait for event CHANNEL_ANSWER or CHANNEL_HANGUP

If (event_name = “CHANNEL_ANSWER”) then answer_timestamp =
getHeader(“Caller-Channel-Answered-Time”) 

If (event_name = “CHANNEL_HANGUP”) then hangup_timestamp =
getHeader(“Event-Date-Timestamp”)

 

The session:getState() described in module lua gets the call state but not
the channel state. For instance, ‘CS_EXECUTE’ is the channel state when it
is executing a dialplan not when the call is answered. 

 

Is there a way to wait for channel events such as CHANNEL_ANSWER and
CHANNEL_HANGUP in order to retrieve answer and hangup timestamps for a call?

 

Any input is very much appreciated.

 

Thanks.

 

Sam

 

 




 

-- 
Mit freundlichen Grüßen
*Karsten Horsmann*

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130818/84196634/attachment.html 


Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users mailing list