AllStarLink / app_rpt

Refactoring and upgrade of AllStarLink's app_rpt, etc.
5 stars 4 forks source link

Jitterbuffer resyncthreshold #233

Closed tsawyer closed 7 months ago

tsawyer commented 10 months ago

A one second butter buffer is too small for app_rpt as indicated by the constant resyncing seen below. I'd like to lengthen it.

The sample iax.conf distributed with Asterisk 20 has the default and commented settings shown here. My settings below that.

;jitterbuffer=no
;maxjitterbuffer=1000
;maxjitterinterps=10
;resyncthreshold=1000
;jittertargetextra=40

jitterbuffer = yes
maxjitterbuffer = 4000
resyncthreshold = 2000

Problem is after iax2 reload the new settings didn't take effect as can be seen here.

[2023-10-06 09:09:55.255] WARNING[2245169][C-00009483]: chan_iax2.c:1237 jb_warning_output: Resyncing the jb. last_delay -121, this delay 979, threshold 1000, new offset -1012
[2023-10-06 09:10:05.027] WARNING[2245165][C-00009483]: chan_iax2.c:1237 jb_warning_output: Resyncing the jb. last_delay 0, this delay -1099, threshold 1000, new offset 87
[2023-10-06 09:11:29.759] WARNING[2245164][C-00009483]: chan_iax2.c:1237 jb_warning_output: Resyncing the jb. last_delay -1, this delay 5401, threshold 1000, new offset -5314
[2023-10-06 09:11:33.608] WARNING[2245163][C-00009483]: chan_iax2.c:1237 jb_warning_output: Resyncing the jb. last_delay 0, this delay -5400, threshold 1000, new offset 86
[2023-10-06 09:11:55.331] WARNING[2245162][C-00009483]: chan_iax2.c:1237 jb_warning_output: Resyncing the jb. last_delay -3, this delay 2228, threshold 1000, new offset -2142
[2023-10-06 09:12:03.907] WARNING[2245160][C-00009483]: chan_iax2.c:1237 jb_warning_output: Resyncing the jb. last_delay 0, this delay -2229, threshold 1000, new offset 87
[2023-10-06 09:13:55.655] WARNING[2245166][C-00009483]: chan_iax2.c:1237 jb_warning_output: Resyncing the jb. last_delay -1, this delay 1098, threshold 1000, new offset -1011
[2023-10-06 09:14:04.865] WARNING[2245165][C-00009483]: chan_iax2.c:1237 jb_warning_output: Resyncing the jb. last_delay 0, this delay -1099, threshold 1000, new offset 88
tsawyer commented 10 months ago

Found this is chan_iax2.c.

338 static int maxjitterbuffer=1000;
339 static int resyncthreshold=1000;

Line 13727 to 13730 appear to load maxjitterbuffer and resyncthreshold but if they are static can they be changed?

13727                 else if (!strcasecmp(v->name, "maxjitterbuffer"))
13728                         maxjitterbuffer = atoi(v->value);
13729                 else if (!strcasecmp(v->name, "resyncthreshold"))
13730                         resyncthreshold = atoi(v->value);
encbar5 commented 10 months ago

Yes they can be changed. Static only refers to the storage. If they were 'const' they could not be changed.

tsawyer commented 10 months ago

Thanks for the short C lesson. I've attempted to change them as the settings posted show. However, it's looks like the resync threshold has not changed. Console capture still shows threshold 1000. This is a low priority but I'd like to keep this issue open to be addressed at a later date.

encbar5 commented 10 months ago

Browsing the code, it looks like the resync threshold gets set when the channel is created. Reloading might re-read the config, but then that would only affect new connections? Have you tried dropping the connections and reestablishing them after the module reload?

tsawyer commented 10 months ago

@encbar5 Your suggestion to reestablish the connections worked. I disconnected all nodes (this is a hub) and reconnected them. That was about 12 hours ago. Since then only these two resyncs occurred. As you can see the resync threshold is no longer 1000. It's not exactly at the 2000 I set, but the initial warning has a delay of more than 2000 which was the desired effect.

Whether or not this threshold is a good idea remains to be seen. I'm going to leave the system play this way and see how it works out.

[2023-10-09 17:24:22.520] WARNING[2245166][C-00009d4b] chan_iax2.c: Resyncing the jb. last_delay 1928, this delay 4851, threshold 2056, new offset -4851
[2023-10-09 17:24:28.691] WARNING[2245162][C-00009d4b] chan_iax2.c: Resyncing the jb. last_delay 0, this delay -4830, threshold 2120, new offset -21

Fyi, the network was taking hits when this happened as evidenced by many voter disconnects at the same time.

InterLinked1 commented 7 months ago

Doesn't appear to be an actual issue here so I'm closing this... please reopen if this is a mistake.