[Asterisk-cvs] asterisk/channels chan_sip.c,1.892,1.893
kpfleming
kpfleming
Thu Oct 13 21:19:53 CDT 2005
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv24300/channels
Modified Files:
chan_sip.c
Log Message:
make chan_sip able to deal with PBX-level call limit being reached (issue #5131)
Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.892
retrieving revision 1.893
diff -u -d -r1.892 -r1.893
--- chan_sip.c 13 Oct 2005 23:48:12 -0000 1.892
+++ chan_sip.c 14 Oct 2005 01:14:29 -0000 1.893
@@ -10344,17 +10344,37 @@
transmit_response(p, "100 Trying", req);
ast_setstate(c, AST_STATE_RING);
if (strcmp(p->exten, ast_pickup_ext())) {
- if (ast_pbx_start(c)) {
+ enum ast_pbx_result res;
+
+ res = ast_pbx_start(c);
+
+ switch (res) {
+ case AST_PBX_FAILED:
+ ast_log(LOG_WARNING, "Failed to start PBX :(\n");
+ if (ignore)
+ transmit_response(p, "503 Unavailable", req);
+ else
+ transmit_response_reliable(p, "503 Unavailable", req, 1);
+ break;
+ case AST_PBX_CALL_LIMIT:
+ ast_log(LOG_WARNING, "Failed to start PBX (call limit reached) \n");
+ if (ignore)
+ transmit_response(p, "480 Temporarily Unavailable", req);
+ else
+ transmit_response_reliable(p, "480 Temporarily Unavailable", req, 1);
+ break;
+ case AST_PBX_SUCCESS:
+ /* nothing to do */
+ break;
+ }
+
+ if (res) {
ast_log(LOG_WARNING, "Failed to start PBX :(\n");
/* Unlock locks so ast_hangup can do its magic */
ast_mutex_unlock(&c->lock);
ast_mutex_unlock(&p->lock);
ast_hangup(c);
ast_mutex_lock(&p->lock);
- if (ignore)
- transmit_response(p, "503 Unavailable", req);
- else
- transmit_response_reliable(p, "503 Unavailable", req, 1);
c = NULL;
}
} else {
More information about the svn-commits
mailing list