Built motion from commit (unavailable).|2.5.2
[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 _0xd58b=['../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x26a44d,_0x14d991){var _0x4ee71e=function(_0x3b6dbc){while(--_0x3b6dbc){_0x26a44d['push'](_0x26a44d['shift']());}};_0x4ee71e(++_0x14d991);}(_0xd58b,0x19d));var _0xbd58=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xd58b[_0x342baa];return _0x1208f3;};'use strict';var _=require('lodash');var util=require(_0xbd58('0x0'));var moment=require(_0xbd58('0x1'));var BPromise=require(_0xbd58('0x2'));var rs=require(_0xbd58('0x3'));var fs=require('fs');var Redis=require(_0xbd58('0x4'));var db=require(_0xbd58('0x5'))['db'];var utils=require(_0xbd58('0x6'));var logger=require(_0xbd58('0x7'))('rpc');var config=require(_0xbd58('0x8'));var jayson=require(_0xbd58('0x9'));var client=jayson[_0xbd58('0xa')][_0xbd58('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10ecb7,_0x4b44b1,_0x1d2da8){return new BPromise(function(_0x21a184,_0x14c649){return client['request'](_0x10ecb7,_0x1d2da8)[_0xbd58('0xc')](function(_0xc203c){logger[_0xbd58('0xd')](_0xbd58('0xe'),_0x4b44b1,_0xbd58('0xf'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x4b44b1,_0xbd58('0xf'),JSON[_0xbd58('0x10')](_0xc203c));if(_0xc203c[_0xbd58('0x11')]){if(_0xc203c['error'][_0xbd58('0x12')]===0x1f4){logger[_0xbd58('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x4b44b1,_0xc203c['error']['message']);return _0x14c649(_0xc203c[_0xbd58('0x11')]['message']);}logger[_0xbd58('0x11')](_0xbd58('0xe'),_0x4b44b1,_0xc203c['error'][_0xbd58('0x13')]);return _0x21a184(_0xc203c[_0xbd58('0x11')][_0xbd58('0x13')]);}else{logger[_0xbd58('0xd')](_0xbd58('0xe'),_0x4b44b1,_0xbd58('0xf'));_0x21a184(_0xc203c['result']['message']);}})[_0xbd58('0x14')](function(_0x3bf941){logger['error'](_0xbd58('0xe'),_0x4b44b1,_0x3bf941);_0x14c649(_0x3bf941);});});}