MGCP_Templates: Add receive templates for SDP and use those in {CR,MD}CX

Change-Id: Ibc46888b1b7913d399c79ab735841844ff0487ad
This commit is contained in:
Daniel Willmann 2022-02-08 16:22:59 +01:00
parent fc5e17adab
commit fdb48680ba
1 changed files with 52 additions and 4 deletions

View File

@ -113,10 +113,10 @@ module MGCP_Templates {
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 @@ module MGCP_Templates {
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 @@ module MGCP_Templates {
}
}
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 @@ module MGCP_Templates {
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 @@ module MGCP_Templates {
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