da831d870a4ab4b479b99925ff88c7e43325dca8
[motion2.git] / server / api / voiceMailMessage / voiceMailMessage.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 _0x323c=['request','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','moment','bluebird','../../config/logger','rpc','jayson/promise','client','http'];(function(_0xfbd934,_0x3bca94){var _0x30cc84=function(_0x15a3bb){while(--_0x15a3bb){_0xfbd934['push'](_0xfbd934['shift']());}};_0x30cc84(++_0x3bca94);}(_0x323c,0x64));var _0xc323=function(_0x51b9a7,_0x5adef5){_0x51b9a7=_0x51b9a7-0x0;var _0xe1875b=_0x323c[_0x51b9a7];return _0xe1875b;};'use strict';var _=require('lodash');var util=require(_0xc323('0x0'));var moment=require(_0xc323('0x1'));var BPromise=require(_0xc323('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc323('0x3'))(_0xc323('0x4'));var config=require('../../config/environment');var jayson=require(_0xc323('0x5'));var client=jayson[_0xc323('0x6')][_0xc323('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x595898,_0x47ff35,_0x448b4a){return new BPromise(function(_0x3ef81c,_0xe17f23){return client[_0xc323('0x8')](_0x595898,_0x448b4a)['then'](function(_0xd63936){logger[_0xc323('0x9')](_0xc323('0xa'),_0x47ff35,'request\x20sent');logger[_0xc323('0xb')](_0xc323('0xc'),_0x47ff35,_0xc323('0xd'),JSON['stringify'](_0xd63936));if(_0xd63936[_0xc323('0xe')]){if(_0xd63936[_0xc323('0xe')][_0xc323('0xf')]===0x1f4){logger[_0xc323('0xe')](_0xc323('0xa'),_0x47ff35,_0xd63936[_0xc323('0xe')][_0xc323('0x10')]);return _0xe17f23(_0xd63936['error'][_0xc323('0x10')]);}logger[_0xc323('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x47ff35,_0xd63936[_0xc323('0xe')][_0xc323('0x10')]);return _0x3ef81c(_0xd63936['error']['message']);}else{logger['info'](_0xc323('0xa'),_0x47ff35,'request\x20sent');_0x3ef81c(_0xd63936['result'][_0xc323('0x10')]);}})[_0xc323('0x11')](function(_0x4dab73){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x47ff35,_0x4dab73);_0xe17f23(_0x4dab73);});});}