mgcp: add prefix to virtual trunk
the virtual trunk is addressed without a prefix (just *@domain).
- reorganize find_endpoint() so that it accepts a prefix when
addressing the virtual trunk.
- do no longer accept wildcarded CRCX requests without prefix
(will not break anything, the feature of wildcarded CRCX is
not in use yet)
- keep the old prefix-less method but print a warning that it is
depreacted.
Change-Id: I2aac3ba0f1f3122dfbb3bf36f74198ecb2b21de5
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 16e9cb8..daedc8d 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -198,9 +198,12 @@
{
int rc;
- if (endp->wildcarded_crcx) {
- rc = msgb_printf(msg, "Z: %u@%s\n", ENDPOINT_NUMBER(endp),
- endp->cfg->domain);
+ /* NOTE: Only in the virtual trunk we allow dynamic endpoint names */
+ if (endp->wildcarded_crcx
+ && endp->tcfg->trunk_type == MGCP_TRUNK_VIRTUAL) {
+ rc = msgb_printf(msg, "Z: %s%u@%s\n",
+ MGCP_ENDPOINT_PREFIX_VIRTUAL_TRUNK,
+ ENDPOINT_NUMBER(endp), endp->cfg->domain);
if (rc < 0)
return -EINVAL;
}