MGCP_Templates: Add receive templates for SDP and use those in {CR,MD}CX
Change-Id: Ibc46888b1b7913d399c79ab735841844ff0487ad
diff --git a/library/MGCP_Templates.ttcn b/library/MGCP_Templates.ttcn
index 917ef89..2fd9b18 100644
--- a/library/MGCP_Templates.ttcn
+++ b/library/MGCP_Templates.ttcn
@@ -113,10 +113,10 @@
sdp := sdp
}
- template MgcpCommand tr_CRCX(template MgcpEndpoint ep := ?) := {
+ template MgcpCommand tr_CRCX(template MgcpEndpoint ep := ?, template SDP_Message sdp := *) := {
line := t_MgcpCmdLine("CRCX", ?, ep),
params := *,
- sdp := *
+ sdp := sdp
}
template MgcpResponse tr_CRCX_ACK := {
@@ -187,10 +187,10 @@
sdp := sdp
}
- template MgcpCommand tr_MDCX := {
+ template MgcpCommand tr_MDCX(template SDP_Message sdp := *) := {
line := t_MgcpCmdLine("MDCX", ?, ?),
params := *,
- sdp := *
+ sdp := sdp
}
template MgcpResponse tr_MDCX_ACK := {
@@ -284,6 +284,18 @@
}
}
+ template SDP_connection tr_SDP_connection_IP(template charstring addr, template charstring addr_type := ?,
+ template integer ttl := *,
+ template integer num_of_addr := *) := {
+ net_type := "IN",
+ addr_type := addr_type,
+ conn_addr := {
+ addr := addr,
+ ttl := ttl,
+ num_of_addr := num_of_addr
+ }
+ }
+
template SDP_time ts_SDP_time(charstring beg, charstring end) := {
time_field := {
start_time := beg,
@@ -310,6 +322,25 @@
attributes := attributes
}
+ template SDP_media_desc tr_SDP_media_desc(template integer port_number := ?,
+ template SDP_fmt_list fmts := ?,
+ template SDP_attribute_list attributes := ?) := {
+ media_field := {
+ media := "audio",
+ ports := {
+ port_number := port_number,
+ num_of_ports := omit
+ },
+ transport := "RTP/AVP",
+ fmts := fmts
+ },
+ information := *,
+ connections := *,
+ bandwidth := *,
+ key := *,
+ attributes := attributes
+ }
+
/* master template for generating SDP based in template arguments */
template SDP_Message ts_SDP(charstring local_addr, charstring remote_addr,
charstring session_id, charstring session_version,
@@ -331,6 +362,23 @@
media_list := { ts_SDP_media_desc(rtp_port, fmts, attributes) }
}
+ template SDP_Message tr_SDP(template charstring remote_addr := ?, template integer rtp_port := ?) := {
+ protocol_version := 0,
+ origin := ?,
+ session_name := ?,
+ information := *,
+ uri := *,
+ emails := *,
+ phone_numbers := *,
+ connection := tr_SDP_connection_IP(remote_addr, ?),
+ bandwidth := *,
+ times := ?,
+ timezone_adjustments := *,
+ key := *,
+ attributes := *,
+ media_list := { tr_SDP_media_desc(rtp_port) }
+ }
+
template SDP_attribute ts_SDP_rtpmap(integer fmt, charstring val) := {
rtpmap := {
attr_value := int2str(fmt) & " " & val