1ceac830a61f62dbcd6fa03d4ab458e2c18991d8
[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 _0x4407=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','error','code','message','VoiceMail,\x20%s,\x20%s','result','catch','util'];(function(_0x25b6a6,_0x2dd1ce){var _0x3e0d14=function(_0x98636f){while(--_0x98636f){_0x25b6a6['push'](_0x25b6a6['shift']());}};_0x3e0d14(++_0x2dd1ce);}(_0x4407,0x71));var _0x7440=function(_0x7a55af,_0x790d7f){_0x7a55af=_0x7a55af-0x0;var _0x3c0670=_0x4407[_0x7a55af];return _0x3c0670;};'use strict';var _=require('lodash');var util=require(_0x7440('0x0'));var moment=require(_0x7440('0x1'));var BPromise=require('bluebird');var rs=require(_0x7440('0x2'));var fs=require('fs');var Redis=require(_0x7440('0x3'));var db=require(_0x7440('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7440('0x5'))('rpc');var config=require(_0x7440('0x6'));var jayson=require(_0x7440('0x7'));var client=jayson['client'][_0x7440('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4356b7,_0x50fb62,_0x5dc20d){return new BPromise(function(_0x4c1947,_0x421008){return client[_0x7440('0x9')](_0x4356b7,_0x5dc20d)['then'](function(_0x1c53ef){logger[_0x7440('0xa')]('VoiceMail,\x20%s,\x20%s',_0x50fb62,_0x7440('0xb'));logger[_0x7440('0xc')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x50fb62,_0x7440('0xb'),JSON['stringify'](_0x1c53ef));if(_0x1c53ef[_0x7440('0xd')]){if(_0x1c53ef[_0x7440('0xd')][_0x7440('0xe')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x50fb62,_0x1c53ef[_0x7440('0xd')]['message']);return _0x421008(_0x1c53ef[_0x7440('0xd')][_0x7440('0xf')]);}logger[_0x7440('0xd')](_0x7440('0x10'),_0x50fb62,_0x1c53ef['error'][_0x7440('0xf')]);return _0x4c1947(_0x1c53ef[_0x7440('0xd')][_0x7440('0xf')]);}else{logger[_0x7440('0xa')](_0x7440('0x10'),_0x50fb62,_0x7440('0xb'));_0x4c1947(_0x1c53ef[_0x7440('0x11')][_0x7440('0xf')]);}})[_0x7440('0x12')](function(_0x221d8e){logger[_0x7440('0xd')](_0x7440('0x10'),_0x50fb62,_0x221d8e);_0x421008(_0x221d8e);});});}