0a85828150ac859bd971a582cfecdaaf95ae3f59
[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 _0xf675=['request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf675,0x199));var _0x5f67=function(_0xf35bd4,_0x51ff64){_0xf35bd4=_0xf35bd4-0x0;var _0x47912b=_0xf675[_0xf35bd4];return _0x47912b;};'use strict';var _=require(_0x5f67('0x0'));var util=require(_0x5f67('0x1'));var moment=require(_0x5f67('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f67('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f67('0x4'))['db'];var utils=require(_0x5f67('0x5'));var logger=require(_0x5f67('0x6'))('rpc');var config=require(_0x5f67('0x7'));var jayson=require(_0x5f67('0x8'));var client=jayson[_0x5f67('0x9')][_0x5f67('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b67eb,_0xc71a7,_0x121d19){return new BPromise(function(_0x55efcd,_0x5749f5){return client[_0x5f67('0xb')](_0x5b67eb,_0x121d19)[_0x5f67('0xc')](function(_0x530ef1){logger['info'](_0x5f67('0xd'),_0xc71a7,_0x5f67('0xe'));logger[_0x5f67('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0xc71a7,'request\x20sent',JSON['stringify'](_0x530ef1));if(_0x530ef1[_0x5f67('0x10')]){if(_0x530ef1[_0x5f67('0x10')]['code']===0x1f4){logger[_0x5f67('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0xc71a7,_0x530ef1[_0x5f67('0x10')]['message']);return _0x5749f5(_0x530ef1[_0x5f67('0x10')][_0x5f67('0x11')]);}logger[_0x5f67('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0xc71a7,_0x530ef1[_0x5f67('0x10')]['message']);return _0x55efcd(_0x530ef1[_0x5f67('0x10')]['message']);}else{logger[_0x5f67('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0xc71a7,_0x5f67('0xe'));_0x55efcd(_0x530ef1[_0x5f67('0x13')][_0x5f67('0x11')]);}})[_0x5f67('0x14')](function(_0x444ee5){logger[_0x5f67('0x10')](_0x5f67('0xd'),_0xc71a7,_0x444ee5);_0x5749f5(_0x444ee5);});});}