86cf7c040f634aa61a209d645d74148711513fbf
[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 _0x408e=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','code','VoiceMail,\x20%s,\x20%s','error','message'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x408e,0xc6));var _0xe408=function(_0x388550,_0x3fd74b){_0x388550=_0x388550-0x0;var _0x735860=_0x408e[_0x388550];return _0x735860;};'use strict';var _=require('lodash');var util=require(_0xe408('0x0'));var moment=require('moment');var BPromise=require(_0xe408('0x1'));var rs=require(_0xe408('0x2'));var fs=require('fs');var Redis=require(_0xe408('0x3'));var db=require(_0xe408('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe408('0x5'));var jayson=require(_0xe408('0x6'));var client=jayson[_0xe408('0x7')][_0xe408('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f0fd3,_0x39d22f,_0x5b4104){return new BPromise(function(_0x401e3d,_0xc4d573){return client[_0xe408('0x9')](_0x2f0fd3,_0x5b4104)['then'](function(_0x41dd61){logger[_0xe408('0xa')]('VoiceMail,\x20%s,\x20%s',_0x39d22f,_0xe408('0xb'));logger[_0xe408('0xc')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x39d22f,'request\x20sent',JSON[_0xe408('0xd')](_0x41dd61));if(_0x41dd61['error']){if(_0x41dd61['error'][_0xe408('0xe')]===0x1f4){logger['error'](_0xe408('0xf'),_0x39d22f,_0x41dd61[_0xe408('0x10')][_0xe408('0x11')]);return _0xc4d573(_0x41dd61[_0xe408('0x10')]['message']);}logger[_0xe408('0x10')](_0xe408('0xf'),_0x39d22f,_0x41dd61[_0xe408('0x10')]['message']);return _0x401e3d(_0x41dd61[_0xe408('0x10')][_0xe408('0x11')]);}else{logger[_0xe408('0xa')]('VoiceMail,\x20%s,\x20%s',_0x39d22f,_0xe408('0xb'));_0x401e3d(_0x41dd61['result'][_0xe408('0x11')]);}})['catch'](function(_0x140393){logger['error']('VoiceMail,\x20%s,\x20%s',_0x39d22f,_0x140393);_0xc4d573(_0x140393);});});}