Built motion from commit 26d08302.|2.6.31
[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 _0x9bfd=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','info'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9bfd,0x17c));var _0xd9bf=function(_0x4c5b31,_0x2ba64e){_0x4c5b31=_0x4c5b31-0x0;var _0x355911=_0x9bfd[_0x4c5b31];return _0x355911;};'use strict';var _=require('lodash');var util=require(_0xd9bf('0x0'));var moment=require(_0xd9bf('0x1'));var BPromise=require('bluebird');var rs=require(_0xd9bf('0x2'));var fs=require('fs');var Redis=require(_0xd9bf('0x3'));var db=require(_0xd9bf('0x4'))['db'];var utils=require(_0xd9bf('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd9bf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd9bf('0x7')][_0xd9bf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a69b9,_0x446b47,_0xd32306){return new BPromise(function(_0x59aa92,_0x54fc1f){return client[_0xd9bf('0x9')](_0x5a69b9,_0xd32306)['then'](function(_0x5724b9){logger['info']('VoiceMail,\x20%s,\x20%s',_0x446b47,_0xd9bf('0xa'));logger[_0xd9bf('0xb')](_0xd9bf('0xc'),_0x446b47,_0xd9bf('0xa'),JSON[_0xd9bf('0xd')](_0x5724b9));if(_0x5724b9[_0xd9bf('0xe')]){if(_0x5724b9[_0xd9bf('0xe')][_0xd9bf('0xf')]===0x1f4){logger[_0xd9bf('0xe')](_0xd9bf('0x10'),_0x446b47,_0x5724b9[_0xd9bf('0xe')][_0xd9bf('0x11')]);return _0x54fc1f(_0x5724b9[_0xd9bf('0xe')][_0xd9bf('0x11')]);}logger[_0xd9bf('0xe')](_0xd9bf('0x10'),_0x446b47,_0x5724b9[_0xd9bf('0xe')][_0xd9bf('0x11')]);return _0x59aa92(_0x5724b9[_0xd9bf('0xe')][_0xd9bf('0x11')]);}else{logger[_0xd9bf('0x12')](_0xd9bf('0x10'),_0x446b47,_0xd9bf('0xa'));_0x59aa92(_0x5724b9['result'][_0xd9bf('0x11')]);}})['catch'](function(_0x13ce1e){logger[_0xd9bf('0xe')](_0xd9bf('0x10'),_0x446b47,_0x13ce1e);_0x54fc1f(_0x13ce1e);});});}