Ami tcp 5038

I have an Asterisk server that is managing requests coming from many clients via AMI commands.
I noticed that suddenly the server is not able to manage that AMI requests coming from the port 5038.

The only thing that I can do is to launch the command “fwconsole restart” in order to give to Asterisk again the possibility to accept requests coming from 5038 port.

It seems that Asterisk has a limit to accept a number of connection/requests o there is something that block suddenly the port.

Can you give me a suggestion?


A little details:

[2022-01-26 11:33:36] [freepbx.INFO]: Connection attmempt to AMI failed [] []

Jan 26 11:34:36 asterisk-prod kernel: TCP: request_sock_TCP: Possible SYN flooding on port 5038. Sending cookies. Check SNMP counters.

Last time I had that problem, I used

It worked fine.

1 Like

Hi Dicko,
we are 50 agents that are using a web application developed in Phyton using Panoramisk ( to manage AMI requests.

All the Agents works fine but suddenly they lost the connection to Asterisk and the only action that I can do to solve the problem is “fwconsole restart” command. This give the opportunity to use again the 5038 port.

Is any configuration in Asterisk that I can check? On the Linux side, for example?

Grazie Dicko,

That will happen if you try and open too many connections, the link i posted is a proxy for ami that only opens one connection to each asterisk box you need to connect to, I haven’t used it for years but it probably still works as a proxy, no interpretative stuff , there is also a websocket proxy around somewhere that would need you wrap your ami calls in json.

Hi Dicko,
based on your experience…there is an implicit limit configured on Asterisk regarding the max connections/max requests/buffer… that AMI can manage?


There isn’t a built in limit. If you push anything far enough it’ll come crashing down, what that limit is depends on things (version of Asterisk, AMI traffic, whether you filter the messages or not Asterisk side, what actions you’re doing).

1 Like

It does not sound like a great idea having each agent open their own AMI connection to Asterisk. You should avoid having Asterisk do more than the bare minimum. Why don’t you put a service cache in front - at 50 agents, even saving everything on a database will be fine.

What are you trying to do?

Hi QM2021,
as already above wrote, I create an application that give to the Agents the possibility to Login/Logut and notify different pauses to the queue. Also I created an application to monitor queue calls, agent activity and so on…

What do you mean when you write “…put a service cache in front…”

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