Are there any more recent suggestions for how to connect RASA to a telephony channel. I’ve read the blog post on Twilio but curious if there are others.
I’ve made a modification of this tutorial for asterisk using a dialplan and agi:
#!/usr/bin/python3.6
from asterisk.agi import *
import requests
import json
agi = AGI()
path = agi.get_variable("RECORDED_FILE") + ".wav"
response = requests.post('http://localhost:5005/webhooks/voip_rasa/webhook', json ={"path": path})
jsn = response.json()
agi.set_variable("BOTRESPONSE", jsn['text'])
The connector (I forgot where I found how to do this) class:
class VoipRasa(InputChannel):
@classmethod
def name(cls):
return 'voip_rasa'
def blueprint(self, on_new_message):
voip_webhook = Blueprint('voip_webhook', __name__)
@voip_webhook.route("/", methods=['GET'])
async def health(request):
return response.json({"status": "ok"})
@voip_webhook.route("/webhook", methods=['POST'])
async def receive(request):
payload = request.json
path = payload['path']
message = stt(path)
out = CollectingOutputChannel()
await on_new_message(UserMessage(message, out))
responses = [m["text"] for m in out.messages]
txt = responses[0]
r = {"text": txt}
return response.json(r)
return voip_webhook
I got the wav file with the Record
function.
I used Festival
for the tts.
1 Like
Hi @Gehova,
Your tutorial is great. You have tried it for Google Speech Recognition and GTTS ?
Hi, there is a solution from Tenios to enable an existing chatbot for the telephone channel. The solution can be found on the website: Voice Bot API