aboutsummaryrefslogtreecommitdiffstats
path: root/rtp.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-08-09 01:59:59 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-08-09 01:59:59 +0000
commite915d19e2feb107878a566f88f99f023b82b90f6 (patch)
treefe65734fb55f7f0e65a4e554aa801939b67b4b80 /rtp.c
parent53fb7866aba8a5605080dc284ac036f245352fb6 (diff)
bridging code cleanups:
code style, formatting use enum/symbolic constants for return codes efficiency improvements (zaptel) only disable DTMF detection once per bridge, not every frame (zaptel) ensure VPM DTMF detector is turned off during native bridge git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6312 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'rtp.c')
-rwxr-xr-xrtp.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/rtp.c b/rtp.c
index 31f98a5cd..642a821ad 100755
--- a/rtp.c
+++ b/rtp.c
@@ -1425,7 +1425,7 @@ static struct ast_rtp_protocol *get_proto(struct ast_channel *chan)
/* ast_rtp_bridge: Bridge calls. If possible and allowed, initiate
re-invite so the peers exchange media directly outside
of Asterisk. */
-int ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc)
+enum ast_bridge_result ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc)
{
struct ast_frame *f;
struct ast_channel *who, *cs[3];
@@ -1449,7 +1449,7 @@ int ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, st
/* if need DTMF, cant native bridge */
if (flags & (AST_BRIDGE_DTMF_CHANNEL_0 | AST_BRIDGE_DTMF_CHANNEL_1))
- return -2;
+ return AST_BRIDGE_FAILED_NOWARN;
/* Lock channels */
ast_mutex_lock(&c0->lock);
@@ -1466,13 +1466,13 @@ int ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, st
ast_log(LOG_WARNING, "Can't find native functions for channel '%s'\n", c0->name);
ast_mutex_unlock(&c0->lock);
ast_mutex_unlock(&c1->lock);
- return -1;
+ return AST_BRIDGE_FAILED;
}
if (!pr1) {
ast_log(LOG_WARNING, "Can't find native functions for channel '%s'\n", c1->name);
ast_mutex_unlock(&c0->lock);
ast_mutex_unlock(&c1->lock);
- return -1;
+ return AST_BRIDGE_FAILED;
}
/* Get channel specific interface structures */
@@ -1496,7 +1496,7 @@ int ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, st
/* Somebody doesn't want to play... */
ast_mutex_unlock(&c0->lock);
ast_mutex_unlock(&c1->lock);
- return -2;
+ return AST_BRIDGE_FAILED_NOWARN;
}
/* Get codecs from both sides */
if (pr0->get_codec)
@@ -1514,7 +1514,7 @@ int ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, st
ast_log(LOG_DEBUG, "Channel codec0 = %d is not codec1 = %d, cannot native bridge in RTP.\n", codec0, codec1);
ast_mutex_unlock(&c0->lock);
ast_mutex_unlock(&c1->lock);
- return -2;
+ return AST_BRIDGE_FAILED_NOWARN;
}
}
@@ -1559,8 +1559,7 @@ int ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, st
if (pr1->set_rtp_peer(c1, NULL, NULL, 0))
ast_log(LOG_WARNING, "Channel '%s' failed to break RTP bridge\n", c1->name);
}
- /* Tell it to try again later */
- return -3;
+ return AST_BRIDGE_RETRY;
}
to = -1;
/* Now check if they have changed address */
@@ -1629,8 +1628,7 @@ int ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, st
if (pr1->set_rtp_peer(c1, NULL, NULL, 0))
ast_log(LOG_WARNING, "Channel '%s' failed to break RTP bridge\n", c1->name);
}
- /* That's all we needed */
- return 0;
+ return AST_BRIDGE_COMPLETE;
} else {
if ((f->frametype == AST_FRAME_DTMF) ||
(f->frametype == AST_FRAME_VOICE) ||
@@ -1650,7 +1648,7 @@ int ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, st
cs[1] = cs[2];
}
- return -1;
+ return AST_BRIDGE_FAILED;
}
static int rtp_do_debug_ip(int fd, int argc, char *argv[])