0dd281c280f213e068f0ee627713e8c7eae1ff24
[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 _0x5a5c=['message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x14411,_0xd0431f){var _0x171a46=function(_0x10a431){while(--_0x10a431){_0x14411['push'](_0x14411['shift']());}};_0x171a46(++_0xd0431f);}(_0x5a5c,0x1e7));var _0xc5a5=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x5a5c[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0xc5a5('0x0'));var util=require('util');var moment=require(_0xc5a5('0x1'));var BPromise=require('bluebird');var rs=require(_0xc5a5('0x2'));var fs=require('fs');var Redis=require(_0xc5a5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc5a5('0x4'));var logger=require(_0xc5a5('0x5'))(_0xc5a5('0x6'));var config=require(_0xc5a5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc5a5('0x8')][_0xc5a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ca717,_0x24580f,_0x3d0a00){return new BPromise(function(_0x3ae939,_0x465e6f){return client[_0xc5a5('0xa')](_0x2ca717,_0x3d0a00)[_0xc5a5('0xb')](function(_0x206807){logger[_0xc5a5('0xc')](_0xc5a5('0xd'),_0x24580f,_0xc5a5('0xe'));logger[_0xc5a5('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x24580f,_0xc5a5('0xe'),JSON[_0xc5a5('0x10')](_0x206807));if(_0x206807[_0xc5a5('0x11')]){if(_0x206807[_0xc5a5('0x11')][_0xc5a5('0x12')]===0x1f4){logger['error'](_0xc5a5('0xd'),_0x24580f,_0x206807['error']['message']);return _0x465e6f(_0x206807['error'][_0xc5a5('0x13')]);}logger[_0xc5a5('0x11')](_0xc5a5('0xd'),_0x24580f,_0x206807[_0xc5a5('0x11')][_0xc5a5('0x13')]);return _0x3ae939(_0x206807['error'][_0xc5a5('0x13')]);}else{logger['info'](_0xc5a5('0xd'),_0x24580f,_0xc5a5('0xe'));_0x3ae939(_0x206807[_0xc5a5('0x14')][_0xc5a5('0x13')]);}})[_0xc5a5('0x15')](function(_0x4829ea){logger[_0xc5a5('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x24580f,_0x4829ea);_0x465e6f(_0x4829ea);});});}