aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-08-23 14:31:20 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-08-23 14:31:20 +0000
commit913beb48cab9d7111f078d0068d5b8dd0ee3a489 (patch)
tree284494f55b5541ab81f26eac73be63da844cdf40
parent2f97560589fed3d1daf8dd303e7e9661f8d29fcc (diff)
Qualify rtptimeout with a reinvite having taken place (bug #2286)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3635 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xchannels/chan_sip.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 937a942cc..b461284d1 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -7576,7 +7576,7 @@ restartsearch:
sip = iflist;
while(sip) {
ast_mutex_lock(&sip->lock);
- if (sip->rtp && sip->lastrtprx && (sip->rtptimeout || sip->rtpholdtimeout)) {
+ if (sip->rtp && sip->lastrtprx && (sip->rtptimeout || sip->rtpholdtimeout) && !sip->redirip.sin_addr.s_addr) {
if (t > sip->lastrtprx + sip->rtptimeout) {
/* Might be a timeout now -- see if we're on hold */
struct sockaddr_in sin;
@@ -8592,19 +8592,29 @@ static int reload_config(void)
static struct ast_rtp *sip_get_rtp_peer(struct ast_channel *chan)
{
struct sip_pvt *p;
+ struct ast_rtp *rtp = NULL;
p = chan->pvt->pvt;
- if (p && p->rtp && p->canreinvite)
- return p->rtp;
- return NULL;
+ if (p) {
+ ast_mutex_lock(&p->lock);
+ if (p->rtp && p->canreinvite)
+ rtp = p->rtp;
+ ast_mutex_unlock(&p->lock);
+ }
+ return rtp;
}
static struct ast_rtp *sip_get_vrtp_peer(struct ast_channel *chan)
{
struct sip_pvt *p;
+ struct ast_rtp *rtp = NULL;
p = chan->pvt->pvt;
- if (p && p->vrtp && p->canreinvite)
- return p->vrtp;
- return NULL;
+ if (p) {
+ ast_mutex_lock(&p->lock);
+ if (p->vrtp && p->canreinvite)
+ rtp = p->vrtp;
+ ast_mutex_unlock(&p->lock);
+ }
+ return rtp;
}
static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs)
@@ -8612,6 +8622,7 @@ static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struc
struct sip_pvt *p;
p = chan->pvt->pvt;
if (p) {
+ ast_mutex_lock(&p->lock);
if (rtp)
ast_rtp_get_peer(rtp, &p->redirip);
else
@@ -8629,6 +8640,9 @@ static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struc
p->needreinvite = 1;
}
}
+ /* Reset lastrtprx timer */
+ time(&p->lastrtprx);
+ ast_mutex_unlock(&p->lock);
return 0;
}
return -1;