Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / api / teamVoiceQueue / teamVoiceQueue.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 _0x8600=['stringify','error','message','info','result','catch','util','randomstring','ioredis','../../mysqldb','rpc','client','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x53c540,_0xaa78b2){var _0x29e07b=function(_0x438cdb){while(--_0x438cdb){_0x53c540['push'](_0x53c540['shift']());}};_0x29e07b(++_0xaa78b2);}(_0x8600,0xd7));var _0x0860=function(_0x150599,_0x3bdfb0){_0x150599=_0x150599-0x0;var _0x12c65f=_0x8600[_0x150599];return _0x12c65f;};'use strict';var _=require('lodash');var util=require(_0x0860('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0860('0x1'));var fs=require('fs');var Redis=require(_0x0860('0x2'));var db=require(_0x0860('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0860('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0860('0x5')][_0x0860('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x314fb6,_0x29dbf9,_0x395f09){return new BPromise(function(_0x324865,_0x548004){return client[_0x0860('0x7')](_0x314fb6,_0x395f09)[_0x0860('0x8')](function(_0x1ffa7b){logger['info'](_0x0860('0x9'),_0x29dbf9,'request\x20sent');logger[_0x0860('0xa')](_0x0860('0xb'),_0x29dbf9,_0x0860('0xc'),JSON[_0x0860('0xd')](_0x1ffa7b));if(_0x1ffa7b[_0x0860('0xe')]){if(_0x1ffa7b[_0x0860('0xe')]['code']===0x1f4){logger[_0x0860('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x29dbf9,_0x1ffa7b[_0x0860('0xe')][_0x0860('0xf')]);return _0x548004(_0x1ffa7b[_0x0860('0xe')][_0x0860('0xf')]);}logger['error'](_0x0860('0x9'),_0x29dbf9,_0x1ffa7b[_0x0860('0xe')][_0x0860('0xf')]);return _0x324865(_0x1ffa7b[_0x0860('0xe')][_0x0860('0xf')]);}else{logger[_0x0860('0x10')](_0x0860('0x9'),_0x29dbf9,'request\x20sent');_0x324865(_0x1ffa7b[_0x0860('0x11')]['message']);}})[_0x0860('0x12')](function(_0x428643){logger['error'](_0x0860('0x9'),_0x29dbf9,_0x428643);_0x548004(_0x428643);});});}