]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Send error message if we fail to allocate sip socket, possibly caused by too few
authorOlle Johansson <oej@edvina.net>
Wed, 15 Nov 2006 15:17:10 +0000 (15:17 +0000)
committerOlle Johansson <oej@edvina.net>
Wed, 15 Nov 2006 15:17:10 +0000 (15:17 +0000)
file handles (wasn't possible before, but with the new way of sending temp messages, it is).

Found this bug under heavy load testing with SIPP.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@47655 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 91db38a2f729e467b367a93eb26c2fab2a5312ee..ca692d915cedcb6c58baadce9e1f940675c06076 100644 (file)
@@ -3263,6 +3263,19 @@ static struct sip_pvt *find_call(struct sip_request *req, struct sockaddr_in *si
                p = sip_alloc(callid, sin, 1, intended_method);
                if (p)
                        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;