dccfded23a73a51862267506e68b09c397836cc5
[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 _0x61f5=['ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird'];(function(_0x345a01,_0x4f1843){var _0x48ccd7=function(_0x460a13){while(--_0x460a13){_0x345a01['push'](_0x345a01['shift']());}};_0x48ccd7(++_0x4f1843);}(_0x61f5,0x18d));var _0x561f=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0x61f5[_0x19dd7a];return _0x3feb6a;};'use strict';var _=require('lodash');var util=require(_0x561f('0x0'));var moment=require('moment');var BPromise=require(_0x561f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x561f('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x561f('0x3'));var config=require(_0x561f('0x4'));var jayson=require(_0x561f('0x5'));var client=jayson[_0x561f('0x6')][_0x561f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3697f4,_0x1b43ad,_0x1ad6df){return new BPromise(function(_0x377fc4,_0x3595e5){return client[_0x561f('0x8')](_0x3697f4,_0x1ad6df)[_0x561f('0x9')](function(_0x78c295){logger[_0x561f('0xa')](_0x561f('0xb'),_0x1b43ad,_0x561f('0xc'));logger[_0x561f('0xd')](_0x561f('0xe'),_0x1b43ad,_0x561f('0xc'),JSON[_0x561f('0xf')](_0x78c295));if(_0x78c295[_0x561f('0x10')]){if(_0x78c295['error'][_0x561f('0x11')]===0x1f4){logger[_0x561f('0x10')]('VoiceMail,\x20%s,\x20%s',_0x1b43ad,_0x78c295[_0x561f('0x10')][_0x561f('0x12')]);return _0x3595e5(_0x78c295[_0x561f('0x10')]['message']);}logger[_0x561f('0x10')](_0x561f('0xb'),_0x1b43ad,_0x78c295[_0x561f('0x10')][_0x561f('0x12')]);return _0x377fc4(_0x78c295[_0x561f('0x10')][_0x561f('0x12')]);}else{logger['info'](_0x561f('0xb'),_0x1b43ad,'request\x20sent');_0x377fc4(_0x78c295[_0x561f('0x13')][_0x561f('0x12')]);}})[_0x561f('0x14')](function(_0x367339){logger[_0x561f('0x10')](_0x561f('0xb'),_0x1b43ad,_0x367339);_0x3595e5(_0x367339);});});}