5a057b33a46d189a4ef68e791bcfe22847e7987e
[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 _0x5352=['lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x28b146,_0x55052b){var _0x598444=function(_0x2248a9){while(--_0x2248a9){_0x28b146['push'](_0x28b146['shift']());}};_0x598444(++_0x55052b);}(_0x5352,0x165));var _0x2535=function(_0x524fc0,_0x1544f6){_0x524fc0=_0x524fc0-0x0;var _0x2469f2=_0x5352[_0x524fc0];return _0x2469f2;};'use strict';var _=require(_0x2535('0x0'));var util=require('util');var moment=require(_0x2535('0x1'));var BPromise=require('bluebird');var rs=require(_0x2535('0x2'));var fs=require('fs');var Redis=require(_0x2535('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2535('0x4'));var logger=require(_0x2535('0x5'))(_0x2535('0x6'));var config=require(_0x2535('0x7'));var jayson=require(_0x2535('0x8'));var client=jayson[_0x2535('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x573971,_0x1063b2,_0x25605b){return new BPromise(function(_0x3b9ddf,_0x3bc419){return client[_0x2535('0xa')](_0x573971,_0x25605b)[_0x2535('0xb')](function(_0x366a00){logger[_0x2535('0xc')](_0x2535('0xd'),_0x1063b2,_0x2535('0xe'));logger[_0x2535('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x1063b2,'request\x20sent',JSON[_0x2535('0x10')](_0x366a00));if(_0x366a00[_0x2535('0x11')]){if(_0x366a00[_0x2535('0x11')][_0x2535('0x12')]===0x1f4){logger[_0x2535('0x11')](_0x2535('0xd'),_0x1063b2,_0x366a00[_0x2535('0x11')][_0x2535('0x13')]);return _0x3bc419(_0x366a00['error'][_0x2535('0x13')]);}logger[_0x2535('0x11')](_0x2535('0xd'),_0x1063b2,_0x366a00[_0x2535('0x11')][_0x2535('0x13')]);return _0x3b9ddf(_0x366a00[_0x2535('0x11')]['message']);}else{logger[_0x2535('0xc')](_0x2535('0xd'),_0x1063b2,_0x2535('0xe'));_0x3b9ddf(_0x366a00['result'][_0x2535('0x13')]);}})[_0x2535('0x14')](function(_0x38716b){logger[_0x2535('0x11')](_0x2535('0xd'),_0x1063b2,_0x38716b);_0x3bc419(_0x38716b);});});}