1bd1224b1e7a619e893ef4aa87158d1526ba18d8
[motion2.git] / server / api / chatTransferReport / chatTransferReport.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 _0x0816=['message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x21fef1,_0x6d02f0){var _0xee3f52=function(_0x3c1f0c){while(--_0x3c1f0c){_0x21fef1['push'](_0x21fef1['shift']());}};_0xee3f52(++_0x6d02f0);}(_0x0816,0xea));var _0x6081=function(_0x1709e7,_0x2ced21){_0x1709e7=_0x1709e7-0x0;var _0x402819=_0x0816[_0x1709e7];return _0x402819;};'use strict';var _=require(_0x6081('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6081('0x1'));var fs=require('fs');var Redis=require(_0x6081('0x2'));var db=require(_0x6081('0x3'))['db'];var utils=require(_0x6081('0x4'));var logger=require('../../config/logger')(_0x6081('0x5'));var config=require(_0x6081('0x6'));var jayson=require(_0x6081('0x7'));var client=jayson['client'][_0x6081('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8f4a9e,_0x469aa9,_0x56dc88){return new BPromise(function(_0x1174c7,_0x36a411){return client['request'](_0x8f4a9e,_0x56dc88)[_0x6081('0x9')](function(_0x151fc3){logger[_0x6081('0xa')](_0x6081('0xb'),_0x469aa9,'request\x20sent');logger[_0x6081('0xc')](_0x6081('0xd'),_0x469aa9,_0x6081('0xe'),JSON[_0x6081('0xf')](_0x151fc3));if(_0x151fc3[_0x6081('0x10')]){if(_0x151fc3[_0x6081('0x10')][_0x6081('0x11')]===0x1f4){logger[_0x6081('0x10')](_0x6081('0xb'),_0x469aa9,_0x151fc3[_0x6081('0x10')][_0x6081('0x12')]);return _0x36a411(_0x151fc3[_0x6081('0x10')][_0x6081('0x12')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x469aa9,_0x151fc3[_0x6081('0x10')]['message']);return _0x1174c7(_0x151fc3['error'][_0x6081('0x12')]);}else{logger['info'](_0x6081('0xb'),_0x469aa9,'request\x20sent');_0x1174c7(_0x151fc3[_0x6081('0x13')][_0x6081('0x12')]);}})[_0x6081('0x14')](function(_0x25998f){logger[_0x6081('0x10')](_0x6081('0xb'),_0x469aa9,_0x25998f);_0x36a411(_0x25998f);});});}