Built motion from commit 9e1399f3.|2.5.37
[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 _0xf029=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf029,0xb0));var _0x9f02=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xf029[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x9f02('0x0'));var util=require(_0x9f02('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f02('0x2'));var db=require(_0x9f02('0x3'))['db'];var utils=require(_0x9f02('0x4'));var logger=require(_0x9f02('0x5'))(_0x9f02('0x6'));var config=require(_0x9f02('0x7'));var jayson=require(_0x9f02('0x8'));var client=jayson[_0x9f02('0x9')][_0x9f02('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a2c17,_0x57aa59,_0x2bb81f){return new BPromise(function(_0x2584b3,_0x33491b){return client[_0x9f02('0xb')](_0x3a2c17,_0x2bb81f)[_0x9f02('0xc')](function(_0x5a4a5b){logger['info'](_0x9f02('0xd'),_0x57aa59,_0x9f02('0xe'));logger[_0x9f02('0xf')](_0x9f02('0x10'),_0x57aa59,_0x9f02('0xe'),JSON[_0x9f02('0x11')](_0x5a4a5b));if(_0x5a4a5b[_0x9f02('0x12')]){if(_0x5a4a5b['error'][_0x9f02('0x13')]===0x1f4){logger[_0x9f02('0x12')](_0x9f02('0xd'),_0x57aa59,_0x5a4a5b[_0x9f02('0x12')][_0x9f02('0x14')]);return _0x33491b(_0x5a4a5b[_0x9f02('0x12')][_0x9f02('0x14')]);}logger[_0x9f02('0x12')](_0x9f02('0xd'),_0x57aa59,_0x5a4a5b[_0x9f02('0x12')][_0x9f02('0x14')]);return _0x2584b3(_0x5a4a5b['error']['message']);}else{logger[_0x9f02('0x15')](_0x9f02('0xd'),_0x57aa59,'request\x20sent');_0x2584b3(_0x5a4a5b[_0x9f02('0x16')][_0x9f02('0x14')]);}})[_0x9f02('0x17')](function(_0x5501c6){logger[_0x9f02('0x12')](_0x9f02('0xd'),_0x57aa59,_0x5501c6);_0x33491b(_0x5501c6);});});}