1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
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. *
17 // *************************************************************************
18 var _0x2635=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x1f0bb3,_0x4b03b1){var _0x1f234a=function(_0x2ef92e){while(--_0x2ef92e){_0x1f0bb3['push'](_0x1f0bb3['shift']());}};_0x1f234a(++_0x4b03b1);}(_0x2635,0x126));var _0x5263=function(_0x185e1d,_0x2c1087){_0x185e1d=_0x185e1d-0x0;var _0x7bd73c=_0x2635[_0x185e1d];return _0x7bd73c;};'use strict';var _=require(_0x5263('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5263('0x1'));var rs=require(_0x5263('0x2'));var fs=require('fs');var Redis=require(_0x5263('0x3'));var db=require(_0x5263('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5263('0x5'))(_0x5263('0x6'));var config=require(_0x5263('0x7'));var jayson=require(_0x5263('0x8'));var client=jayson[_0x5263('0x9')][_0x5263('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x367e41,_0x5d3a02,_0x3eded2){return new BPromise(function(_0x3d0ce3,_0x464f2d){return client[_0x5263('0xb')](_0x367e41,_0x3eded2)[_0x5263('0xc')](function(_0x9b6f5f){logger['info'](_0x5263('0xd'),_0x5d3a02,_0x5263('0xe'));logger[_0x5263('0xf')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x5d3a02,_0x5263('0xe'),JSON[_0x5263('0x10')](_0x9b6f5f));if(_0x9b6f5f['error']){if(_0x9b6f5f['error']['code']===0x1f4){logger['error'](_0x5263('0xd'),_0x5d3a02,_0x9b6f5f[_0x5263('0x11')]['message']);return _0x464f2d(_0x9b6f5f['error']['message']);}logger[_0x5263('0x11')](_0x5263('0xd'),_0x5d3a02,_0x9b6f5f['error'][_0x5263('0x12')]);return _0x3d0ce3(_0x9b6f5f[_0x5263('0x11')][_0x5263('0x12')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x5d3a02,'request\x20sent');_0x3d0ce3(_0x9b6f5f[_0x5263('0x13')][_0x5263('0x12')]);}})[_0x5263('0x14')](function(_0x1001c6){logger[_0x5263('0x11')](_0x5263('0xd'),_0x5d3a02,_0x1001c6);_0x464f2d(_0x1001c6);});});}