Built motion from commit (unavailable).|2.5.17
[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 _0x59f1=['lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','ChatProactiveAction,\x20%s,\x20%s','message','result'];(function(_0x5a32df,_0x261206){var _0xa9a4cf=function(_0xc7f032){while(--_0xc7f032){_0x5a32df['push'](_0x5a32df['shift']());}};_0xa9a4cf(++_0x261206);}(_0x59f1,0xab));var _0x159f=function(_0x2a0e74,_0x62918d){_0x2a0e74=_0x2a0e74-0x0;var _0x570e03=_0x59f1[_0x2a0e74];return _0x570e03;};'use strict';var _=require(_0x159f('0x0'));var util=require('util');var moment=require(_0x159f('0x1'));var BPromise=require('bluebird');var rs=require(_0x159f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x159f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x159f('0x4'))(_0x159f('0x5'));var config=require(_0x159f('0x6'));var jayson=require(_0x159f('0x7'));var client=jayson[_0x159f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e295c,_0x465740,_0x183a96){return new BPromise(function(_0x2708c6,_0x186ba5){return client[_0x159f('0x9')](_0x2e295c,_0x183a96)[_0x159f('0xa')](function(_0x1de114){logger[_0x159f('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x465740,_0x159f('0xc'));logger[_0x159f('0xd')](_0x159f('0xe'),_0x465740,'request\x20sent',JSON['stringify'](_0x1de114));if(_0x1de114[_0x159f('0xf')]){if(_0x1de114['error']['code']===0x1f4){logger[_0x159f('0xf')](_0x159f('0x10'),_0x465740,_0x1de114[_0x159f('0xf')][_0x159f('0x11')]);return _0x186ba5(_0x1de114['error']['message']);}logger[_0x159f('0xf')](_0x159f('0x10'),_0x465740,_0x1de114[_0x159f('0xf')][_0x159f('0x11')]);return _0x2708c6(_0x1de114[_0x159f('0xf')][_0x159f('0x11')]);}else{logger[_0x159f('0xb')](_0x159f('0x10'),_0x465740,_0x159f('0xc'));_0x2708c6(_0x1de114[_0x159f('0x12')]['message']);}})['catch'](function(_0xc349c6){logger['error'](_0x159f('0x10'),_0x465740,_0xc349c6);_0x186ba5(_0xc349c6);});});}