Built motion from commit (unavailable).|2.5.3
[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 _0x0f51=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','util'];(function(_0x8a5128,_0x31286d){var _0x12b427=function(_0x2b9636){while(--_0x2b9636){_0x8a5128['push'](_0x8a5128['shift']());}};_0x12b427(++_0x31286d);}(_0x0f51,0x125));var _0x10f5=function(_0x15599c,_0x1ebd6a){_0x15599c=_0x15599c-0x0;var _0x5f1b30=_0x0f51[_0x15599c];return _0x5f1b30;};'use strict';var _=require('lodash');var util=require(_0x10f5('0x0'));var moment=require(_0x10f5('0x1'));var BPromise=require(_0x10f5('0x2'));var rs=require(_0x10f5('0x3'));var fs=require('fs');var Redis=require(_0x10f5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x10f5('0x5'));var logger=require(_0x10f5('0x6'))('rpc');var config=require(_0x10f5('0x7'));var jayson=require(_0x10f5('0x8'));var client=jayson[_0x10f5('0x9')][_0x10f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f8390,_0x2b7322,_0x28c2f3){return new BPromise(function(_0x43c52c,_0x244cc1){return client[_0x10f5('0xb')](_0x2f8390,_0x28c2f3)[_0x10f5('0xc')](function(_0xe11162){logger['info'](_0x10f5('0xd'),_0x2b7322,_0x10f5('0xe'));logger[_0x10f5('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2b7322,_0x10f5('0xe'),JSON[_0x10f5('0x10')](_0xe11162));if(_0xe11162['error']){if(_0xe11162[_0x10f5('0x11')]['code']===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x2b7322,_0xe11162[_0x10f5('0x11')][_0x10f5('0x12')]);return _0x244cc1(_0xe11162[_0x10f5('0x11')][_0x10f5('0x12')]);}logger[_0x10f5('0x11')](_0x10f5('0xd'),_0x2b7322,_0xe11162[_0x10f5('0x11')][_0x10f5('0x12')]);return _0x43c52c(_0xe11162[_0x10f5('0x11')][_0x10f5('0x12')]);}else{logger[_0x10f5('0x13')](_0x10f5('0xd'),_0x2b7322,_0x10f5('0xe'));_0x43c52c(_0xe11162['result'][_0x10f5('0x12')]);}})[_0x10f5('0x14')](function(_0x3dfdaf){logger[_0x10f5('0x11')](_0x10f5('0xd'),_0x2b7322,_0x3dfdaf);_0x244cc1(_0x3dfdaf);});});}