diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-09-09 19:54:34 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-09-09 19:54:34 +0000 |
commit | b0c5a1fc33941d893d2508c4f61c4b7321443d74 (patch) | |
tree | 639e1b561a4180e86e5cc18dcd6460e031c3398e | |
parent | 43c1f8970d644f002591812b3ab36400278e5470 (diff) |
allow users of RTP to know when the peer endpoint is (apparently) behind a NAT
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6558 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | channels/chan_mgcp.c | 2 | ||||
-rwxr-xr-x | channels/chan_sip.c | 2 | ||||
-rwxr-xr-x | channels/chan_skinny.c | 2 | ||||
-rwxr-xr-x | include/asterisk/rtp.h | 2 | ||||
-rwxr-xr-x | rtp.c | 18 |
5 files changed, 13 insertions, 13 deletions
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 9cf875409..6e7dd3aaa 100755 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -3928,7 +3928,7 @@ static struct ast_rtp *mgcp_get_rtp_peer(struct ast_channel *chan) return NULL; } -static int mgcp_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs) +static int mgcp_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs, int nat_active) { /* XXX Is there such thing as video support with MGCP? XXX */ struct mgcp_subchannel *sub; diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 410eb9a84..769e67ebd 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -11920,7 +11920,7 @@ static struct ast_rtp *sip_get_vrtp_peer(struct ast_channel *chan) } /*--- sip_set_rtp_peer: Set the RTP peer for this call ---*/ -static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs) +static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs, int nat_active) { struct sip_pvt *p; diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index 053a7e026..33431c865 100755 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -1327,7 +1327,7 @@ static struct ast_rtp *skinny_get_rtp_peer(struct ast_channel *chan) return NULL; } -static int skinny_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs) +static int skinny_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs, int nat_active) { struct skinny_subchannel *sub; sub = chan->tech_pvt; diff --git a/include/asterisk/rtp.h b/include/asterisk/rtp.h index 7bea249b2..0f371d839 100755 --- a/include/asterisk/rtp.h +++ b/include/asterisk/rtp.h @@ -50,7 +50,7 @@ struct ast_rtp_protocol { /* Get RTP struct, or NULL if unwilling to transfer */ struct ast_rtp *(* const get_vrtp_info)(struct ast_channel *chan); /* Set RTP peer */ - int (* const set_rtp_peer)(struct ast_channel *chan, struct ast_rtp *peer, struct ast_rtp *vpeer, int codecs); + int (* const set_rtp_peer)(struct ast_channel *chan, struct ast_rtp *peer, struct ast_rtp *vpeer, int codecs, int nat_active); int (* const get_codec)(struct ast_channel *chan); const char * const type; struct ast_rtp_protocol *next; @@ -1538,7 +1538,7 @@ enum ast_bridge_result ast_rtp_bridge(struct ast_channel *c0, struct ast_channel } /* Ok, we should be able to redirect the media. Start with one channel */ - if (pr0->set_rtp_peer(c0, p1, vp1, codec1)) + if (pr0->set_rtp_peer(c0, p1, vp1, codec1, ast_test_flag(p1, FLAG_NAT_ACTIVE))) ast_log(LOG_WARNING, "Channel '%s' failed to talk to '%s'\n", c0->name, c1->name); else { /* Store RTP peer */ @@ -1547,7 +1547,7 @@ enum ast_bridge_result ast_rtp_bridge(struct ast_channel *c0, struct ast_channel ast_rtp_get_peer(vp1, &vac1); } /* Then test the other channel */ - if (pr1->set_rtp_peer(c1, p0, vp0, codec0)) + if (pr1->set_rtp_peer(c1, p0, vp0, codec0, ast_test_flag(p0, FLAG_NAT_ACTIVE))) ast_log(LOG_WARNING, "Channel '%s' failed to talk back to '%s'\n", c1->name, c0->name); else { /* Store RTP peer */ @@ -1571,11 +1571,11 @@ enum ast_bridge_result ast_rtp_bridge(struct ast_channel *c0, struct ast_channel (c0->masq || c0->masqr || c1->masq || c1->masqr)) { ast_log(LOG_DEBUG, "Oooh, something is weird, backing out\n"); if (c0->tech_pvt == pvt0) { - if (pr0->set_rtp_peer(c0, NULL, NULL, 0)) + if (pr0->set_rtp_peer(c0, NULL, NULL, 0, 0)) ast_log(LOG_WARNING, "Channel '%s' failed to break RTP bridge\n", c0->name); } if (c1->tech_pvt == pvt1) { - if (pr1->set_rtp_peer(c1, NULL, NULL, 0)) + if (pr1->set_rtp_peer(c1, NULL, NULL, 0, 0)) ast_log(LOG_WARNING, "Channel '%s' failed to break RTP bridge\n", c1->name); } return AST_BRIDGE_RETRY; @@ -1600,10 +1600,10 @@ enum ast_bridge_result ast_rtp_bridge(struct ast_channel *c0, struct ast_channel c1->name, ast_inet_ntoa(iabuf, sizeof(iabuf), vt1.sin_addr), ntohs(vt1.sin_port), codec1); ast_log(LOG_DEBUG, "Oooh, '%s' was %s:%d/(format %d)\n", c1->name, ast_inet_ntoa(iabuf, sizeof(iabuf), ac1.sin_addr), ntohs(ac1.sin_port), oldcodec1); - ast_log(LOG_DEBUG, "Oooh, '%s' wasv %s:%d/(format %d)\n", + ast_log(LOG_DEBUG, "Oooh, '%s' was %s:%d/(format %d)\n", c1->name, ast_inet_ntoa(iabuf, sizeof(iabuf), vac1.sin_addr), ntohs(vac1.sin_port), oldcodec1); } - if (pr0->set_rtp_peer(c0, t1.sin_addr.s_addr ? p1 : NULL, vt1.sin_addr.s_addr ? vp1 : NULL, codec1)) + if (pr0->set_rtp_peer(c0, t1.sin_addr.s_addr ? p1 : NULL, vt1.sin_addr.s_addr ? vp1 : NULL, codec1, ast_test_flag(p1, FLAG_NAT_ACTIVE))) ast_log(LOG_WARNING, "Channel '%s' failed to update to '%s'\n", c0->name, c1->name); memcpy(&ac1, &t1, sizeof(ac1)); memcpy(&vac1, &vt1, sizeof(vac1)); @@ -1616,7 +1616,7 @@ enum ast_bridge_result ast_rtp_bridge(struct ast_channel *c0, struct ast_channel ast_log(LOG_DEBUG, "Oooh, '%s' was %s:%d/(format %d)\n", c0->name, ast_inet_ntoa(iabuf, sizeof(iabuf), ac0.sin_addr), ntohs(ac0.sin_port), oldcodec0); } - if (pr1->set_rtp_peer(c1, t0.sin_addr.s_addr ? p0 : NULL, vt0.sin_addr.s_addr ? vp0 : NULL, codec0)) + if (pr1->set_rtp_peer(c1, t0.sin_addr.s_addr ? p0 : NULL, vt0.sin_addr.s_addr ? vp0 : NULL, codec0, ast_test_flag(p0, FLAG_NAT_ACTIVE))) ast_log(LOG_WARNING, "Channel '%s' failed to update to '%s'\n", c1->name, c0->name); memcpy(&ac0, &t0, sizeof(ac0)); memcpy(&vac0, &vt0, sizeof(vac0)); @@ -1640,11 +1640,11 @@ enum ast_bridge_result ast_rtp_bridge(struct ast_channel *c0, struct ast_channel if (option_debug) ast_log(LOG_DEBUG, "Oooh, got a %s\n", f ? "digit" : "hangup"); if ((c0->tech_pvt == pvt0) && (!c0->_softhangup)) { - if (pr0->set_rtp_peer(c0, NULL, NULL, 0)) + if (pr0->set_rtp_peer(c0, NULL, NULL, 0, 0)) ast_log(LOG_WARNING, "Channel '%s' failed to break RTP bridge\n", c0->name); } if ((c1->tech_pvt == pvt1) && (!c1->_softhangup)) { - if (pr1->set_rtp_peer(c1, NULL, NULL, 0)) + if (pr1->set_rtp_peer(c1, NULL, NULL, 0, 0)) ast_log(LOG_WARNING, "Channel '%s' failed to break RTP bridge\n", c1->name); } return AST_BRIDGE_COMPLETE; |