6019ceb48db75c2ac9e73975c009105c7b7156bc
[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 _0x8f95=['bluebird','../../mysqldb','../../config/utils','../../config/logger','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','result','catch'];(function(_0x1524a7,_0xffe64d){var _0x6a4acf=function(_0x28fb95){while(--_0x28fb95){_0x1524a7['push'](_0x1524a7['shift']());}};_0x6a4acf(++_0xffe64d);}(_0x8f95,0x108));var _0x58f9=function(_0x3f2ef3,_0x3f16f1){_0x3f2ef3=_0x3f2ef3-0x0;var _0x3fd1a3=_0x8f95[_0x3f2ef3];return _0x3fd1a3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x58f9('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58f9('0x1'))['db'];var utils=require(_0x58f9('0x2'));var logger=require(_0x58f9('0x3'))(_0x58f9('0x4'));var config=require(_0x58f9('0x5'));var jayson=require(_0x58f9('0x6'));var client=jayson[_0x58f9('0x7')][_0x58f9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12245f,_0x5071f7,_0x3e5374){return new BPromise(function(_0x23261f,_0x468523){return client[_0x58f9('0x9')](_0x12245f,_0x3e5374)[_0x58f9('0xa')](function(_0x581e45){logger[_0x58f9('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x5071f7,_0x58f9('0xc'));logger[_0x58f9('0xd')](_0x58f9('0xe'),_0x5071f7,_0x58f9('0xc'),JSON[_0x58f9('0xf')](_0x581e45));if(_0x581e45[_0x58f9('0x10')]){if(_0x581e45[_0x58f9('0x10')][_0x58f9('0x11')]===0x1f4){logger[_0x58f9('0x10')](_0x58f9('0x12'),_0x5071f7,_0x581e45['error'][_0x58f9('0x13')]);return _0x468523(_0x581e45[_0x58f9('0x10')][_0x58f9('0x13')]);}logger['error'](_0x58f9('0x12'),_0x5071f7,_0x581e45[_0x58f9('0x10')][_0x58f9('0x13')]);return _0x23261f(_0x581e45[_0x58f9('0x10')]['message']);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x5071f7,_0x58f9('0xc'));_0x23261f(_0x581e45[_0x58f9('0x14')][_0x58f9('0x13')]);}})[_0x58f9('0x15')](function(_0x599c9b){logger[_0x58f9('0x10')](_0x58f9('0x12'),_0x5071f7,_0x599c9b);_0x468523(_0x599c9b);});});}