You were asked what type of telephones were in use, and I have not seen a reply to that yet.
Also, have you even tried googling for an answer at all?
From co-pile-o-p:
"In Asterisk, a refcount (reference count) is a counter used to track how many parts of the system are currently holding a reference to an object.
Asterisk uses the astobj2 (ao2) API for reference-counted objects.
If the refcount is wrong, you can get two main classes of bugs:
-
Refcount too high → Object never freed (memory leak).
-
Refcount too low → Object freed too early, leading to bad magic number errors or crashes.
1. How Refcounting Works in Asterisk
-
Every ao2 object starts with a refcount of 1 when created.
-
Functions like ao2_ref(obj, +1) increase the count, and ao2_ref(obj, -1) decrease it.
-
When the count reaches 0, the object’s destructor is called and memory is freed.
-
If code keeps a reference without releasing it, the count never reaches 0 → leak.
-
If code releases too many times, the object is freed while still in use → crash.
2. Debugging Refcount Issues
Asterisk has Reference Count Debugging mode 1:
Enabling in Asterisk 14+
-
Edit /etc/asterisk/asterisk.conf and set:
Ini
Copy code
refdebug=yes
-
Restart Asterisk.
-
Reproduce the problem.
-
Stop Asterisk gracefully:
Bash
Copy code
asterisk -rx "core stop gracefully"
-
Process the log:
Bash
Copy code
/var/lib/asterisk/scripts/refcounter.py -f /var/log/asterisk/refs -n > /tmp/refs.txt
-
Review /tmp/refs.txt or attach it to a bug report.
Note: The -n flag suppresses normal lifetimes so you only see leaks, invalid refs, or skewed lifetimes.
3. Example of a Raw Refcount Log
From /var/log/asterisk/refs:
Copy code
0x7f9dbc002048,+1,19256,chan_sip.c,8651,sip_alloc,**constructor**,allocate a dialog(pvt) struct
0x7f9dbc002048,-1,19256,chan_sip.c,28226,handle_request_do,4,throw away dialog ptr
-
+1 / -1 → refcount change
-
constructor / destructor → object creation/destruction
-
File, line, and function show where the change happened.
4. Common Problems
-
Autodestruct warnings: A channel still has a reference preventing cleanup.
-
Bad magic number: Accessing an object after it’s freed.
-
FRACK! Excessive refcount: Refcount reached absurd values (e.g., 100,000) — often due to loops or repeated ao2_ref() without matching ao2_unref() 2.
Example FRACK error:
Copy code
ERROR: Excessive refcount 100000 reached on ao2 object 0x563b78882c30
FRACK!, Failed assertion Excessive refcount 100000 reached
5. Tips for Developers
-
Always pair ao2_ref(obj, +1) with a matching ao2_ref(obj, -1).
-
Use refdebug mode in development to catch leaks early.
-
Avoid holding references longer than necessary.
-
When debugging, search the refs log for the object address to see its entire lifetime.
If you want, I can give you a step-by-step guide to trace a specific leaked or over-referenced object in Asterisk using refcounter.py so you can pinpoint the exact function causing the problem.
Do you want me to prepare that tracing workflow?"
I’m not going to bother verifying if any of that is even correct since it’s an AI spew - but - if even half of it is correct, you can run the commands to log this. According to AI spew increasing refcounts mean a memory leak.
In My Humble Opinion anyone running that many calls and extensions needs to be doing on a version of Asterisk they have compiled themselves, NOT an apt install thingie. If you are doing this - then it would be very simple to add some extra logging code into asterisk in a few key areas to monitor refcounts - and if you see them increasing forever - you have a leak. Then you try finding this with valgrind.
There’s not a lot of asterisk systems with as many extensions as yours out there so a memory leak that you have crop up every 16 hours would likely take months to show on most other systems. In addition, you have said nothing about the underlying network infrastructure. Is your system behind a firewall/address translator or some such that is mucking with SIP? Are your extensions behind something that is mucking with SIP?
In general your going to get more help here if you try some rudimentary things to fix it.