Fix crash at local calls between pbx<->fxs, REF 14916
The crash happens randomly at internal calls. It seems like sometimes asterisk-chan-voicemngr hangs due to some race conditions (ubus calls not responding anymore) and sometimes it crashes in random places of the code.
What is done:
-
Refactor function for retrieving RTP statistics - add handling of ubus context the initial fix for ubus calls race condition was done in 025ea991 line:
ret = ubus_invoke(get_shared_context(__FUNCTION__), endpt_id, "rtp_stats", bb.head, ubus_call_answer_rtp_stats, sub, 500);
The 'sub' parameter is passed as a context for the ubus call and needs to be handled in the ubus_call_answer_rtp_stats callback function. This part was missed in the initial commit. -
Fixed parsing of blob data for ubus method callbacks. The "sip_client_status" and "call_status" ubus methods were wrongly copy-pasted from the event ubus method, which could lead to potential memory corruption during the parsing of the ubus response.
-
Added error handling for null subchannel. The subchannel is now validated in all parts of the code, but it was previously missed in some areas.