b669867744ae25911c3073f4d2bad79e52450905
[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 _0x8019=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird'];(function(_0x5bdcce,_0x2db971){var _0x51d1f6=function(_0x3de84e){while(--_0x3de84e){_0x5bdcce['push'](_0x5bdcce['shift']());}};_0x51d1f6(++_0x2db971);}(_0x8019,0x18d));var _0x9801=function(_0x19a41b,_0x966050){_0x19a41b=_0x19a41b-0x0;var _0x310441=_0x8019[_0x19a41b];return _0x310441;};'use strict';var _=require('lodash');var util=require(_0x9801('0x0'));var moment=require('moment');var BPromise=require(_0x9801('0x1'));var rs=require(_0x9801('0x2'));var fs=require('fs');var Redis=require(_0x9801('0x3'));var db=require(_0x9801('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9801('0x5'));var config=require(_0x9801('0x6'));var jayson=require(_0x9801('0x7'));var client=jayson[_0x9801('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18782c,_0x4a8cba,_0x39b691){return new BPromise(function(_0xbdc9b6,_0x25d276){return client[_0x9801('0x9')](_0x18782c,_0x39b691)[_0x9801('0xa')](function(_0x312d31){logger[_0x9801('0xb')](_0x9801('0xc'),_0x4a8cba,_0x9801('0xd'));logger[_0x9801('0xe')](_0x9801('0xf'),_0x4a8cba,_0x9801('0xd'),JSON[_0x9801('0x10')](_0x312d31));if(_0x312d31[_0x9801('0x11')]){if(_0x312d31[_0x9801('0x11')][_0x9801('0x12')]===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x4a8cba,_0x312d31[_0x9801('0x11')][_0x9801('0x13')]);return _0x25d276(_0x312d31['error'][_0x9801('0x13')]);}logger[_0x9801('0x11')](_0x9801('0xc'),_0x4a8cba,_0x312d31['error'][_0x9801('0x13')]);return _0xbdc9b6(_0x312d31[_0x9801('0x11')]['message']);}else{logger[_0x9801('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x4a8cba,_0x9801('0xd'));_0xbdc9b6(_0x312d31['result'][_0x9801('0x13')]);}})[_0x9801('0x14')](function(_0x59c96d){logger[_0x9801('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x4a8cba,_0x59c96d);_0x25d276(_0x59c96d);});});}