Built motion from commit b5996064.|2.6.21
[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 _0xe8d7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','ChatProactiveAction,\x20%s,\x20%s','message','catch','util'];(function(_0x33bff0,_0xa58cd4){var _0x11eada=function(_0x12d006){while(--_0x12d006){_0x33bff0['push'](_0x33bff0['shift']());}};_0x11eada(++_0xa58cd4);}(_0xe8d7,0x1a3));var _0x7e8d=function(_0x346045,_0x3ce566){_0x346045=_0x346045-0x0;var _0x3d1573=_0xe8d7[_0x346045];return _0x3d1573;};'use strict';var _=require('lodash');var util=require(_0x7e8d('0x0'));var moment=require('moment');var BPromise=require(_0x7e8d('0x1'));var rs=require(_0x7e8d('0x2'));var fs=require('fs');var Redis=require(_0x7e8d('0x3'));var db=require(_0x7e8d('0x4'))['db'];var utils=require(_0x7e8d('0x5'));var logger=require(_0x7e8d('0x6'))(_0x7e8d('0x7'));var config=require('../../config/environment');var jayson=require(_0x7e8d('0x8'));var client=jayson[_0x7e8d('0x9')][_0x7e8d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56b897,_0x1de673,_0x528f3d){return new BPromise(function(_0x3936c8,_0x5c9913){return client['request'](_0x56b897,_0x528f3d)[_0x7e8d('0xb')](function(_0x461f2c){logger[_0x7e8d('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x1de673,_0x7e8d('0xd'));logger[_0x7e8d('0xe')](_0x7e8d('0xf'),_0x1de673,_0x7e8d('0xd'),JSON['stringify'](_0x461f2c));if(_0x461f2c[_0x7e8d('0x10')]){if(_0x461f2c['error']['code']===0x1f4){logger['error'](_0x7e8d('0x11'),_0x1de673,_0x461f2c[_0x7e8d('0x10')][_0x7e8d('0x12')]);return _0x5c9913(_0x461f2c[_0x7e8d('0x10')][_0x7e8d('0x12')]);}logger[_0x7e8d('0x10')](_0x7e8d('0x11'),_0x1de673,_0x461f2c[_0x7e8d('0x10')]['message']);return _0x3936c8(_0x461f2c[_0x7e8d('0x10')][_0x7e8d('0x12')]);}else{logger[_0x7e8d('0xc')](_0x7e8d('0x11'),_0x1de673,_0x7e8d('0xd'));_0x3936c8(_0x461f2c['result'][_0x7e8d('0x12')]);}})[_0x7e8d('0x13')](function(_0x2a260d){logger[_0x7e8d('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x1de673,_0x2a260d);_0x5c9913(_0x2a260d);});});}