Built motion from commit ffdca78c.|2.6.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 _0xeb0c=['info','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message'];(function(_0x254b22,_0x27159f){var _0x1279db=function(_0x3ca06f){while(--_0x3ca06f){_0x254b22['push'](_0x254b22['shift']());}};_0x1279db(++_0x27159f);}(_0xeb0c,0xd4));var _0xceb0=function(_0x4e9274,_0x49576e){_0x4e9274=_0x4e9274-0x0;var _0x8b474c=_0xeb0c[_0x4e9274];return _0x8b474c;};'use strict';var _=require('lodash');var util=require(_0xceb0('0x0'));var moment=require(_0xceb0('0x1'));var BPromise=require(_0xceb0('0x2'));var rs=require(_0xceb0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xceb0('0x4'))['db'];var utils=require(_0xceb0('0x5'));var logger=require(_0xceb0('0x6'))(_0xceb0('0x7'));var config=require('../../config/environment');var jayson=require(_0xceb0('0x8'));var client=jayson[_0xceb0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dcdd4,_0x41761b,_0x5b84ef){return new BPromise(function(_0x4089a9,_0x186a84){return client[_0xceb0('0xa')](_0x5dcdd4,_0x5b84ef)['then'](function(_0x2690d7){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x41761b,_0xceb0('0xb'));logger[_0xceb0('0xc')](_0xceb0('0xd'),_0x41761b,_0xceb0('0xb'),JSON[_0xceb0('0xe')](_0x2690d7));if(_0x2690d7[_0xceb0('0xf')]){if(_0x2690d7[_0xceb0('0xf')][_0xceb0('0x10')]===0x1f4){logger[_0xceb0('0xf')](_0xceb0('0x11'),_0x41761b,_0x2690d7['error']['message']);return _0x186a84(_0x2690d7['error'][_0xceb0('0x12')]);}logger[_0xceb0('0xf')](_0xceb0('0x11'),_0x41761b,_0x2690d7[_0xceb0('0xf')][_0xceb0('0x12')]);return _0x4089a9(_0x2690d7[_0xceb0('0xf')][_0xceb0('0x12')]);}else{logger[_0xceb0('0x13')](_0xceb0('0x11'),_0x41761b,_0xceb0('0xb'));_0x4089a9(_0x2690d7['result'][_0xceb0('0x12')]);}})[_0xceb0('0x14')](function(_0x54a85a){logger['error'](_0xceb0('0x11'),_0x41761b,_0x54a85a);_0x186a84(_0x54a85a);});});}