Currently the output SSRC is always forced to be the same if SSRC
patching is enabled.
This patch modifies this to optionally restrict the number of SSRC
changes that will be corrected.
Note that the configuration only allows for the 'once' mode and 'off'.
Sponsored-by: On-Waves ehf
---
openbsc/include/openbsc/mgcp_internal.h | 2 +-
openbsc/src/libmgcp/mgcp_network.c | 2 ++
openbsc/src/libmgcp/mgcp_protocol.c | 4 +++-
openbsc/src/libmgcp/mgcp_vty.c | 2 +-
4 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/openbsc/include/openbsc/mgcp_internal.h
b/openbsc/include/openbsc/mgcp_internal.h
index b16bd49..255161f 100644
--- a/openbsc/include/openbsc/mgcp_internal.h
+++ b/openbsc/include/openbsc/mgcp_internal.h
@@ -85,7 +85,7 @@ struct mgcp_rtp_end {
char *fmtp_extra;
/* RTP patching */
- int force_constant_ssrc;
+ int force_constant_ssrc; /* -1: always, 0: don't, 1: once */
int force_constant_timing;
/*
diff --git a/openbsc/src/libmgcp/mgcp_network.c b/openbsc/src/libmgcp/mgcp_network.c
index abb48f5..79c9e1a 100644
--- a/openbsc/src/libmgcp/mgcp_network.c
+++ b/openbsc/src/libmgcp/mgcp_network.c
@@ -280,6 +280,8 @@ void mgcp_patch_and_count(struct mgcp_endpoint *endp, struct
mgcp_rtp_state *sta
timestamp;
state->patch = 1;
ssrc = state->orig_ssrc;
+ if (rtp_end->force_constant_ssrc != -1)
+ rtp_end->force_constant_ssrc -= 1;
LOGP(DMGCP, LOGL_NOTICE,
"SSRC patching enabled on 0x%x SSRC: %u "
diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c
index d7e4745..facbeb2 100644
--- a/openbsc/src/libmgcp/mgcp_protocol.c
+++ b/openbsc/src/libmgcp/mgcp_protocol.c
@@ -619,8 +619,10 @@ void mgcp_rtp_end_config(struct mgcp_endpoint *endp, int
expect_ssrc_change,
{
struct mgcp_trunk_config *tcfg = endp->tcfg;
+ int patch_ssrc = expect_ssrc_change && tcfg->force_constant_ssrc;
+
rtp->force_constant_timing = tcfg->force_constant_timing;
- rtp->force_constant_ssrc = tcfg->force_constant_ssrc;
+ rtp->force_constant_ssrc = patch_ssrc ? 1 : 0;
}
static struct msgb *handle_create_con(struct mgcp_parse_data *p)
diff --git a/openbsc/src/libmgcp/mgcp_vty.c b/openbsc/src/libmgcp/mgcp_vty.c
index 16b973f..38570cb 100644
--- a/openbsc/src/libmgcp/mgcp_vty.c
+++ b/openbsc/src/libmgcp/mgcp_vty.c
@@ -613,7 +613,7 @@ DEFUN(cfg_trunk_patch_rtp_ssrc,
RTP_PATCH_STR
"Force a fixed SSRC\n"
"Disable\n"
- "Enable\n"
+ "Enable (once per MDCX)\n"
)
{
struct mgcp_trunk_config *trunk = vty->index;
--
1.7.9.5