[asterisk-dev] Call unhold/topology change indication order

Fridrich Maximilian M.Fridrich at commend.com
Wed May 11 06:54:34 CDT 2022


Hi,

I am currently working on fixing [ASTERISK-30051] res_pjsip: No video
after un-hold with moh_passthrough=yes. [1]

I have debugged the code with DEBUG_THREADS enabled (which resolves the issue)
and without and compared the two. The issue clearly seems to be that
chan_pjsip:chan_pjsip_indicate() is called in the wrong order:

1. It is called to indicate AST_CONTROL_STREAM_TOPOLOGY_REQUEST_CHANGE
2. It is called to indicate AST_CONTROL_UNHOLD

With DEBUG_THREADS enabled, AST_CONTROL_UNHOLD is always called first and video
works as expected.

Before I try to fix the underlying issue (which I think I have identified - see
below) I want to understand why AST_CONTROL_UNHOLD needs to be indicated before
AST_CONTROL_STREAM_TOPOLOGY_REQUEST_CHANGE.

Does anyone have any idea why it has to be called in that order?

Thank you,
Max

PS: The underlying issue seems to be a race condition from two threads waiting
for bridge_channel:bridge_channel_wait and the one receiving the
topology_change "winning" the race. But I don't quite understand why that is an
issue in the first place.

[1]
https://issues.asterisk.org/jira/browse/ASTERISK-30051



More information about the asterisk-dev mailing list