diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-04-14 20:48:30 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-04-14 20:48:30 +0000 |
commit | 51aec737506aeeb32bcd7b14fcf6e783ec0dcb29 (patch) | |
tree | 8f8d4f6a6a1cb0f6508a3902ec8f6a83ea38e0ed /rtp.c | |
parent | 78fd812eb4498e7b66344f12a307858a3c140326 (diff) |
Trim down gateway names with []'s in them
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@850 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'rtp.c')
-rwxr-xr-x | rtp.c | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -891,6 +891,9 @@ int ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, st struct ast_channel *who, *cs[3]; struct ast_rtp *p0, *p1; struct ast_rtp_protocol *pr0, *pr1; + struct sockaddr_in ac0, ac1; + struct sockaddr_in t0, t1; + void *pvt0, *pvt1; int to; @@ -933,8 +936,16 @@ int ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, st } if (pr0->set_rtp_peer(c0, p1)) ast_log(LOG_WARNING, "Channel '%s' failed to talk to '%s'\n", c0->name, c1->name); - if (pr1->set_rtp_peer(c1, p0)) + else { + /* Store RTP peer */ + ast_rtp_get_peer(p1, &ac1); + } + if (pr1->set_rtp_peer(c1, p0)) ast_log(LOG_WARNING, "Channel '%s' failed to talk back to '%s'\n", c1->name, c0->name); + else { + /* Store RTP peer */ + ast_rtp_get_peer(p0, &ac0); + } ast_pthread_mutex_unlock(&c0->lock); ast_pthread_mutex_unlock(&c1->lock); cs[0] = c0; @@ -957,6 +968,20 @@ int ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, st return -3; } to = -1; + ast_rtp_get_peer(p1, &t1); + ast_rtp_get_peer(p0, &t0); + if (inaddrcmp(&t1, &ac1)) { + ast_log(LOG_DEBUG, "Oooh, '%s' changed end address\n", c1->name); + if (pr0->set_rtp_peer(c0, p1)) + ast_log(LOG_WARNING, "Channel '%s' failed to update to '%s'\n", c0->name, c1->name); + memcpy(&ac1, &t1, sizeof(ac1)); + } + if (inaddrcmp(&t0, &ac0)) { + ast_log(LOG_DEBUG, "Oooh, '%s' changed end address\n", c0->name); + if (pr1->set_rtp_peer(c1, p0)) + ast_log(LOG_WARNING, "Channel '%s' failed to update to '%s'\n", c1->name, c0->name); + memcpy(&ac0, &t0, sizeof(ac0)); + } who = ast_waitfor_n(cs, 2, &to); if (!who) { ast_log(LOG_DEBUG, "Ooh, empty read...\n"); |