mgcp_trunk: remove double check

At the moment, the trunk prefix is checked twice. Lets re-arange the
code a bit so that the check only happens once.

Change-Id: I91fb8cf6e3b077ba8f18fdbcd071275c6fd7cacd
Related: OS#2547
This commit is contained in:
Philipp Maier 2020-07-02 14:59:16 +02:00 committed by laforge
parent fe67e094ad
commit 24b8c0ce92
1 changed files with 2 additions and 6 deletions

View File

@ -159,13 +159,9 @@ struct mgcp_trunk *mgcp_trunk_by_name(const struct mgcp_config *cfg, const char
return mgcp_trunk_by_num(cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
}
prefix_len = sizeof(MGCP_ENDPOINT_PREFIX_E1_TRUNK) - 1;
if (strncmp(epname, MGCP_ENDPOINT_PREFIX_E1_TRUNK, prefix_len) == 0) {
trunk_nr = e1_trunk_nr_from_epname(epname);
if (trunk_nr < 0)
return NULL;
trunk_nr = e1_trunk_nr_from_epname(epname);
if (trunk_nr > 0)
return mgcp_trunk_by_num(cfg, MGCP_TRUNK_E1, trunk_nr);
}
/* Earlier versions of osmo-mgw were accepting endpoint names
* without trunk prefix. This is normally not allowed, each MGCP