Built motion from commit (unavailable).|2.5.4
[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 _0xa076=['jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x1c22ac,_0x4c86bd){var _0x4c867a=function(_0x370c7d){while(--_0x370c7d){_0x1c22ac['push'](_0x1c22ac['shift']());}};_0x4c867a(++_0x4c86bd);}(_0xa076,0x19d));var _0x6a07=function(_0x2ea6af,_0x255d1c){_0x2ea6af=_0x2ea6af-0x0;var _0x28bfc6=_0xa076[_0x2ea6af];return _0x28bfc6;};'use strict';var _=require(_0x6a07('0x0'));var util=require(_0x6a07('0x1'));var moment=require(_0x6a07('0x2'));var BPromise=require('bluebird');var rs=require(_0x6a07('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a07('0x4'))['db'];var utils=require(_0x6a07('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6a07('0x6'));var jayson=require(_0x6a07('0x7'));var client=jayson[_0x6a07('0x8')][_0x6a07('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x97a87e,_0x2f208c,_0x38db1c){return new BPromise(function(_0x5de94c,_0x4f6582){return client['request'](_0x97a87e,_0x38db1c)[_0x6a07('0xa')](function(_0x55c469){logger[_0x6a07('0xb')](_0x6a07('0xc'),_0x2f208c,'request\x20sent');logger[_0x6a07('0xd')](_0x6a07('0xe'),_0x2f208c,_0x6a07('0xf'),JSON['stringify'](_0x55c469));if(_0x55c469[_0x6a07('0x10')]){if(_0x55c469['error'][_0x6a07('0x11')]===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x2f208c,_0x55c469[_0x6a07('0x10')][_0x6a07('0x12')]);return _0x4f6582(_0x55c469[_0x6a07('0x10')][_0x6a07('0x12')]);}logger[_0x6a07('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x2f208c,_0x55c469['error'][_0x6a07('0x12')]);return _0x5de94c(_0x55c469[_0x6a07('0x10')]['message']);}else{logger['info'](_0x6a07('0xc'),_0x2f208c,_0x6a07('0xf'));_0x5de94c(_0x55c469[_0x6a07('0x13')][_0x6a07('0x12')]);}})[_0x6a07('0x14')](function(_0x173c46){logger[_0x6a07('0x10')](_0x6a07('0xc'),_0x2f208c,_0x173c46);_0x4f6582(_0x173c46);});});}