[asterisk-commits] crichter: branch 1.2 r48467 - in /branches/1.2/channels: ./ misdn/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Dec 14 06:03:49 MST 2006


Author: crichter
Date: Thu Dec 14 07:03:49 2006
New Revision: 48467

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48467
Log:
removed FIXUP state. added check for channel allocation conflict when we create a setup while the other site creates a setup on the same channel, besides the check we resolve this conflict.

Modified:
    branches/1.2/channels/chan_misdn.c
    branches/1.2/channels/misdn/isdn_lib.c

Modified: branches/1.2/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/chan_misdn.c?view=diff&rev=48467&r1=48466&r2=48467
==============================================================================
--- branches/1.2/channels/chan_misdn.c (original)
+++ branches/1.2/channels/chan_misdn.c Thu Dec 14 07:03:49 2006
@@ -124,7 +124,6 @@
 	/* misdn_hangup */
 	MISDN_HOLDED, /*!< if this chan is holded */
 	MISDN_HOLD_DISCONNECT, /*!< if this chan is holded */
-	MISDN_FIXUP/*!< if this chan is holded */
   
 };
 
@@ -684,7 +683,6 @@
 	{MISDN_HUNGUP_FROM_MISDN,"HUNGUP_FROM_MISDN"}, /* when DISCONNECT/RELEASE/REL_COMP  cam from misdn */
 	{MISDN_HOLDED,"HOLDED"}, /* when DISCONNECT/RELEASE/REL_COMP  cam from misdn */
 	{MISDN_HOLD_DISCONNECT,"HOLD_DISCONNECT"}, /* when DISCONNECT/RELEASE/REL_COMP  cam from misdn */
-	{MISDN_FIXUP,"FIXUP"}, /**/
 	{MISDN_HUNGUP_FROM_AST,"HUNGUP_FROM_AST"} /* when DISCONNECT/RELEASE/REL_COMP came out of */
 	/* misdn_hangup */
 };
@@ -1831,7 +1829,6 @@
 	chan_misdn_log(1, p->bc?p->bc->port:0, "* IND: Got Fixup State:%s L3id:%x\n", misdn_get_ch_state(p), p->l3id);
 	
 	p->ast = ast ;
-	p->state=MISDN_FIXUP;
   
 	return 0;
 }
@@ -1998,7 +1995,6 @@
 	if (ast->_state == AST_STATE_RESERVED || 
 		p->state == MISDN_NOTHING || 
 		p->state == MISDN_HOLDED || 
-		p->state == MISDN_FIXUP || 
 		p->state == MISDN_HOLD_DISCONNECT ) {
 
 		CLEAN_CH:

Modified: branches/1.2/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/misdn/isdn_lib.c?view=diff&rev=48467&r1=48466&r2=48467
==============================================================================
--- branches/1.2/channels/misdn/isdn_lib.c (original)
+++ branches/1.2/channels/misdn/isdn_lib.c Thu Dec 14 07:03:49 2006
@@ -667,9 +667,15 @@
 
 	cb_log(4,stack->port,"set_chan_in_stack: %d\n",channel);
 	if (channel >=1 ) {
-		stack->channels[channel-1] = 1;
+		if (!stack->channels[channel-1])
+			stack->channels[channel-1] = 1;
+		else {
+			cb_log(0,stack->port,"channel already in use:%d\n", channel );
+			return -1;
+		}
 	} else {
 		cb_log(0,stack->port,"couldn't set channel %d in\n", channel );
+		return -1;
 	}
   
 	return 0;
@@ -1479,7 +1485,13 @@
 			}  
 
 			if (bc->channel >0 && bc->channel<255) {
-				set_chan_in_stack(stack ,bc->channel);
+				int ret=set_chan_in_stack(stack ,bc->channel);
+				if (event == EVENT_SETUP && ret<0){
+					/* empty bchannel */
+					bc->channel=0;
+					bc->out_cause=44;
+					misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
+				}
 			}
 
 #if 0
@@ -2024,9 +2036,16 @@
 			switch (event) {
 				case EVENT_SETUP:
 					if (bc->channel>0 && bc->channel<255) {
-
-						if (stack->ptp) 
-							set_chan_in_stack(stack, bc->channel);
+						if (stack->ptp)  {
+							int ret=set_chan_in_stack(stack, bc->channel);
+							if (event==EVENT_SETUP && ret<0){
+								/* empty bchannel */
+								bc->channel=0;
+								bc->out_cause=44;
+								misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
+							}
+
+						}
 						else 
 							cb_log(3,stack->port," --> PTMP but channel requested\n");
 



More information about the asterisk-commits mailing list