[asterisk-commits] murf: branch murf/bug8386-1.2 r48695 - in /team/murf/bug8386-1.2: ./ apps/ ch...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Dec 20 19:23:43 MST 2006


Author: murf
Date: Wed Dec 20 20:23:42 2006
New Revision: 48695

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48695
Log:
Merged revisions 48434,48467,48484,48552,48576,48584 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r48434 | murf | 2006-12-12 21:23:17 -0700 (Tue, 12 Dec 2006) | 1 line

This small patch fixes bug 8541, where the L option to the Dial app wasn't working right. A similar bug (8386) was filed and fixed earlier, but an intervening bug fix to a DTMF problem broke the L() code in a different way. Hopefully, everything is happy now.
........
r48467 | crichter | 2006-12-14 06:03:49 -0700 (Thu, 14 Dec 2006) | 1 line

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.
........
r48484 | oej | 2006-12-15 03:51:53 -0700 (Fri, 15 Dec 2006) | 2 lines

Issue #8592 - handle 504 as 503 - congestion

........
r48552 | crichter | 2006-12-18 03:19:39 -0700 (Mon, 18 Dec 2006) | 1 line

when our PTP Partner sends us a SETUP with a preselected channel we just accept it, even when we're NT. added some checks for segfaults.
........
r48576 | crichter | 2006-12-19 06:08:51 -0700 (Tue, 19 Dec 2006) | 1 line

when we reject a channel, because it's in use already, we shouldn't process the setup anymore. made the channel allocation a bit easier and more understandable, removed a few unused lines
........
r48584 | file | 2006-12-19 14:10:26 -0700 (Tue, 19 Dec 2006) | 2 lines

Free localuser structure when we fail to dial (issue #8612 reported by rizzo)

........

Modified:
    team/murf/bug8386-1.2/   (props changed)
    team/murf/bug8386-1.2/apps/app_dial.c
    team/murf/bug8386-1.2/channels/chan_misdn.c
    team/murf/bug8386-1.2/channels/chan_sip.c
    team/murf/bug8386-1.2/channels/misdn/isdn_lib.c

Propchange: team/murf/bug8386-1.2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Dec 20 20:23:42 2006
@@ -1,1 +1,1 @@
-/branches/1.2:1-48413
+/branches/1.2:1-48694

Modified: team/murf/bug8386-1.2/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/apps/app_dial.c?view=diff&rev=48695&r1=48694&r2=48695
==============================================================================
--- team/murf/bug8386-1.2/apps/app_dial.c (original)
+++ team/murf/bug8386-1.2/apps/app_dial.c Wed Dec 20 20:23:42 2006
@@ -1058,6 +1058,7 @@
 			cur = rest;
 			if (!cur)
 				chan->hangupcause = cause;
+			free(tmp);
 			continue;
 		}
 		pbx_builtin_setvar_helper(tmp->chan, "DIALEDPEERNUMBER", numsubst);
@@ -1096,6 +1097,7 @@
 			if (!tmp->chan) {
 				HANDLE_CAUSE(cause, chan);
 				cur = rest;
+				free(tmp);
 				continue;
 			}
 		}
@@ -1163,6 +1165,7 @@
 			ast_hangup(tmp->chan);
 			tmp->chan = NULL;
 			cur = rest;
+			free(tmp);
 			continue;
 		} else {
 			senddialevent(chan, tmp->chan);

Modified: team/murf/bug8386-1.2/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/channels/chan_misdn.c?view=diff&rev=48695&r1=48694&r2=48695
==============================================================================
--- team/murf/bug8386-1.2/channels/chan_misdn.c (original)
+++ team/murf/bug8386-1.2/channels/chan_misdn.c Wed Dec 20 20:23:42 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:
@@ -2397,6 +2393,10 @@
 	const struct tone_zone_sound *ts= NULL;
 	struct ast_channel *ast=cl->ast;
 
+	if (!ast) {
+		chan_misdn_log(0,cl->bc->port,"No Ast in dialtone_indicate\n");
+		return -1;
+	}
 
 	int nd=0;
 	misdn_cfg_get( cl->bc->port, MISDN_CFG_NODIALTONE, &nd, sizeof(nd));
@@ -2430,6 +2430,12 @@
 static int stop_indicate(struct chan_list *cl)
 {
 	struct ast_channel *ast=cl->ast;
+
+	if (!ast) {
+		chan_misdn_log(0,cl->bc->port,"No Ast in stop_indicate\n");
+		return -1;
+	}
+
 	chan_misdn_log(3,cl->bc->port," --> None\n");
 	misdn_lib_tone_generator_stop(cl->bc);
 	ast_playtones_stop(ast);

Modified: team/murf/bug8386-1.2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/channels/chan_sip.c?view=diff&rev=48695&r1=48694&r2=48695
==============================================================================
--- team/murf/bug8386-1.2/channels/chan_sip.c (original)
+++ team/murf/bug8386-1.2/channels/chan_sip.c Wed Dec 20 20:23:42 2006
@@ -2325,6 +2325,7 @@
 		case 502:	
 			return AST_CAUSE_DESTINATION_OUT_OF_ORDER;
 		case 503:	/* Service unavailable */
+		case 504:	/* Server timeout */
 			return AST_CAUSE_CONGESTION;
 		default:
 			return AST_CAUSE_NORMAL;
@@ -10206,6 +10207,7 @@
 				case 400: /* Bad Request */
 				case 500: /* Server error */
 				case 503: /* Service Unavailable */
+				case 504: /* Server Timeout */
 					if (owner)
 						ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
 					break;
@@ -10299,6 +10301,7 @@
 				case 603: /* Decline */
 				case 500: /* Server error */
 				case 503: /* Service Unavailable */
+				case 504: /* Server timeout */
 
 					if (sipmethod == SIP_INVITE && !ignore) {	/* re-invite failed */
 						sip_cancel_destroy(p);

Modified: team/murf/bug8386-1.2/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8386-1.2/channels/misdn/isdn_lib.c?view=diff&rev=48695&r1=48694&r2=48695
==============================================================================
--- team/murf/bug8386-1.2/channels/misdn/isdn_lib.c (original)
+++ team/murf/bug8386-1.2/channels/misdn/isdn_lib.c Wed Dec 20 20:23:42 2006
@@ -433,7 +433,6 @@
 		if (i != 15 && (channel < 0 || i == channel)) { /* skip E1 Dchannel ;) and work with chan preselection */
 			if (!stack->channels[i]) {
 				cb_log (3, stack->port, " --> found chan%s: %d\n", channel>=0?" (preselected)":"", i+1);
-				stack->channels[i] = 1;
 				return i+1;
 			}
 		}
@@ -666,10 +665,17 @@
 {
 
 	cb_log(4,stack->port,"set_chan_in_stack: %d\n",channel);
+	dump_chan_list(stack);
 	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;
@@ -814,6 +820,8 @@
 		free_chan = find_free_chan_in_stack(stack, bc->channel_preselected?bc->channel:0);
 		if (!free_chan) return -1;
 		bc->channel=free_chan;
+
+		if (set_chan_in_stack(stack ,bc->channel)<0) return -1;
 		
 		cb_log(4,stack->port, " -->  found channel: %d\n",free_chan);
     
@@ -845,6 +853,7 @@
 			if (!free_chan) return -1;
 			bc->channel=free_chan;
 			cb_log(2,stack->port, " -->  found channel: %d\n",free_chan);
+			if (set_chan_in_stack(stack ,bc->channel)<0) return -1;
 		} else {
 			/* other phones could have made a call also on this port (ptmp) */
 			bc->channel=0xff;
@@ -1468,27 +1477,27 @@
 		setup_bc(bc);
 
 		case EVENT_SETUP:
-			
 		{
 			if (bc->channel == 0xff) {
 				bc->channel=find_free_chan_in_stack(stack, 0);
 				if (!bc->channel) {
 					cb_log(0, stack->port, "Any Channel Requested, but we have no more!!\n");
-					break;
+					bc->out_cause=34;
+					misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
+					return -1;
 				}
-			}  
+			} 
 
 			if (bc->channel >0 && bc->channel<255) {
-				set_chan_in_stack(stack ,bc->channel);
-			}
-
-#if 0
-			int ret=setup_bc(bc);
-			if (ret == -EINVAL){
-				cb_log(0,bc->port,"handle_event: setup_bc failed\n");
-				misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
-			}
-#endif
+				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);
+					return -1;
+				}
+			}
 		}
 		break;
 
@@ -1790,12 +1799,6 @@
 			cb_log(7, stack->port, " --> new_process: New L3Id: %x\n",hh->dinfo);
 			bc->l3_id=hh->dinfo;
 
-			if (bc->channel<=0) {
-				bc->channel=find_free_chan_in_stack(stack,0);
-
-				if (bc->channel<=0)
-					goto ERR_NO_CHANNEL;
-			}
 		}
 		break;
 
@@ -2023,32 +2026,22 @@
 
 			switch (event) {
 				case EVENT_SETUP:
-					if (bc->channel>0 && bc->channel<255) {
-
-						if (stack->ptp) 
-							set_chan_in_stack(stack, bc->channel);
-						else 
-							cb_log(3,stack->port," --> PTMP but channel requested\n");
-
-					} else {
-
-						bc->channel = find_free_chan_in_stack(stack, 0);
-						if (!bc->channel) {
-							cb_log(0, stack->port, " No free channel at the moment\n");
-					
-							msg_t *dmsg;
-				
-							cb_log(0, stack->port, "Releaseing call %x (No free Chan for you..)\n", hh->dinfo);
-								dmsg = create_l3msg(CC_RELEASE_COMPLETE | REQUEST,MT_RELEASE_COMPLETE, hh->dinfo,sizeof(RELEASE_COMPLETE_t), 1);
-							stack->nst.manager_l3(&stack->nst, dmsg);
-							free_msg(msg);
-							return 0;
-						}
-						
+					if (bc->channel<=0 || bc->channel==0xff) {
+						bc->channel=find_free_chan_in_stack(stack,0);
+		
+						if (bc->channel<=0)
+							goto ERR_NO_CHANNEL;
+					} else if (!stack->ptp) 
+						cb_log(3,stack->port," --> PTMP but channel requested\n"); 
+
+					int ret=set_chan_in_stack(stack, bc->channel);
+					if (event==EVENT_SETUP && ret<0){
+						/* empty bchannel */
+						bc->channel=0;
+						bc->out_cause=44;
+
+						goto ERR_NO_CHANNEL;
 					}
-#if 0
-					setup_bc(bc);
-#endif
 
 					break;
 				case EVENT_RELEASE:
@@ -2592,7 +2585,12 @@
 			isdn_msg_parse_event(msgs_g,msg,bc, 0);
 			
 			/** Preprocess some Events **/
-			handle_event(bc, event, frm);
+			int ret=handle_event(bc, event, frm);
+			if (ret<0) {
+				cb_log(0,stack->port,"couldn't handle event\n");
+				free_msg(msg);
+				return 1;
+			}
 			/*  shoot up event to App: */
 			cb_log(5, stack->port, "lib Got Prim: Addr %x prim %x dinfo %x\n",frm->addr, frm->prim, frm->dinfo);
       
@@ -3206,7 +3204,13 @@
 				bc->channel = find_free_chan_in_stack(stack, 0);
 				if (!bc->channel) {
 					cb_log(0, stack->port, " No free channel at the moment\n");
-					
+					/*FIXME: add disconnect*/
+					err=-ENOCHAN;
+					goto ERR;
+				}
+				
+				if (set_chan_in_stack(stack ,bc->channel)<0) {
+					/*FIXME: add disconnect*/
 					err=-ENOCHAN;
 					goto ERR;
 				}



More information about the asterisk-commits mailing list