a06fa4d55e206a5423e112eafb5fe59f550232ee
[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 _0x23c7=['VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x19018f,_0x1ed257){var _0x183cb2=function(_0x2916a3){while(--_0x2916a3){_0x19018f['push'](_0x19018f['shift']());}};_0x183cb2(++_0x1ed257);}(_0x23c7,0x18f));var _0x723c=function(_0xedfa8,_0x6db736){_0xedfa8=_0xedfa8-0x0;var _0x5a5e49=_0x23c7[_0xedfa8];return _0x5a5e49;};'use strict';var _=require(_0x723c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x723c('0x1'));var rs=require(_0x723c('0x2'));var fs=require('fs');var Redis=require(_0x723c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x723c('0x4'));var logger=require(_0x723c('0x5'))(_0x723c('0x6'));var config=require(_0x723c('0x7'));var jayson=require(_0x723c('0x8'));var client=jayson[_0x723c('0x9')][_0x723c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bd82c,_0x3f7bcb,_0x264700){return new BPromise(function(_0x41dfb9,_0x5e0099){return client[_0x723c('0xb')](_0x3bd82c,_0x264700)['then'](function(_0x108a80){logger[_0x723c('0xc')]('VoiceMail,\x20%s,\x20%s',_0x3f7bcb,_0x723c('0xd'));logger[_0x723c('0xe')](_0x723c('0xf'),_0x3f7bcb,_0x723c('0xd'),JSON[_0x723c('0x10')](_0x108a80));if(_0x108a80[_0x723c('0x11')]){if(_0x108a80['error'][_0x723c('0x12')]===0x1f4){logger[_0x723c('0x11')]('VoiceMail,\x20%s,\x20%s',_0x3f7bcb,_0x108a80['error']['message']);return _0x5e0099(_0x108a80[_0x723c('0x11')]['message']);}logger[_0x723c('0x11')](_0x723c('0x13'),_0x3f7bcb,_0x108a80['error'][_0x723c('0x14')]);return _0x41dfb9(_0x108a80[_0x723c('0x11')][_0x723c('0x14')]);}else{logger['info'](_0x723c('0x13'),_0x3f7bcb,_0x723c('0xd'));_0x41dfb9(_0x108a80[_0x723c('0x15')]['message']);}})[_0x723c('0x16')](function(_0x4e3a75){logger[_0x723c('0x11')](_0x723c('0x13'),_0x3f7bcb,_0x4e3a75);_0x5e0099(_0x4e3a75);});});}