sshh12 / llm_convo

Use ChatGPT over Twilio to create an AI phone agent (works for incoming or outgoing calls).
MIT License
99 stars 19 forks source link

Setup APIs and ngrok but no pickup #2

Closed jryebread closed 1 year ago

jryebread commented 1 year ago

Hi I setup the webhook in twilio to call ngrok/incoming-voice endpoint but it just rings forever when i call and when i make it ngrok.app/audio/incoming-voice I get a 405 error, Is there some missing setup required in the readme?

sshh12 commented 1 year ago

Hm worth checking if these environment variables are set:

account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
from_phone = os.environ["TWILIO_PHONE_NUMBER"]

Other than that any other error messages / logging you are seeing when this happens?

As another sanity check, you could add tws.start_call("your phone #") like in the example script to see if it's able to interact with the twilio API.

jryebread commented 1 year ago

Hi Thanks for your quick response

The twilio API interaction all seems to be correct since i get and can recieve calls

I got it working by removing the {{host}} param and just adding the websocket url directly here:

<Response>
    <Start>
        <Stream name="Audio Stream" url="wss://d0ef-104-173-33-232.ngrok-free.app/audiostream" />
    </Start>
    <Pause length="60"/>
</Response>
"""

Only thing that isn't working is I don't hear any audio (the TTS part) over the phone or from my computer, but that might be due to my system settings and running the script from Windows WSL

Thanks this is an awesome project!

sshh12 commented 1 year ago

Great! To debug the TTS you could try to find the "tts.mp3" in your temp directory to see if that's being generated at all or correctly.

Abe-Telo commented 1 year ago

Great! To debug the TTS you could try to find the "tts.mp3" in your temp directory to see if that's being generated at all or correctly.

Maybe it does not generate for me. is the temp dir in the same folder? or in a system folder? Running debain.

sshh12 commented 1 year ago

It'll write to system temp folder os.path.join(tempfile.mkdtemp(), "tts.mp3")