553118be921fd2ba7d8b7594343006c6ef9618cf
[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 _0xc67b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','moment'];(function(_0x41909f,_0x32eb77){var _0x50de06=function(_0x29f0e5){while(--_0x29f0e5){_0x41909f['push'](_0x41909f['shift']());}};_0x50de06(++_0x32eb77);}(_0xc67b,0x1df));var _0xbc67=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xc67b[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbc67('0x0'));var BPromise=require(_0xbc67('0x1'));var rs=require(_0xbc67('0x2'));var fs=require('fs');var Redis=require(_0xbc67('0x3'));var db=require(_0xbc67('0x4'))['db'];var utils=require(_0xbc67('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbc67('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x47ca4e,_0x48e160,_0x17a6ad){return new BPromise(function(_0x47e440,_0x3b1ac0){return client[_0xbc67('0x7')](_0x47ca4e,_0x17a6ad)[_0xbc67('0x8')](function(_0x484293){logger[_0xbc67('0x9')](_0xbc67('0xa'),_0x48e160,'request\x20sent');logger[_0xbc67('0xb')](_0xbc67('0xc'),_0x48e160,'request\x20sent',JSON[_0xbc67('0xd')](_0x484293));if(_0x484293[_0xbc67('0xe')]){if(_0x484293[_0xbc67('0xe')][_0xbc67('0xf')]===0x1f4){logger[_0xbc67('0xe')](_0xbc67('0xa'),_0x48e160,_0x484293[_0xbc67('0xe')][_0xbc67('0x10')]);return _0x3b1ac0(_0x484293['error']['message']);}logger[_0xbc67('0xe')](_0xbc67('0xa'),_0x48e160,_0x484293[_0xbc67('0xe')][_0xbc67('0x10')]);return _0x47e440(_0x484293[_0xbc67('0xe')][_0xbc67('0x10')]);}else{logger[_0xbc67('0x9')](_0xbc67('0xa'),_0x48e160,_0xbc67('0x11'));_0x47e440(_0x484293[_0xbc67('0x12')]['message']);}})[_0xbc67('0x13')](function(_0x2adf63){logger[_0xbc67('0xe')](_0xbc67('0xa'),_0x48e160,_0x2adf63);_0x3b1ac0(_0x2adf63);});});}