diff options
author | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-11-15 16:04:24 +0000 |
---|---|---|
committer | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-11-15 16:04:24 +0000 |
commit | 00eaa09eba784439747534777883a09dbdffc3e7 (patch) | |
tree | 9a2040e1a98238c3c91eeab36c0e09b1b9dd6b0d /channels/chan_sip.c | |
parent | 636969ce9805cb6587a6b0434241a5f8c5fe78df (diff) |
Send proper SIP error message improperly when we can't allocate dialog (out of file handles is one cause)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@47660 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 2971aef04..8494b03dc 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -4435,9 +4435,22 @@ static struct sip_pvt *find_call(struct sip_request *req, struct sockaddr_in *si 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 */ sip_pvt_lock(p); + } 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) { |