Built motion from commit (unavailable).|2.5.24
[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 _0xde98=['ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','info'];(function(_0x52b39a,_0xb1e790){var _0x47dbf5=function(_0x4d79bf){while(--_0x4d79bf){_0x52b39a['push'](_0x52b39a['shift']());}};_0x47dbf5(++_0xb1e790);}(_0xde98,0x116));var _0x8de9=function(_0x5051de,_0x25dbd7){_0x5051de=_0x5051de-0x0;var _0x3f178c=_0xde98[_0x5051de];return _0x3f178c;};'use strict';var _=require('lodash');var util=require(_0x8de9('0x0'));var moment=require(_0x8de9('0x1'));var BPromise=require('bluebird');var rs=require(_0x8de9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8de9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8de9('0x4'))(_0x8de9('0x5'));var config=require('../../config/environment');var jayson=require(_0x8de9('0x6'));var client=jayson[_0x8de9('0x7')][_0x8de9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c8cc2,_0x245532,_0x383be4){return new BPromise(function(_0x9401a5,_0x53bbad){return client['request'](_0x5c8cc2,_0x383be4)['then'](function(_0xad6392){logger[_0x8de9('0x9')](_0x8de9('0xa'),_0x245532,_0x8de9('0xb'));logger['debug'](_0x8de9('0xc'),_0x245532,_0x8de9('0xb'),JSON[_0x8de9('0xd')](_0xad6392));if(_0xad6392[_0x8de9('0xe')]){if(_0xad6392['error']['code']===0x1f4){logger[_0x8de9('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x245532,_0xad6392[_0x8de9('0xe')]['message']);return _0x53bbad(_0xad6392[_0x8de9('0xe')][_0x8de9('0xf')]);}logger[_0x8de9('0xe')](_0x8de9('0xa'),_0x245532,_0xad6392[_0x8de9('0xe')]['message']);return _0x9401a5(_0xad6392[_0x8de9('0xe')][_0x8de9('0xf')]);}else{logger[_0x8de9('0x9')](_0x8de9('0xa'),_0x245532,_0x8de9('0xb'));_0x9401a5(_0xad6392[_0x8de9('0x10')][_0x8de9('0xf')]);}})[_0x8de9('0x11')](function(_0x565d60){logger[_0x8de9('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x245532,_0x565d60);_0x53bbad(_0x565d60);});});}