ba45755b89e1fb4cc1a0408906b11b1b7c68b68c
[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 _0xe3fb=['jayson/promise','client','http','request','then','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','ChatProactiveAction,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4c6053,_0x452963){var _0x3f4117=function(_0xd506c6){while(--_0xd506c6){_0x4c6053['push'](_0x4c6053['shift']());}};_0x3f4117(++_0x452963);}(_0xe3fb,0xe7));var _0xbe3f=function(_0x5bef0a,_0x1fb747){_0x5bef0a=_0x5bef0a-0x0;var _0x1a02ea=_0xe3fb[_0x5bef0a];return _0x1a02ea;};'use strict';var _=require('lodash');var util=require(_0xbe3f('0x0'));var moment=require(_0xbe3f('0x1'));var BPromise=require('bluebird');var rs=require(_0xbe3f('0x2'));var fs=require('fs');var Redis=require(_0xbe3f('0x3'));var db=require(_0xbe3f('0x4'))['db'];var utils=require(_0xbe3f('0x5'));var logger=require(_0xbe3f('0x6'))(_0xbe3f('0x7'));var config=require(_0xbe3f('0x8'));var jayson=require(_0xbe3f('0x9'));var client=jayson[_0xbe3f('0xa')][_0xbe3f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bdf48,_0x5612d8,_0x556fa3){return new BPromise(function(_0x4bca4d,_0xb04d6a){return client[_0xbe3f('0xc')](_0x5bdf48,_0x556fa3)[_0xbe3f('0xd')](function(_0x4b1c6f){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x5612d8,_0xbe3f('0xe'));logger[_0xbe3f('0xf')](_0xbe3f('0x10'),_0x5612d8,'request\x20sent',JSON[_0xbe3f('0x11')](_0x4b1c6f));if(_0x4b1c6f[_0xbe3f('0x12')]){if(_0x4b1c6f[_0xbe3f('0x12')]['code']===0x1f4){logger[_0xbe3f('0x12')](_0xbe3f('0x13'),_0x5612d8,_0x4b1c6f[_0xbe3f('0x12')][_0xbe3f('0x14')]);return _0xb04d6a(_0x4b1c6f['error'][_0xbe3f('0x14')]);}logger['error'](_0xbe3f('0x13'),_0x5612d8,_0x4b1c6f[_0xbe3f('0x12')]['message']);return _0x4bca4d(_0x4b1c6f['error'][_0xbe3f('0x14')]);}else{logger[_0xbe3f('0x15')](_0xbe3f('0x13'),_0x5612d8,_0xbe3f('0xe'));_0x4bca4d(_0x4b1c6f[_0xbe3f('0x16')][_0xbe3f('0x14')]);}})[_0xbe3f('0x17')](function(_0x18d91b){logger['error'](_0xbe3f('0x13'),_0x5612d8,_0x18d91b);_0xb04d6a(_0x18d91b);});});}