summaryrefslogtreecommitdiff
path: root/rtp.c
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2006-05-16 22:11:02 +0000
committerKevin P. Fleming <kpfleming@digium.com>2006-05-16 22:11:02 +0000
commitc3dce57d95b4f313dde62f4d607a30f5c101596c (patch)
tree16a03f4e88229adb3de2cd5470afd1e4048a3956 /rtp.c
parentca8f9083c0142f6c5be55408a80487dd44f2ea3c (diff)
mark RTP sessions that are not carrying DTMF
allow native bridging of RTP sessions that are not carrying DTMF even when the bridge needs to listen to DTMF (when SIP INFO is used for DTMF, for example) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@27559 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'rtp.c')
-rw-r--r--rtp.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/rtp.c b/rtp.c
index 841bbbd95..bfb226203 100644
--- a/rtp.c
+++ b/rtp.c
@@ -86,6 +86,7 @@ struct rtpPayloadType {
#define FLAG_NAT_ACTIVE (3 << 1)
#define FLAG_NAT_INACTIVE (0 << 1)
#define FLAG_NAT_INACTIVE_NOWARN (1 << 1)
+#define FLAG_HAS_DTMF (1 << 3)
/*! \brief RTP session description */
struct ast_rtp {
@@ -434,6 +435,11 @@ void ast_rtp_setnat(struct ast_rtp *rtp, int nat)
rtp->nat = nat;
}
+void ast_rtp_setdtmf(struct ast_rtp *rtp, int dtmf)
+{
+ ast_set2_flag(rtp, dtmf ? 1 : 0, FLAG_HAS_DTMF);
+}
+
static struct ast_frame *send_dtmf(struct ast_rtp *rtp)
{
char iabuf[INET_ADDRSTRLEN];
@@ -1344,6 +1350,7 @@ struct ast_rtp *ast_rtp_new_with_bindaddr(struct sched_context *sched, struct io
rtp->s = rtp_socket();
rtp->ssrc = ast_random();
rtp->seqno = ast_random() & 0xffff;
+ ast_set_flag(rtp, FLAG_HAS_DTMF);
if (rtp->s < 0) {
free(rtp);
ast_log(LOG_ERROR, "Unable to allocate socket: %s\n", strerror(errno));
@@ -1921,10 +1928,6 @@ enum ast_bridge_result ast_rtp_bridge(struct ast_channel *c0, struct ast_channel
memset(&vac0, 0, sizeof(vac0));
memset(&vac1, 0, sizeof(vac1));
- /* if need DTMF, cant native bridge */
- if (flags & (AST_BRIDGE_DTMF_CHANNEL_0 | AST_BRIDGE_DTMF_CHANNEL_1))
- return AST_BRIDGE_FAILED_NOWARN;
-
/* Lock channels */
ast_channel_lock(c0);
while(ast_channel_trylock(c1)) {
@@ -1966,6 +1969,25 @@ enum ast_bridge_result ast_rtp_bridge(struct ast_channel *c0, struct ast_channel
ast_channel_unlock(c1);
return AST_BRIDGE_FAILED_NOWARN;
}
+
+ if (ast_test_flag(p0, FLAG_HAS_DTMF) && (flags & AST_BRIDGE_DTMF_CHANNEL_0)) {
+ /* can't bridge, we are carrying DTMF for this channel and the bridge
+ needs it
+ */
+ ast_channel_unlock(c0);
+ ast_channel_unlock(c1);
+ return AST_BRIDGE_FAILED_NOWARN;
+ }
+
+ if (ast_test_flag(p1, FLAG_HAS_DTMF) && (flags & AST_BRIDGE_DTMF_CHANNEL_1)) {
+ /* can't bridge, we are carrying DTMF for this channel and the bridge
+ needs it
+ */
+ ast_channel_unlock(c0);
+ ast_channel_unlock(c1);
+ return AST_BRIDGE_FAILED_NOWARN;
+ }
+
/* Get codecs from both sides */
codec0 = pr0->get_codec ? pr0->get_codec(c0) : 0;
codec1 = pr1->get_codec ? pr1->get_codec(c1) : 0;