aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/mgcp
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-21 21:25:13 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-04-25 23:01:55 +0800
commitb844b876adf53781f9cebe4ac13bdd185db29365 (patch)
tree4289ddfd5c47674129794ff8f7c1d70f9b9de2b6 /openbsc/src/mgcp
parent8d9833ef8376a144ef384d0f47b5c67bd0a1f6e2 (diff)
[mgcp] Add a dummy send method...
This can be used by higher level code to send one dummy message from the audio port to the network. This can be used to make the remote discover the nated port of this endpoint.
Diffstat (limited to 'openbsc/src/mgcp')
-rw-r--r--openbsc/src/mgcp/mgcp_network.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/openbsc/src/mgcp/mgcp_network.c b/openbsc/src/mgcp/mgcp_network.c
index 5a982608e..49d21be10 100644
--- a/openbsc/src/mgcp/mgcp_network.c
+++ b/openbsc/src/mgcp/mgcp_network.c
@@ -73,6 +73,8 @@ enum {
PROTO_RTCP,
};
+#define DUMMY_LOAD 0x23
+
static int udp_send(int fd, struct in_addr *addr, int port, char *buf, int len)
{
@@ -84,6 +86,14 @@ static int udp_send(int fd, struct in_addr *addr, int port, char *buf, int len)
return sendto(fd, buf, len, 0, (struct sockaddr *)&out, sizeof(out));
}
+int mgcp_send_dummy(struct mgcp_endpoint *endp)
+{
+ static char buf[] = { DUMMY_LOAD };
+
+ return udp_send(endp->local_rtp.fd, &endp->remote,
+ endp->net_rtp, buf, 1);
+}
+
static void patch_payload(int payload, char *data, int len)
{
struct rtp_hdr *rtp_hdr;
@@ -161,6 +171,14 @@ static int rtp_data_cb(struct bsc_fd *fd, unsigned int what)
LOGP(DMGCP, LOGL_NOTICE, "Found BTS for endpoint: 0x%x on port: %d/%d of %s\n",
ENDPOINT_NUMBER(endp), ntohs(endp->bts_rtp), ntohs(endp->bts_rtcp),
inet_ntoa(addr.sin_addr));
+
+ /* throw away dummy message */
+ if (rc == 1 && buf[0] == DUMMY_LOAD) {
+ LOGP(DMGCP, LOGL_NOTICE, "Filtered dummy on 0x%x\n",
+ ENDPOINT_NUMBER(endp));
+ return 0;
+ }
+
}
}