[asterisk-commits] oej: branch 1.4 r47656 - in /branches/1.4: ./ channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Nov 15 08:25:51 MST 2006


Author: oej
Date: Wed Nov 15 09:25:50 2006
New Revision: 47656

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47656
Log:
Send error message when we can't allocate SIP dialog, possibly due to limitation of file descriptors.
(imported from 1.2)

Modified:
    branches/1.4/   (props changed)
    branches/1.4/channels/chan_sip.c

Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=47656&r1=47655&r2=47656
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Wed Nov 15 09:25:50 2006
@@ -4306,9 +4306,22 @@
 			transmit_response_using_temp(callid, sin, 1, intended_method, req, "489 Bad event");
 		} else {
 			/* Ok, time to create a new SIP dialog object, a pvt */
-			if ((p = sip_alloc(callid, sin, 1, intended_method))) 
+			if ((p = sip_alloc(callid, sin, 1, intended_method)))  {
 				/* Ok, we've created a dialog, let's go and process it */
 				ast_mutex_lock(&p->lock);
+			} else {
+				/* We have a memory or file/socket error (can't allocate RTP sockets or something) so we're not
+					getting a dialog from sip_alloc. 
+	
+					Without a dialog we can't retransmit and handle ACKs and all that, but at least
+					send an error message.
+	
+					Sorry, we apologize for the inconvienience
+				*/
+				transmit_response_using_temp(callid, sin, 1, intended_method, req, "500 Server internal error");
+				if (option_debug > 3)
+					ast_log(LOG_DEBUG, "Failed allocating SIP dialog, sending 500 Server internal error and giving up\n");
+			}
 		}
 		return p;
 	} else if( sip_methods[intended_method].can_create == CAN_CREATE_DIALOG_UNSUPPORTED_METHOD) {



More information about the asterisk-commits mailing list