Built motion from commit 5293bb2a.|2.6.30
[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 _0x4746=['request\x20sent','debug','error','code','message','VoiceChanSpy,\x20%s,\x20%s','info','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x335d26,_0x1021df){var _0x163517=function(_0x46e716){while(--_0x46e716){_0x335d26['push'](_0x335d26['shift']());}};_0x163517(++_0x1021df);}(_0x4746,0xc6));var _0x6474=function(_0x59ef83,_0x1616f4){_0x59ef83=_0x59ef83-0x0;var _0x404afa=_0x4746[_0x59ef83];return _0x404afa;};'use strict';var _=require(_0x6474('0x0'));var util=require(_0x6474('0x1'));var moment=require('moment');var BPromise=require(_0x6474('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6474('0x3'));var db=require(_0x6474('0x4'))['db'];var utils=require(_0x6474('0x5'));var logger=require(_0x6474('0x6'))(_0x6474('0x7'));var config=require('../../config/environment');var jayson=require(_0x6474('0x8'));var client=jayson[_0x6474('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x433af9,_0x427f79,_0xcd065e){return new BPromise(function(_0xec3cda,_0x15d4c2){return client[_0x6474('0xa')](_0x433af9,_0xcd065e)['then'](function(_0x1bc38b){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x427f79,_0x6474('0xb'));logger[_0x6474('0xc')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x427f79,_0x6474('0xb'),JSON['stringify'](_0x1bc38b));if(_0x1bc38b[_0x6474('0xd')]){if(_0x1bc38b['error'][_0x6474('0xe')]===0x1f4){logger[_0x6474('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x427f79,_0x1bc38b['error']['message']);return _0x15d4c2(_0x1bc38b[_0x6474('0xd')][_0x6474('0xf')]);}logger[_0x6474('0xd')](_0x6474('0x10'),_0x427f79,_0x1bc38b[_0x6474('0xd')][_0x6474('0xf')]);return _0xec3cda(_0x1bc38b[_0x6474('0xd')][_0x6474('0xf')]);}else{logger[_0x6474('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x427f79,'request\x20sent');_0xec3cda(_0x1bc38b['result'][_0x6474('0xf')]);}})[_0x6474('0x12')](function(_0x29c19b){logger[_0x6474('0xd')](_0x6474('0x10'),_0x427f79,_0x29c19b);_0x15d4c2(_0x29c19b);});});}