d97b8977c23fae475fa9a3878eb041f141adc26e
[motion2.git] / server / services / ami / rpc / memberReport.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xeffa=['seconds','inbound','calleridnum','exten','queue','agent','toNumber','accountcode','uniqueid','CreateMemberReport','voiceDialReport','membername','starttime','endtime','diff','outbound','moment','queuecallerexitAt','Request','voice','interface','format','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt'];(function(_0x223f38,_0x4ece37){var _0x4f18b7=function(_0x502d2c){while(--_0x502d2c){_0x223f38['push'](_0x223f38['shift']());}};_0x4f18b7(++_0x4ece37);}(_0xeffa,0x1b0));var _0xaeff=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xeffa[_0x4e676e];return _0x336a3c;};'use strict';var moment=require(_0xaeff('0x0'));var _=require('lodash');var util=require('util');var client=require('../client');exports['voiceQueueReport']=function(_0x20016f){var _0x23e764=_0x20016f['queuecallercompleteAt']||_0x20016f[_0xaeff('0x1')];return client[_0xaeff('0x2')]('CreateMemberReport',{'body':{'channel':_0xaeff('0x3'),'membername':_0x20016f['lastAssignedTo'],'interface':_['isNil'](_0x20016f[_0xaeff('0x4')])?util[_0xaeff('0x5')](_0xaeff('0x6'),_0x20016f[_0xaeff('0x7')]):_0x20016f[_0xaeff('0x4')],'type':_0xaeff('0x8'),'enterAt':_0x20016f[_0xaeff('0x9')],'exitAt':_0x23e764,'duration':moment(_0x23e764)['diff'](_0x20016f['queuecallerleaveAt'],_0xaeff('0xa')),'data1':_0xaeff('0xb'),'data2':_0x20016f[_0xaeff('0xc')],'data3':_0x20016f[_0xaeff('0xd')],'data4':null,'data5':_0x20016f[_0xaeff('0xe')],'role':_0xaeff('0xf'),'internal':_0x20016f['accountcode']?_[_0xaeff('0x10')](_0x20016f[_0xaeff('0x11')]):undefined,'uniqueid':_0x20016f[_0xaeff('0x12')]},'log':_0xaeff('0x13')});};exports[_0xaeff('0x14')]=function(_0xc54472){return client['Request'](_0xaeff('0x13'),{'body':{'channel':_0xaeff('0x3'),'membername':_0xc54472[_0xaeff('0x15')],'interface':_0xc54472[_0xaeff('0x4')],'type':_0xaeff('0x8'),'enterAt':_0xc54472[_0xaeff('0x16')],'exitAt':_0xc54472[_0xaeff('0x17')],'duration':moment(_0xc54472[_0xaeff('0x17')])[_0xaeff('0x18')](_0xc54472[_0xaeff('0x16')],'seconds')>=0x0?moment(_0xc54472['endtime'])[_0xaeff('0x18')](_0xc54472[_0xaeff('0x16')],'seconds'):null,'data1':_0xaeff('0x19'),'data2':_0xc54472[_0xaeff('0x11')],'data3':_0xc54472[_0xaeff('0xd')],'data4':_0xc54472['dialstring']||null,'role':'agent','internal':_0xc54472['accountcode']?_['toNumber'](_0xc54472[_0xaeff('0x11')]):undefined,'uniqueid':_0xc54472[_0xaeff('0x12')]},'log':_0xaeff('0x13')});};