Built motion from commit b0a9a629.|2.6.33
[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 _0x8a81=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird'];(function(_0x19ca6e,_0x5e0abc){var _0x175fe1=function(_0x5edc8a){while(--_0x5edc8a){_0x19ca6e['push'](_0x19ca6e['shift']());}};_0x175fe1(++_0x5e0abc);}(_0x8a81,0x67));var _0x18a8=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x8a81[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require(_0x18a8('0x0'));var moment=require('moment');var BPromise=require(_0x18a8('0x1'));var rs=require(_0x18a8('0x2'));var fs=require('fs');var Redis=require(_0x18a8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x18a8('0x4'));var logger=require(_0x18a8('0x5'))(_0x18a8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x18a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x527e9e,_0x27ead0,_0x5cbbe7){return new BPromise(function(_0xd95564,_0x1c2275){return client[_0x18a8('0x8')](_0x527e9e,_0x5cbbe7)[_0x18a8('0x9')](function(_0x3de6c0){logger[_0x18a8('0xa')](_0x18a8('0xb'),_0x27ead0,_0x18a8('0xc'));logger[_0x18a8('0xd')](_0x18a8('0xe'),_0x27ead0,'request\x20sent',JSON[_0x18a8('0xf')](_0x3de6c0));if(_0x3de6c0[_0x18a8('0x10')]){if(_0x3de6c0['error'][_0x18a8('0x11')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x27ead0,_0x3de6c0[_0x18a8('0x10')]['message']);return _0x1c2275(_0x3de6c0[_0x18a8('0x10')][_0x18a8('0x12')]);}logger[_0x18a8('0x10')](_0x18a8('0xb'),_0x27ead0,_0x3de6c0[_0x18a8('0x10')][_0x18a8('0x12')]);return _0xd95564(_0x3de6c0[_0x18a8('0x10')][_0x18a8('0x12')]);}else{logger[_0x18a8('0xa')](_0x18a8('0xb'),_0x27ead0,_0x18a8('0xc'));_0xd95564(_0x3de6c0[_0x18a8('0x13')][_0x18a8('0x12')]);}})[_0x18a8('0x14')](function(_0x5452cf){logger[_0x18a8('0x10')](_0x18a8('0xb'),_0x27ead0,_0x5452cf);_0x1c2275(_0x5452cf);});});}