fa93406494ccbbf57b72c1307889c9c9cb7330cf
[motion2.git] / server / api / chatProactiveAction / chatProactiveAction.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 _0xe0b8=['info','request\x20sent','debug','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','then'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xe0b8,0xe5));var _0x8e0b=function(_0x209ed7,_0x29ad03){_0x209ed7=_0x209ed7-0x0;var _0x594ff0=_0xe0b8[_0x209ed7];return _0x594ff0;};'use strict';var _=require('lodash');var util=require(_0x8e0b('0x0'));var moment=require(_0x8e0b('0x1'));var BPromise=require(_0x8e0b('0x2'));var rs=require(_0x8e0b('0x3'));var fs=require('fs');var Redis=require(_0x8e0b('0x4'));var db=require(_0x8e0b('0x5'))['db'];var utils=require(_0x8e0b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8e0b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8e0b('0x8')][_0x8e0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x262415,_0x2a56a1,_0x545057){return new BPromise(function(_0xd051e4,_0x1e5507){return client['request'](_0x262415,_0x545057)[_0x8e0b('0xa')](function(_0xf83eda){logger[_0x8e0b('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x2a56a1,_0x8e0b('0xc'));logger[_0x8e0b('0xd')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2a56a1,'request\x20sent',JSON['stringify'](_0xf83eda));if(_0xf83eda[_0x8e0b('0xe')]){if(_0xf83eda['error'][_0x8e0b('0xf')]===0x1f4){logger[_0x8e0b('0xe')](_0x8e0b('0x10'),_0x2a56a1,_0xf83eda['error']['message']);return _0x1e5507(_0xf83eda[_0x8e0b('0xe')][_0x8e0b('0x11')]);}logger[_0x8e0b('0xe')](_0x8e0b('0x10'),_0x2a56a1,_0xf83eda[_0x8e0b('0xe')][_0x8e0b('0x11')]);return _0xd051e4(_0xf83eda[_0x8e0b('0xe')][_0x8e0b('0x11')]);}else{logger[_0x8e0b('0xb')](_0x8e0b('0x10'),_0x2a56a1,_0x8e0b('0xc'));_0xd051e4(_0xf83eda[_0x8e0b('0x12')][_0x8e0b('0x11')]);}})[_0x8e0b('0x13')](function(_0x18b522){logger[_0x8e0b('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x2a56a1,_0x18b522);_0x1e5507(_0x18b522);});});}