c2553c7f32db15fbace662d23501f53a72b562b4
[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 _0x5bfe=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5bfe,0xd0));var _0xe5bf=function(_0x1a6e20,_0x1f6fbc){_0x1a6e20=_0x1a6e20-0x0;var _0x550b88=_0x5bfe[_0x1a6e20];return _0x550b88;};'use strict';var _=require('lodash');var util=require(_0xe5bf('0x0'));var moment=require(_0xe5bf('0x1'));var BPromise=require('bluebird');var rs=require(_0xe5bf('0x2'));var fs=require('fs');var Redis=require(_0xe5bf('0x3'));var db=require(_0xe5bf('0x4'))['db'];var utils=require(_0xe5bf('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe5bf('0x6'));var jayson=require(_0xe5bf('0x7'));var client=jayson[_0xe5bf('0x8')][_0xe5bf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40cf23,_0xdad20a,_0x6cdc07){return new BPromise(function(_0x4e8f48,_0x54b708){return client[_0xe5bf('0xa')](_0x40cf23,_0x6cdc07)['then'](function(_0x4d4b2c){logger[_0xe5bf('0xb')](_0xe5bf('0xc'),_0xdad20a,_0xe5bf('0xd'));logger[_0xe5bf('0xe')](_0xe5bf('0xf'),_0xdad20a,_0xe5bf('0xd'),JSON[_0xe5bf('0x10')](_0x4d4b2c));if(_0x4d4b2c[_0xe5bf('0x11')]){if(_0x4d4b2c[_0xe5bf('0x11')][_0xe5bf('0x12')]===0x1f4){logger[_0xe5bf('0x11')]('VoiceMail,\x20%s,\x20%s',_0xdad20a,_0x4d4b2c[_0xe5bf('0x11')][_0xe5bf('0x13')]);return _0x54b708(_0x4d4b2c[_0xe5bf('0x11')][_0xe5bf('0x13')]);}logger[_0xe5bf('0x11')](_0xe5bf('0xc'),_0xdad20a,_0x4d4b2c[_0xe5bf('0x11')][_0xe5bf('0x13')]);return _0x4e8f48(_0x4d4b2c[_0xe5bf('0x11')][_0xe5bf('0x13')]);}else{logger[_0xe5bf('0xb')](_0xe5bf('0xc'),_0xdad20a,_0xe5bf('0xd'));_0x4e8f48(_0x4d4b2c['result']['message']);}})[_0xe5bf('0x14')](function(_0x4c606d){logger[_0xe5bf('0x11')](_0xe5bf('0xc'),_0xdad20a,_0x4c606d);_0x54b708(_0x4c606d);});});}