Don't reinvite if we got a refer
authorMark Spencer <markster@digium.com>
Wed, 12 Nov 2003 00:13:55 +0000 (00:13 +0000)
committerMark Spencer <markster@digium.com>
Wed, 12 Nov 2003 00:13:55 +0000 (00:13 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1724 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 013ebd1..13ef5f1 100755 (executable)
@@ -240,6 +240,7 @@ static struct sip_pvt {
        int amaflags;                                           /* AMA Flags */
        int pendinginvite;                                      /* Any pending invite */
        int pendingbye;                                         /* Need to send bye after we ack? */
+       int gotrefer;                                           /* Got a refer? */
        struct sip_request initreq;                     /* Initial request */
        
        int maxtime;                                            /* Max time for first response */
@@ -5123,6 +5124,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
                                attempt_transfer(p, p->refer_call);
                                ast_mutex_unlock(&p->refer_call->lock);
                                p->refer_call = NULL;
+                               p->gotrefer = 1;
                        } else {
                                ast_log(LOG_DEBUG,"202 Accepted (blind)\n");
                                c = p->owner;
@@ -5133,6 +5135,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
                                                ast_async_goto(transfer_to,p->context, p->refer_to,1, 1);
                                        }
                                }
+                               p->gotrefer = 1;
                        }
                        /* Always increment on a BYE */
                        transmit_request_with_auth(p, "BYE", 0, 1);
@@ -6231,8 +6234,10 @@ static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struc
                        ast_rtp_get_peer(vrtp, &p->vredirip);
                else
                        memset(&p->vredirip, 0, sizeof(p->vredirip));
-               transmit_reinvite_with_sdp(p, rtp, vrtp);
-               p->outgoing = 1;
+               if (!p->gotrefer) {
+                       transmit_reinvite_with_sdp(p, rtp, vrtp);
+                       p->outgoing = 1;
+               }
                return 0;
        }
        return -1;