mgcp: Keep the local_port like it was set on allocation
Do not reset statically allocated local_port. The port
might be different to the calculation of endpoint number
and base port. This might be the case for the coming remote
transcoding.
diff --git a/openbsc/src/mgcp/mgcp_protocol.c b/openbsc/src/mgcp/mgcp_protocol.c
index 435ceee..ddcbfaf 100644
--- a/openbsc/src/mgcp/mgcp_protocol.c
+++ b/openbsc/src/mgcp/mgcp_protocol.c
@@ -382,7 +382,6 @@
int i;
if (range->mode == PORT_ALLOC_STATIC) {
- end->local_port = rtp_calculate_port(ENDPOINT_NUMBER(endp), range->base_port);
end->local_alloc = PORT_ALLOC_STATIC;
return 0;
}
@@ -795,12 +794,14 @@
static void mgcp_rtp_end_reset(struct mgcp_rtp_end *end)
{
- if (end->local_alloc == PORT_ALLOC_DYNAMIC)
+ if (end->local_alloc == PORT_ALLOC_DYNAMIC) {
mgcp_free_rtp_port(end);
+ end->local_port = 0;
+ }
end->packets = 0;
memset(&end->addr, 0, sizeof(end->addr));
- end->rtp_port = end->rtcp_port = end->local_port = 0;
+ end->rtp_port = end->rtcp_port = 0;
end->payload_type = -1;
end->local_alloc = -1;
}