d871567e5be3f22936b1535fab3ed5245d203bc1
[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 _0x4750=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x54a9e0,_0x15c846){var _0x1ebb54=function(_0x5162f9){while(--_0x5162f9){_0x54a9e0['push'](_0x54a9e0['shift']());}};_0x1ebb54(++_0x15c846);}(_0x4750,0xdf));var _0x0475=function(_0x3b3bc1,_0x167704){_0x3b3bc1=_0x3b3bc1-0x0;var _0x28a6af=_0x4750[_0x3b3bc1];return _0x28a6af;};'use strict';var _=require(_0x0475('0x0'));var util=require(_0x0475('0x1'));var moment=require(_0x0475('0x2'));var BPromise=require(_0x0475('0x3'));var rs=require(_0x0475('0x4'));var fs=require('fs');var Redis=require(_0x0475('0x5'));var db=require(_0x0475('0x6'))['db'];var utils=require(_0x0475('0x7'));var logger=require(_0x0475('0x8'))(_0x0475('0x9'));var config=require('../../config/environment');var jayson=require(_0x0475('0xa'));var client=jayson[_0x0475('0xb')][_0x0475('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x447167,_0x4fdc4d,_0x52ffc6){return new BPromise(function(_0x9a9f1b,_0x5909a2){return client[_0x0475('0xd')](_0x447167,_0x52ffc6)[_0x0475('0xe')](function(_0x254408){logger[_0x0475('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x4fdc4d,_0x0475('0x10'));logger[_0x0475('0x11')](_0x0475('0x12'),_0x4fdc4d,'request\x20sent',JSON[_0x0475('0x13')](_0x254408));if(_0x254408[_0x0475('0x14')]){if(_0x254408[_0x0475('0x14')][_0x0475('0x15')]===0x1f4){logger[_0x0475('0x14')](_0x0475('0x16'),_0x4fdc4d,_0x254408[_0x0475('0x14')][_0x0475('0x17')]);return _0x5909a2(_0x254408[_0x0475('0x14')][_0x0475('0x17')]);}logger[_0x0475('0x14')](_0x0475('0x16'),_0x4fdc4d,_0x254408[_0x0475('0x14')][_0x0475('0x17')]);return _0x9a9f1b(_0x254408[_0x0475('0x14')]['message']);}else{logger[_0x0475('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x4fdc4d,_0x0475('0x10'));_0x9a9f1b(_0x254408['result'][_0x0475('0x17')]);}})[_0x0475('0x18')](function(_0x580612){logger[_0x0475('0x14')](_0x0475('0x16'),_0x4fdc4d,_0x580612);_0x5909a2(_0x580612);});});}