Built motion from commit 52c8a02d.|2.6.29
[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 _0xc9a3=['../../config/environment','jayson/promise','http','then','info','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMail,\x20%s,\x20%s','message','util','moment','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0x2856c6,_0x745fd1){var _0x5f23a1=function(_0x26c135){while(--_0x26c135){_0x2856c6['push'](_0x2856c6['shift']());}};_0x5f23a1(++_0x745fd1);}(_0xc9a3,0xd7));var _0x3c9a=function(_0x32c292,_0x30ef95){_0x32c292=_0x32c292-0x0;var _0x583cd3=_0xc9a3[_0x32c292];return _0x583cd3;};'use strict';var _=require('lodash');var util=require(_0x3c9a('0x0'));var moment=require(_0x3c9a('0x1'));var BPromise=require(_0x3c9a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c9a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3c9a('0x4'))(_0x3c9a('0x5'));var config=require(_0x3c9a('0x6'));var jayson=require(_0x3c9a('0x7'));var client=jayson['client'][_0x3c9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d890a,_0x1e3d0d,_0x1e6bde){return new BPromise(function(_0x302c22,_0x2a2868){return client['request'](_0x3d890a,_0x1e6bde)[_0x3c9a('0x9')](function(_0x2a7b80){logger[_0x3c9a('0xa')]('VoiceMail,\x20%s,\x20%s',_0x1e3d0d,_0x3c9a('0xb'));logger['debug'](_0x3c9a('0xc'),_0x1e3d0d,_0x3c9a('0xb'),JSON[_0x3c9a('0xd')](_0x2a7b80));if(_0x2a7b80[_0x3c9a('0xe')]){if(_0x2a7b80[_0x3c9a('0xe')]['code']===0x1f4){logger[_0x3c9a('0xe')](_0x3c9a('0xf'),_0x1e3d0d,_0x2a7b80['error'][_0x3c9a('0x10')]);return _0x2a2868(_0x2a7b80[_0x3c9a('0xe')][_0x3c9a('0x10')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x1e3d0d,_0x2a7b80['error']['message']);return _0x302c22(_0x2a7b80[_0x3c9a('0xe')][_0x3c9a('0x10')]);}else{logger[_0x3c9a('0xa')]('VoiceMail,\x20%s,\x20%s',_0x1e3d0d,'request\x20sent');_0x302c22(_0x2a7b80['result']['message']);}})['catch'](function(_0x4a3b43){logger[_0x3c9a('0xe')]('VoiceMail,\x20%s,\x20%s',_0x1e3d0d,_0x4a3b43);_0x2a2868(_0x4a3b43);});});}