8ef427b37c3a5ca4bd6a0d3b9fa96f59701bfd07
[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 _0x9db7=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4a599b,_0x1d2125){var _0x2d53d3=function(_0x5e7982){while(--_0x5e7982){_0x4a599b['push'](_0x4a599b['shift']());}};_0x2d53d3(++_0x1d2125);}(_0x9db7,0x1b8));var _0x79db=function(_0x321458,_0x362516){_0x321458=_0x321458-0x0;var _0x485778=_0x9db7[_0x321458];return _0x485778;};'use strict';var _=require('lodash');var util=require(_0x79db('0x0'));var moment=require(_0x79db('0x1'));var BPromise=require(_0x79db('0x2'));var rs=require(_0x79db('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x79db('0x4'))['db'];var utils=require(_0x79db('0x5'));var logger=require(_0x79db('0x6'))(_0x79db('0x7'));var config=require(_0x79db('0x8'));var jayson=require(_0x79db('0x9'));var client=jayson[_0x79db('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f31c1,_0x4f75f6,_0x34f8c9){return new BPromise(function(_0x2639e1,_0x1c872b){return client[_0x79db('0xb')](_0x1f31c1,_0x34f8c9)[_0x79db('0xc')](function(_0x2ec15b){logger[_0x79db('0xd')](_0x79db('0xe'),_0x4f75f6,_0x79db('0xf'));logger[_0x79db('0x10')](_0x79db('0x11'),_0x4f75f6,_0x79db('0xf'),JSON[_0x79db('0x12')](_0x2ec15b));if(_0x2ec15b[_0x79db('0x13')]){if(_0x2ec15b['error'][_0x79db('0x14')]===0x1f4){logger[_0x79db('0x13')](_0x79db('0xe'),_0x4f75f6,_0x2ec15b[_0x79db('0x13')][_0x79db('0x15')]);return _0x1c872b(_0x2ec15b[_0x79db('0x13')][_0x79db('0x15')]);}logger[_0x79db('0x13')]('VoiceMail,\x20%s,\x20%s',_0x4f75f6,_0x2ec15b[_0x79db('0x13')][_0x79db('0x15')]);return _0x2639e1(_0x2ec15b[_0x79db('0x13')][_0x79db('0x15')]);}else{logger[_0x79db('0xd')](_0x79db('0xe'),_0x4f75f6,'request\x20sent');_0x2639e1(_0x2ec15b['result']['message']);}})['catch'](function(_0x3f07b7){logger[_0x79db('0x13')](_0x79db('0xe'),_0x4f75f6,_0x3f07b7);_0x1c872b(_0x3f07b7);});});}