01cfc158f67494cc14d08100b06829c56a043950
[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 _0x56c2=['../../config/environment','http','request','info','request\x20sent','debug','stringify','error','VoiceMail,\x20%s,\x20%s','message','catch','util','moment','ioredis','rpc'];(function(_0x26d063,_0x25b669){var _0x304e68=function(_0x473be2){while(--_0x473be2){_0x26d063['push'](_0x26d063['shift']());}};_0x304e68(++_0x25b669);}(_0x56c2,0x164));var _0x256c=function(_0x396701,_0x1600e2){_0x396701=_0x396701-0x0;var _0x5df190=_0x56c2[_0x396701];return _0x5df190;};'use strict';var _=require('lodash');var util=require(_0x256c('0x0'));var moment=require(_0x256c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x256c('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x256c('0x3'));var config=require(_0x256c('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x256c('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x57342a,_0x1370a5,_0x1f677a){return new BPromise(function(_0x18f121,_0x4ada52){return client[_0x256c('0x6')](_0x57342a,_0x1f677a)['then'](function(_0x3484e5){logger[_0x256c('0x7')]('VoiceMail,\x20%s,\x20%s',_0x1370a5,_0x256c('0x8'));logger[_0x256c('0x9')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x1370a5,'request\x20sent',JSON[_0x256c('0xa')](_0x3484e5));if(_0x3484e5['error']){if(_0x3484e5[_0x256c('0xb')]['code']===0x1f4){logger[_0x256c('0xb')](_0x256c('0xc'),_0x1370a5,_0x3484e5[_0x256c('0xb')][_0x256c('0xd')]);return _0x4ada52(_0x3484e5[_0x256c('0xb')][_0x256c('0xd')]);}logger[_0x256c('0xb')]('VoiceMail,\x20%s,\x20%s',_0x1370a5,_0x3484e5[_0x256c('0xb')]['message']);return _0x18f121(_0x3484e5['error'][_0x256c('0xd')]);}else{logger['info'](_0x256c('0xc'),_0x1370a5,_0x256c('0x8'));_0x18f121(_0x3484e5['result']['message']);}})[_0x256c('0xe')](function(_0x588acf){logger[_0x256c('0xb')](_0x256c('0xc'),_0x1370a5,_0x588acf);_0x4ada52(_0x588acf);});});}