[svn-commits] nadi: branch group/trunk-cm-csel-hash r47360 - in /team/group/trunk-cm-csel-h...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu Nov 9 06:22:02 MST 2006


Author: nadi
Date: Thu Nov  9 07:22:01 2006
New Revision: 47360

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47360
Log:
new log_event function for state_machine

Modified:
    team/group/trunk-cm-csel-hash/channels/chan_misdn.c
    team/group/trunk-cm-csel-hash/channels/misdn/isdn_lib.c
    team/group/trunk-cm-csel-hash/channels/misdn/isdn_msg_parser.c
    team/group/trunk-cm-csel-hash/res/res_csel.c

Modified: team/group/trunk-cm-csel-hash/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/group/trunk-cm-csel-hash/channels/chan_misdn.c?view=diff&rev=47360&r1=47359&r2=47360
==============================================================================
--- team/group/trunk-cm-csel-hash/channels/chan_misdn.c (original)
+++ team/group/trunk-cm-csel-hash/channels/chan_misdn.c Thu Nov  9 07:22:01 2006
@@ -225,6 +225,7 @@
 	struct state_machine_transition *table;
 	int      num_rows;
 	int      (*send_event)(void *p, int event);
+	void     (*log_event)(void *p, int direction, int state, int event);
 };
 
 /* Global Static Variables */
@@ -665,15 +666,19 @@
 #define EVENT_NONE      -3 /*!< return value of handle(): no event will be sent out, state_machine_run continues */
 #define EVENT_ANY       -4 /*!< wildcard for the event field in struct state_machine_transision */
 
+#define LOG_RECEIVE      0 /*!< passed to log callback when receiving events */
+#define LOG_TRANSMIT     1 /*!< passed to log callback when transmitting events */
+
 static struct state_machine * state_machine_create (void *p,
 													int state,
 													struct state_machine_transition *table,
 													int num_rows,
-													int (*send_event)(void *p, int event))
+													int (*send_event)(void *p, int event),
+													void (*log_event)(void *p, int direction, int state, int event))
 {
 	struct state_machine *sm = malloc(sizeof(struct state_machine));
 
-	chan_misdn_log(1, 0, "state_machine_create: Creating with state %d ...\n", state);
+	chan_misdn_log(2, 0, "state_machine_create: Creating with state %d ...\n", state);
 
 	if (sm) {
 		sm->p = p;
@@ -681,6 +686,7 @@
 		sm->table = table;
 		sm->num_rows = num_rows;
 		sm->send_event = send_event;
+		sm->log_event = log_event;
 	}
 
 	return sm;
@@ -689,7 +695,7 @@
 static void state_machine_destroy (struct state_machine *sm)
 {
 	if (sm) {
-		chan_misdn_log(1, 0, "state_machine_destroy: Freeing at state %d ...\n", sm->state);
+		chan_misdn_log(2, 0, "state_machine_destroy: Freeing at state %d ...\n", sm->state);
 		free(sm);
 	}
 }
@@ -702,7 +708,8 @@
 		err,
 		retval = -1;
 
-	chan_misdn_log(1, 0, "state_machine_run: Running event %d at state %d ...\n", event, sm->state);
+	if (sm->log_event)
+		sm->log_event(sm->p, LOG_RECEIVE, sm->state, event);
 
 	for (; i < sm->num_rows; ++i) {
 		t = &sm->table[i];
@@ -719,9 +726,9 @@
 			case EVENT_NONE:
 				break;
 			default:
-				chan_misdn_log(1, 0, "state_machine_run:   -> Sending event %d ...\n", event_out);
+				if (sm->log_event)
+					sm->log_event(sm->p, LOG_TRANSMIT, sm->state, event_out);
 				err = sm->send_event(sm->p, event_out);
-				chan_misdn_log(1, 0, "state_machine_run:   -> Finished event %d, retval: %d ...\n", event_out, err);
 				if (err) {
 					retval = err;
 					goto out;
@@ -738,7 +745,7 @@
 	}
 
 out:
-	chan_misdn_log(1, 0, "state_machine_run: Returning with value %d ...\n", retval);
+	chan_misdn_log(2, 0, "state_machine_run: Returning with value %d ...\n", retval);
 	return retval;
 }
 
@@ -889,10 +896,8 @@
 	int re = 0;
 
 	if (event > EVENT_NOTHING && event < EVENT_UNKNOWN) {
-		chan_misdn_log(0, ch->bc->port, "--> I: %s\n", event2str(event));
 		misdn_lib_send_event(ch->bc, event);
 	} else {
-		chan_misdn_log(0, ch->bc->port, "--> *: %s\n", event2str(event));
 		switch (event) {
 		case AEVENT_CPROCEEDING:
 			ast_queue_control(ch->ast, AST_CONTROL_PROCEEDING);
@@ -913,6 +918,16 @@
 	}
 
 	return re;
+}
+
+static void log_event (void *p, int direction, int state, int event)
+{
+	struct chan_list *ch = p;
+
+	chan_misdn_log(1, ch->bc->port, "%c%s %s\n",
+				   event > EVENT_NOTHING && event < EVENT_UNKNOWN ? 'I' : '*',
+				   direction == LOG_RECEIVE ? "->" : "<-",
+				   event2str(event));
 }
 
 /* Channel Selection */
@@ -1007,7 +1022,8 @@
 
 	cl->sm = state_machine_create(cl, MISDN_NOTHING, misdn_state_table,
 								  sizeof(misdn_state_table) / sizeof(struct state_machine_transition),
-								  send_event);
+								  send_event,
+								  log_event);
 	cl->orginator = orig;
 	cl->need_queue_hangup = 1;
 	cl->need_hangup = 1;
@@ -1518,7 +1534,7 @@
 	tmp = pbx_builtin_getvar_helper(chan, "MISDN_PID");
 	if (tmp) {
 		ch->other_pid = atoi(tmp);
-		chan_misdn_log(1, bc->port, "IMPORT_PID: importing pid:%s\n", tmp);
+		chan_misdn_log(2, bc->port, "IMPORT_PID: importing pid:%s\n", tmp);
 		if (ch->other_pid > 0) {
 			ch->other_ch = find_chan_by_pid(cl_te, ch->other_pid);
 			if (ch->other_ch)
@@ -1647,7 +1663,7 @@
 static void export_chan (struct ast_channel *chan, struct misdn_bchannel *bc, struct chan_list *ch)
 {
 	char tmp[32];
-	chan_misdn_log(1, bc->port, "EXPORT_PID: pid:%d\n", bc->pid);
+	chan_misdn_log(2, bc->port, "EXPORT_PID: pid:%d\n", bc->pid);
 	snprintf(tmp, sizeof(tmp), "%d", bc->pid);
 	pbx_builtin_setvar_helper(chan, "_MISDN_PID", tmp);
 }
@@ -1689,15 +1705,15 @@
 static void send_cause_to_ast (struct ast_channel *ast, struct misdn_bchannel *bc, struct chan_list *ch)
 {
 	if (!ast) {
-		chan_misdn_log(1, 0, "send_cause_to_ast: No Ast\n");
+		chan_misdn_log(2, 0, "send_cause_to_ast: No Ast\n");
 		return;
 	}
 	if (!bc) {
-		chan_misdn_log(1, 0, "send_cause_to_ast: No BC\n");
+		chan_misdn_log(2, 0, "send_cause_to_ast: No BC\n");
 		return;
 	}
 	if (!ch) {
-		chan_misdn_log(1, 0, "send_cause_to_ast: No Ch\n");
+		chan_misdn_log(2, 0, "send_cause_to_ast: No Ch\n");
 		return;
 	}
 
@@ -1706,9 +1722,9 @@
 	if (bc->cause == 21 || bc->cause == 17) {
 		state_machine_set_state(ch->sm, MISDN_BUSY);
 		if (!ch->need_busy) {
-			chan_misdn_log(1, bc->port, "Queued busy already\n");
+			chan_misdn_log(2, bc->port, "Queued busy already\n");
 		} else {
-			chan_misdn_log(1, bc->port, " --> * SEND: Queue Busy pid:%d\n", bc->pid);
+			chan_misdn_log(2, bc->port, " --> * SEND: Queue Busy pid:%d\n", bc->pid);
 			ast_queue_control(ast, AST_CONTROL_BUSY);
 			ch->need_busy = 0;
 		}
@@ -1723,7 +1739,7 @@
 	if (!cm_get_strcasecmp(misdn_cm, "yes", PORT, MCFG_NODIALTONE, cl->bc->port))
 		nd = 1;
 	if (nd) {
-		chan_misdn_log(1, cl->bc->port, "Not sending Dialtone, because config wants it\n");
+		chan_misdn_log(2, cl->bc->port, "Not sending Dialtone, because config wants it\n");
 		return 0;
 	}
 
@@ -1776,15 +1792,15 @@
 	int port;
 
 	if (!ch || !ch->bc) {
-		chan_misdn_log(1, 0, "Cannot hangup chan, no ch or no ch->bc!\n");
+		chan_misdn_log(2, 0, "Cannot hangup chan, no ch or no ch->bc!\n");
 		return;
 	}
 	
 	port = ch->bc ? ch->bc->port : 0;
-	chan_misdn_log(1, port, "hangup_chan\n");
+	chan_misdn_log(2, port, "hangup_chan\n");
 
 	if (ch->need_hangup) {
-		chan_misdn_log(1, port, "-> hangup\n");
+		chan_misdn_log(2, port, "-> hangup\n");
 		send_cause_to_ast(ch->ast, ch->bc, ch);
 		ch->need_hangup = ch->need_queue_hangup = 0;
 		if (ch->ast)
@@ -1793,16 +1809,16 @@
 	}
 
 	if (!ch->need_queue_hangup) {
-		chan_misdn_log(1, port, "No need to queue hangup\n");
+		chan_misdn_log(2, port, "No need to queue hangup\n");
 	}
 
 	ch->need_queue_hangup = 0;
 	if (ch->ast) {
 		send_cause_to_ast(ch->ast, ch->bc, ch);
 		ast_queue_hangup(ch->ast);
-		chan_misdn_log(1, port, "-> queue_hangup\n");
+		chan_misdn_log(2, port, "-> queue_hangup\n");
 	} else
-		chan_misdn_log(1, port, "Cannot hangup chan, no ast\n");
+		chan_misdn_log(2, port, "Cannot hangup chan, no ast\n");
 }
 
 /* Isdn asks us to release channel, pendant to misdn_hangup */
@@ -1812,11 +1828,11 @@
 	struct chan_list *ch = find_chan_by_bc(cl_te, bc);
 
 	if (!ch) {
-		chan_misdn_log(1, bc->port, "release_chan: Ch not found!\n");
+		chan_misdn_log(2, bc->port, "release_chan: Ch not found!\n");
 		return;
 	}
 	ast = ch->ast;
-	chan_misdn_log(1, bc->port, "release_chan: bc with l3id: %x\n", bc->l3_id);
+	chan_misdn_log(2, bc->port, "release_chan: bc with l3id: %x\n", bc->l3_id);
 
 	if (ch->jb) {
 		misdn_jb_destroy(ch->jb);
@@ -1841,7 +1857,7 @@
 	close(ch->pipe[1]);
 
 	if (ast && MISDN_ASTERISK_TECH_PVT(ast)) {
-		chan_misdn_log(1, bc->port, "* RELEASING CHANNEL pid:%d ctx:%s dad:%s oad:%s state: %s\n",
+		chan_misdn_log(2, bc->port, "* RELEASING CHANNEL pid:%d ctx:%s dad:%s oad:%s state: %s\n",
 					   bc->pid, ast->context, ast->exten, AST_CID_P(ast), get_ch_state(ch));
 		chan_misdn_log(3, bc->port, " --> * State Down\n");
 		MISDN_ASTERISK_TECH_PVT(ast) = NULL;
@@ -1877,11 +1893,11 @@
 	misdn_lib_send_event(bc, (bc->nt || misdn_lib_is_ptp(bc->port)) ? EVENT_SETUP_ACKNOWLEDGE : EVENT_PROCEEDING);
 
 	if (!bc->nt && (ch->orginator == ORG_MISDN) && !ch->incoming_early_audio) 
-		chan_misdn_log(1, bc->port, " --> incoming_early_audio off\n");
+		chan_misdn_log(2, bc->port, " --> incoming_early_audio off\n");
 	else  
 		dialtone_indicate(ch);
 
-	chan_misdn_log(1, bc->port, "* Starting Ast ctx:%s dad:%s oad:%s with 's' extension\n", ast->context, ast->exten, AST_CID_P(ast));
+	chan_misdn_log(2, bc->port, "* Starting Ast ctx:%s dad:%s oad:%s with 's' extension\n", ast->context, ast->exten, AST_CID_P(ast));
 	strncpy(ast->exten, "s", 2);
 
 	if (pbx_start_chan(ch) < 0) {
@@ -2483,7 +2499,7 @@
 		switch (bc->capability) {
 		case INFO_CAPABILITY_DIGITAL_UNRESTRICTED:
 		case INFO_CAPABILITY_DIGITAL_RESTRICTED:
-			chan_misdn_log(1, bc->port, " --> CONF: HDLC\n");
+			chan_misdn_log(2, bc->port, " --> CONF: HDLC\n");
 			bc->hdlc = 1;
 		}
 	}
@@ -2500,7 +2516,7 @@
 	chan_misdn_log(5, bc->port, "config_ch_jitterbuffer: Called\n");
 
 	if (!len) {
-		chan_misdn_log(1, bc->port, "config_ch_jitterbuffer: Deactivating Jitterbuffer\n");
+		chan_misdn_log(2, bc->port, "config_ch_jitterbuffer: Deactivating Jitterbuffer\n");
 		bc->nojitter = 1;
 	} else {
 		if (len <= 100 || len > 8000) {
@@ -2554,7 +2570,7 @@
 		return -1;
 	}
 
-	chan_misdn_log(1, bc->port, "config_ch: Getting Config\n");
+	chan_misdn_log(2, bc->port, "config_ch: Getting Config\n");
 
 	cm_get(misdn_cm, buf, sizeof(buf), PORT, MCFG_LANGUAGE, bc->port);
 	ast_string_field_set(ast, language, buf);
@@ -2601,7 +2617,7 @@
 		}
 
 		if (!cm_get(misdn_cm, buf, sizeof(buf), PORT, MCFG_CALLERID, bc->port) && !ast_strlen_zero(buf)) {
-			chan_misdn_log(1, bc->port, " --> * Setting Cid to %s\n", buf);
+			chan_misdn_log(2, bc->port, " --> * Setting Cid to %s\n", buf);
 			strncpy(bc->oad, buf, sizeof(bc->oad));
 			bc->oad[sizeof(bc->oad) - 1] = 0;
 		}
@@ -2701,7 +2717,7 @@
 		if (exten) 
 			ast_copy_string(tmp->exten, exten,  sizeof(tmp->exten));
 		else
-			chan_misdn_log(1, 0, "misdn_new: no exten given.\n");
+			chan_misdn_log(2, 0, "misdn_new: no exten given.\n");
 
 		if (callerid) {
 			ast_callerid_parse(callerid, &cid_name, &cid_num);
@@ -2771,7 +2787,7 @@
 		}
 	} else {
 		if (channel)
-			chan_misdn_log(1, port, " --> preselected_channel: %d\n", channel);
+			chan_misdn_log(2, port, " --> preselected_channel: %d\n", channel);
 		newbc = misdn_lib_get_free_bc(port, channel, 0);
 	}
 
@@ -2817,7 +2833,7 @@
 		return -1;
 	}
 	
-	chan_misdn_log(1, bc->port, "* IND : Digit %c\n", digit);
+	chan_misdn_log(2, bc->port, "* IND : Digit %c\n", digit);
 
 	switch (state_machine_get_state(p->sm)) {
 	case MISDN_CALLING:
@@ -2894,8 +2910,8 @@
 		return -1;
 	}
 
-	chan_misdn_log(1, port, "* CALL: %s\n", dest);
-	chan_misdn_log(1, port, " --> * dad:%s tech:%s ctx:%s\n", ast->exten, ast->name, ast->context);
+	chan_misdn_log(2, port, "* CALL: %s\n", dest);
+	chan_misdn_log(2, port, " --> * dad:%s tech:%s ctx:%s\n", ast->exten, ast->name, ast->context);
 	chan_misdn_log(3, port, " --> * adding2newbc ext %s\n", ast->exten);
 
 	if (ast->exten) {
@@ -2928,7 +2944,6 @@
 	else
 		chan_misdn_log(2, port, "NO OPTS GIVEN\n");
 
-	chan_misdn_log(0, port, "<-- *: %s\n", event2str(AEVENT_CALL));
 	if ((r = state_machine_run(ch->sm, AEVENT_CALL)))
 		chan_misdn_log(0, port, "state_machine_run failed on AEVENT_CALL: %d!\n", r);
 
@@ -2937,13 +2952,13 @@
 	
 	if (r == -ENOCHAN) {
 		chan_misdn_log(0, port, " --> * Theres no Channel at the moment .. !\n");
-		chan_misdn_log(1, port, " --> * SEND: State Down pid:%d\n", newbc ? newbc->pid : -1);
+		chan_misdn_log(2, port, " --> * SEND: State Down pid:%d\n", newbc ? newbc->pid : -1);
 		ast->hangupcause = 34;
 		ast_setstate(ast, AST_STATE_DOWN);
 		return -1;
 	}
 
-	chan_misdn_log(1, port, " --> * SEND: State Dialing pid:%d\n", newbc ? newbc->pid : 1);
+	chan_misdn_log(2, port, " --> * SEND: State Dialing pid:%d\n", newbc ? newbc->pid : 1);
 
 	ast_setstate(ast, AST_STATE_DIALING);
 	ast->hangupcause = 16;
@@ -2989,14 +3004,14 @@
 		}
 
 		/* trying to make a mISDN_dsp conference */
-		chan_misdn_log(1, ch1->bc->port, "I SEND: Making conference with Number:%d\n", ch1->bc->pid + 1);
+		chan_misdn_log(2, ch1->bc->port, "I SEND: Making conference with Number:%d\n", ch1->bc->pid + 1);
 		misdn_lib_bridge(ch1->bc, ch2->bc);
 	}
 
 	if (option_verbose > 2) 
 		ast_verbose(VERBOSE_PREFIX_3 "Native bridging %s and %s\n", c0->name, c1->name);
 
-	chan_misdn_log(1, ch1->bc->port, "* Making Native Bridge between %s and %s\n", ch1->bc->oad, ch2->bc->oad);
+	chan_misdn_log(2, ch1->bc->port, "* Making Native Bridge between %s and %s\n", ch1->bc->oad, ch2->bc->oad);
 
 	if (!(flags & AST_BRIDGE_DTMF_CHANNEL_0))
 		ch1->ignore_dtmf = 1;
@@ -3015,15 +3030,15 @@
 		if (!f || f->frametype == AST_FRAME_CONTROL) {
 			/* got hangup .. */
 			if (!f) 
-				chan_misdn_log(1, ch1->bc->port, "Read Null Frame\n");
+				chan_misdn_log(2, ch1->bc->port, "Read Null Frame\n");
 			else
-				chan_misdn_log(1, ch1->bc->port, "Read Frame Controll class:%d\n", f->subclass);
+				chan_misdn_log(2, ch1->bc->port, "Read Frame Controll class:%d\n", f->subclass);
 			*fo = f;
 			*rc = who;
 			break;
 		}
 		if (f->frametype == AST_FRAME_DTMF) {
-			chan_misdn_log(1, 0, "Read DTMF %d from %s\n", f->subclass, who->exten);
+			chan_misdn_log(2, 0, "Read DTMF %d from %s\n", f->subclass, who->exten);
 			*fo = f;
 			*rc = who;
 			break;
@@ -3031,7 +3046,7 @@
 		ast_write((who == c0 ? c1 : c0), f);
 	}
 
-	chan_misdn_log(1, ch1->bc->port, "I SEND: Splitting conference with Number:%d\n", ch1->bc->pid + 1);
+	chan_misdn_log(2, ch1->bc->port, "I SEND: Splitting conference with Number:%d\n", ch1->bc->pid + 1);
 	misdn_lib_split_bridge(ch1->bc, ch2->bc);
 
 	return AST_BRIDGE_COMPLETE;
@@ -3088,19 +3103,18 @@
 		bc->out_cause = tmpcause ? tmpcause : 16;
 	}
 
-	chan_misdn_log(1, bc->port,
+	chan_misdn_log(2, bc->port,
 				   "* IND : HANGUP\tpid:%d ctx:%s dad:%s oad:%s State:%s\n"
 				   " --> l3id:%x\n --> cause:%d\n --> out_cause:%d\n --> state:%s\n",
 				   p->bc ? p->bc->pid : -1, ast->context, ast->exten, AST_CID_P(ast), get_ch_state(p),
 				   p->l3id, bc->cause, bc->out_cause, get_ch_state(p));
 
-	chan_misdn_log(0, bc->port, "<-- *: %s\n", event2str(AEVENT_HANGUP));
 	if ((re = state_machine_run(p->sm, AEVENT_HANGUP))) {
 		chan_misdn_log(0, bc->port, "state_machine_run failed on AEVENT_HANGUP: %d!\n", re);
 		return -1;
 	}
 	
-	chan_misdn_log(1, bc->port, "Channel: %s hanguped new state:%s\n", ast->name, get_ch_state(p));
+	chan_misdn_log(2, bc->port, "Channel: %s hanguped new state:%s\n", ast->name, get_ch_state(p));
 
 	return 0;
 }
@@ -3141,7 +3155,7 @@
 		break;
 	case MISDN_HOLD_DISCONNECT:
 		/* need to send release here */
-		chan_misdn_log(1, bc->port, " --> cause %d\n --> out_cause %d\n", bc->cause, bc->out_cause);
+		chan_misdn_log(2, bc->port, " --> cause %d\n --> out_cause %d\n", bc->cause, bc->out_cause);
 		bc->out_cause = -1;
 		break;
 	default:
@@ -3162,11 +3176,11 @@
 	if (!ast || !(p = MISDN_ASTERISK_TECH_PVT(ast)) || !p->bc)
 		return -1;
 
-	chan_misdn_log(1, p->bc->port, "* ANSWER:\n");
+	chan_misdn_log(2, p->bc->port, "* ANSWER:\n");
 
 	tmp_key = pbx_builtin_getvar_helper(p->ast, "CRYPT_KEY");
 	if (tmp_key) {
-		chan_misdn_log(1, p->bc->port, " --> Connection will be BF crypted\n");
+		chan_misdn_log(2, p->bc->port, " --> Connection will be BF crypted\n");
 		strncpy(p->bc->crypt_key, tmp_key, sizeof(p->bc->crypt_key));
 		p->bc->crypt_key[sizeof(p->bc->crypt_key) - 1] = 0;
 	} else
@@ -3174,7 +3188,7 @@
 
 	nodsp = pbx_builtin_getvar_helper(ast, "MISDN_DIGITAL_TRANS");
 	if (nodsp) {
-		chan_misdn_log(1, p->bc->port, " --> Connection is transparent digital\n");
+		chan_misdn_log(2, p->bc->port, " --> Connection is transparent digital\n");
 		p->bc->nodsp = 1;
 		p->bc->hdlc = 0;
 		p->bc->nojitter = 1;
@@ -3188,7 +3202,6 @@
 		ast_copy_string(p->bc->cad, p->bc->dad, sizeof(p->bc->cad));
 	}
 
-	chan_misdn_log(0, p->bc->port, "<-- *: %s\n", event2str(AEVENT_ANSWER));
 	state_machine_run(p->sm, AEVENT_ANSWER);
 	
 	start_bc_tones(p);
@@ -3268,15 +3281,15 @@
 	int diff, len;
 
 	if (!ast) {
-		chan_misdn_log(1, 0, "misdn_read called without ast\n");
+		chan_misdn_log(2, 0, "misdn_read called without ast\n");
 		return NULL;
 	}
 	if (!(tmp = MISDN_ASTERISK_TECH_PVT(ast))) {
-		chan_misdn_log(1, 0, "misdn_read called without ast->pvt\n");
+		chan_misdn_log(2, 0, "misdn_read called without ast->pvt\n");
 		return NULL;
 	}
 	if (!tmp->bc) {
-		chan_misdn_log(1, 0, "misdn_read called without bc\n");
+		chan_misdn_log(2, 0, "misdn_read called without bc\n");
 		return NULL;
 	}
 
@@ -3392,12 +3405,12 @@
 		return -1;
 	}
 	
-	chan_misdn_log(1, p->bc->port, "* IND : Indication [%d] from %s\n", cond, ast->exten);
+	chan_misdn_log(2, p->bc->port, "* IND : Indication [%d] from %s\n", cond, ast->exten);
 
 	switch (cond) {
 	case AST_CONTROL_BUSY:
-		chan_misdn_log(1, p->bc->port, "* IND :\tbusy\n");
-		chan_misdn_log(1, p->bc->port, " --> * SEND: State Busy pid:%d\n", p->bc->pid);
+		chan_misdn_log(2, p->bc->port, "* IND :\tbusy\n");
+		chan_misdn_log(2, p->bc->port, " --> * SEND: State Busy pid:%d\n", p->bc->pid);
 		ast_setstate(ast, AST_STATE_BUSY);
 		p->bc->out_cause = 17;
 		if (state_machine_get_state(p->sm) != MISDN_CONNECTED) {
@@ -3407,61 +3420,61 @@
 			chan_misdn_log(-1, p->bc->port, " --> !! Got Busy in Connected State !?! ast:%s\n", ast->name);
 		return -1;
 	case AST_CONTROL_RING:
-		chan_misdn_log(1, p->bc->port, " --> * IND :\tring pid:%d\n", p->bc->pid);
+		chan_misdn_log(2, p->bc->port, " --> * IND :\tring pid:%d\n", p->bc->pid);
 		return -1;
 	case AST_CONTROL_RINGING:
 		switch (state_machine_get_state(p->sm)) {
 		case MISDN_ALERTING:
-			chan_misdn_log(1, p->bc->port, " --> * IND :\tringing pid:%d but I was Ringing before, so ignoreing it\n", p->bc->pid);
+			chan_misdn_log(2, p->bc->port, " --> * IND :\tringing pid:%d but I was Ringing before, so ignoreing it\n", p->bc->pid);
 			break;
 		case MISDN_CONNECTED:
-			chan_misdn_log(1, p->bc->port, " --> * IND :\tringing pid:%d but Connected, so just send TONE_ALERTING without state changes \n", p->bc->pid);
+			chan_misdn_log(2, p->bc->port, " --> * IND :\tringing pid:%d but Connected, so just send TONE_ALERTING without state changes \n", p->bc->pid);
 			return -1;
 		default:
 			state_machine_set_state(p->sm, MISDN_ALERTING);
-			chan_misdn_log(1, p->bc->port, " --> * IND :\tringing pid:%d\n", p->bc->pid);
+			chan_misdn_log(2, p->bc->port, " --> * IND :\tringing pid:%d\n", p->bc->pid);
 			misdn_lib_send_event(p->bc, EVENT_ALERTING);
 			if (p->other_ch && p->other_ch->bc) {
 				if (misdn_inband_avail(p->other_ch->bc)) {
-					chan_misdn_log(1, p->bc->port, " --> other End is mISDN and has inband info available\n");
+					chan_misdn_log(2, p->bc->port, " --> other End is mISDN and has inband info available\n");
 					break;
 				}
 				if (!p->other_ch->bc->nt) {
-					chan_misdn_log(1, p->bc->port, " --> other End is mISDN TE so it has inband info for sure (?)\n");
+					chan_misdn_log(2, p->bc->port, " --> other End is mISDN TE so it has inband info for sure (?)\n");
 					break;
 				}
 			}
-			chan_misdn_log(1, p->bc->port, " --> * SEND: State Ring pid:%d\n", p->bc->pid);
+			chan_misdn_log(2, p->bc->port, " --> * SEND: State Ring pid:%d\n", p->bc->pid);
 			ast_setstate(ast, AST_STATE_RINGING);
 			if (!p->bc->nt && p->orginator == ORG_MISDN && !p->incoming_early_audio) 
-				chan_misdn_log(1, p->bc->port, " --> incoming_early_audio off\n");
+				chan_misdn_log(2, p->bc->port, " --> incoming_early_audio off\n");
 			else 
 				return -1;
 		}
 		break;
 	case AST_CONTROL_ANSWER:
-		chan_misdn_log(1, p->bc->port, " --> * IND :\tanswer pid:%d\n", p->bc->pid);
+		chan_misdn_log(2, p->bc->port, " --> * IND :\tanswer pid:%d\n", p->bc->pid);
 		start_bc_tones(p);
 		break;
 	case AST_CONTROL_TAKEOFFHOOK:
-		chan_misdn_log(1, p->bc->port, " --> *\ttakeoffhook pid:%d\n", p->bc->pid);
+		chan_misdn_log(2, p->bc->port, " --> *\ttakeoffhook pid:%d\n", p->bc->pid);
 		return -1;
 	case AST_CONTROL_OFFHOOK:
-		chan_misdn_log(1, p->bc->port, " --> *\toffhook pid:%d\n", p->bc->pid);
+		chan_misdn_log(2, p->bc->port, " --> *\toffhook pid:%d\n", p->bc->pid);
 		return -1;
 	case AST_CONTROL_FLASH:
-		chan_misdn_log(1, p->bc->port, " --> *\tflash pid:%d\n", p->bc->pid);
+		chan_misdn_log(2, p->bc->port, " --> *\tflash pid:%d\n", p->bc->pid);
 		break;
 	case AST_CONTROL_PROGRESS:
-		chan_misdn_log(1, p->bc->port, " --> * IND :\tprogress pid:%d\n", p->bc->pid);
+		chan_misdn_log(2, p->bc->port, " --> * IND :\tprogress pid:%d\n", p->bc->pid);
 		misdn_lib_send_event(p->bc, EVENT_PROGRESS);
 		break;
 	case AST_CONTROL_PROCEEDING:
-		chan_misdn_log(1, p->bc->port, " --> * IND :\tproceeding pid:%d\n", p->bc->pid);
+		chan_misdn_log(2, p->bc->port, " --> * IND :\tproceeding pid:%d\n", p->bc->pid);
 		misdn_lib_send_event(p->bc, EVENT_PROCEEDING);
 		break;
 	case AST_CONTROL_CONGESTION:
-		chan_misdn_log(1, p->bc->port, " --> * IND :\tcongestion pid:%d\n", p->bc->pid);
+		chan_misdn_log(2, p->bc->port, " --> * IND :\tcongestion pid:%d\n", p->bc->pid);
 		p->bc->out_cause = 42;
 		if (state_machine_get_state(p->sm) != MISDN_CONNECTED) {
 			start_bc_tones(p);
@@ -3472,16 +3485,16 @@
 			hanguptone_indicate(p);
 		break;
 	case -1:
-		chan_misdn_log(1, p->bc->port, " --> * IND :\t-1! (stop indication) pid:%d\n", p->bc->pid);
+		chan_misdn_log(2, p->bc->port, " --> * IND :\t-1! (stop indication) pid:%d\n", p->bc->pid);
 		stop_indicate(p);
 		if (state_machine_get_state(p->sm) == MISDN_CONNECTED) 
 			start_bc_tones(p);
 		break;
 	case AST_CONTROL_HOLD:
-		chan_misdn_log(1, p->bc->port, " --> *\tHOLD pid:%d\n", p->bc->pid);
+		chan_misdn_log(2, p->bc->port, " --> *\tHOLD pid:%d\n", p->bc->pid);
 		break;
 	case AST_CONTROL_UNHOLD:
-		chan_misdn_log(1, p->bc->port, " --> *\tUNHOLD pid:%d\n", p->bc->pid);
+		chan_misdn_log(2, p->bc->port, " --> *\tUNHOLD pid:%d\n", p->bc->pid);
 		break;
 	default:
 		ast_log(LOG_NOTICE, " --> * Unknown Indication:%d pid:%d\n", cond, p->bc->pid);
@@ -3497,7 +3510,7 @@
 	if (!ast || !(p = MISDN_ASTERISK_TECH_PVT(ast)))
 		return -1;
 
-	chan_misdn_log(1, p->bc ? p->bc->port : 0, "* IND: Got Fixup State:%s L3id:%x\n", get_ch_state(p), p->l3id);
+	chan_misdn_log(2, p->bc ? p->bc->port : 0, "* IND: Got Fixup State:%s L3id:%x\n", get_ch_state(p), p->l3id);
 	p->ast = ast;
 	state_machine_set_state(p->sm, MISDN_FIXUP);
 	return 0;
@@ -3537,7 +3550,7 @@
 	if (cm_get_int(misdn_cm, boa, PORT, MCFG_BLOCK_ON_ALARM, ch->bc->port))
 		boa = 0;
 	if (boa > 0) {
-		chan_misdn_log(1, ch->bc->port, " --> blocking\n");
+		chan_misdn_log(2, ch->bc->port, " --> blocking\n");
 		misdn_lib_port_block(ch->bc->port); 
 	}
 
@@ -3606,12 +3619,12 @@
 	struct chan_list *ch = p;
 	struct misdn_bchannel *bc = ch->bc;
 	
-	chan_misdn_log(1, bc->port, "Set State Ringing\n");
+	chan_misdn_log(2, bc->port, "Set State Ringing\n");
 	if (misdn_cap_is_speech(bc->capability) && misdn_inband_avail(bc)) {
-		chan_misdn_log(1, bc->port, "Starting tones, we have inband data.\n");
+		chan_misdn_log(2, bc->port, "Starting tones, we have inband data.\n");
 		start_bc_tones(ch);
 	} else
-		chan_misdn_log(1, bc->port, "We have no inband Data, the other end must create ringing.\n");
+		chan_misdn_log(2, bc->port, "We have no inband Data, the other end must create ringing.\n");
 
 	return EVENT_DEFAULT;
 }
@@ -3665,7 +3678,7 @@
 	struct chan_list *ch = find_chan_by_bc(cl_te, bc);
 
 	if (event != EVENT_BCHAN_DATA && event != EVENT_TONE_GENERATE) { /*  Debug Only Non-Bchan */
-		chan_misdn_log((event == EVENT_CLEANUP && !user_data) ? 5 : 1, bc->port, "I IND :%s oad:%s dad:%s pid:%d state:%s\n",
+		chan_misdn_log((event == EVENT_CLEANUP && !user_data) ? 5 : 2, bc->port, "I IND :%s oad:%s dad:%s pid:%d state:%s\n",
 					   manager_isdn_get_info(event), bc->oad, bc->dad, bc->pid, ch ? get_ch_state(ch) : "none");
 		if ((event != EVENT_CLEANUP || user_data)) {
 			misdn_lib_log_ies(bc);
@@ -3702,13 +3715,13 @@
 		case EVENT_FACILITY:
 			break;
 		case EVENT_RELEASE_COMPLETE:
-			chan_misdn_log(1, bc->port, " --> no Ch, so we've already released.\n");
+			chan_misdn_log(2, bc->port, " --> no Ch, so we've already released.\n");
 		case EVENT_CLEANUP:
 		case EVENT_TONE_GENERATE:
 		case EVENT_BCHAN_DATA:
 			return -1;
 		default:
-			chan_misdn_log(1, bc->port, "Chan not existing at the moment bc->l3id:%x bc:%p event:%s port:%d channel:%d\n",
+			chan_misdn_log(2, bc->port, "Chan not existing at the moment bc->l3id:%x bc:%p event:%s port:%d channel:%d\n",
 						   bc->l3_id, bc, manager_isdn_get_info(event), bc->port, bc->channel);
 			return -1;
 		}
@@ -3750,7 +3763,7 @@
 				if (write(ch->pipe[1], bc->bframe, bc->bframe_len) <= 0)
 					chan_misdn_log(-1, bc->port, "Write returned <= 0 (err = %s)\n", strerror(errno));
 			} else
-				chan_misdn_log(1, bc->port, "Wripe Pipe full!\n");
+				chan_misdn_log(2, bc->port, "Wripe Pipe full!\n");
 		}
 		return RESPONSE_OK;
 	}
@@ -3783,7 +3796,6 @@
 	/*
 	 * run the state machine and return if the event could be handled
 	 */
-	chan_misdn_log(0, bc->port, "<-- I: %s\n", event2str(event));
 	if (ch && !state_machine_run(ch->sm, event)) {
 		if (event == EVENT_RELEASE || event == EVENT_RELEASE_COMPLETE || event == EVENT_CLEANUP)
 			release_chan(ch->bc);
@@ -3808,7 +3820,7 @@
 			if (state_machine_get_state(ch->sm) == MISDN_WAITING4DIGS) {
 				/*  Ok, incomplete Setup, waiting till extension exists */
 				if (ast_strlen_zero(bc->info_dad) && !ast_strlen_zero(bc->keypad)) {
-					chan_misdn_log(1, bc->port, " --> using keypad as info\n");
+					chan_misdn_log(2, bc->port, " --> using keypad as info\n");
 					strcpy(bc->info_dad, bc->keypad);
 				}
 				strncat(bc->dad, bc->info_dad, sizeof(bc->dad));
@@ -3890,14 +3902,14 @@
 				if (state_machine_get_state(ch->sm) == MISDN_NOTHING)
 					ch = NULL;
 				else {
-					chan_misdn_log(1, bc->port, " --> Ignoring Call we already have one\n");
+					chan_misdn_log(2, bc->port, " --> Ignoring Call we already have one\n");
 					return RESPONSE_IGNORE_SETUP_WITHOUT_CLOSE;
 				}
 			}
 			if (!cm_get(misdn_cm, msns, sizeof(msns), PORT, MCFG_MSNS, bc->port))
 				msn_valid = is_msn_valid(msns, bc->dad);
 			if (!bc->nt && !msn_valid) {
-				chan_misdn_log(1, bc->port, " --> Ignoring Call, its not in our MSN List\n");
+				chan_misdn_log(2, bc->port, " --> Ignoring Call, its not in our MSN List\n");
 				return RESPONSE_IGNORE_SETUP; /*  Ignore MSNs which are not in our list. */
 			}
 
@@ -4059,7 +4071,7 @@
 			stop_indicate(ch);
 			if (bridged && !strcasecmp(bridged->tech->type, "mISDN")) {
 				bridged_ch = MISDN_ASTERISK_TECH_PVT(bridged);
-				chan_misdn_log(1, bc->port, " --> copying cpndialplan:%d and cad:%s to the A-Channel\n", bc->cpnnumplan, bc->cad);
+				chan_misdn_log(2, bc->port, " --> copying cpndialplan:%d and cad:%s to the A-Channel\n", bc->cpnnumplan, bc->cad);
 				if (bridged_ch) {
 					bridged_ch->bc->cpnnumplan = bc->cpnnumplan;
 					ast_copy_string(bridged_ch->bc->cad, bc->cad, sizeof(bc->cad));
@@ -4079,14 +4091,14 @@
 					/* If there's inband information available (e.g. a recorded message saying what was wrong with the
 					 * dialled number, or perhaps even giving an alternative number, then play it instead of
 					 * immediately releasing the call */
-					chan_misdn_log(1, bc->port, " --> Inband Info Avail, not sending RELEASE\n");
+					chan_misdn_log(2, bc->port, " --> Inband Info Avail, not sending RELEASE\n");
 					start_bc_tones(ch);
 					break;
 				}
 				/* Check for holded channel, to implement transfer */
 				holded_ch = find_holded(cl_te, bc);
 				if (holded_ch && holded_ch != ch && ch->ast && state_machine_get_state(ch->sm) == MISDN_CONNECTED) {
-					chan_misdn_log(1, bc->port, " --> found holded ch\n");
+					chan_misdn_log(2, bc->port, " --> found holded ch\n");
 					misdn_transfer_bc(ch, holded_ch) ;
 				}
 				stop_bc_tones(ch);
@@ -4098,7 +4110,7 @@
 	case EVENT_BCHAN_ERROR:
 	case EVENT_TIMEOUT:
 		if (ch && bc)
-			chan_misdn_log(1, bc->port, "--> state: %s\n", get_ch_state(ch));
+			chan_misdn_log(2, bc->port, "--> state: %s\n", get_ch_state(ch));
 		switch (state_machine_get_state(ch->sm)) {
 		case MISDN_DIALING:
 		case MISDN_PROGRESS:
@@ -4127,7 +4139,7 @@
 			}
 			break;
 		case MISDN_CLEANING: 
-			chan_misdn_log(1, bc->port, " --> in state cleaning .. so ingoring, the stack should clean it for us\n");
+			chan_misdn_log(2, bc->port, " --> in state cleaning .. so ingoring, the stack should clean it for us\n");
 			break;
 		default:
 			misdn_lib_send_event(bc, EVENT_RELEASE_COMPLETE);
@@ -4295,33 +4307,33 @@
 		switch(tok[0]) {
 		case 'd' :
 			ast_copy_string(ch->bc->display, ++tok, 84);
-			chan_misdn_log(1, ch->bc->port, "SETOPT: Display:%s\n", ch->bc->display);
+			chan_misdn_log(2, ch->bc->port, "SETOPT: Display:%s\n", ch->bc->display);
 			break;
 		case 'n':
-			chan_misdn_log(1, ch->bc->port, "SETOPT: No DSP\n");
+			chan_misdn_log(2, ch->bc->port, "SETOPT: No DSP\n");
 			ch->bc->nodsp = 1;
 			break;
 		case 'j':
-			chan_misdn_log(1, ch->bc->port, "SETOPT: jitter\n");
+			chan_misdn_log(2, ch->bc->port, "SETOPT: jitter\n");
 			change_jitter = 1;
 			switch (*++tok) {
 			case 'b' :
 				ch->jb_len = atoi(++tok);
-				chan_misdn_log(1, ch->bc->port, " --> buffer_len:%d\n", ch->jb_len);
+				chan_misdn_log(2, ch->bc->port, " --> buffer_len:%d\n", ch->jb_len);
 				break;
 			case 't' :
 				ch->jb_upper_threshold = atoi(++tok);
-				chan_misdn_log(1, ch->bc->port, " --> upper_threshold:%d\n", ch->jb_upper_threshold);
+				chan_misdn_log(2, ch->bc->port, " --> upper_threshold:%d\n", ch->jb_upper_threshold);
 				break;
 			case 'n':
 				ch->bc->nojitter = 1;
-				chan_misdn_log(1, ch->bc->port, " --> nojitter\n");
+				chan_misdn_log(2, ch->bc->port, " --> nojitter\n");
 				break;
 			default:
 				ch->jb_len = 4000;
 				ch->jb_upper_threshold = 0;
-				chan_misdn_log(1, ch->bc->port, " --> buffer_len:%d (default)\n", ch->jb_len);
-				chan_misdn_log(1, ch->bc->port, " --> upper_threshold:%d (default)\n", ch->jb_upper_threshold);
+				chan_misdn_log(2, ch->bc->port, " --> buffer_len:%d (default)\n", ch->jb_len);
+				chan_misdn_log(2, ch->bc->port, " --> upper_threshold:%d (default)\n", ch->jb_upper_threshold);
 			}
 			break;
 		case 'v':
@@ -4334,10 +4346,10 @@
 					gain = 8;
 				if (*tok == 'r') {
 					ch->bc->rxgain = gain;
-					chan_misdn_log(1, ch->bc->port, "SETOPT: RX-Volume:%d\n", gain);
+					chan_misdn_log(2, ch->bc->port, "SETOPT: RX-Volume:%d\n", gain);
 				} else {
 					ch->bc->txgain = gain;
-					chan_misdn_log(1, ch->bc->port, "SETOPT: TX-Volume:%d\n", gain);
+					chan_misdn_log(2, ch->bc->port, "SETOPT: TX-Volume:%d\n", gain);
 				}
 			}
 			break;
@@ -4351,9 +4363,9 @@
 			chan_misdn_log(0, ch->bc->port, "SETOPT: crypt with key:%s\n", misdn_key_vector[keyidx]);
 			break;
 		case 'e':
-			chan_misdn_log(1, ch->bc->port, "SETOPT: EchoCancel\n");
+			chan_misdn_log(2, ch->bc->port, "SETOPT: EchoCancel\n");
 			if (neglect) {
-				chan_misdn_log(1, ch->bc->port, " --> disabled\n");
+				chan_misdn_log(2, ch->bc->port, " --> disabled\n");
 				ch->bc->ec_enable = 0;
 			} else {
 				ch->bc->ec_enable = 1;
@@ -4362,9 +4374,9 @@
 			}
 			break;
 		case 'h':
-			chan_misdn_log(1, ch->bc->port, "SETOPT: Digital\n");
+			chan_misdn_log(2, ch->bc->port, "SETOPT: Digital\n");
 			if (strlen(tok) > 1 && tok[1] == '1') {
-				chan_misdn_log(1, ch->bc->port, "SETOPT: HDLC \n");
+				chan_misdn_log(2, ch->bc->port, "SETOPT: HDLC \n");
 				if (!ch->bc->hdlc) {
 					ch->bc->hdlc = 1;
 					misdn_lib_setup_bc(ch->bc);
@@ -4373,20 +4385,20 @@
 			ch->bc->capability = INFO_CAPABILITY_DIGITAL_UNRESTRICTED;
 			break;
 		case 's':
-			chan_misdn_log(1, ch->bc->port, "SETOPT: Send DTMF\n");
+			chan_misdn_log(2, ch->bc->port, "SETOPT: Send DTMF\n");
 			ch->bc->send_dtmf = 1;
 			break;
 		case 'f':
-			chan_misdn_log(1, ch->bc->port, "SETOPT: Faxdetect\n");
+			chan_misdn_log(2, ch->bc->port, "SETOPT: Faxdetect\n");
 			ch->faxdetect = 1;
 			cm_get_int(misdn_cm, ch->faxdetect_timeout, PORT, MCFG_FAXDETECT_TIMEOUT);
 			break;
 		case 'a':
-			chan_misdn_log(1, ch->bc->port, "SETOPT: AST_DSP (for DTMF)\n");
+			chan_misdn_log(2, ch->bc->port, "SETOPT: AST_DSP (for DTMF)\n");
 			ch->ast_dsp = 1;
 			break;
 		case 'p':
-			chan_misdn_log(1, ch->bc->port, "SETOPT: callerpres: %s\n", &tok[1]);
+			chan_misdn_log(2, ch->bc->port, "SETOPT: callerpres: %s\n", &tok[1]);
 			/* CRICH: callingpres!!! */
 			if (strstr(tok, "allowed"))
 				ch->bc->pres = 0;
@@ -4408,7 +4420,7 @@
 			ch->trans = ast_translator_build_path(AST_FORMAT_SLINEAR, AST_FORMAT_ALAW);
 	}
 	if (ch->ast_dsp) {
-		chan_misdn_log(1, ch->bc->port, "SETOPT: with AST_DSP we deactivate mISDN_dsp\n");
+		chan_misdn_log(2, ch->bc->port, "SETOPT: with AST_DSP we deactivate mISDN_dsp\n");
 		ch->bc->nodsp = 1;
 		ch->bc->nojitter = 1;
 	}

Modified: team/group/trunk-cm-csel-hash/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/group/trunk-cm-csel-hash/channels/misdn/isdn_lib.c?view=diff&rev=47360&r1=47359&r2=47360
==============================================================================
--- team/group/trunk-cm-csel-hash/channels/misdn/isdn_lib.c (original)
+++ team/group/trunk-cm-csel-hash/channels/misdn/isdn_lib.c Thu Nov  9 07:22:01 2006
@@ -430,7 +430,7 @@
 {
 	int i;
 
-	cb_log(1,stack->port,"find_free_chan: req_chan:%d\n",channel);
+	cb_log(2,stack->port,"find_free_chan: req_chan:%d\n",channel);
 
 	if (channel < 0 || channel > MAX_BCHANS) {
 		cb_log(4, stack->port, " !! out of bound call to find_free_chan_in_stack! (ch:%d)\n", channel);
@@ -442,7 +442,7 @@
 	for (i = 0; i < stack->b_num; i++) {
 		if (i != 15 && (channel < 0 || i == channel)) { /* skip E1 Dchannel ;) and work with chan preselection */
 			if (!stack->channels[i]) {
-				cb_log (1, stack->port, " --> found chan%s: %d\n", channel>=0?" (preselected)":"", i+1);
+				cb_log(2, stack->port, " --> found chan%s: %d\n", channel>=0?" (preselected)":"", i+1);
 				stack->channels[i] = 1;
 				bc->channel=i+1;
 				cb_event(EVENT_NEW_CHANNEL, bc, NULL);
@@ -1606,7 +1606,7 @@
 	struct misdn_stack *stack=get_stack_by_bc(bc);
 
 	if (!stack) {
-		cb_log(1,0,"misdn_release: No Stack found\n");
+		cb_log(2,0,"misdn_release: No Stack found\n");
 		return;
 	}
 	
@@ -2060,7 +2060,7 @@
 				if (reject) {
 					switch(bc->cause){
 						case 17:
-							cb_log(1, stack->port, "Siemens Busy reject..\n");
+							cb_log(2, stack->port, "Siemens Busy reject..\n");
 
 							break;
 						default:
@@ -2258,7 +2258,7 @@
 	struct misdn_bchannel *bc=find_bc_by_addr(frm->addr);
 	
 	if (!bc) {
-		cb_log(1,0,"handle_bchan: BC not found for prim:%x with addr:%x dinfo:%x\n", frm->prim, frm->addr, frm->dinfo);
+		cb_log(2,0,"handle_bchan: BC not found for prim:%x with addr:%x dinfo:%x\n", frm->prim, frm->addr, frm->dinfo);
 		return 0 ;
 	}
 	
@@ -2474,7 +2474,7 @@
 #endif
 				
 				if (i<0) {
-					cb_log(10,stack->port,"cb_event returned <0\n");
+					cb_log(20,stack->port,"cb_event returned <0\n");
 					/*clean_up_bc(bc);*/
 				}
 			}
@@ -2730,10 +2730,10 @@
 	switch(frm->prim) {
 
 	case DL_ESTABLISH | REQUEST:
-		cb_log(1,stack->port,"DL_ESTABLISH|REQUEST \n");
+		cb_log(2,stack->port,"DL_ESTABLISH|REQUEST \n");
 		return 1;
 	case DL_RELEASE | REQUEST:
-		cb_log(1,stack->port,"DL_RELEASE|REQUEST \n");
+		cb_log(2,stack->port,"DL_RELEASE|REQUEST \n");
 		return 1;
 		
 	case DL_ESTABLISH | INDICATION:
@@ -3093,7 +3093,7 @@
 				}
 			}
 
-			cb_log(1,port,"There is no free channel on port (%d)\n",port);
+			cb_log(2,port,"There is no free channel on port (%d)\n",port);
 			return NULL;
 		}
 	}
@@ -3173,13 +3173,13 @@
 	if ( stack->nt && !stack->l1link) {
 		/** Queue Event **/
 		bc->evq=event;
-		cb_log(1, stack->port, "Queueing Event %s because L1 is down (btw. Activating L1)\n", isdn_get_info(msgs_g, event, 0));
+		cb_log(2, stack->port, "Queueing Event %s because L1 is down (btw. Activating L1)\n", isdn_get_info(msgs_g, event, 0));
 		misdn_lib_get_l1_up(stack);
 		return 0;
 	}
 	
-	cb_log(1, stack->port, "I SEND:%s oad:%s dad:%s pid:%d\n", isdn_get_info(msgs_g, event, 0), bc->oad, bc->dad, bc->pid);
-	cb_log(1, stack->port, " --> bc_state:%s\n",bc_state2str(bc->bc_state));
+	cb_log(2, stack->port, "I SEND:%s oad:%s dad:%s pid:%d\n", isdn_get_info(msgs_g, event, 0), bc->oad, bc->dad, bc->pid);
+	cb_log(2, stack->port, " --> bc_state:%s\n",bc_state2str(bc->bc_state));
 	misdn_lib_log_ies(bc);
 	
 	switch (event) {
@@ -3637,7 +3637,7 @@
 					
 					struct misdn_bchannel *bc=find_bc_by_l3id(stack,frm->addr);
 					if (bc) {
-						cb_log(1,bc->port,"CLEARSTACK queued, cleaning up\n");
+						cb_log(2,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);
@@ -3844,7 +3844,7 @@
 			mISDN_write_frame(help->midev, buf, help->bc[i].addr, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC);
 			help->bc[i].addr = 0;
 		}
-		cb_log (1, help->port, "Destroying this port.\n");
+		cb_log(2, help->port, "Destroying this port.\n");
 		stack_destroy(help);
 	}
 	
@@ -3862,7 +3862,7 @@
 		}
 	}
   
-	cb_log(1, 0, "Closing mISDN device\n");
+	cb_log(2, 0, "Closing mISDN device\n");
 	te_lib_destroy(glob_mgr->midev);
 }
 
@@ -4202,15 +4202,15 @@
 
 	struct misdn_stack *stack=get_stack_by_bc(bc);
 	
-	cb_log(1, stack?stack->port:0,"ec_enable\n");
+	cb_log(2, stack?stack->port:0,"ec_enable\n");
 
 	if (!misdn_cap_is_speech(bc->capability)) {
-		cb_log(1, stack?stack->port:0, " --> no speech? cannot enable EC\n");
+		cb_log(2, stack?stack->port:0, " --> no speech? cannot enable EC\n");
 		return;
 	}
 
 	if (bc->ec_enable) {
-		cb_log(1, stack?stack->port:0,"Sending Control ECHOCAN_ON taps:%d\n",bc->ec_deftaps);
+		cb_log(2, stack?stack->port:0,"Sending Control ECHOCAN_ON taps:%d\n",bc->ec_deftaps);
 	
 		switch (bc->ec_deftaps) {
 		case 4:
@@ -4242,15 +4242,15 @@
 {
 	struct misdn_stack *stack=get_stack_by_bc(bc);
 	
-	cb_log(1, stack?stack->port:0,"ec_disable\n");
+	cb_log(2, stack?stack->port:0,"ec_disable\n");
 
 	if (!misdn_cap_is_speech(bc->capability)) {
-		cb_log(1, stack?stack->port:0, " --> no speech? cannot disable EC\n");
+		cb_log(2, stack?stack->port:0, " --> no speech? cannot disable EC\n");
 		return;
 	}
 
 	if ( ! bc->ec_enable) {
-		cb_log(1, stack?stack->port:0, "Sending Control ECHOCAN_OFF\n");
+		cb_log(2, stack?stack->port:0, "Sending Control ECHOCAN_OFF\n");
 		manager_ph_control(bc,  ECHOCAN_OFF, 0);
 	}
 }
@@ -4267,7 +4267,7 @@
 	manager_ph_control(bc, CMX_RECEIVE_OFF, 0);
 	manager_ph_control(bc, CMX_CONF_JOIN, conf_id);
 
-	cb_log(1,bc->port, "Joining bc:%x in conf:%d\n",bc->addr,conf_id);
+	cb_log(2,bc->port, "Joining bc:%x in conf:%d\n",bc->addr,conf_id);
 
 	char data[16];
 	int len=15;
@@ -4285,13 +4285,13 @@
 	manager_ph_control(bc, CMX_RECEIVE_ON, 0);
 	manager_ph_control(bc, CMX_CONF_SPLIT, conf_id);
 

[... 101 lines stripped ...]


More information about the svn-commits mailing list