High latency asterisk

Good morning everyone and excuse my English; It’s been over 10 years since I had experience with Asterisk and I’m running out of time a bit on my last project. I have installed on my dear debian asterisk 16 with freepbx; I don’t use pjsip just chan_sip (nothing personal against pjsip). The configured port is 5060 and I have a trunk to port 9060, my trunks vary a lot in latency depending on the calls and it happens to me with two trunks with different providers, I can’t really capture anything relevant with wireshark, I have sip alg disabled on all routers. All this behavior has started since I decided to reinstall all the servers and join them to a cluster. Analyzing the packets I can see that the nat works correctly and that the phones connected remotely as inside maintain a very very low and stable latency, I have tried everything and every day the same pattern is repeated, maintaining normal latency outside business hours. I no longer know where to continue investigating or where asterisk gets the ping latencies to my provider 40ms, asterisk tells me +100ms,+150ms,200ms and when the calls are over asterisk returns 40ms.
Ops, speed test from my servers ok (more than 100mbps upload and download), remote connections to my servers very fast (for example copying files over ssh).

Everything was fine before the cluster?

What kind of cluster is it?

Are you stuck with the cluster?

Is the cluster doing something weird, like mirroring RTP streams?

Is there confusion in your switch about which device in the cluster to associate with which IP?

it was working very good after cluster; the cluster is working perfect:
asterisk (master) => 172.27.1.201 → 172.27.1.254
=>interface 2-> 192.168.1.201 (slave ping here waiting for start if it fails)
=>asterisk started
asterisk (slave)=> 172.27.1.202 → 172.27.1.254<=not configured while master is active
=>interface 2->192.168.1.202 (master ping here, always is active)
=>asterisk stopped while master is active
my extensions: 172.27.1.X/24 connects to 172.27.1.254 (it works, very low latency over 6ms)
remote asterisk over vpn 172.27.2.X/24 connects to 172.27.1.201 (default mask for this ip is class B but its allowed use class C) latency very low (over 10ms).

external ip providers (netelip and vozcom) i can see connections over 172.27.1.201 to netelip and vozcom; both providers with problems.

speed test over 100mbps upload and ±100Mbps download from asterisk server.

Thx for your time!

What address are you binding to in chan_sip config files? Only .254?

What does output of “sip show channelstats” look like during these calls?

and default chan_sip ip is 0.0.0.0 (all interfaces) but i think that if have any problem my extensions or my remote extensions over vpn must fail too, the last image was captured during two simultaneous calls over netelip

Please do not post pictures of text. Please cut and paste wrapped in pre-formatted text tags so the forum software does not eat special characters and formatting.

Today the same pattern, asterisk shows me high latency in my trunks, with the sip show channelstats command it shows me 00000 packets lost. A simple ping to the ip of my provider always the same latency 40ms, asterisk indicates variable values ​​from 40 to 1200ms

Could be the provider’s SIP UAS.

Every day from 9 to 12.30 the same thing happens, I have tried everything, if mikrotik does not deceive me the traffic at that time is ridiculous (kpbs) lost packets rarely exceed 0.1%. I understand less and less. I have two diferent sip providers and same ussue. Thx for your time!

I just saw something new!, sip show channelstats → two active channels (both my provider) and sip show channels->0 active channels!!! Why does it tell me that there are no active channels and the first command contradicts me?

debianMasterLG*CLI> sip show channelstats
Peer             Call ID      Duration Recv: Pack  Lost       (     %) Jitter Send: Pack  Lost       (     %) Jitter
185.8.244.100    3757e8a2123           0000000000  0000000000 ( 0.00%) 0.0000 0000000000  0000000000 ( 0.00%) 0.0000
185.8.244.100    347617b173a           0000000000  0000000000 ( 0.00%) 0.0000 0000000000  0000000000 ( 0.00%) 0.0000
2 active SIP channels
debianMasterLG*CLI> core show channels
Channel              Location             State   Application(Data)             
0 active channels
0 active calls
11130 calls processed
debianMasterLG*CLI> sip show channelstats
Peer             Call ID      Duration Recv: Pack  Lost       (     %) Jitter Send: Pack  Lost       (     %) Jitter
185.8.244.100    3757e8a2123           0000000000  0000000000 ( 0.00%) 0.0000 0000000000  0000000000 ( 0.00%) 0.0000
185.8.244.100    347617b173a           0000000000  0000000000 ( 0.00%) 0.0000 0000000000  0000000000 ( 0.00%) 0.0000
2 active SIP channels

netelip-out/xxxxxxxxxxxxxxxxx 185.8.244.100                               Yes        No             9060     OK (156 ms) 


Because there were no calls in progress.

I have never seen anything or similar, I can’t find an explanation for these latencies. I understand that if it were a hardware limitation it would have to see an excessive use of cpu or memory; there would also be many lost packages at that time.

two different providers same problem, three geographically separated asterisk servers same way of acting at the same time (the only thing they have in common is a trunk for internal use in the vpn and the version of asterisk and s.o. debian) all external calls are directed to a phone in vpn “sip alg” disabled on routers.



this is the daily graph, every 5 minutes asterisk sends the delay with the trunk; at this time there is a greater influx of calls but it is not something substantially greater than from the time when asterisk begins to give good results. This same graph is identical every day on each of the 3 asterisk servers. I see the odd packet dropped rarely with the sip show channelstats command.

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