unispeech / asterisk-unimrcp

UniMRCP modules for Asterisk
http://www.unimrcp.org/asterisk
GNU General Public License v2.0
48 stars 35 forks source link

The RTP downstream of TTS is blocked by NAT #21

Closed wavestudio closed 5 years ago

wavestudio commented 6 years ago

I have tested ASR and TTS functionity today,and my asterisk and mrcp server were all installed behind NAT, asterisk communicated with mrcp server remotely through the internet.I have setup the local IP and external IP of asterisk-unimrcp and mrcp server(all for sip and rtp), and mrcp server also setup the static NAT to pass through the NAT.ASR functionity worked fine but TTS functionity failed,i can hear nothing at user side. I found that mrcp server had sent out the RTP packets but asterisk-unimrcp can't receive these RTP packets,but sip and mrcp signals worked fine at TTS case.The RTP downstream of TTS was blocked by NAT. I think this was caused by the unidirectionality of TTS RTP stream.I think this can be solved by setup a static NAT at asterisk side, or put the asterisk server into the DMZ of router,or a ICE solution,but unfortunately these solutions are not allowed by my requirements. Any other solution(s) to solve this issue?

achaloyan commented 6 years ago

There does not seem to be any good solution to your problem. In case of TTS, there is a unidirectional RTP stream sent from the MRCP server, which is blocked by NAT, as you described. So, there is not much Asterisk/UniMRCP can do about, unless a dummy UDP packets are sent to the MRCP server through the negotiated RTP rx port. This will make incoming RTP packets traverse through the NAT...

wavestudio commented 6 years ago

@achaloyan Thanks for your support, your opinion is same as me. In my case, i also call MRCPRecog first and then call MRCPSynth, this means a RTP upstream first and then another RTP downstream.I find an offer-new-connection option in mrcp.conf ,seems it means that specifies whether to offer the server to establish a new connection or re-use the existing one.I think that if MRCPRecog and MRCPSynth can share an same audio channel, maybe this issue can be solved.How do you think about it?

achaloyan commented 6 years ago

The mentioned parameter "offer-new=connection" applies to MRCPv2 only and has nothing to do with RTP streams. So, it will have no impact on your issue.