aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-08-05 06:31:58 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-08-08 07:21:43 +0800
commite320fc115aaa189ce2f4639189f52d981b57eb8a (patch)
tree0369380785a749138bd4edf7fdc0e58ff167410c /openbsc
parent5bf8f957015eb70e98e5a803229196ee962e0cb7 (diff)
mgcp: Move the loopback code into the common send as well.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/mgcp/mgcp_network.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/openbsc/src/mgcp/mgcp_network.c b/openbsc/src/mgcp/mgcp_network.c
index 395eabfb9..7e9049ced 100644
--- a/openbsc/src/mgcp/mgcp_network.c
+++ b/openbsc/src/mgcp/mgcp_network.c
@@ -154,6 +154,15 @@ static void patch_and_count(struct mgcp_endpoint *endp, struct mgcp_rtp_state *s
static int send_to(struct mgcp_endpoint *endp, int dest, int is_rtp,
struct sockaddr_in *addr, char *buf, int rc)
{
+ struct mgcp_config *cfg = endp->cfg;
+ /* For loop toggle the destination and then dispatch. */
+ if (cfg->audio_loop)
+ dest = !dest;
+
+ /* Loop based on the conn_mode, maybe undoing the above */
+ if (endp->conn_mode == MGCP_CONN_LOOPBACK)
+ dest = !dest;
+
if (dest == DEST_NETWORK) {
if (is_rtp) {
patch_and_count(endp, &endp->bts_state,
@@ -263,14 +272,6 @@ static int rtp_data_cb(struct bsc_fd *fd, unsigned int what)
else
++endp->net_end.packets;
- /* For loop toggle the destination and then dispatch. */
- if (cfg->audio_loop)
- dest = !dest;
-
- /* Loop based on the conn_mode, maybe undoing the above */
- if (endp->conn_mode == MGCP_CONN_LOOPBACK)
- dest = !dest;
-
return send_to(endp, dest, proto == PROTO_RTP, &addr, &buf[0], rc);
}