[asterisk-commits] rmudgett: branch 10 r374537 - in /branches/10: ./ channels/ channels/misdn/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 5 13:25:22 CDT 2012


Author: rmudgett
Date: Fri Oct  5 13:25:20 2012
New Revision: 374537

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=374537
Log:
Merged revisions 374515-374535 from
https://origsvn.digium.com/svn/asterisk/be/branches/C.3-bier

................
  r374515 | rmudgett | 2012-10-04 17:52:36 -0500 (Thu, 04 Oct 2012) | 10 lines

  chan_misdn: Remove some deadcode

  * Made setup_bc() static.

  Patches:
	patch1_unused-code.diff (license #6372) patch uploaded by Guenther Kelleter
	Modified

  JIRA ABE-2882

................
  r374516 | rmudgett | 2012-10-04 18:01:01 -0500 (Thu, 04 Oct 2012) | 7 lines

  chan_misdn: Remove unused bchan states

  Patches:
	patch2_unused-states.diff (license #6372) patch uploaded by Guenther Kelleter

  JIRA ABE-2882

................
  r374517 | rmudgett | 2012-10-04 18:17:51 -0500 (Thu, 04 Oct 2012) | 16 lines

  chan_misdn: Remove unnecessary null pointer checks and checks for stack->nt

  * cleanup_bc() is always called with valid bc (or it would've crashed
  before).

  * Value of stack->nt is known in advance at some places.

  * Rename handle_event() to handle_event_te(), handle_frm() to
  handle_frm_te().

  Patches:
	patch3_checks.diff (license #6372) patch uploaded by Guenther Kelleter
	Modified

  JIRA ABE-2882

................
  r374518 | rmudgett | 2012-10-04 18:21:59 -0500 (Thu, 04 Oct 2012) | 7 lines

  chan_misdn: Fix spelling in log messages

  Patches:
	patch4_spelling.diff (license #6372) patch uploaded by Guenther Kelleter

  JIRA ABE-2882

................
  r374519 | rmudgett | 2012-10-04 18:31:59 -0500 (Thu, 04 Oct 2012) | 15 lines

  chan_misdn: Don't cleanup a bc twice.

  In handle_frm_te() after calling misdn_lib_send_event(bc,
  EVENT_RELEASE_COMPLETE) bc is emptied, cleaned and set not in use,
  although misdn_lib_send_event() already did the same.  This is bad.  When
  it's not in use we are not allowed to touch it.

  * Moved log message in front of the resulting actions and fixed it to
  match the case.

  Patches:
	patch5_bccleanup.diff (license #6372) patch uploaded by Guenther Kelleter

  JIRA ABE-2882

................
  r374520 | rmudgett | 2012-10-04 18:43:56 -0500 (Thu, 04 Oct 2012) | 12 lines

  chan_misdn: Fix memory leaks, bc, chan not cleaned up etc., really bad stuff.

  * Fix return codes of cb_events() for EVENT_SETUP to use caller's cleanup
  mechanisms.

  * Move cl_queue_chan() call after bearer check.

  Patches:
	patch6_leaks.diff (license #6372) patch uploaded by Guenther Kelleter

  JIRA ABE-2882

................
  r374521 | rmudgett | 2012-10-04 18:48:38 -0500 (Thu, 04 Oct 2012) | 11 lines

  chan_misdn: We must initialize cause on sending a DISCONNECT.

  We must initialize cause on sending a DISCONNECT, so it is later correctly
  indicated to ast_channel in case the answer (RELEASE/RELEASE_COMPLETE)
  does not include one.

  Patches:
	patch7_hangupcause.diff (license #6372) patch uploaded by Guenther Kelleter

  JIRA ABE-2882

................
  r374522 | rmudgett | 2012-10-04 19:03:56 -0500 (Thu, 04 Oct 2012) | 7 lines

  chan_misdn: Remove unused code for upqueue

  Patches:
	patch8_unused-upqueue.diff (license #6372) patch uploaded by Guenther Kelleter

  JIRA ABE-2882

................
  r374523 | rmudgett | 2012-10-04 19:11:50 -0500 (Thu, 04 Oct 2012) | 7 lines

  chan_misdn: Improve debugging (port number, messages fixed, dups removed)

  Patches:
	patch9_debug.diff (license #6372) patch uploaded by Guenther Kelleter

  JIRA ABE-2882

................
  r374533 | rmudgett | 2012-10-05 12:17:18 -0500 (Fri, 05 Oct 2012) | 8 lines

  chan_misdn: Better debug: we can print_bc_info even if there's no ast leg.

  Patches:
	patch10_debug-bc-2.diff (license #6372) patch uploaded by Guenther Kelleter
	Modified.

  JIRA ABE-2882

................
  r374534 | rmudgett | 2012-10-05 12:34:10 -0500 (Fri, 05 Oct 2012) | 16 lines

  chan_misdn: setup_bc() is called too early for an incoming SETUP on TE.

  This prevents the B channel from being setup for HDLC mode when requested
  by the bearer capability and config option hdlc=yes.  It violates
  ETS300102 Ch.5.2.3.2: "The user, in any case, must not connect to the
  channel until a CONNECT ACKNOWLEDGE message has been received."

  * Call setup_bc() on receipt of CONNECT_ACKNOWLEGDE for PTMP, and on first
  response to SETUP for PTP.

  Patches:
	abe-2881-2.diff (license #6372) patch uploaded by Guenther Kelleter
	Modified.

  JIRA ABE-2881

................
  r374535 | rmudgett | 2012-10-05 12:41:05 -0500 (Fri, 05 Oct 2012) | 2 lines

  chan_misdn: Remove some more deadcode.

................
........

Merged revisions 374536 from http://svn.asterisk.org/svn/asterisk/branches/1.8

Modified:
    branches/10/   (props changed)
    branches/10/channels/chan_misdn.c
    branches/10/channels/misdn/isdn_lib.c
    branches/10/channels/misdn/isdn_lib.h
    branches/10/channels/misdn/isdn_msg_parser.c

Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: branches/10/channels/chan_misdn.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/channels/chan_misdn.c?view=diff&rev=374537&r1=374536&r2=374537
==============================================================================
--- branches/10/channels/chan_misdn.c (original)
+++ branches/10/channels/chan_misdn.c Fri Oct  5 13:25:20 2012
@@ -4179,7 +4179,7 @@
 #endif
 			"  --> notone : rx %d tx:%d\n"
 			"  --> bc_hold: %d\n",
-			help->ast->name,
+			ast ? ast->name : "",
 			help->l3id,
 			help->addr,
 			bc->addr,
@@ -4235,7 +4235,6 @@
 				continue;
 			}
 			ast_cli(a->fd, "bc with pid:%d has no Ast Leg\n", bc->pid);
-			continue;
 		}
 
 		if (misdn_debug[0] > 2) {
@@ -6925,7 +6924,7 @@
 		return -1;
 	}
 
-	chan_misdn_log(5, p->bc->port, "* IND : Indication [%d] on %s\n\n", cond, ast->name);
+	chan_misdn_log(5, p->bc->port, "* IND : Indication [%d] on %s\n", cond, ast->name);
 
 	switch (cond) {
 	case AST_CONTROL_BUSY:
@@ -8135,7 +8134,7 @@
 
 	tmp = ast_channel_alloc(1, state, cid_num, cid_name, "", exten, "", linkedid, 0, "%s/%s%d-u%d", misdn_type, c ? "" : "tmp", chan_offset + c, glob_channel++);
 	if (tmp) {
-		chan_misdn_log(2, 0, " --> * NEW CHANNEL dialed:%s caller:%s\n", exten, callerid);
+		chan_misdn_log(2, port, " --> * NEW CHANNEL dialed:%s caller:%s\n", exten, callerid);
 
 		ast_best_codec(cap, &tmpfmt);
 		ast_format_cap_add(tmp->nativeformats, &prefformat);
@@ -8373,14 +8372,13 @@
 
 static void hangup_chan(struct chan_list *ch, struct misdn_bchannel *bc)
 {
-	int port;
+	int port = bc->port;
 
 	if (!ch) {
-		cb_log(1, 0, "Cannot hangup chan, no ch\n");
+		cb_log(1, port, "Cannot hangup chan, no ch\n");
 		return;
 	}
 
-	port = bc->port;
 	cb_log(5, port, "hangup_chan called\n");
 
 	if (ch->need_hangup) {
@@ -10138,7 +10136,7 @@
 		ch = chan_list_init(ORG_MISDN);
 		if (!ch) {
 			chan_misdn_log(-1, bc->port, "cb_events: malloc for chan_list failed!\n");
-			return 0;
+			return RESPONSE_RELEASE_SETUP;
 		}
 
 		ch->bc = bc;
@@ -10157,9 +10155,8 @@
 		}
 		if (!chan) {
 			chan_list_unref(ch, "Failed to create a new channel");
-			misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
-			ast_log(LOG_ERROR, "cb_events: misdn_new failed !\n");
-			return 0;
+			ast_log(LOG_ERROR, "cb_events: misdn_new failed!\n");
+			return RESPONSE_RELEASE_SETUP;
 		}
 
 		if ((exceed = add_in_calls(bc->port))) {
@@ -10217,9 +10214,6 @@
 			pbx_builtin_setvar_helper(chan, "CALLTYPE", "SPEECH");
 			break;
 		}
-
-		/** queue new chan **/
-		cl_queue_chan(ch);
 
 		if (!strstr(ch->allowed_bearers, "all")) {
 			int i;
@@ -10240,14 +10234,16 @@
 				/* We did not find the bearer capability */
 				chan_misdn_log(0, bc->port, "Bearer capability not allowed: %s(%d)\n",
 					bearer2str(bc->capability), bc->capability);
+
+				ch->state = MISDN_EXTCANTMATCH;
+				chan_list_unref(ch, "BC not allowed, releasing call");
 				bc->out_cause = AST_CAUSE_INCOMPATIBLE_DESTINATION;
-
-				ch->state = MISDN_EXTCANTMATCH;
-				misdn_lib_send_event(bc, EVENT_RELEASE_COMPLETE);
-				chan_list_unref(ch, "BC not allowed, releasing call");
-				return RESPONSE_OK;
-			}
-		}
+				return RESPONSE_RELEASE_SETUP;
+			}
+		}
+
+		/** queue new chan **/
+		cl_queue_chan(ch);
 
 		if (bc->fac_in.Function != Fac_None) {
 			misdn_facility_ie_handler(event, bc, ch);
@@ -12654,7 +12650,7 @@
 	char port_buf[8];
 
 	if (!(0 <= port && port <= max_ports)) {
-		ast_log(LOG_WARNING, "cb_log called with out-of-range port number! (%d)\n", port);
+		ast_log(LOG_WARNING, "chan_misdn_log called with out-of-range port number! (%d)\n", port);
 		port = 0;
 		level = -1;
 	} else if (!(level == -1

Modified: branches/10/channels/misdn/isdn_lib.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/channels/misdn/isdn_lib.c?view=diff&rev=374537&r1=374536&r2=374537
==============================================================================
--- branches/10/channels/misdn/isdn_lib.c (original)
+++ branches/10/channels/misdn/isdn_lib.c Fri Oct  5 13:25:20 2012
@@ -46,8 +46,6 @@
 void misdn_join_conf(struct misdn_bchannel *bc, int conf_id);
 void misdn_split_conf(struct misdn_bchannel *bc, int conf_id);
 
-int queue_cleanup_bc(struct misdn_bchannel *bc) ;
-
 int misdn_lib_get_l2_up(struct misdn_stack *stack);
 
 struct misdn_stack *get_misdn_stack(void);
@@ -214,14 +212,12 @@
 struct misdn_lib {
 	/*! \brief mISDN device handle returned by mISDN_open() */
 	int midev;
-	int midev_nt;	/* Not used */
 
 	pthread_t event_thread;
 	pthread_t event_handler_thread;
 
 	void *user_data;
 
-	msg_queue_t upqueue;
 	msg_queue_t activatequeue;
 
 	sem_t new_msg;
@@ -239,8 +235,6 @@
 void misdn_tx_jitter(struct misdn_bchannel *bc, int len);
 
 struct misdn_bchannel *find_bc_by_l3id(struct misdn_stack *stack, unsigned long l3id);
-
-int setup_bc(struct misdn_bchannel *bc);
 
 int manager_isdn_handler(iframe_t *frm ,msg_t *msg);
 
@@ -629,16 +623,9 @@
 	} states[] = {
 		{"BCHAN_CLEANED", BCHAN_CLEANED },
 		{"BCHAN_EMPTY", BCHAN_EMPTY},
-		{"BCHAN_SETUP", BCHAN_SETUP},
-		{"BCHAN_SETUPED", BCHAN_SETUPED},
-		{"BCHAN_ACTIVE", BCHAN_ACTIVE},
 		{"BCHAN_ACTIVATED", BCHAN_ACTIVATED},
-		{"BCHAN_BRIDGE",  BCHAN_BRIDGE},
 		{"BCHAN_BRIDGED", BCHAN_BRIDGED},
 		{"BCHAN_RELEASE", BCHAN_RELEASE},
-		{"BCHAN_RELEASED", BCHAN_RELEASED},
-		{"BCHAN_CLEAN", BCHAN_CLEAN},
-		{"BCHAN_CLEAN_REQUEST", BCHAN_CLEAN_REQUEST},
 		{"BCHAN_ERROR", BCHAN_ERROR}
 	};
 
@@ -833,9 +820,8 @@
 	unsigned char buff[32];
 	struct misdn_stack * stack;
 
-	cb_log(3, bc?bc->port:0, "$$$ CLEANUP CALLED pid:%d\n", bc?bc->pid:-1);
-
-	if (!bc  ) return -1;
+	cb_log(3, bc->port, "$$$ CLEANUP CALLED pid:%d\n", bc->pid);
+
 	stack=get_stack_by_bc(bc);
 
 	if (!stack) return -1;
@@ -1065,14 +1051,7 @@
 }
 
 
-void misdn_lib_setup_bc(struct misdn_bchannel *bc)
-{
-	clean_up_bc(bc);
-	setup_bc(bc);
-}
-
-
-int setup_bc(struct misdn_bchannel *bc)
+static int setup_bc(struct misdn_bchannel *bc)
 {
 	unsigned char buff[1025];
 	int midev;
@@ -1259,9 +1238,9 @@
 	pthread_mutex_init(&bc->send_lock->lock, NULL);
 
 	empty_bc(bc);
+
+	bc->port=stack->port;
 	bc_state_change(bc, BCHAN_CLEANED);
-
-	bc->port=stack->port;
 	bc->nt=stack->nt?1:0;
 	bc->pri=stack->pri;
 
@@ -1333,7 +1312,6 @@
 	stack->pri=0;
 
 	msg_queue_init(&stack->downqueue);
-	msg_queue_init(&stack->upqueue);
 
 	pthread_mutex_init(&stack->st_lock, NULL);
 
@@ -1354,11 +1332,11 @@
 
 	switch(stinf->pid.protocol[0] & ~ISDN_PID_FEATURE_MASK) {
 	case ISDN_PID_L0_TE_S0:
+		cb_log(8, port, "TE Stack\n");
 		stack->nt=0;
 		break;
 	case ISDN_PID_L0_NT_S0:
 		cb_log(8, port, "NT Stack\n");
-
 		stack->nt=1;
 		break;
 	case ISDN_PID_L0_TE_E1:
@@ -1367,10 +1345,9 @@
 		stack->pri=1;
 		break;
 	case ISDN_PID_L0_NT_E1:
-		cb_log(8, port, "TE S2M Stack\n");
+		cb_log(8, port, "NT S2M Stack\n");
 		stack->nt=1;
 		stack->pri=1;
-
 		break;
 	default:
 		cb_log(0, port, "this is a unknown port type 0x%08x\n", stinf->pid.protocol[0]);
@@ -1388,8 +1365,6 @@
 	{
 		int ret;
 		int nt=stack->nt;
-
-		cb_log(8, port, "Init. Stack.\n");
 
 		memset(&li, 0, sizeof(li));
 		{
@@ -1430,9 +1405,6 @@
 			cb_log(0, port, "%s: Cannot get layer(%d) id of this port.\n", __FUNCTION__, 2);
 			return(NULL);
 		}
-
-		cb_log(8, port, "NT Stacks upper_id %x\n",stack->upper_id);
-
 
 		/* create nst (nt-mode only) */
 		if (nt) {
@@ -1483,7 +1455,7 @@
 
 	}
 
-	cb_log(8,0,"stack_init: port:%d lowerId:%x  upperId:%x\n",stack->port,stack->lower_id, stack->upper_id);
+	cb_log(8, port, "stack_init: lowerId:%x upperId:%x\n", stack->lower_id, stack->upper_id);
 
 	return stack;
 }
@@ -1650,14 +1622,11 @@
 
 
 
-static int handle_event ( struct misdn_bchannel *bc, enum event_e event, iframe_t *frm)
+static int handle_event_te(struct misdn_bchannel *bc, enum event_e event, iframe_t *frm)
 {
 	struct misdn_stack *stack=get_stack_by_bc(bc);
 
-	if (!stack->nt) {
-
-		switch (event) {
-
+	switch (event) {
 		case EVENT_CONNECT_ACKNOWLEDGE:
 			setup_bc(bc);
 
@@ -1734,7 +1703,9 @@
 				return -1;
 			}
 
-			setup_bc(bc);
+			if (event != EVENT_SETUP) {
+				setup_bc(bc);
+			}
 			break;
 		}
 
@@ -1743,9 +1714,6 @@
 			break;
 		default:
 			break;
-		}
-	} else {    /** NT MODE **/
-
 	}
 	return 0;
 }
@@ -2194,10 +2162,6 @@
 			if (stack->l2upcnt>3) {
 				cb_log(0 , stack->port, "!!! Could not Get the L2 up after 3 Attempts!!!\n");
 			} else {
-#if 0
-				if (stack->nt)
-					misdn_lib_reinit_nt_stack(stack->port);
-#endif
 				if (stack->l1link) {
 					misdn_lib_get_l2_up(stack);
 					stack->l2upcnt++;
@@ -2490,43 +2454,6 @@
 	case MGR_SETSTACK| INDICATION:
 		cb_log(3, stack->port, "BCHAN: MGR_SETSTACK|IND pid:%d\n",bc->pid);
 	break;
-#if 0
-	AGAIN:
-		bc->addr = mISDN_get_layerid(stack->midev, bc->b_stid, bc->layer);
-		if (!bc->addr) {
-
-			if (errno == EAGAIN) {
-				usleep(1000);
-				goto AGAIN;
-			}
-
-			cb_log(0,stack->port,"$$$ Get Layer (%d) Id Error: %s\n",bc->layer,strerror(errno));
-
-			/* we kill the channel later, when we received some
-			   data. */
-			bc->addr= frm->addr;
-		} else if ( bc->addr < 0) {
-			cb_log(0, stack->port,"$$$ bc->addr <0 Error:%s\n",strerror(errno));
-			bc->addr=0;
-		}
-
-		cb_log(4, stack->port," --> Got Adr %x\n", bc->addr);
-
-		free_msg(msg);
-
-
-		switch(bc->bc_state) {
-		case BCHAN_SETUP:
-			bc_state_change(bc,BCHAN_SETUPED);
-		break;
-
-		case BCHAN_CLEAN_REQUEST:
-		default:
-			cb_log(0, stack->port," --> STATE WASN'T SETUP (but %s) in SETSTACK|IND pid:%d\n",bc_state2str(bc->bc_state), bc->pid);
-			clean_up_bc(bc);
-		}
-		return 1;
-#endif
 
 	case MGR_DELLAYER| INDICATION:
 		cb_log(3, stack->port, "BCHAN: MGR_DELLAYER|IND pid:%d\n",bc->pid);
@@ -2766,7 +2693,7 @@
 }
 
 
-static int handle_frm(msg_t *msg)
+static int handle_frm_te(msg_t *msg)
 {
 	struct misdn_bchannel dummybc;
 	struct misdn_bchannel *bc;
@@ -2785,11 +2712,11 @@
 		return 0;
 	}
 
-	cb_log(4, stack ? stack->port : 0, "handle_frm: frm->addr:%x frm->prim:%x\n", frm->addr, frm->prim);
+	cb_log(4, stack->port, "handle_frm_te: frm->addr:%x frm->prim:%x\n", frm->addr, frm->prim);
 
 	ret = handle_cr(stack, frm);
 	if (ret < 0) {
-		cb_log(3, stack ? stack->port : 0, "handle_frm: handle_cr <0 prim:%x addr:%x\n", frm->prim, frm->addr);
+		cb_log(3, stack->port, "handle_frm_te: handle_cr <0 prim:%x addr:%x\n", frm->prim, frm->addr);
 	}
 	if (ret) {
 		free_msg(msg);
@@ -2828,7 +2755,7 @@
 	isdn_msg_parse_event(msgs_g, msg, bc, 0);
 
 	/* Preprocess some Events */
-	ret = handle_event(bc, event, frm);
+	ret = handle_event_te(bc, event, frm);
 	if (ret < 0) {
 		cb_log(0, stack->port, "couldn't handle event\n");
 		free_msg(msg);
@@ -2852,24 +2779,21 @@
 			cb_log(0, stack->port, "TOTALLY IGNORING SETUP\n");
 			break;
 		case RESPONSE_IGNORE_SETUP:
+			cb_log(0, stack->port, "GOT IGNORE SETUP\n");
 			/* I think we should send CC_RELEASE_CR, but am not sure*/
 			bc->out_cause = AST_CAUSE_NORMAL_CLEARING;
 			/* fall through */
 		case RESPONSE_RELEASE_SETUP:
+			if (response == RESPONSE_RELEASE_SETUP) {
+				cb_log(0, stack->port, "GOT RELEASE SETUP\n");
+			}
 			misdn_lib_send_event(bc, EVENT_RELEASE_COMPLETE);
-			if (bc->channel > 0) {
-				empty_chan_in_stack(stack, bc->channel);
-			}
-			empty_bc(bc);
-			bc_state_change(bc, BCHAN_CLEANED);
-			bc->in_use = 0;
-
-			cb_log(0, stack->port, "GOT IGNORE SETUP\n");
 			break;
 		case RESPONSE_OK:
 			cb_log(4, stack->port, "GOT SETUP OK\n");
 			break;
 		default:
+			cb_log(0, stack->port, "GOT UNKNOWN SETUP RESPONSE\n");
 			break;
 		}
 		break;
@@ -3300,12 +3224,6 @@
 
 	if (++mypid>5000) mypid=1;
 	bc->pid=mypid;
-
-#if 0
-	bc->addr=0;
-	bc->b_stid=0;
-	bc->layer_id=0;
-#endif
 
 	bc->in_use = 1;
 }
@@ -3691,8 +3609,13 @@
 	case EVENT_PROCEEDING:
 	case EVENT_SETUP_ACKNOWLEDGE:
 	case EVENT_CONNECT:
-		if (!stack->nt)
+		if (!stack->nt) {
+			if (stack->ptp) {
+				setup_bc(bc);
+			}
 			break;
+		}
+		/* fall through */
 
 	case EVENT_RETRIEVE_ACKNOWLEDGE:
 		if (stack->nt) {
@@ -3788,6 +3711,11 @@
 			cb_log(0, bc->port, " --> we have already sent DISCONNECT\n");
 			RETURN(-1,OUT);
 		}
+		/* IE cause is mandatory for DISCONNECT, but optional for the answers to DISCONNECT.
+		 * We must initialize cause, so it is later correctly indicated to ast_channel
+		 * in case the answer does not include one!
+		 */
+		bc->cause = bc->out_cause;
 
 		bc->need_disconnect=0;
 		break;
@@ -3962,24 +3890,6 @@
 	return 0;
 }
 
-#if 0
-static int queue_l2l3(msg_t *msg)
-{
-	iframe_t *frm= (iframe_t*)msg->data;
-	struct misdn_stack *stack;
-	stack=find_stack_by_addr( frm->addr );
-
-
-	if (!stack) {
-		return 0;
-	}
-
-	msg_queue_tail(&stack->upqueue, msg);
-	sem_post(&glob_mgr->new_msg);
-	return 1;
-}
-#endif
-
 int manager_isdn_handler(iframe_t *frm ,msg_t *msg)
 {
 
@@ -4004,7 +3914,7 @@
 	}
 
 #ifdef RECV_FRM_SYSLOG_DEBUG
-	syslog(LOG_NOTICE,"mISDN recv: P(%02d): ADDR:%x PRIM:%x DINFO:%x\n",stack->port, frm->addr, frm->prim, frm->dinfo);
+	syslog(LOG_NOTICE,"mISDN recv: ADDR:%x PRIM:%x DINFO:%x\n", frm->addr, frm->prim, frm->dinfo);
 #endif
 
 	if (handle_timers(msg))
@@ -4025,7 +3935,7 @@
 		return 0;
 	}
 
-	if (handle_frm(msg)) {
+	if (handle_frm_te(msg)) {
 		return 0;
 	}
 
@@ -4070,32 +3980,6 @@
 
 
 	return 0;
-}
-
-
-int queue_cleanup_bc(struct misdn_bchannel *bc)
-{
-	msg_t *msg=alloc_msg(MAX_MSG_SIZE);
-	iframe_t *frm;
-	if (!msg) {
-		cb_log(0, bc->port, "queue_cleanup_bc: alloc_msg failed!\n");
-		return -1;
-	}
-	frm=(iframe_t*)msg->data;
-
-	/* activate bchannel */
-	frm->prim = MGR_CLEARSTACK| REQUEST;
-
-	frm->addr = bc->l3_id;
-
-	frm->dinfo = bc->port;
-	frm->len = 0;
-
-	msg_queue_tail(&glob_mgr->activatequeue, msg);
-	sem_post(&glob_mgr->new_msg);
-
-	return 0;
-
 }
 
 int misdn_lib_pid_restart(int pid)
@@ -4210,28 +4094,6 @@
 			iframe_t *frm =  (iframe_t*) msg->data ;
 
 			switch ( frm->prim) {
-
-			case MGR_CLEARSTACK | REQUEST:
-				/*a queued bchannel cleanup*/
-				{
-					struct misdn_stack *stack=find_stack_by_port(frm->dinfo);
-					struct misdn_bchannel *bc;
-					if (!stack) {
-						cb_log(0,0,"no stack found with port [%d]!! so we cannot cleanup the bc\n",frm->dinfo);
-						free_msg(msg);
-						break;
-					}
-
-					bc = find_bc_by_l3id(stack, frm->addr);
-					if (bc) {
-						cb_log(1,bc->port,"CLEARSTACK queued, cleaning up\n");
-						clean_up_bc(bc);
-					} else {
-						cb_log(0,stack->port,"bc could not be cleaned correctly !! addr [%x]\n",frm->addr);
-					}
-				}
-				free_msg(msg);
-				break;
 			case MGR_SETSTACK | REQUEST :
 				free_msg(msg);
 				break;
@@ -4244,18 +4106,6 @@
 		for (stack=glob_mgr->stack_list;
 		     stack;
 		     stack=stack->next ) {
-
-			while ( (msg=msg_dequeue(&stack->upqueue)) ) {
-				/** Handle L2/3 Signalling after bchans **/
-				if (!handle_frm_nt(msg)) {
-					/* Maybe it's TE */
-					if (!handle_frm(msg)) {
-						/* wow none! */
-						cb_log(0,stack->port,"Wow we've got a strange issue while dequeueing a Frame\n");
-					}
-				}
-			}
-
 			/* Here we should check if we really want to
 				send all the messages we've queued, lets
 				assume we've queued a Disconnect, but
@@ -4720,9 +4570,7 @@
 {
 	struct misdn_bchannel *help;
 
-	cb_log(4,stack?stack->port:0, "*HOLDER: find %lx\n",l3id);
-
-	if (!stack) return NULL;
+	cb_log(4, stack->port, "*HOLDER: find %lx\n",l3id);
 
 	for (help=stack->holding;
 	     help;

Modified: branches/10/channels/misdn/isdn_lib.h
URL: http://svnview.digium.com/svn/asterisk/branches/10/channels/misdn/isdn_lib.h?view=diff&rev=374537&r1=374536&r2=374537
==============================================================================
--- branches/10/channels/misdn/isdn_lib.h (original)
+++ branches/10/channels/misdn/isdn_lib.h Fri Oct  5 13:25:20 2012
@@ -78,16 +78,9 @@
 enum bchannel_state {
 	BCHAN_CLEANED=0,
 	BCHAN_EMPTY,
-	BCHAN_SETUP,
-	BCHAN_SETUPED,
-	BCHAN_ACTIVE,
 	BCHAN_ACTIVATED,
-	BCHAN_BRIDGE,
 	BCHAN_BRIDGED,
 	BCHAN_RELEASE,
-	BCHAN_RELEASED,
-	BCHAN_CLEAN,
-	BCHAN_CLEAN_REQUEST,
 	BCHAN_ERROR
 };
 
@@ -814,8 +807,6 @@
 void misdn_lib_tone_generator_stop(struct misdn_bchannel *bc);
 
 
-void misdn_lib_setup_bc(struct misdn_bchannel *bc);
-
 void misdn_lib_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2);
 void misdn_lib_split_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2);
 

Modified: branches/10/channels/misdn/isdn_msg_parser.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/channels/misdn/isdn_msg_parser.c?view=diff&rev=374537&r1=374536&r2=374537
==============================================================================
--- branches/10/channels/misdn/isdn_msg_parser.c (original)
+++ branches/10/channels/misdn/isdn_msg_parser.c Fri Oct  5 13:25:20 2012
@@ -484,9 +484,9 @@
 	{
 		int  protocol ;
 		dec_ie_useruser(setup->USER_USER, (Q931_info_t *)setup, &protocol, bc->uu, &bc->uulen, nt,bc);
-		if (bc->uulen) cb_log(1,bc->port,"USERUESRINFO:%s\n",bc->uu);
+		if (bc->uulen) cb_log(1, bc->port, "USERUSERINFO:%s\n", bc->uu);
 		else
-		cb_log(1,bc->port,"NO USERUESRINFO\n");
+		cb_log(1, bc->port, "NO USERUSERINFO\n");
 	}
 
 	dec_ie_progress(setup->PROGRESS, (Q931_info_t *)setup, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
@@ -618,7 +618,7 @@
 	if (bc->uulen) {
 		int  protocol=4;
 		enc_ie_useruser(&setup->USER_USER, msg, protocol, bc->uu, bc->uulen, nt,bc);
-		cb_log(1,bc->port,"ENCODING USERUESRINFO:%s\n",bc->uu);
+		cb_log(1, bc->port, "ENCODING USERUSERINFO:%s\n", bc->uu);
 	}
 
 #if defined(AST_MISDN_ENHANCEMENTS)
@@ -1087,7 +1087,7 @@
 	if (bc->uulen) {
 		int  protocol=4;
 		enc_ie_useruser(&disconnect->USER_USER, msg, protocol, bc->uu, bc->uulen, nt,bc);
-		cb_log(1,bc->port,"ENCODING USERUESRINFO:%s\n",bc->uu);
+		cb_log(1, bc->port, "ENCODING USERUSERINFO:%s\n", bc->uu);
 	}
 
 #ifdef DEBUG
@@ -1175,7 +1175,7 @@
 	if (bc->uulen) {
 		int  protocol=4;
 		enc_ie_useruser(&release->USER_USER, msg, protocol, bc->uu, bc->uulen, nt,bc);
-		cb_log(1,bc->port,"ENCODING USERUESRINFO:%s\n",bc->uu);
+		cb_log(1, bc->port, "ENCODING USERUSERINFO:%s\n", bc->uu);
 	}
 
 #ifdef DEBUG
@@ -1237,7 +1237,7 @@
 	if (bc->uulen) {
 		int  protocol=4;
 		enc_ie_useruser(&release_complete->USER_USER, msg, protocol, bc->uu, bc->uulen, nt,bc);
-		cb_log(1,bc->port,"ENCODING USERUESRINFO:%s\n",bc->uu);
+		cb_log(1, bc->port, "ENCODING USERUSERINFO:%s\n", bc->uu);
 	}
 
 #ifdef DEBUG




More information about the asterisk-commits mailing list