[Home]

Summary:ASTERISK-29081: res_stasis: Add compare function for bridges moh container
Reporter:Hajek Michal (hajekmi)Labels:patch
Date Opened:2020-09-14 11:15:37Date Closed:2020-09-23 08:10:20
Priority:MinorRegression?
Status:Closed/CompleteComponents:Resources/res_stasis
Versions:16.13.0 17.7.0 18.0.0 Frequency of
Occurrence
Frequent
Related
Issues:
Environment:CentOSAttachments:( 0) astobj2_container.txt
( 1) full_2.txt
( 2) full.txt
( 3) moh_bug_res_stasis_2.patch
( 4) moh_bug_res_stasis.patch
Description:1/ Created much PJSIP channels and goto Stasis app at the same time.
2/ Created bridge for every channel.
3/ Assigned channels to bridges.
4/ Play MOH on bridges.

Sometimes I hear, that same channel not play moh, this is problem for our customers, they hear silent.
Comments:By: Asterisk Team (asteriskteam) 2020-09-14 11:15:38.167-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: Hajek Michal (hajekmi) 2020-09-14 11:16:55.947-0500

patch for res_stasis

By: Joshua C. Colp (jcolp) 2020-09-15 10:52:44.263-0500

Can you please attach a log of attempts that failed? As well are you waiting for HTTP requests to complete before doing things? What kind of HTTP responses do you get?

By: Hajek Michal (hajekmi) 2020-09-15 15:39:34.908-0500

Full log - Problem with MOH on bridge bridge_1600201661.23.
You can found line
{color:red}
{code}
[Sep 15 22:27:42.112] DEBUG[83237] res_stasis.c: BUG? Found moh_wrapper 1600201659.7 in bridge bridge_1600201661.23
{code}
{color}
I append debug log to res/res_stasis.c

{code}
struct ast_channel *stasis_app_bridge_moh_channel(struct ast_bridge *bridge)
{
struct ast_channel *chan;
struct stasis_app_bridge_channel_wrapper *moh_wrapper;

ao2_lock(app_bridges_moh);
moh_wrapper = ao2_find(app_bridges_moh, bridge->uniqueid, OBJ_SEARCH_KEY | OBJ_NOLOCK);
if (!moh_wrapper) {
chan = bridge_moh_create(bridge);
}
ao2_unlock(app_bridges_moh);

if (moh_wrapper) {
       ast_log(LOG_DEBUG, "BUG? Found moh_wrapper %s in bridge %s\n", moh_wrapper->channel_id, bridge->uniqueid);
chan = ast_channel_get_by_name(moh_wrapper->channel_id);
ao2_ref(moh_wrapper, -1);
}

return chan;
}
{code}

By: Hajek Michal (hajekmi) 2020-09-15 15:48:25.753-0500

astob2 dump

By: Joshua C. Colp (jcolp) 2020-09-15 16:01:21.487-0500

And if you extend the log message to include moh_wrapper->bridge_id as well? Does it match the unique id of the actual bridge?

By: Hajek Michal (hajekmi) 2020-09-15 16:22:53.995-0500

I do it and this is result in full_2.txt
{color:red}
{code}
[Sep 15 23:19:41.321] DEBUG[127444] res_stasis.c: BUG? Found moh_wrapper 1600204778.2 ( bridge bridge_1600204777.0 ) in bridge bridge_1600204780.25
{code}
{color}

By: Hajek Michal (hajekmi) 2020-09-15 16:23:34.449-0500

ast_log(LOG_DEBUG, "BUG? Found moh_wrapper %s ( bridge %s ) in bridge %s\n", moh_wrapper->channel_id, moh_wrapper->bridge_id, bridge->uniqueid);


By: Joshua C. Colp (jcolp) 2020-09-16 04:38:05.914-0500

That is the issue then - not that there is no sort, but that there is no comparison function. As a result when a lot are present it doesn't find the correct moh_wrapper. Adding a sort function had the side effect of fixing it due to the sorting taking place, but a comparison function should actually be used instead to ensure the correct thing is matched.

By: Hajek Michal (hajekmi) 2020-09-16 08:06:31.728-0500

Thanks for the directions. Apply new patch

By: Hajek Michal (hajekmi) 2020-09-16 08:09:24.159-0500

Compare function for bridges moh container

By: Friendly Automation (friendly-automation) 2020-09-23 08:10:20.511-0500

Change 14986 merged by Friendly Automation:
res_stasis.c: Add compare function for bridges moh container

[https://gerrit.asterisk.org/c/asterisk/+/14986|https://gerrit.asterisk.org/c/asterisk/+/14986]

By: Friendly Automation (friendly-automation) 2020-09-23 09:57:28.229-0500

Change 14927 merged by Joshua Colp:
res_stasis.c: Add compare function for bridges moh container

[https://gerrit.asterisk.org/c/asterisk/+/14927|https://gerrit.asterisk.org/c/asterisk/+/14927]

By: Friendly Automation (friendly-automation) 2020-09-23 09:59:02.537-0500

Change 14961 merged by Joshua Colp:
res_stasis.c: Add compare function for bridges moh container

[https://gerrit.asterisk.org/c/asterisk/+/14961|https://gerrit.asterisk.org/c/asterisk/+/14961]

By: Friendly Automation (friendly-automation) 2020-09-23 10:00:11.029-0500

Change 14960 merged by Joshua Colp:
res_stasis.c: Add compare function for bridges moh container

[https://gerrit.asterisk.org/c/asterisk/+/14960|https://gerrit.asterisk.org/c/asterisk/+/14960]

By: Friendly Automation (friendly-automation) 2020-09-23 10:00:32.421-0500

Change 14959 merged by Joshua Colp:
res_stasis.c: Add compare function for bridges moh container

[https://gerrit.asterisk.org/c/asterisk/+/14959|https://gerrit.asterisk.org/c/asterisk/+/14959]