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 _0x6792=['Condition,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info'];(function(_0x5982fd,_0x3ce959){var _0x238b15=function(_0x1203b7){while(--_0x1203b7){_0x5982fd['push'](_0x5982fd['shift']());}};_0x238b15(++_0x3ce959);}(_0x6792,0x1ac));var _0x2679=function(_0x2c604b,_0x29ccb1){_0x2c604b=_0x2c604b-0x0;var _0x1ceffe=_0x6792[_0x2c604b];return _0x1ceffe;};'use strict';var _=require(_0x2679('0x0'));var util=require('util');var moment=require(_0x2679('0x1'));var BPromise=require(_0x2679('0x2'));var rs=require(_0x2679('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x2679('0x4'));var logger=require(_0x2679('0x5'))(_0x2679('0x6'));var config=require(_0x2679('0x7'));var jayson=require(_0x2679('0x8'));var client=jayson['client'][_0x2679('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x520e9e,_0x35d5cf,_0x249e52){return new BPromise(function(_0x5184ec,_0x118fd5){return client['request'](_0x520e9e,_0x249e52)[_0x2679('0xa')](function(_0x4ab2df){logger[_0x2679('0xb')](_0x2679('0xc'),_0x35d5cf,_0x2679('0xd'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x35d5cf,_0x2679('0xd'),JSON[_0x2679('0xe')](_0x4ab2df));if(_0x4ab2df[_0x2679('0xf')]){if(_0x4ab2df[_0x2679('0xf')][_0x2679('0x10')]===0x1f4){logger[_0x2679('0xf')]('Condition,\x20%s,\x20%s',_0x35d5cf,_0x4ab2df[_0x2679('0xf')][_0x2679('0x11')]);return _0x118fd5(_0x4ab2df['error'][_0x2679('0x11')]);}logger[_0x2679('0xf')](_0x2679('0xc'),_0x35d5cf,_0x4ab2df[_0x2679('0xf')][_0x2679('0x11')]);return _0x5184ec(_0x4ab2df[_0x2679('0xf')]['message']);}else{logger[_0x2679('0xb')](_0x2679('0xc'),_0x35d5cf,_0x2679('0xd'));_0x5184ec(_0x4ab2df[_0x2679('0x12')][_0x2679('0x11')]);}})[_0x2679('0x13')](function(_0x4666bc){logger[_0x2679('0xf')](_0x2679('0xc'),_0x35d5cf,_0x4666bc);_0x118fd5(_0x4666bc);});});}