[Asterisk-code-review] res_stasis.c: Add compare function for bridges moh container (asterisk[18])
Joshua Colp
asteriskteam at digium.com
Wed Sep 23 09:58:43 CDT 2020
Joshua Colp has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14960 )
Change subject: res_stasis.c: Add compare function for bridges moh container
......................................................................
res_stasis.c: Add compare function for bridges moh container
Sometimes not play MOH on bridge.
ASTERISK-29081
Reported-by: Michal Hajek <michal.hajek at daktela.com>
Change-Id: I760c73e0c9be1d340303b5d1c18a00c4759e8232
---
M res/res_stasis.c
1 file changed, 28 insertions(+), 1 deletion(-)
Approvals:
Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
George Joseph: Looks good to me, approved
diff --git a/res/res_stasis.c b/res/res_stasis.c
index 7d05e8b..f16062b 100644
--- a/res/res_stasis.c
+++ b/res/res_stasis.c
@@ -425,6 +425,33 @@
);
};
+/*! AO2 comparison function for bridges moh container */
+static int bridges_channel_compare(void *obj, void *arg, int flags)
+{
+ const struct stasis_app_bridge_channel_wrapper *object_left = obj;
+ const struct stasis_app_bridge_channel_wrapper *object_right = arg;
+ const char *right_key = arg;
+ int cmp;
+
+ switch (flags & OBJ_SEARCH_MASK) {
+ case OBJ_SEARCH_OBJECT:
+ right_key = object_right->bridge_id;
+ case OBJ_SEARCH_KEY:
+ cmp = strcmp(object_left->bridge_id, right_key);
+ break;
+ case OBJ_SEARCH_PARTIAL_KEY:
+ cmp = strncmp(object_left->bridge_id, right_key, strlen(right_key));
+ break;
+ default:
+ cmp = 0;
+ break;
+ }
+ if (cmp) {
+ return 0;
+ }
+ return CMP_MATCH;
+}
+
static void stasis_app_bridge_channel_wrapper_destructor(void *obj)
{
struct stasis_app_bridge_channel_wrapper *wrapper = obj;
@@ -2323,7 +2350,7 @@
BRIDGES_NUM_BUCKETS, bridges_hash, NULL, bridges_compare);
app_bridges_moh = ao2_container_alloc_hash(
AO2_ALLOC_OPT_LOCK_MUTEX, 0,
- 37, bridges_channel_hash_fn, NULL, NULL);
+ 37, bridges_channel_hash_fn, NULL, bridges_channel_compare);
app_bridges_playback = ao2_container_alloc_hash(
AO2_ALLOC_OPT_LOCK_MUTEX, AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT,
37, bridges_channel_hash_fn, bridges_channel_sort_fn, NULL);
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14960
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: I760c73e0c9be1d340303b5d1c18a00c4759e8232
Gerrit-Change-Number: 14960
Gerrit-PatchSet: 2
Gerrit-Owner: Hajek Michal <michal.hajek at daktela.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200923/240d0c2a/attachment.html>
More information about the asterisk-code-review
mailing list