Audio Latency Issues in SIP Trunk and Telephony Number

I recently set up a SIP trunk in Asterisk and integrated it with the LiveKit number service. However, I am experiencing significant delays in the agent responses, and the audio latency is around 18–25 seconds during calls. I would like to understand how to reduce latency in the LiveKit Agent panel and improve the overall call response time.

18-25 seconds during calls? As in the speech-to-speech latency is 18-25 seconds? The first thing would be to understand what is introducing that delay, and my guess is it would be multiple things. I’m still working on a better resource for this, but a good place to start is this FAQ: Frequently Asked Questions (FAQ) - #13 by darryncampbell

I recommend first eliminating the SIP leg, to measure your latency when connecting to the room through the web. Then understand what the latency is in your SIP leg by looking at your PCAP files (does the call involve multiple trans-atlantic hops for example)

These are my agent details related to STT and TTS configuration. I have tested different models as well. I set up a LiveKit SIP trunk in Asterisk, and when I place a call through the trunk, the call connects successfully. However, after dialing, I hear the greeting only after about 8 seconds of ringing. When I speak during the call, the agent responses are significantly delayed, and this delay happens on every interaction. I am also experiencing the same issue when calling through the telephony phone number.

The guide I referred to in my original response is now published: Understand and Improve Agent Latency | LiveKit