aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/mgcp/mgcp_protocol.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-11-01 19:57:50 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-11-01 21:15:55 +0100
commitb54048fe25a28c47149f916ae293654b5330ff78 (patch)
treee88b46b9c4fb378408f7df62cdf20b46823f58fd /openbsc/src/mgcp/mgcp_protocol.c
parentfbca4ea1171abb65fd8e1f121469adaeb57104df (diff)
mgcp: Make transcoding a per Endpoint configuration
This allows to switch off transcoding on the fly, or only enable it for certain vessels with known problems.
Diffstat (limited to 'openbsc/src/mgcp/mgcp_protocol.c')
-rw-r--r--openbsc/src/mgcp/mgcp_protocol.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/openbsc/src/mgcp/mgcp_protocol.c b/openbsc/src/mgcp/mgcp_protocol.c
index c73031c0..4e7ebf8b 100644
--- a/openbsc/src/mgcp/mgcp_protocol.c
+++ b/openbsc/src/mgcp/mgcp_protocol.c
@@ -421,12 +421,17 @@ static int allocate_ports(struct mgcp_endpoint *endp)
return -1;
}
- if (endp->cfg->transcoder_ip &&
- allocate_port(endp, &endp->transcoder_end, &endp->cfg->transcoder_ports,
- mgcp_bind_transcoder_rtp_port) != 0) {
- mgcp_rtp_end_reset(&endp->net_end);
- mgcp_rtp_end_reset(&endp->bts_end);
- return -1;
+ if (endp->cfg->transcoder_ip) {
+ if (allocate_port(endp, &endp->transcoder_end,
+ &endp->cfg->transcoder_ports,
+ mgcp_bind_transcoder_rtp_port) != 0) {
+ mgcp_rtp_end_reset(&endp->net_end);
+ mgcp_rtp_end_reset(&endp->bts_end);
+ return -1;
+ }
+
+ /* remember that we have set up transcoding */
+ endp->is_transcoded = 1;
}
return 0;
@@ -848,6 +853,7 @@ void mgcp_free_endp(struct mgcp_endpoint *endp)
mgcp_rtp_end_reset(&endp->bts_end);
mgcp_rtp_end_reset(&endp->net_end);
mgcp_rtp_end_reset(&endp->transcoder_end);
+ endp->is_transcoded = 0;
memset(&endp->net_state, 0, sizeof(endp->net_state));
memset(&endp->bts_state, 0, sizeof(endp->bts_state));
@@ -927,7 +933,7 @@ static void create_transcoder(struct mgcp_endpoint *endp)
int in_endp = ENDPOINT_NUMBER(endp);
int out_endp = back_channel(in_endp);
- if (!endp->cfg->transcoder_ip)
+ if (!endp->is_transcoded)
return;
send_msg(endp, in_endp, endp->bts_end.local_port, "CRCX", "recvonly");
@@ -945,7 +951,7 @@ static void delete_transcoder(struct mgcp_endpoint *endp)
int in_endp = ENDPOINT_NUMBER(endp);
int out_endp = back_channel(in_endp);
- if (!endp->cfg->transcoder_ip)
+ if (!endp->is_transcoded)
return;
send_dlcx(endp, in_endp);