Built motion from commit e02f907f.|2.6.14
[motion2.git] / server / api / voiceTransferReport / voiceTransferReport.rpc.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 _0x6140=['debug','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','VoiceTransferReport,\x20%s,\x20%s','catch','VoiceTransferReport','raw','CreateVoiceTransferReport'];(function(_0xff9cb,_0x1b45d7){var _0x455a53=function(_0x50cd1b){while(--_0x50cd1b){_0xff9cb['push'](_0xff9cb['shift']());}};_0x455a53(++_0x1b45d7);}(_0x6140,0x89));var _0x0614=function(_0x4df17c,_0x2d2b61){_0x4df17c=_0x4df17c-0x0;var _0x4e79b5=_0x6140[_0x4df17c];return _0x4e79b5;};'use strict';var _=require(_0x0614('0x0'));var util=require('util');var moment=require(_0x0614('0x1'));var BPromise=require(_0x0614('0x2'));var rs=require(_0x0614('0x3'));var fs=require('fs');var Redis=require(_0x0614('0x4'));var db=require(_0x0614('0x5'))['db'];var utils=require(_0x0614('0x6'));var logger=require(_0x0614('0x7'))(_0x0614('0x8'));var config=require(_0x0614('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0614('0xa')][_0x0614('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x200a97,_0x49c6e4,_0x522354){return new BPromise(function(_0x39ea27,_0x5002b6){return client[_0x0614('0xc')](_0x200a97,_0x522354)[_0x0614('0xd')](function(_0x513636){logger[_0x0614('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x49c6e4,'request\x20sent');logger['debug'](_0x0614('0xf'),_0x49c6e4,_0x0614('0x10'),JSON['stringify'](_0x513636));if(_0x513636[_0x0614('0x11')]){if(_0x513636[_0x0614('0x11')][_0x0614('0x12')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x49c6e4,_0x513636['error'][_0x0614('0x13')]);return _0x5002b6(_0x513636[_0x0614('0x11')][_0x0614('0x13')]);}logger[_0x0614('0x11')](_0x0614('0x14'),_0x49c6e4,_0x513636[_0x0614('0x11')][_0x0614('0x13')]);return _0x39ea27(_0x513636[_0x0614('0x11')]['message']);}else{logger[_0x0614('0xe')](_0x0614('0x14'),_0x49c6e4,_0x0614('0x10'));_0x39ea27(_0x513636['result'][_0x0614('0x13')]);}})[_0x0614('0x15')](function(_0x46e57a){logger[_0x0614('0x11')](_0x0614('0x14'),_0x49c6e4,_0x46e57a);_0x5002b6(_0x46e57a);});});}exports['CreateVoiceTransferReport']=function(_0x5cf464){var _0x2d14bb=this;return new Promise(function(_0x3c4bd1,_0x58a2d9){return db[_0x0614('0x16')]['create'](_0x5cf464['body'],{'raw':_0x5cf464['options']?_0x5cf464['options'][_0x0614('0x17')]===undefined?!![]:![]:!![]})[_0x0614('0xd')](function(_0x1a4448){logger[_0x0614('0xe')](_0x0614('0x18'),_0x5cf464);logger[_0x0614('0x19')]('CreateVoiceTransferReport',_0x5cf464,JSON[_0x0614('0x1a')](_0x1a4448));_0x3c4bd1(_0x1a4448);})[_0x0614('0x15')](function(_0x4c3c5b){logger[_0x0614('0x11')](_0x0614('0x18'),_0x4c3c5b[_0x0614('0x13')],_0x5cf464);_0x58a2d9(_0x2d14bb[_0x0614('0x11')](0x1f4,_0x4c3c5b[_0x0614('0x13')]));});});};