Built motion from commit 10af8726.|2.6.34
[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 _0x46f8=['http','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x568a3d,_0x2fac85){var _0x2bbdaf=function(_0x4bee3f){while(--_0x4bee3f){_0x568a3d['push'](_0x568a3d['shift']());}};_0x2bbdaf(++_0x2fac85);}(_0x46f8,0x1c5));var _0x846f=function(_0x2ee600,_0x42d45b){_0x2ee600=_0x2ee600-0x0;var _0x1894f9=_0x46f8[_0x2ee600];return _0x1894f9;};'use strict';var _=require('lodash');var util=require(_0x846f('0x0'));var moment=require(_0x846f('0x1'));var BPromise=require('bluebird');var rs=require(_0x846f('0x2'));var fs=require('fs');var Redis=require(_0x846f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x846f('0x4'));var logger=require('../../config/logger')(_0x846f('0x5'));var config=require(_0x846f('0x6'));var jayson=require(_0x846f('0x7'));var client=jayson[_0x846f('0x8')][_0x846f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15468a,_0x430af7,_0x28bda4){return new BPromise(function(_0x1becce,_0x311b61){return client['request'](_0x15468a,_0x28bda4)[_0x846f('0xa')](function(_0x5d5aff){logger[_0x846f('0xb')](_0x846f('0xc'),_0x430af7,'request\x20sent');logger[_0x846f('0xd')](_0x846f('0xe'),_0x430af7,_0x846f('0xf'),JSON[_0x846f('0x10')](_0x5d5aff));if(_0x5d5aff[_0x846f('0x11')]){if(_0x5d5aff[_0x846f('0x11')][_0x846f('0x12')]===0x1f4){logger['error'](_0x846f('0xc'),_0x430af7,_0x5d5aff[_0x846f('0x11')]['message']);return _0x311b61(_0x5d5aff[_0x846f('0x11')][_0x846f('0x13')]);}logger[_0x846f('0x11')](_0x846f('0xc'),_0x430af7,_0x5d5aff['error'][_0x846f('0x13')]);return _0x1becce(_0x5d5aff[_0x846f('0x11')][_0x846f('0x13')]);}else{logger[_0x846f('0xb')](_0x846f('0xc'),_0x430af7,_0x846f('0xf'));_0x1becce(_0x5d5aff[_0x846f('0x14')][_0x846f('0x13')]);}})[_0x846f('0x15')](function(_0x144a2e){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x430af7,_0x144a2e);_0x311b61(_0x144a2e);});});}