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

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Mar 12 09:47:57 MST 2006


Author: oej
Date: Sun Mar 12 10:47:55 2006
New Revision: 12546

URL: http://svn.digium.com/view/asterisk?rev=12546&view=rev
Log:
- Adding some hangupcauses before hangups
- Removing double warning

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=12546&r1=12545&r2=12546&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Sun Mar 12 10:47:55 2006
@@ -2971,6 +2971,7 @@
 	if (state != AST_STATE_DOWN) {
 		if (ast_pbx_start(tmp)) {
 			ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
+			tmp->hangupcause = AST_CAUSE_SWITCH_CONGESTION;
 			ast_hangup(tmp);
 			tmp = NULL;
 		}
@@ -10217,8 +10218,10 @@
 	chan2m = ast_channel_alloc(0);
 	if ((!chan2m) || (!chan1m)) {
 		if (chan1m)
+			chan1m->hangupcause = AST_CAUSE_SWITCH_CONGESTION;
 			ast_hangup(chan1m);
 		if (chan2m)
+			chan2m->hangupcause = AST_CAUSE_SWITCH_CONGESTION;
 			ast_hangup(chan2m);
 		return -1;
 	}
@@ -10247,6 +10250,7 @@
 	if (ast_do_masquerade(chan2m)) {
 		ast_log(LOG_WARNING, "Masquerade failed :(\n");
 		ast_mutex_unlock(&chan2m->lock);
+		chan2m->hangupcause = AST_CAUSE_SWITCH_CONGESTION;
 		ast_hangup(chan2m);
 		return -1;
 	}
@@ -10578,7 +10582,6 @@
 				}
 
 				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);
@@ -10597,12 +10600,14 @@
 					ast_set_flag(p, SIP_ALREADYGONE);	
 					/* Unlock locks so ast_hangup can do its magic */
 					ast_mutex_unlock(&p->lock);
+					c->hangupcause = AST_CAUSE_CALL_REJECTED;
 					ast_hangup(c);
 					ast_mutex_lock(&p->lock);
 					c = NULL;
 				} else {
 					ast_mutex_unlock(&p->lock);
 					ast_setstate(c, AST_STATE_DOWN);
+					c->hangupcause = AST_CAUSE_NORMAL_CLEARING;
 					ast_hangup(c);
 					ast_mutex_lock(&p->lock);
 					c = NULL;



More information about the asterisk-commits mailing list