Built motion from commit c116dc8b.|2.6.30
[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 _0x1767=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x1e5ac6,_0x268876){var _0x3aec7d=function(_0x56cdd5){while(--_0x56cdd5){_0x1e5ac6['push'](_0x1e5ac6['shift']());}};_0x3aec7d(++_0x268876);}(_0x1767,0x71));var _0x7176=function(_0x57efaa,_0x1d0a41){_0x57efaa=_0x57efaa-0x0;var _0x3c7ecb=_0x1767[_0x57efaa];return _0x3c7ecb;};'use strict';var _=require(_0x7176('0x0'));var util=require(_0x7176('0x1'));var moment=require(_0x7176('0x2'));var BPromise=require('bluebird');var rs=require(_0x7176('0x3'));var fs=require('fs');var Redis=require(_0x7176('0x4'));var db=require(_0x7176('0x5'))['db'];var utils=require(_0x7176('0x6'));var logger=require('../../config/logger')(_0x7176('0x7'));var config=require('../../config/environment');var jayson=require(_0x7176('0x8'));var client=jayson[_0x7176('0x9')][_0x7176('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e0914,_0x1973b0,_0x3a4f5e){return new BPromise(function(_0x1ae806,_0xfc3784){return client[_0x7176('0xb')](_0x1e0914,_0x3a4f5e)[_0x7176('0xc')](function(_0xbdccf4){logger[_0x7176('0xd')](_0x7176('0xe'),_0x1973b0,_0x7176('0xf'));logger[_0x7176('0x10')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x1973b0,_0x7176('0xf'),JSON['stringify'](_0xbdccf4));if(_0xbdccf4[_0x7176('0x11')]){if(_0xbdccf4['error'][_0x7176('0x12')]===0x1f4){logger[_0x7176('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x1973b0,_0xbdccf4['error'][_0x7176('0x13')]);return _0xfc3784(_0xbdccf4[_0x7176('0x11')]['message']);}logger[_0x7176('0x11')](_0x7176('0xe'),_0x1973b0,_0xbdccf4['error'][_0x7176('0x13')]);return _0x1ae806(_0xbdccf4[_0x7176('0x11')][_0x7176('0x13')]);}else{logger[_0x7176('0xd')](_0x7176('0xe'),_0x1973b0,_0x7176('0xf'));_0x1ae806(_0xbdccf4[_0x7176('0x14')]['message']);}})[_0x7176('0x15')](function(_0x2199f8){logger['error'](_0x7176('0xe'),_0x1973b0,_0x2199f8);_0xfc3784(_0x2199f8);});});}