4ee21eaf1021e87af7839212e9496aa9f0d5d89b
[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 _0x4a56=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis'];(function(_0x10778c,_0x461571){var _0x38d5f2=function(_0x3afba0){while(--_0x3afba0){_0x10778c['push'](_0x10778c['shift']());}};_0x38d5f2(++_0x461571);}(_0x4a56,0xd5));var _0x64a5=function(_0x3d0ad3,_0x1783ee){_0x3d0ad3=_0x3d0ad3-0x0;var _0x5397b6=_0x4a56[_0x3d0ad3];return _0x5397b6;};'use strict';var _=require('lodash');var util=require(_0x64a5('0x0'));var moment=require('moment');var BPromise=require(_0x64a5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x64a5('0x2'));var db=require(_0x64a5('0x3'))['db'];var utils=require(_0x64a5('0x4'));var logger=require(_0x64a5('0x5'))(_0x64a5('0x6'));var config=require(_0x64a5('0x7'));var jayson=require(_0x64a5('0x8'));var client=jayson[_0x64a5('0x9')][_0x64a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32c09e,_0x5ae8cf,_0x56a0f0){return new BPromise(function(_0x493178,_0x3ed361){return client[_0x64a5('0xb')](_0x32c09e,_0x56a0f0)[_0x64a5('0xc')](function(_0x53c14e){logger[_0x64a5('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x5ae8cf,_0x64a5('0xe'));logger[_0x64a5('0xf')](_0x64a5('0x10'),_0x5ae8cf,'request\x20sent',JSON[_0x64a5('0x11')](_0x53c14e));if(_0x53c14e[_0x64a5('0x12')]){if(_0x53c14e[_0x64a5('0x12')][_0x64a5('0x13')]===0x1f4){logger['error'](_0x64a5('0x14'),_0x5ae8cf,_0x53c14e[_0x64a5('0x12')][_0x64a5('0x15')]);return _0x3ed361(_0x53c14e[_0x64a5('0x12')][_0x64a5('0x15')]);}logger[_0x64a5('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x5ae8cf,_0x53c14e[_0x64a5('0x12')]['message']);return _0x493178(_0x53c14e['error']['message']);}else{logger[_0x64a5('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x5ae8cf,'request\x20sent');_0x493178(_0x53c14e[_0x64a5('0x16')]['message']);}})[_0x64a5('0x17')](function(_0x4ede48){logger['error'](_0x64a5('0x14'),_0x5ae8cf,_0x4ede48);_0x3ed361(_0x4ede48);});});}