[Freeswitch-users] Problem in geting call duration

David Knell dave at 3c.co.uk
Wed Aug 20 23:16:29 PDT 2008

Hi -
> How it will be possible to take dtmf digits from users when using 
> session.preAnswer().
By and large, you can't.  There's no forward audio path established 
until the call's answered.

> 1. User dials a DID number.
> 2.  Call comes to public .xml and  then runs the javascript .
> 3. javascript first play the account balance of the user (i know it 
> can be done with session.preAnswer.)
> 4.After playing balance  script ask to enter the destination number  
> ...(this will not work with session.preAnswer())
> 6. then dial the entered number.
> 7. after call completion get the CDR for the call which shows the 
> duration of call.(only call duration of new session originated in 
> javascript.)
You'll need to answer the call before the user enters the destination 
number.  We do something similar (but not in Javascript..) - we get two 
XML CDRs for each call, one for the inbound leg and one for the 
outbound.  Set a variable on the outbound leg with the caller's user ID 
in your system; you can then link the CDR for the outbound call back to 
the user and bill them.

Cheers --


David Knell, Director, 3C Limited
T: 020 8114 8901  F: 020 3002 7257  M: 001 415 630 3031

More information about the FreeSWITCH-users mailing list