d7eb46bb3fbbaff83ab6e7a830889e23567597d6
[motion2.git] / server / api / userVoiceQueue / userVoiceQueue.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 _0x062e=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x35f852,_0x5c0a47){var _0x7ff655=function(_0x4e90b8){while(--_0x4e90b8){_0x35f852['push'](_0x35f852['shift']());}};_0x7ff655(++_0x5c0a47);}(_0x062e,0x103));var _0xe062=function(_0x989fe,_0x3c9dc3){_0x989fe=_0x989fe-0x0;var _0x1cee1b=_0x062e[_0x989fe];return _0x1cee1b;};'use strict';var _=require(_0xe062('0x0'));var util=require('util');var moment=require(_0xe062('0x1'));var BPromise=require(_0xe062('0x2'));var rs=require(_0xe062('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe062('0x4'))['db'];var utils=require(_0xe062('0x5'));var logger=require('../../config/logger')(_0xe062('0x6'));var config=require(_0xe062('0x7'));var jayson=require(_0xe062('0x8'));var client=jayson[_0xe062('0x9')][_0xe062('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b984b,_0x2ec793,_0x1fa662){return new BPromise(function(_0x41c463,_0x1f30d4){return client[_0xe062('0xb')](_0x1b984b,_0x1fa662)[_0xe062('0xc')](function(_0xb8c4a9){logger[_0xe062('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x2ec793,_0xe062('0xe'));logger[_0xe062('0xf')](_0xe062('0x10'),_0x2ec793,'request\x20sent',JSON[_0xe062('0x11')](_0xb8c4a9));if(_0xb8c4a9[_0xe062('0x12')]){if(_0xb8c4a9[_0xe062('0x12')][_0xe062('0x13')]===0x1f4){logger['error'](_0xe062('0x14'),_0x2ec793,_0xb8c4a9['error'][_0xe062('0x15')]);return _0x1f30d4(_0xb8c4a9[_0xe062('0x12')][_0xe062('0x15')]);}logger[_0xe062('0x12')](_0xe062('0x14'),_0x2ec793,_0xb8c4a9[_0xe062('0x12')][_0xe062('0x15')]);return _0x41c463(_0xb8c4a9[_0xe062('0x12')]['message']);}else{logger[_0xe062('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x2ec793,_0xe062('0xe'));_0x41c463(_0xb8c4a9['result']['message']);}})['catch'](function(_0xdc9944){logger[_0xe062('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x2ec793,_0xdc9944);_0x1f30d4(_0xdc9944);});});}