Built motion from commit 639a1a7f.|2.6.19
[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 _0x87a4=['rpc','../../config/environment','jayson/promise','client','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util','randomstring','ioredis'];(function(_0x5c2278,_0x5e1e08){var _0x482004=function(_0xb56a0e){while(--_0xb56a0e){_0x5c2278['push'](_0x5c2278['shift']());}};_0x482004(++_0x5e1e08);}(_0x87a4,0x12e));var _0x487a=function(_0x5bae43,_0xdc3682){_0x5bae43=_0x5bae43-0x0;var _0x5f1277=_0x87a4[_0x5bae43];return _0x5f1277;};'use strict';var _=require(_0x487a('0x0'));var util=require(_0x487a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x487a('0x2'));var fs=require('fs');var Redis=require(_0x487a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x487a('0x4'));var config=require(_0x487a('0x5'));var jayson=require(_0x487a('0x6'));var client=jayson[_0x487a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x319a5c,_0x356a3e,_0x3a1e6f){return new BPromise(function(_0x17d0e2,_0x533969){return client['request'](_0x319a5c,_0x3a1e6f)[_0x487a('0x8')](function(_0xbb05cc){logger['info'](_0x487a('0x9'),_0x356a3e,_0x487a('0xa'));logger[_0x487a('0xb')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x356a3e,_0x487a('0xa'),JSON['stringify'](_0xbb05cc));if(_0xbb05cc[_0x487a('0xc')]){if(_0xbb05cc['error'][_0x487a('0xd')]===0x1f4){logger[_0x487a('0xc')](_0x487a('0x9'),_0x356a3e,_0xbb05cc['error']['message']);return _0x533969(_0xbb05cc['error'][_0x487a('0xe')]);}logger['error'](_0x487a('0x9'),_0x356a3e,_0xbb05cc[_0x487a('0xc')][_0x487a('0xe')]);return _0x17d0e2(_0xbb05cc[_0x487a('0xc')][_0x487a('0xe')]);}else{logger[_0x487a('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x356a3e,_0x487a('0xa'));_0x17d0e2(_0xbb05cc[_0x487a('0x10')][_0x487a('0xe')]);}})[_0x487a('0x11')](function(_0x167346){logger['error'](_0x487a('0x9'),_0x356a3e,_0x167346);_0x533969(_0x167346);});});}