]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
automerge commit
authorAutomerge script <automerge@asterisk.org>
Fri, 1 Sep 2006 18:02:51 +0000 (18:02 +0000)
committerAutomerge script <automerge@asterisk.org>
Fri, 1 Sep 2006 18:02:51 +0000 (18:02 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@41734 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c
include/asterisk/rtp.h
rtp.c

index 41948a160b7a4b26e916dbcb20367112191cde05..5259a459f776e7a37fa667ee9a228e288aaa9c93 100644 (file)
@@ -13051,13 +13051,14 @@ static struct ast_rtp *sip_get_vrtp_peer(struct ast_channel *chan)
 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;
+       int changed = 0;
 
        p = chan->tech_pvt;
        if (!p) 
                return -1;
        ast_mutex_lock(&p->lock);
                if (rtp) {
-               ast_rtp_get_peer(rtp, &p->redirip);
+               changed |= ast_rtp_get_peer(rtp, &p->redirip);
 #ifdef SIP_MIDCOM
                if (m_cb)
                  m_cb->ast_rtp_get_their_nat_audio_hook(rtp, p->r);
@@ -13066,7 +13067,7 @@ static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struc
        else
                memset(&p->redirip, 0, sizeof(p->redirip));
                if (vrtp) {
-               ast_rtp_get_peer(vrtp, &p->vredirip);
+               changed |= ast_rtp_get_peer(vrtp, &p->vredirip);
 #ifdef SIP_MIDCOM
                if (m_cb)
                  m_cb->ast_rtp_get_their_nat_video_hook(vrtp, p->r);
@@ -13074,8 +13075,11 @@ static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struc
                }
        else
                memset(&p->vredirip, 0, sizeof(p->vredirip));
-       p->redircodecs = codecs;
-       if (codecs && !ast_test_flag(p, SIP_GOTREFER)) {
+       if (codecs && (p->redircodecs != codecs)) {
+               p->redircodecs = codecs;
+               changed = 1;
+       }
+       if (changed && !ast_test_flag(p, SIP_GOTREFER)) {
                if (!p->pendinginvite) {
                        if (option_debug > 2) {
                                char iabuf[INET_ADDRSTRLEN];
index f1e771e34a7c038f96f790e56ce841e9486e8f0f..45c1e5a07a0a7741c038e173e2ed065864662762 100644 (file)
@@ -96,7 +96,7 @@ struct ast_rtp *ast_rtp_new_with_bindaddr(struct sched_context *sched, struct io
 
 void ast_rtp_set_peer(struct ast_rtp *rtp, struct sockaddr_in *them);
 
-void ast_rtp_get_peer(struct ast_rtp *rtp, struct sockaddr_in *them);
+int ast_rtp_get_peer(struct ast_rtp *rtp, struct sockaddr_in *them);
 
 void ast_rtp_get_us(struct ast_rtp *rtp, struct sockaddr_in *us);
 
diff --git a/rtp.c b/rtp.c
index 7de9727e9803ad3462c3e3f269aeeb4a22d781d1..376bd93ce5fa4afe48d5de4c2adfa7ea8f8e296c 100644 (file)
--- a/rtp.c
+++ b/rtp.c
@@ -1045,11 +1045,17 @@ void ast_rtp_set_peer(struct ast_rtp *rtp, struct sockaddr_in *them)
        rtp->rxseqno = 0;
 }
 
-void ast_rtp_get_peer(struct ast_rtp *rtp, struct sockaddr_in *them)
+int ast_rtp_get_peer(struct ast_rtp *rtp, struct sockaddr_in *them)
 {
-       them->sin_family = AF_INET;
-       them->sin_port = rtp->them.sin_port;
-       them->sin_addr = rtp->them.sin_addr;
+       if ((them->sin_family != AF_INET) ||
+           (them->sin_port != rtp->them.sin_port) ||
+           (them->sin_addr.s_addr != rtp->them.sin_addr.s_addr)) {
+               them->sin_family = AF_INET;
+               them->sin_port = rtp->them.sin_port;
+               them->sin_addr = rtp->them.sin_addr;
+               return 1;
+       }
+       return 0;
 }
 
 void ast_rtp_get_us(struct ast_rtp *rtp, struct sockaddr_in *us)