e9bd1d19dbe48078f7e164338268321f2f628f5c
[motion2.git] / server / api / voiceMail / voiceMail.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 _0x9bf1=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','info','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment'];(function(_0x158da6,_0x3cb06d){var _0x429c30=function(_0x2d5895){while(--_0x2d5895){_0x158da6['push'](_0x158da6['shift']());}};_0x429c30(++_0x3cb06d);}(_0x9bf1,0x1b8));var _0x19bf=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9bf1[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x19bf('0x0'));var util=require('util');var moment=require(_0x19bf('0x1'));var BPromise=require('bluebird');var rs=require(_0x19bf('0x2'));var fs=require('fs');var Redis=require(_0x19bf('0x3'));var db=require(_0x19bf('0x4'))['db'];var utils=require(_0x19bf('0x5'));var logger=require('../../config/logger')(_0x19bf('0x6'));var config=require(_0x19bf('0x7'));var jayson=require(_0x19bf('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd8bdee,_0x1b869a,_0x235a6b){return new BPromise(function(_0x2af2d5,_0x5291ef){return client['request'](_0xd8bdee,_0x235a6b)['then'](function(_0x4f2801){logger[_0x19bf('0x9')](_0x19bf('0xa'),_0x1b869a,'request\x20sent');logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x1b869a,_0x19bf('0xb'),JSON[_0x19bf('0xc')](_0x4f2801));if(_0x4f2801[_0x19bf('0xd')]){if(_0x4f2801[_0x19bf('0xd')][_0x19bf('0xe')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x1b869a,_0x4f2801[_0x19bf('0xd')][_0x19bf('0xf')]);return _0x5291ef(_0x4f2801[_0x19bf('0xd')]['message']);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x1b869a,_0x4f2801[_0x19bf('0xd')][_0x19bf('0xf')]);return _0x2af2d5(_0x4f2801['error'][_0x19bf('0xf')]);}else{logger[_0x19bf('0x9')](_0x19bf('0xa'),_0x1b869a,_0x19bf('0xb'));_0x2af2d5(_0x4f2801['result'][_0x19bf('0xf')]);}})[_0x19bf('0x10')](function(_0x3a2933){logger['error'](_0x19bf('0xa'),_0x1b869a,_0x3a2933);_0x5291ef(_0x3a2933);});});}