e860882df300a1c20b909fe76fa2ec051a23d677
[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 _0xcd7c=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x54bf80,_0x1f46ff){var _0x447550=function(_0x297e7b){while(--_0x297e7b){_0x54bf80['push'](_0x54bf80['shift']());}};_0x447550(++_0x1f46ff);}(_0xcd7c,0x104));var _0xccd7=function(_0x1ac307,_0x2863be){_0x1ac307=_0x1ac307-0x0;var _0x44743a=_0xcd7c[_0x1ac307];return _0x44743a;};'use strict';var _=require(_0xccd7('0x0'));var util=require(_0xccd7('0x1'));var moment=require('moment');var BPromise=require(_0xccd7('0x2'));var rs=require(_0xccd7('0x3'));var fs=require('fs');var Redis=require(_0xccd7('0x4'));var db=require(_0xccd7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xccd7('0x6'))(_0xccd7('0x7'));var config=require(_0xccd7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xccd7('0x9')][_0xccd7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf40a2d,_0x59da7c,_0x9508e4){return new BPromise(function(_0x26bfdf,_0x464b92){return client['request'](_0xf40a2d,_0x9508e4)[_0xccd7('0xb')](function(_0x479b29){logger[_0xccd7('0xc')](_0xccd7('0xd'),_0x59da7c,_0xccd7('0xe'));logger[_0xccd7('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x59da7c,_0xccd7('0xe'),JSON[_0xccd7('0x10')](_0x479b29));if(_0x479b29[_0xccd7('0x11')]){if(_0x479b29[_0xccd7('0x11')][_0xccd7('0x12')]===0x1f4){logger[_0xccd7('0x11')](_0xccd7('0xd'),_0x59da7c,_0x479b29[_0xccd7('0x11')][_0xccd7('0x13')]);return _0x464b92(_0x479b29[_0xccd7('0x11')][_0xccd7('0x13')]);}logger[_0xccd7('0x11')](_0xccd7('0xd'),_0x59da7c,_0x479b29[_0xccd7('0x11')]['message']);return _0x26bfdf(_0x479b29[_0xccd7('0x11')][_0xccd7('0x13')]);}else{logger[_0xccd7('0xc')](_0xccd7('0xd'),_0x59da7c,'request\x20sent');_0x26bfdf(_0x479b29[_0xccd7('0x14')][_0xccd7('0x13')]);}})[_0xccd7('0x15')](function(_0x5320c8){logger['error'](_0xccd7('0xd'),_0x59da7c,_0x5320c8);_0x464b92(_0x5320c8);});});}