[asterisk-commits] trunk r9107 - /trunk/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Feb 2 13:51:11 MST 2006


Author: oej
Date: Thu Feb  2 14:51:08 2006
New Revision: 9107

URL: http://svn.digium.com/view/asterisk?rev=9107&view=rev
Log:
- Remove "frame relay" from chan_sip !
- Add some comments for the monitoring thread

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=9107&r1=9106&r2=9107&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Feb  2 14:51:08 2006
@@ -11310,7 +11310,10 @@
 	return 0;
 }
 
-/*! \brief The SIP monitoring thread */
+/*! \brief The SIP monitoring thread 
+\note	This thread monitors all the SIP sessions and peers that needs notification of mwi
+	(and thus do not have a separate thread) indefinitely 
+*/
 static void *do_monitor(void *data)
 {
 	int res;
@@ -11322,12 +11325,10 @@
 	int curpeernum;
 	int reloading;
 
-	/* Add an I/O event to our UDP socket */
+	/* Add an I/O event to our SIP UDP socket */
 	if (sipsock > -1) 
 		ast_io_add(io, sipsock, sipsock_read, AST_IO_IN, NULL);
 	
-	/* This thread monitors all the frame relay interfaces which are not yet in use
-	   (and thus do not have a separate thread) indefinitely */
 	/* From here on out, we die whenever asked */
 	for(;;) {
 		/* Check for a reload request */
@@ -11346,6 +11347,7 @@
 		time(&t);
 		for (sip = iflist; sip; sip = sip->next) {
 			ast_mutex_lock(&sip->lock);
+			/* Check RTP timeouts and kill calls if we have a timeout set and do not get RTP */
 			if (sip->rtp && sip->owner && (sip->owner->_state == AST_STATE_UP) && !sip->redirip.sin_addr.s_addr) {
 				if (sip->lastrtptx && sip->rtpkeepalive && t > sip->lastrtptx + sip->rtpkeepalive) {
 					/* Need to send an empty RTP packet */
@@ -11376,6 +11378,7 @@
 					}
 				}
 			}
+			/* If we have sessions that needs to be destroyed, do it now */
 			if (ast_test_flag(sip, SIP_NEEDDESTROY) && !sip->packets && !sip->owner) {
 				ast_mutex_unlock(&sip->lock);
 				__sip_destroy(sip, 1);
@@ -11402,16 +11405,16 @@
 		if (fastrestart)
 			res = 1;
 		res = ast_io_wait(io, res);
-		if (res > 20)
+		if (option_debug && res > 20)
 			ast_log(LOG_DEBUG, "chan_sip: ast_io_wait ran %d all at once\n", res);
 		ast_mutex_lock(&monlock);
 		if (res >= 0)  {
 			res = ast_sched_runq(sched);
-			if (res >= 20)
+			if (option_debug && res >= 20)
 				ast_log(LOG_DEBUG, "chan_sip: ast_sched_runq ran %d all at once\n", res);
 		}
 
-		/* needs work to send mwi to realtime peers */
+		/* Send MWI notifications to peers - static and cached realtime peers */
 		time(&t);
 		fastrestart = FALSE;
 		curpeernum = 0;



More information about the asterisk-commits mailing list