Change in osmo-mgw[master]: mgcp_endp: make wildcarded detection separate

laforge gerrit-no-reply at
Wed Jul 14 19:17:01 UTC 2021

laforge has submitted this change. ( )

Change subject: mgcp_endp: make wildcarded detection separate

mgcp_endp: make wildcarded detection separate

osmo-mgw currently does only a very simple detection method for
wildcarded requests, but it makes sense to split this detection
off into a separate function so that it can be used from different code
locations and we still have it at one place only.

Change-Id: I27018c01afb8acabfcf5d435c996cc9806e52d6b
Related: SYS#5535
M include/osmocom/mgcp/mgcp_endp.h
M src/libosmo-mgcp/mgcp_endp.c
2 files changed, 14 insertions(+), 1 deletion(-)

  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved

diff --git a/include/osmocom/mgcp/mgcp_endp.h b/include/osmocom/mgcp/mgcp_endp.h
index 8d19b44..db1a897 100644
--- a/include/osmocom/mgcp/mgcp_endp.h
+++ b/include/osmocom/mgcp/mgcp_endp.h
@@ -134,6 +134,7 @@
 void mgcp_endp_release(struct mgcp_endpoint *endp);
 int mgcp_endp_claim(struct mgcp_endpoint *endp, const char *callid);
 void mgcp_endp_update(struct mgcp_endpoint *endp);
+bool mgcp_endp_is_wildcarded(const char *epname);
 struct mgcp_endpoint *mgcp_endp_by_name_trunk(int *cause, const char *epname,
 					      const struct mgcp_trunk *trunk);
 struct mgcp_endpoint *mgcp_endp_by_name(int *cause, const char *epname,
diff --git a/src/libosmo-mgcp/mgcp_endp.c b/src/libosmo-mgcp/mgcp_endp.c
index 9ebdd8e..ddfd6cf 100644
--- a/src/libosmo-mgcp/mgcp_endp.c
+++ b/src/libosmo-mgcp/mgcp_endp.c
@@ -237,6 +237,18 @@
 	return NULL;
+/*! Check if the given epname refers to a wildcarded request or to a specific
+ *  endpoint.
+ *  \param[in] epname endpoint name to check
+ *  \returns true if epname refers to wildcarded request, else false. */
+bool mgcp_endp_is_wildcarded(const char *epname)
+	if (strstr(epname, "*"))
+		return true;
+	return false;
 /*! Find an endpoint by its name on a specified trunk.
  *  \param[out] cause pointer to store cause code, can be NULL.
  *  \param[in] epname endpoint name to lookup.
@@ -253,7 +265,7 @@
 	/* At the moment we only support a primitive ('*'-only) method of
 	 * wildcarded endpoint searches that picks the next free endpoint on
 	 * a trunk. */
-	if (strstr(epname, "*")) {
+	if (mgcp_endp_is_wildcarded(epname)) {
 		endp = find_free_endpoint(trunk);
 		if (endp) {

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I27018c01afb8acabfcf5d435c996cc9806e52d6b
Gerrit-Change-Number: 24939
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at>
Gerrit-Reviewer: pespin <pespin at>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list