Built motion from commit (unavailable).|2.5.11
[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 _0x08dd=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2be01d,_0x5e7bae){var _0x2918a9=function(_0x1bd70e){while(--_0x1bd70e){_0x2be01d['push'](_0x2be01d['shift']());}};_0x2918a9(++_0x5e7bae);}(_0x08dd,0x1f2));var _0xd08d=function(_0x4a339e,_0xc55463){_0x4a339e=_0x4a339e-0x0;var _0x401b5=_0x08dd[_0x4a339e];return _0x401b5;};'use strict';var _=require(_0xd08d('0x0'));var util=require(_0xd08d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd08d('0x2'));var fs=require('fs');var Redis=require(_0xd08d('0x3'));var db=require(_0xd08d('0x4'))['db'];var utils=require(_0xd08d('0x5'));var logger=require('../../config/logger')(_0xd08d('0x6'));var config=require('../../config/environment');var jayson=require(_0xd08d('0x7'));var client=jayson[_0xd08d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x597ae1,_0x5745e7,_0x1bca82){return new BPromise(function(_0x4cb8fe,_0x285bfc){return client['request'](_0x597ae1,_0x1bca82)[_0xd08d('0x9')](function(_0x38779d){logger[_0xd08d('0xa')](_0xd08d('0xb'),_0x5745e7,_0xd08d('0xc'));logger[_0xd08d('0xd')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x5745e7,_0xd08d('0xc'),JSON[_0xd08d('0xe')](_0x38779d));if(_0x38779d[_0xd08d('0xf')]){if(_0x38779d[_0xd08d('0xf')][_0xd08d('0x10')]===0x1f4){logger['error'](_0xd08d('0xb'),_0x5745e7,_0x38779d[_0xd08d('0xf')]['message']);return _0x285bfc(_0x38779d['error']['message']);}logger[_0xd08d('0xf')](_0xd08d('0xb'),_0x5745e7,_0x38779d[_0xd08d('0xf')][_0xd08d('0x11')]);return _0x4cb8fe(_0x38779d[_0xd08d('0xf')][_0xd08d('0x11')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x5745e7,'request\x20sent');_0x4cb8fe(_0x38779d[_0xd08d('0x12')][_0xd08d('0x11')]);}})[_0xd08d('0x13')](function(_0x5710db){logger[_0xd08d('0xf')](_0xd08d('0xb'),_0x5745e7,_0x5710db);_0x285bfc(_0x5710db);});});}