Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / api / voiceChanSpy / voiceChanSpy.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 _0x16a6=['message','catch','lodash','util','moment','ioredis','../../config/utils','rpc','jayson/promise','http','request','info','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s'];(function(_0x10fa67,_0x47da3f){var _0x37b8c7=function(_0x4b9f24){while(--_0x4b9f24){_0x10fa67['push'](_0x10fa67['shift']());}};_0x37b8c7(++_0x47da3f);}(_0x16a6,0x6e));var _0x616a=function(_0x390733,_0x1e3d32){_0x390733=_0x390733-0x0;var _0x33beb9=_0x16a6[_0x390733];return _0x33beb9;};'use strict';var _=require(_0x616a('0x0'));var util=require(_0x616a('0x1'));var moment=require(_0x616a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x616a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x616a('0x4'));var logger=require('../../config/logger')(_0x616a('0x5'));var config=require('../../config/environment');var jayson=require(_0x616a('0x6'));var client=jayson['client'][_0x616a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x7e7331,_0x4e7afc,_0x33b0e9){return new BPromise(function(_0x3317de,_0x39d29c){return client[_0x616a('0x8')](_0x7e7331,_0x33b0e9)['then'](function(_0x100237){logger[_0x616a('0x9')]('VoiceChanSpy,\x20%s,\x20%s',_0x4e7afc,_0x616a('0xa'));logger['debug'](_0x616a('0xb'),_0x4e7afc,'request\x20sent',JSON[_0x616a('0xc')](_0x100237));if(_0x100237[_0x616a('0xd')]){if(_0x100237['error'][_0x616a('0xe')]===0x1f4){logger[_0x616a('0xd')](_0x616a('0xf'),_0x4e7afc,_0x100237[_0x616a('0xd')]['message']);return _0x39d29c(_0x100237[_0x616a('0xd')][_0x616a('0x10')]);}logger[_0x616a('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x4e7afc,_0x100237[_0x616a('0xd')]['message']);return _0x3317de(_0x100237[_0x616a('0xd')][_0x616a('0x10')]);}else{logger[_0x616a('0x9')](_0x616a('0xf'),_0x4e7afc,_0x616a('0xa'));_0x3317de(_0x100237['result'][_0x616a('0x10')]);}})[_0x616a('0x11')](function(_0x57571c){logger[_0x616a('0xd')](_0x616a('0xf'),_0x4e7afc,_0x57571c);_0x39d29c(_0x57571c);});});}