Built motion from commit e1760111.|2.6.18
[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 _0xf6a6=['stringify','error','code','message','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x51736a,_0x5f1e87){var _0x541028=function(_0x49e56a){while(--_0x49e56a){_0x51736a['push'](_0x51736a['shift']());}};_0x541028(++_0x5f1e87);}(_0xf6a6,0x147));var _0x6f6a=function(_0x48b935,_0x8a235){_0x48b935=_0x48b935-0x0;var _0x666cd5=_0xf6a6[_0x48b935];return _0x666cd5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6f6a('0x0'));var BPromise=require(_0x6f6a('0x1'));var rs=require(_0x6f6a('0x2'));var fs=require('fs');var Redis=require(_0x6f6a('0x3'));var db=require(_0x6f6a('0x4'))['db'];var utils=require(_0x6f6a('0x5'));var logger=require(_0x6f6a('0x6'))(_0x6f6a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6f6a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19a1dc,_0x142e06,_0x21ab3b){return new BPromise(function(_0x289c33,_0xcea4d6){return client[_0x6f6a('0x9')](_0x19a1dc,_0x21ab3b)[_0x6f6a('0xa')](function(_0x474d45){logger['info'](_0x6f6a('0xb'),_0x142e06,_0x6f6a('0xc'));logger[_0x6f6a('0xd')](_0x6f6a('0xe'),_0x142e06,_0x6f6a('0xc'),JSON[_0x6f6a('0xf')](_0x474d45));if(_0x474d45[_0x6f6a('0x10')]){if(_0x474d45[_0x6f6a('0x10')][_0x6f6a('0x11')]===0x1f4){logger[_0x6f6a('0x10')](_0x6f6a('0xb'),_0x142e06,_0x474d45['error'][_0x6f6a('0x12')]);return _0xcea4d6(_0x474d45[_0x6f6a('0x10')][_0x6f6a('0x12')]);}logger[_0x6f6a('0x10')](_0x6f6a('0xb'),_0x142e06,_0x474d45[_0x6f6a('0x10')]['message']);return _0x289c33(_0x474d45['error'][_0x6f6a('0x12')]);}else{logger['info'](_0x6f6a('0xb'),_0x142e06,'request\x20sent');_0x289c33(_0x474d45['result'][_0x6f6a('0x12')]);}})['catch'](function(_0x2e2ac5){logger[_0x6f6a('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x142e06,_0x2e2ac5);_0xcea4d6(_0x2e2ac5);});});}