b02f023cf00969745c861aa3dce6ca30af5a285f
[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 _0x2212=['info','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x482943,_0x122def){var _0x963d41=function(_0x231b08){while(--_0x231b08){_0x482943['push'](_0x482943['shift']());}};_0x963d41(++_0x122def);}(_0x2212,0xc8));var _0x2221=function(_0x34cd1f,_0x70083f){_0x34cd1f=_0x34cd1f-0x0;var _0x4b0c61=_0x2212[_0x34cd1f];return _0x4b0c61;};'use strict';var _=require('lodash');var util=require(_0x2221('0x0'));var moment=require(_0x2221('0x1'));var BPromise=require('bluebird');var rs=require(_0x2221('0x2'));var fs=require('fs');var Redis=require(_0x2221('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2221('0x4'));var logger=require(_0x2221('0x5'))(_0x2221('0x6'));var config=require(_0x2221('0x7'));var jayson=require(_0x2221('0x8'));var client=jayson['client'][_0x2221('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x394d9d,_0x3a119d,_0xfb5325){return new BPromise(function(_0x20845a,_0x2676d1){return client['request'](_0x394d9d,_0xfb5325)[_0x2221('0xa')](function(_0x144403){logger['info'](_0x2221('0xb'),_0x3a119d,_0x2221('0xc'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x3a119d,_0x2221('0xc'),JSON[_0x2221('0xd')](_0x144403));if(_0x144403[_0x2221('0xe')]){if(_0x144403['error']['code']===0x1f4){logger[_0x2221('0xe')](_0x2221('0xb'),_0x3a119d,_0x144403['error'][_0x2221('0xf')]);return _0x2676d1(_0x144403[_0x2221('0xe')][_0x2221('0xf')]);}logger[_0x2221('0xe')]('VoiceMail,\x20%s,\x20%s',_0x3a119d,_0x144403[_0x2221('0xe')]['message']);return _0x20845a(_0x144403['error'][_0x2221('0xf')]);}else{logger[_0x2221('0x10')]('VoiceMail,\x20%s,\x20%s',_0x3a119d,'request\x20sent');_0x20845a(_0x144403['result'][_0x2221('0xf')]);}})[_0x2221('0x11')](function(_0xeb224c){logger['error']('VoiceMail,\x20%s,\x20%s',_0x3a119d,_0xeb224c);_0x2676d1(_0xeb224c);});});}