[AGI] Delay after answer and before URI stream


I have a strange issue where there is a huge delay in my AGI script. So basically I have a small AGI script that just Answers a call and plays an audio file from a stream. But sometimes there is u huge delay from 5-15 seconds after the Answer command. I have this script running on multiple boxes and it only behaves like this on one of my Asterisk server. It also seems that it does this when Asterisk is running for about a month. When I restart Asterisk there is no delay anymore.

I do see some huge spike in the CPU when this happens. It goes from 20% to 90%.

AGI script:


echo "Answer"
echo "CONTROL STREAM FILE https://firebasestorage.googleapis.com/v0/b/uniqueURl \"\""

Asterisk: 16.1.1
CentOS: centos-release-7-6.1810.2.el7.centos.x86_64
Kernel: 3.10.0-957.1.3.el7.x86_64
Filesystem: xfs
CPU: Intel® Xeon® CPU L5630 @ 2.13GHz (x12 cores)
RAM: DDR3 (16GB)

Best regards

When contacting a remote service a delay could be noticeable depending of the time for the remote server to reply, also DNS resolution can add a delay on this request

Hello, thank you for your reply! :grinning:

I could change the DNS settings, but is there some way to check if the delay is caused by DNS resolution? And does that explain the high CPU spikes?

I also have the remote service mounted as a networkdisk, the first time it fetches the file it takes about 5 seconds, after that there is still a very small delay. So I moved to URI playback because of that small delay which is still much smaller then I experience now. Also the file should be cached right? So shouldn’t it just grab the file from cache? Or does it check the URI first if the file changed?

Documentation says Caching

When a sound file has been retrieved, it should be cached on the local server. The management of the file should follow standard HTTP caching rules

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.