c1c1010575e1bc5eedb5cabc6c45dc750fd663af
[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 _0x969a=['../../config/environment','request','then','info','VoiceMail,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x9e9e71,_0x164667){var _0x44c29b=function(_0x19785c){while(--_0x19785c){_0x9e9e71['push'](_0x9e9e71['shift']());}};_0x44c29b(++_0x164667);}(_0x969a,0x91));var _0xa969=function(_0x205853,_0x3095a1){_0x205853=_0x205853-0x0;var _0x1b6762=_0x969a[_0x205853];return _0x1b6762;};'use strict';var _=require(_0xa969('0x0'));var util=require('util');var moment=require(_0xa969('0x1'));var BPromise=require(_0xa969('0x2'));var rs=require(_0xa969('0x3'));var fs=require('fs');var Redis=require(_0xa969('0x4'));var db=require(_0xa969('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa969('0x6'));var config=require(_0xa969('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4935af,_0x44e839,_0x1f67e9){return new BPromise(function(_0x3f6d4b,_0x1858cb){return client[_0xa969('0x8')](_0x4935af,_0x1f67e9)[_0xa969('0x9')](function(_0x3c5f5e){logger[_0xa969('0xa')](_0xa969('0xb'),_0x44e839,'request\x20sent');logger[_0xa969('0xc')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x44e839,'request\x20sent',JSON[_0xa969('0xd')](_0x3c5f5e));if(_0x3c5f5e[_0xa969('0xe')]){if(_0x3c5f5e[_0xa969('0xe')]['code']===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x44e839,_0x3c5f5e['error'][_0xa969('0xf')]);return _0x1858cb(_0x3c5f5e[_0xa969('0xe')][_0xa969('0xf')]);}logger[_0xa969('0xe')]('VoiceMail,\x20%s,\x20%s',_0x44e839,_0x3c5f5e[_0xa969('0xe')]['message']);return _0x3f6d4b(_0x3c5f5e[_0xa969('0xe')][_0xa969('0xf')]);}else{logger[_0xa969('0xa')](_0xa969('0xb'),_0x44e839,_0xa969('0x10'));_0x3f6d4b(_0x3c5f5e[_0xa969('0x11')][_0xa969('0xf')]);}})[_0xa969('0x12')](function(_0x38217c){logger['error'](_0xa969('0xb'),_0x44e839,_0x38217c);_0x1858cb(_0x38217c);});});}