[Freeswitch-users] LUA Call duration or Billing Sec

Seven Du dujinfang at gmail.com
Mon Mar 15 20:09:00 PDT 2010


Using event consumer immediately after session:hangup

-- uuid = session.uuid
session:hangup
   for e in (function() return con:pop(1) end) do
             -- psudo code
             -- if e.uuid ==  uuid and e.event_type == reporting then
....
   end

note this is not safe since you may miss the event before you do
con:pop, then maybe you can try non-blocking con:pop() ...  not
tested, just an idea. Anyway, doing inline bill is not recommended.

2010/3/15 Aloysius Lloyd <lloyd.aloysius at gmail.com>:
> Hi All,
> I have the following simple Lua script answer a inbound call then dial
> another number and bridge the call.
> Is there any way to get the  call duration or billing sec using the
> session:getVariable(  );
>
>
> -- answer the call
> session:answer();
> -- sleep a second
> session:sleep(1000);
> -- Initiate an outbound call
> obSession = freeswitch.Session("sofia/gateway/voipms/14165555555",session)
> obSession:execute("sched_hangup","+60 alloted_timeout");
> -- bride the call
>     freeswitch.bridge(session, obSession);
> -- hangup
> session:hangup();
>
> Thank you
> Lloyd
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>




More information about the FreeSWITCH-users mailing list