[Freeswitch-users] cdr via javascript

Paul Zillmann mail at paulzillmann.de
Thu Apr 5 17:48:30 UTC 2018


Hey Francesco,

my guess is that you don't have to answer the a-Leg. Usually the bridge 
application answers the a-Leg when the b-Leg answers.
So your FXO card doesn't push an answer-event?

Paul

Am 05.04.2018 um 18:45 schrieb Francesco Facco de Lagarda:
>
> Thanks Paul for you interest! Much appreciated.
>
> Almost solved!
>
> Js script called dialplan.
>
> I’m using this code:
>
> if (session.ready()) {
>
> session.answer();
>
> var sessOut = new Session("sofia/gateway/realtoneFXO/" +  dialedNum + 
> "@192.168.0.216:5060");
>
> if (sessOut.ready()) {
>
> bridge(session, sessOut);
>
> }
>
> sessOut.hangup();
>
> session.hangup();
>
> var xml = new XML ("<xml>" + sessOut.generateXmlCdr() + "</xml>");
>
> var xmlCDR                        = xml.getChild('cdr');
>
> var xmCallFlow                 = xmlCDR.getChild('callflow');
>
> var xmTimes                 = xmCallFlow.getChild('times');
>
> var created_time                                            = 
> parseInt(xmTimes.getChild('created_time').data);
>
> var profile_created_time                             = 
> parseInt(xmTimes.getChild('profile_created_time').data);
>
> var progress_time                                          = 
> parseInt(xmTimes.getChild('progress_time').data);
>
> var progress_media_time                           = 
> parseInt(xmTimes.getChild('progress_media_time').data);
>
> var answered_time                                       = 
> parseInt(xmTimes.getChild('answered_time').data);
>
> var bridged_time                                            = 
> parseInt(xmTimes.getChild('bridged_time').data);
>
> var last_hold_time                                         = 
> parseInt(xmTimes.getChild('last_hold_time').data);
>
> var hold_accum_time                                   = 
> parseInt(xmTimes.getChild('hold_accum_time').data);
>
> var hangup_time                                            = 
> parseInt(xmTimes.getChild('hangup_time').data);
>
> var resurrect_time                                         = 
> parseInt(xmTimes.getChild('resurrect_time').data);
>
> var transfer_time                                           = 
> parseInt(xmTimes.getChild('transfer_time').data);
>
> var callLength = (hangup_time - answered_time)/1000000;
>
> }
>
> which works fine BUT, as "sofia/gateway/realtoneFXO/" is on analog 
> line (FXO), it does not actually communicate the on-answer properly, 
> so the call length is the total length including dialing, waiting for 
> ring, ringing … and not just the speaking time…
>
> as you see from these values, the answered_time and bridge_time are 
> identical!
>
> <created_time>1522946076054074</created_time>
>
> <profile_created_time>1522946076054074</profile_created_time>
>
> <progress_time>0</progress_time>
>
> <progress_media_time>0</progress_media_time>
>
> <answered_time>1522946079154074</answered_time>
>
> <bridged_time>1522946079154074</bridged_time>
>
> <last_hold_time>0</last_hold_time>
>
> <hold_accum_time>0</hold_accum_time>
>
> <hangup_time>1522946095634072</hangup_time>
>
> <resurrect_time>0</resurrect_time>
>
> <transfer_time>0</transfer_time>
>
> *From:*FreeSWITCH-users 
> <freeswitch-users-bounces at lists.freeswitch.org> *On Behalf Of *Paul 
> Zillmann
> *Sent:* giovedì 5 aprile 2018 18:00
> *To:* freeswitch-users at lists.freeswitch.org
> *Subject:* Re: [Freeswitch-users] cdr via javascript
>
> nodeJS or Browser?
>
> Am 05.04.2018 um 16:39 schrieb Francesco Facco de Lagarda:
>
>     Is there any way I can interrogate cdr data of a call that has
>     finished via javascript?
>     I see no samples of cdr data with js.
>
>     Thanks
>
>     F
>
>
>
>
>     _________________________________________________________________________
>
>     Professional FreeSWITCH Consulting Services:
>
>     consulting at freeswitch.org <mailto:consulting at 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 at lists.freeswitch.org
>     <mailto: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
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at 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 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20180405/02aab218/attachment-0001.html>


More information about the FreeSWITCH-users mailing list