[asterisk-commits] oej: trunk r99839 - /trunk/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 23 04:18:13 CST 2008


Author: oej
Date: Wed Jan 23 04:18:13 2008
New Revision: 99839

URL: http://svn.digium.com/view/asterisk?view=rev&rev=99839
Log:
- Add a few comments to sip_xmit
- Make sure that we are aware of a pending INVITE even if we're using TCP

Modified:
    trunk/channels/chan_sip.c

Change Statistics:
 0 files changed

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=99839&r1=99838&r2=99839
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Wed Jan 23 04:18:13 2008
@@ -1587,7 +1587,8 @@
 /* --- Sockets and networking --------------*/
 
 /*! \brief Main socket for SIP communication.
- * sipsock is shared between the manager thread (which handles reload
+ *
+ * sipsock is shared between the SIP manager thread (which handles reload
  * requests), the io handler (sipsock_read()) and the user routines that
  * issue writes (using __sip_xmit()).
  * The socket is -1 only when opening fails (this is a permanent condition),
@@ -2483,7 +2484,11 @@
 	return "UNKNOWN";
 }
 
-/*! \brief Transmit SIP message */
+/*! \brief Transmit SIP message 
+	Sends a SIP request or response on a given socket (in the pvt)
+	Called by retrans_pkt, send_request, send_response and 
+	__sip_reliable_xmit
+*/
 static int __sip_xmit(struct sip_pvt *p, char *data, int len)
 {
 	int res = 0;
@@ -2767,6 +2772,11 @@
 	int siptimer_a = DEFAULT_RETRANS;
 	int xmitres = 0;
 
+	if (sipmethod == SIP_INVITE) {
+		/* Note this is a pending invite */
+		p->pendinginvite = seqno;
+	}
+
 	/* If the transport is something reliable (TCP or TLS) then don't really send this reliably */
 	/* I removed the code from retrans_pkt that does the same thing so it doesn't get loaded into the scheduler */
 	/* According to the RFC some packets need to be retransmitted even if its TCP, so this needs to get revisited */
@@ -2792,7 +2802,7 @@
 	pkt->is_fatal = fatal;
 	pkt->owner = dialog_ref(p);
 	pkt->next = p->packets;
-	p->packets = pkt;
+	p->packets = pkt;	/* Add it to the queue */
 	pkt->timer_t1 = p->timer_t1;	/* Set SIP timer T1 */
 	if (pkt->timer_t1)
 		siptimer_a = pkt->timer_t1 * 2;
@@ -2802,10 +2812,6 @@
 		siptimer_a, retrans_pkt, pkt, 1);
 	if (sipdebug)
 		ast_debug(4, "*** SIP TIMER: Initializing retransmit timer on packet: Id  #%d\n", pkt->retransid);
-	if (sipmethod == SIP_INVITE) {
-		/* Note this is a pending invite */
-		p->pendinginvite = seqno;
-	}
 
 	xmitres = __sip_xmit(pkt->owner, pkt->data, pkt->packetlen);	/* Send packet */
 




More information about the asterisk-commits mailing list