3abdbc10d45379c4ec4e732eab0f3ec915a175ef
[motion2.git] / server / api / voiceMailMessage / voiceMailMessage.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 _0x20e1=['request\x20sent','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','debug'];(function(_0xb9b8d9,_0x69e921){var _0x3966df=function(_0x33e0ab){while(--_0x33e0ab){_0xb9b8d9['push'](_0xb9b8d9['shift']());}};_0x3966df(++_0x69e921);}(_0x20e1,0x1f3));var _0x120e=function(_0x1aa277,_0x1edd4f){_0x1aa277=_0x1aa277-0x0;var _0x2f21e5=_0x20e1[_0x1aa277];return _0x2f21e5;};'use strict';var _=require(_0x120e('0x0'));var util=require(_0x120e('0x1'));var moment=require(_0x120e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x120e('0x3'));var db=require(_0x120e('0x4'))['db'];var utils=require(_0x120e('0x5'));var logger=require('../../config/logger')(_0x120e('0x6'));var config=require('../../config/environment');var jayson=require(_0x120e('0x7'));var client=jayson[_0x120e('0x8')][_0x120e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b01e,_0x1c28d6,_0x2f82ca){return new BPromise(function(_0x1e504b,_0x503d2d){return client['request'](_0x36b01e,_0x2f82ca)[_0x120e('0xa')](function(_0x4d055c){logger[_0x120e('0xb')](_0x120e('0xc'),_0x1c28d6,'request\x20sent');logger[_0x120e('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x1c28d6,_0x120e('0xe'),JSON['stringify'](_0x4d055c));if(_0x4d055c['error']){if(_0x4d055c[_0x120e('0xf')]['code']===0x1f4){logger['error'](_0x120e('0xc'),_0x1c28d6,_0x4d055c['error']['message']);return _0x503d2d(_0x4d055c[_0x120e('0xf')][_0x120e('0x10')]);}logger[_0x120e('0xf')](_0x120e('0xc'),_0x1c28d6,_0x4d055c[_0x120e('0xf')][_0x120e('0x10')]);return _0x1e504b(_0x4d055c[_0x120e('0xf')][_0x120e('0x10')]);}else{logger[_0x120e('0xb')](_0x120e('0xc'),_0x1c28d6,_0x120e('0xe'));_0x1e504b(_0x4d055c[_0x120e('0x11')][_0x120e('0x10')]);}})[_0x120e('0x12')](function(_0x247849){logger['error'](_0x120e('0xc'),_0x1c28d6,_0x247849);_0x503d2d(_0x247849);});});}