8332c5ad758dc02014ccf938b6391b119e01a3e3
[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 _0x2e84=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4db9ed,_0x1e1a7e){var _0x218dab=function(_0x1a36ab){while(--_0x1a36ab){_0x4db9ed['push'](_0x4db9ed['shift']());}};_0x218dab(++_0x1e1a7e);}(_0x2e84,0x175));var _0x42e8=function(_0xe3f6e7,_0x45773c){_0xe3f6e7=_0xe3f6e7-0x0;var _0x14894f=_0x2e84[_0xe3f6e7];return _0x14894f;};'use strict';var _=require(_0x42e8('0x0'));var util=require(_0x42e8('0x1'));var moment=require(_0x42e8('0x2'));var BPromise=require(_0x42e8('0x3'));var rs=require(_0x42e8('0x4'));var fs=require('fs');var Redis=require(_0x42e8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x42e8('0x6'));var logger=require(_0x42e8('0x7'))(_0x42e8('0x8'));var config=require(_0x42e8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x42e8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x395a38,_0x189638,_0x1eb9c9){return new BPromise(function(_0x165f76,_0x403f47){return client['request'](_0x395a38,_0x1eb9c9)[_0x42e8('0xb')](function(_0x32a8ff){logger[_0x42e8('0xc')](_0x42e8('0xd'),_0x189638,'request\x20sent');logger[_0x42e8('0xe')](_0x42e8('0xf'),_0x189638,_0x42e8('0x10'),JSON[_0x42e8('0x11')](_0x32a8ff));if(_0x32a8ff[_0x42e8('0x12')]){if(_0x32a8ff['error'][_0x42e8('0x13')]===0x1f4){logger['error'](_0x42e8('0xd'),_0x189638,_0x32a8ff['error'][_0x42e8('0x14')]);return _0x403f47(_0x32a8ff['error'][_0x42e8('0x14')]);}logger[_0x42e8('0x12')](_0x42e8('0xd'),_0x189638,_0x32a8ff[_0x42e8('0x12')][_0x42e8('0x14')]);return _0x165f76(_0x32a8ff[_0x42e8('0x12')][_0x42e8('0x14')]);}else{logger[_0x42e8('0xc')](_0x42e8('0xd'),_0x189638,_0x42e8('0x10'));_0x165f76(_0x32a8ff[_0x42e8('0x15')][_0x42e8('0x14')]);}})[_0x42e8('0x16')](function(_0x563f10){logger[_0x42e8('0x12')](_0x42e8('0xd'),_0x189638,_0x563f10);_0x403f47(_0x563f10);});});}