bsc: Handle wildcard endpoint name in MGCP CRCX
MGCP permits for the CallAgent to send a wildcarded endpoint name,
at which point the MGW itself must allocate an endpoint name and
return it as SpecificEndpointId parameter in the CRCX response.
Change-Id: I704bbe4e11b27e83a6ae6a71aa6a715dc8301f34
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 55cdb89..b6e6540 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -75,7 +75,7 @@
peer := -
}
- //g_media.mgcp_ep := int2str(i) & "@mgw";
+ g_media.mgcp_ep := "rtpbridge/" & int2str(nr) & "@mgw";
for (var integer i:= 0; i < sizeof(g_media.mgcp_conn); i := i+1) {
g_media.mgcp_conn[i].mime_type := "AMR";
@@ -169,6 +169,16 @@
[] MGCP.receive(tr_CRCX) -> value mgcp_cmd {
var SDP_Message sdp;
var integer cid := f_get_free_mgcp_conn();
+ if (match(mgcp_cmd.line.ep, t_MGCP_EP_wildcard)) {
+ if (cid != 0) {
+ setverdict(fail, "MGCP wildcard EP only works in first CRCX");
+ self.stop;
+ }
+ /* we keep the endpoint name allocated during MediaState_init */
+ } else {
+ /* Call Agent allocated endpoint, trust/use it always */
+ g_media.mgcp_ep := mgcp_cmd.line.ep;
+ }
if (isvalue(mgcp_cmd.sdp)) {
sdp := mgcp_cmd.sdp;
g_media.mgcp_conn[cid].peer.host := sdp.connection.conn_addr.addr;
@@ -181,7 +191,10 @@
mgcp_conn.mime_type & "/" &
int2str(mgcp_conn.sample_rate))),
valueof(ts_SDP_ptime(mgcp_conn.ptime)) } ));
- MGCP.send(ts_CRCX_ACK(mgcp_cmd.line.trans_id, mgcp_conn.conn_id, sdp));
+ var template MgcpResponse mgcp_resp;
+ mgcp_resp := ts_CRCX_ACK(mgcp_cmd.line.trans_id, mgcp_conn.conn_id, sdp);
+ f_mgcp_par_append(mgcp_resp.params, ts_MgcpParSpecEP(g_media.mgcp_ep));
+ MGCP.send(mgcp_resp);
g_media.mgcp_conn[cid].crcx_seen := true;
repeat;
}