<p>Joshua Colp <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14960">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
George Joseph: Looks good to me, approved
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_stasis.c: Add compare function for bridges moh container<br><br>Sometimes not play MOH on bridge.<br><br>ASTERISK-29081<br>Reported-by: Michal Hajek <michal.hajek@daktela.com><br><br>Change-Id: I760c73e0c9be1d340303b5d1c18a00c4759e8232<br>---<br>M res/res_stasis.c<br>1 file changed, 28 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_stasis.c b/res/res_stasis.c</span><br><span>index 7d05e8b..f16062b 100644</span><br><span>--- a/res/res_stasis.c</span><br><span>+++ b/res/res_stasis.c</span><br><span>@@ -425,6 +425,33 @@</span><br><span> );</span><br><span> };</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/*! AO2 comparison function for bridges moh container */</span><br><span style="color: hsl(120, 100%, 40%);">+static int bridges_channel_compare(void *obj, void *arg, int flags)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ const struct stasis_app_bridge_channel_wrapper *object_left = obj;</span><br><span style="color: hsl(120, 100%, 40%);">+ const struct stasis_app_bridge_channel_wrapper *object_right = arg;</span><br><span style="color: hsl(120, 100%, 40%);">+ const char *right_key = arg;</span><br><span style="color: hsl(120, 100%, 40%);">+ int cmp;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ switch (flags & OBJ_SEARCH_MASK) {</span><br><span style="color: hsl(120, 100%, 40%);">+ case OBJ_SEARCH_OBJECT:</span><br><span style="color: hsl(120, 100%, 40%);">+ right_key = object_right->bridge_id;</span><br><span style="color: hsl(120, 100%, 40%);">+ case OBJ_SEARCH_KEY:</span><br><span style="color: hsl(120, 100%, 40%);">+ cmp = strcmp(object_left->bridge_id, right_key);</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case OBJ_SEARCH_PARTIAL_KEY:</span><br><span style="color: hsl(120, 100%, 40%);">+ cmp = strncmp(object_left->bridge_id, right_key, strlen(right_key));</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ default:</span><br><span style="color: hsl(120, 100%, 40%);">+ cmp = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (cmp) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ return CMP_MATCH;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static void stasis_app_bridge_channel_wrapper_destructor(void *obj)</span><br><span> {</span><br><span> struct stasis_app_bridge_channel_wrapper *wrapper = obj;</span><br><span>@@ -2323,7 +2350,7 @@</span><br><span> BRIDGES_NUM_BUCKETS, bridges_hash, NULL, bridges_compare);</span><br><span> app_bridges_moh = ao2_container_alloc_hash(</span><br><span> AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(0, 100%, 40%);">- 37, bridges_channel_hash_fn, NULL, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ 37, bridges_channel_hash_fn, NULL, bridges_channel_compare);</span><br><span> app_bridges_playback = ao2_container_alloc_hash(</span><br><span> AO2_ALLOC_OPT_LOCK_MUTEX, AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT,</span><br><span> 37, bridges_channel_hash_fn, bridges_channel_sort_fn, NULL);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14960">change 14960</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/14960"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 18 </div>
<div style="display:none"> Gerrit-Change-Id: I760c73e0c9be1d340303b5d1c18a00c4759e8232 </div>
<div style="display:none"> Gerrit-Change-Number: 14960 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Hajek Michal <michal.hajek@daktela.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>