e1ae6cec668475ab7a929dd6064d7fd33ebca36a
[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 _0x4eca=['info','UserVoiceQueue,\x20%s,\x20%s','stringify','code','error','result','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x22cf2e,_0x159a2d){var _0x513a90=function(_0x8b26af){while(--_0x8b26af){_0x22cf2e['push'](_0x22cf2e['shift']());}};_0x513a90(++_0x159a2d);}(_0x4eca,0x158));var _0xa4ec=function(_0x2e3c59,_0x113d7d){_0x2e3c59=_0x2e3c59-0x0;var _0x556761=_0x4eca[_0x2e3c59];return _0x556761;};'use strict';var _=require(_0xa4ec('0x0'));var util=require(_0xa4ec('0x1'));var moment=require('moment');var BPromise=require(_0xa4ec('0x2'));var rs=require(_0xa4ec('0x3'));var fs=require('fs');var Redis=require(_0xa4ec('0x4'));var db=require(_0xa4ec('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa4ec('0x6'))(_0xa4ec('0x7'));var config=require('../../config/environment');var jayson=require(_0xa4ec('0x8'));var client=jayson[_0xa4ec('0x9')][_0xa4ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdd513,_0x2f673e,_0x27845d){return new BPromise(function(_0x517acd,_0x25930e){return client[_0xa4ec('0xb')](_0xdd513,_0x27845d)[_0xa4ec('0xc')](function(_0x5c4cd5){logger[_0xa4ec('0xd')](_0xa4ec('0xe'),_0x2f673e,'request\x20sent');logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2f673e,'request\x20sent',JSON[_0xa4ec('0xf')](_0x5c4cd5));if(_0x5c4cd5['error']){if(_0x5c4cd5['error'][_0xa4ec('0x10')]===0x1f4){logger['error'](_0xa4ec('0xe'),_0x2f673e,_0x5c4cd5[_0xa4ec('0x11')]['message']);return _0x25930e(_0x5c4cd5[_0xa4ec('0x11')]['message']);}logger['error'](_0xa4ec('0xe'),_0x2f673e,_0x5c4cd5[_0xa4ec('0x11')]['message']);return _0x517acd(_0x5c4cd5[_0xa4ec('0x11')]['message']);}else{logger[_0xa4ec('0xd')](_0xa4ec('0xe'),_0x2f673e,'request\x20sent');_0x517acd(_0x5c4cd5[_0xa4ec('0x12')][_0xa4ec('0x13')]);}})[_0xa4ec('0x14')](function(_0x4a5d6a){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x2f673e,_0x4a5d6a);_0x25930e(_0x4a5d6a);});});}