[asterisk-commits] rmudgett: trunk r138738 - in /trunk: channels/ channels/misdn/ configs/ doc/tex/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 18 16:07:29 CDT 2008


Author: rmudgett
Date: Mon Aug 18 16:07:28 2008
New Revision: 138738

URL: http://svn.digium.com/view/asterisk?view=rev&rev=138738
Log:
channels/chan_misdn.c
*  Made bearer2str() use allowed_bearers_array[]
*  Made use the causes.h defines instead of hardcoded numbers.
*  Made use Asterisk presentation indicator values if either of the
mISDN presentation or screen options are negative.
*  Updated the misdn_set_opt application option descriptions.
*  Renamed the awkward Caller ID presentation misdn_set_opt
application option value not_screened to restricted.
Deprecated the not_screened option value.

channels/misdn/isdn_lib.c
*  Made use the causes.h defines instead of hardcoded numbers.
*  Fixed some spelling errors and typos.
*  Added all defined facility code strings to fac2str().

channels/misdn/isdn_lib.h
*  Added doxygen comments to struct misdn_bchannel.

channels/misdn/isdn_lib_intern.h
*  Added doxygen comments to struct misdn_stack.

channels/misdn_config.c
configs/misdn.conf.sample
*  Updated the mISDN presentation and screen parameter descriptions.

doc/tex/misdn.tex
*  Updated the misdn_set_opt application option descriptions.
*  Fixed some spelling errors and typos.


Modified:
    trunk/channels/chan_misdn.c
    trunk/channels/misdn/isdn_lib.c
    trunk/channels/misdn/isdn_lib.h
    trunk/channels/misdn/isdn_lib_intern.h
    trunk/channels/misdn_config.c
    trunk/configs/misdn.conf.sample
    trunk/doc/tex/misdn.tex

Modified: trunk/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_misdn.c?view=diff&rev=138738&r1=138737&r2=138738
==============================================================================
--- trunk/channels/chan_misdn.c (original)
+++ trunk/channels/chan_misdn.c Mon Aug 18 16:07:28 2008
@@ -389,51 +389,35 @@
 
 
 struct allowed_bearers {
-	int cap;
-	int val;
-	char *name;
-	int deprecated;
+	char *name;			/*!< Bearer capability name string used in /etc/misdn.conf allowed_bearers */
+	char *display;		/*!< Bearer capability displayable name */
+	int cap;			/*!< SETUP message bearer capability field code value */
+	int deprecated;		/*!< TRUE if this entry is deprecated. (Misspelled or bad name to use) */
 };
 
-static struct allowed_bearers allowed_bearers_array[]= {
-	{INFO_CAPABILITY_SPEECH,1,"speech"},
-	{INFO_CAPABILITY_AUDIO_3_1K,2,"3_1khz"},
-	{INFO_CAPABILITY_DIGITAL_UNRESTRICTED,4,"digital_unrestricted"},
-	{INFO_CAPABILITY_DIGITAL_RESTRICTED,8,"digital_restricted"},
-	{INFO_CAPABILITY_DIGITAL_RESTRICTED,8,"digital_restriced", 1}, /* Allow misspelling for backwards compatibility */
-	{INFO_CAPABILITY_VIDEO,16,"video"}
+/* *INDENT-OFF* */
+static const struct allowed_bearers allowed_bearers_array[]= {
+	/* Name,                      Displayable Name       Bearer Capability,                    Deprecated */
+	{ "speech",                  "Speech",               INFO_CAPABILITY_SPEECH,               0 },
+	{ "3_1khz",                  "3.1KHz Audio",         INFO_CAPABILITY_AUDIO_3_1K,           0 },
+	{ "digital_unrestricted",    "Unrestricted Digital", INFO_CAPABILITY_DIGITAL_UNRESTRICTED, 0 },
+	{ "digital_restricted",      "Restricted Digital",   INFO_CAPABILITY_DIGITAL_RESTRICTED,   0 },
+	{ "digital_restriced",       "Restricted Digital",   INFO_CAPABILITY_DIGITAL_RESTRICTED,   1 }, /* Allow misspelling for backwards compatibility */
+	{ "video",                   "Video",                INFO_CAPABILITY_VIDEO,                0 }
 };
-
-static char *bearer2str(int cap) {
-	static char *bearers[]={
-		"Speech",
-		"Audio 3.1k",
-		"Unres Digital",
-		"Res Digital",
-		"Video",
-		"Unknown Bearer"
-	};
-	
-	switch (cap) {
-	case INFO_CAPABILITY_SPEECH:
-		return bearers[0];
-		break;
-	case INFO_CAPABILITY_AUDIO_3_1K:
-		return bearers[1];
-		break;
-	case INFO_CAPABILITY_DIGITAL_UNRESTRICTED:
-		return bearers[2];
-		break;
-	case INFO_CAPABILITY_DIGITAL_RESTRICTED:
-		return bearers[3];
-		break;
-	case INFO_CAPABILITY_VIDEO:
-		return bearers[4];
-		break;
-	default:
-		return bearers[5];
-		break;
-	}
+/* *INDENT-ON* */
+
+static const char *bearer2str(int cap)
+{
+	unsigned index;
+
+	for (index = 0; index < ARRAY_LEN(allowed_bearers_array); ++index) {
+		if (allowed_bearers_array[index].cap == cap) {
+			return allowed_bearers_array[index].display;
+		}
+	}	/* end for */
+
+	return "Unknown Bearer";
 }
 
 
@@ -700,7 +684,7 @@
 		} else {
 misdn_overlap_dial_task_disconnect:
 			hanguptone_indicate(ch);
-			ch->bc->out_cause=1;
+			ch->bc->out_cause = AST_CAUSE_UNALLOCATED;
 			ch->state=MISDN_CLEANING;
 			misdn_lib_send_event(ch->bc, EVENT_DISCONNECT);
 		}
@@ -1811,46 +1795,42 @@
 	misdn_cfg_get(port, MISDN_CFG_SCREEN, &screen, sizeof(screen));
 	chan_misdn_log(2, port, " --> pres: %d screen: %d\n", pres, screen);
 		
-	if ( (pres + screen) < 0 ) {
-
+	if (pres < 0 || screen < 0) {
 		chan_misdn_log(2, port, " --> pres: %x\n", ast->cid.cid_pres);
 			
 		switch (ast->cid.cid_pres & 0x60) {
-				
 		case AST_PRES_RESTRICTED:
 			bc->pres = 1;
-			chan_misdn_log(2, port, " --> PRES: Restricted (0x1)\n");
+			chan_misdn_log(2, port, " --> PRES: Restricted (1)\n");
 			break;
 		case AST_PRES_UNAVAILABLE:
 			bc->pres = 2;
-			chan_misdn_log(2, port, " --> PRES: Unavailable (0x2)\n");
+			chan_misdn_log(2, port, " --> PRES: Unavailable (2)\n");
 			break;
 		default:
 			bc->pres = 0;
-			chan_misdn_log(2, port, " --> PRES: Allowed (0x0)\n");
-		}
-			
+			chan_misdn_log(2, port, " --> PRES: Allowed (0)\n");
+			break;
+		}
+
 		switch (ast->cid.cid_pres & 0x3) {
-
+		default:
 		case AST_PRES_USER_NUMBER_UNSCREENED:
 			bc->screen = 0;
-			chan_misdn_log(2, port, " --> SCREEN: Unscreened (0x0)\n");
+			chan_misdn_log(2, port, " --> SCREEN: Unscreened (0)\n");
 			break;
 		case AST_PRES_USER_NUMBER_PASSED_SCREEN:
 			bc->screen = 1;
-			chan_misdn_log(2, port, " --> SCREEN: Passed Screen (0x1)\n");
+			chan_misdn_log(2, port, " --> SCREEN: Passed Screen (1)\n");
 			break;
 		case AST_PRES_USER_NUMBER_FAILED_SCREEN:
 			bc->screen = 2;
-			chan_misdn_log(2, port, " --> SCREEN: Failed Screen (0x2)\n");
+			chan_misdn_log(2, port, " --> SCREEN: Failed Screen (2)\n");
 			break;
 		case AST_PRES_NETWORK_NUMBER:
 			bc->screen = 3;
-			chan_misdn_log(2, port, " --> SCREEN: Network Nr. (0x3)\n");
-			break;
-		default:
-			bc->screen = 0;
-			chan_misdn_log(2, port, " --> SCREEN: Unscreened (0x0)\n");
+			chan_misdn_log(2, port, " --> SCREEN: Network Nr. (3)\n");
+			break;
 		}
 	} else {
 		bc->screen = screen;
@@ -2666,7 +2646,7 @@
 		if (p->bc->nt) {
 			start_bc_tones(p);
 			hanguptone_indicate(p);
-			p->bc->progress_indicator = 8;
+			p->bc->progress_indicator = INFO_PI_INBAND_AVAILABLE;
 		}
 		if (bc->need_disconnect)
 			misdn_lib_send_event( bc, EVENT_DISCONNECT);
@@ -2964,7 +2944,7 @@
 		return 0;
 	}
 
-	chan_misdn_log(9, ch->bc->port, "Sending :%d bytes 2 MISDN\n", frame->samples);
+	chan_misdn_log(9, ch->bc->port, "Sending :%d bytes to MISDN\n", frame->samples);
 	if ( !ch->bc->nojitter && misdn_cap_is_speech(ch->bc->capability) ) {
 		/* Buffered Transmit (triggered by read from isdn side)*/
 		if (misdn_jb_fill(ch->jb, frame->data.ptr, frame->samples) < 0) {
@@ -3224,7 +3204,7 @@
 	}
 
 	if (misdn_cfg_is_group_method(group, METHOD_STANDARD_DEC)) {
-		chan_misdn_log(4, port, " --> STARTING STANDARDDEC...\n");
+		chan_misdn_log(4, port, " --> STARTING STANDARD DEC...\n");
 		dec = 1;
 	}
 
@@ -3828,12 +3808,13 @@
 
 	switch (bc->cause) {
 
-	case 1: /** Congestion Cases **/
-	case 2:
-	case 3:
- 	case 4:
- 	case 22:
- 	case 27:
+	case AST_CAUSE_UNALLOCATED:
+	case AST_CAUSE_NO_ROUTE_TRANSIT_NET:
+	case AST_CAUSE_NO_ROUTE_DESTINATION:
+ 	case 4:	/* Send special information tone */
+ 	case AST_CAUSE_NUMBER_CHANGED:
+ 	case AST_CAUSE_DESTINATION_OUT_OF_ORDER:
+		/* Congestion Cases */
 		/*
 		 * Not Queueing the Congestion anymore, since we want to hear
 		 * the inband message
@@ -3845,9 +3826,8 @@
 		*/
 		break;
 
-	case 21:
-	case 17: /* user busy */
-
+	case AST_CAUSE_CALL_REJECTED:
+	case AST_CAUSE_USER_BUSY:
 		ch->state = MISDN_BUSY;
 
 		if (!ch->need_busy) {
@@ -4139,14 +4119,14 @@
 					break;
 				}
 
-				ast_log(LOG_WARNING, "Extension can never match, so disconnecting on port(%d)."
-						"maybe you want to add an 'i' extension to catch this case.\n",
+				ast_log(LOG_WARNING, "Extension can never match, so disconnecting on port(%d).\n"
+						"\tMaybe you want to add an 'i' extension to catch this case.\n",
 						bc->port);
 
 				if (bc->nt)
 					hanguptone_indicate(ch);
 				ch->state = MISDN_EXTCANTMATCH;
-				bc->out_cause = 1;
+				bc->out_cause = AST_CAUSE_UNALLOCATED;
 
 				misdn_lib_send_event(bc, EVENT_DISCONNECT);
 				break;
@@ -4226,7 +4206,7 @@
 			int cause;
 			chan_misdn_log(0, bc->port, " --> Call Waiting on PMP sending RELEASE_COMPLETE\n");
 			misdn_cfg_get(bc->port, MISDN_CFG_REJECT_CAUSE, &cause, sizeof(cause));
-			bc->out_cause = cause ? cause : 16;
+			bc->out_cause = cause ? cause : AST_CAUSE_NORMAL_CLEARING;
 			return RESPONSE_RELEASE_SETUP;
 		}
 
@@ -4241,7 +4221,7 @@
 			int cause;
 			chan_misdn_log(0, bc->port, " --> Call Waiting on PMP sending RELEASE_COMPLETE\n");
 			misdn_cfg_get(bc->port, MISDN_CFG_REJECT_CAUSE, &cause, sizeof(cause));
-			bc->out_cause = cause ? cause : 16;
+			bc->out_cause = cause ? cause : AST_CAUSE_NORMAL_CLEARING;
 			return RESPONSE_RELEASE_SETUP;
 		}
 
@@ -4289,17 +4269,19 @@
 			break;
 		case 2:
 			pres = AST_PRES_UNAVAILABLE;
-			chan_misdn_log(2, bc->port, " --> PRES: Restricted (2)\n");
+			chan_misdn_log(2, bc->port, " --> PRES: Unavailable (2)\n");
 			break;
 		default:
 			pres = AST_PRES_ALLOWED;
-			chan_misdn_log(2, bc->port, " --> PRES: Restricted (%d)\n", bc->pres);
+			chan_misdn_log(2, bc->port, " --> PRES: Allowed (%d)\n", bc->pres);
+			break;
 		}
 
 		switch (bc->screen) {
+		default:
 		case 0:
 			screen = AST_PRES_USER_NUMBER_UNSCREENED;
-			chan_misdn_log(2, bc->port, " --> SCREEN: Unscreened (0)\n");
+			chan_misdn_log(2, bc->port, " --> SCREEN: Unscreened (%d)\n", bc->screen);
 			break;
 		case 1:
 			screen = AST_PRES_USER_NUMBER_PASSED_SCREEN;
@@ -4313,12 +4295,9 @@
 			screen = AST_PRES_NETWORK_NUMBER;
 			chan_misdn_log(2, bc->port, " --> SCREEN: Network Number (3)\n");
 			break;
-		default:
-			screen = AST_PRES_USER_NUMBER_UNSCREENED;
-			chan_misdn_log(2, bc->port, " --> SCREEN: Unscreened (%d)\n", bc->screen);
-		}
-
-		chan->cid.cid_pres = pres + screen;
+		}
+
+		chan->cid.cid_pres = pres | screen;
 
 		pbx_builtin_setvar_helper(chan, "TRANSFERCAPABILITY", ast_transfercapability2str(bc->capability));
 		chan->transfercapability = bc->capability;
@@ -4408,8 +4387,8 @@
 				break;
 			}
 
-			ast_log(LOG_WARNING, "Extension can never match, so disconnecting on port(%d)."
-					"maybe you want to add an 'i' extension to catch this case.\n",
+			ast_log(LOG_WARNING, "Extension can never match, so disconnecting on port(%d).\n"
+					"\tMaybe you want to add an 'i' extension to catch this case.\n",
 					bc->port);
 			if (bc->nt)
 				hanguptone_indicate(ch);
@@ -4784,7 +4763,7 @@
 			}
 			
 			if (FD_ISSET(ch->pipe[1], &wrfs)) {
-				chan_misdn_log(9, bc->port, "writing %d bytes 2 asterisk\n", bc->bframe_len);
+				chan_misdn_log(9, bc->port, "writing %d bytes to asterisk\n", bc->bframe_len);
 				if (write(ch->pipe[1], bc->bframe, bc->bframe_len) <= 0) {
 					chan_misdn_log(0, bc->port, "Write returned <=0 (err=%s) --> hanging up channel\n", strerror(errno));
 
@@ -4814,7 +4793,7 @@
 		case MISDN_PROCEEDING:
 		case MISDN_CALLING_ACKNOWLEDGE:
 			if (bc->nt) {
-				bc->progress_indicator = 8;
+				bc->progress_indicator = INFO_PI_INBAND_AVAILABLE;
 				hanguptone_indicate(ch);
 			}
 				
@@ -4824,7 +4803,7 @@
 
 		case MISDN_WAITING4DIGS:
 			if (bc->nt) {
-				bc->progress_indicator = 8;
+				bc->progress_indicator = INFO_PI_INBAND_AVAILABLE;
 				bc->out_cause = AST_CAUSE_UNALLOCATED;
 				hanguptone_indicate(ch);
 				misdn_lib_send_event(bc, EVENT_DISCONNECT);
@@ -5117,20 +5096,30 @@
 	ast_cli_register_multiple(chan_misdn_clis, sizeof(chan_misdn_clis) / sizeof(struct ast_cli_entry));
 
 	ast_register_application("misdn_set_opt", misdn_set_opt_exec, "misdn_set_opt",
-				 "misdn_set_opt(:<opt><optarg>:<opt><optarg>..):\n"
-				 "Sets mISDN opts. and optargs\n"
-				 "\n"
-				 "The available options are:\n"
-				 "    d - Send display text on called phone, text is the optparam\n"
-				 "    n - don't detect dtmf tones on called channel\n"
-				 "    h - make digital outgoing call\n" 
-				 "    c - make crypted outgoing call, param is keyindex\n"
-				 "    e - perform echo cancelation on this channel,\n"
-				 "        takes taps as arguments (32,64,128,256)\n"
-				 "    s - send Non Inband DTMF as inband\n"
-				 "   vr - rxgain control\n"
-				 "   vt - txgain control\n"
-				 "    i - Ignore detected dtmf tones, don't signal them to asterisk, they will be transported inband.\n"
+		"misdn_set_opt(:<opt><optarg>:<opt><optarg>...):\n"
+		"Sets mISDN opts. and optargs\n"
+		"\n"
+		"The available options are:\n"
+		"    a - Have Asterisk detect DTMF tones on called channel\n"
+		"    c - Make crypted outgoing call, optarg is keyindex\n"
+		"    d - Send display text to called phone, text is the optarg\n"
+		"    e - Perform echo cancelation on this channel,\n"
+		"        takes taps as optarg (32,64,128,256)\n"
+		"   e! - Disable echo cancelation on this channel\n"
+		"    f - Enable fax detection\n"
+		"    h - Make digital outgoing call\n" 
+		"   h1 - Make HDLC mode digital outgoing call\n" 
+		"    i - Ignore detected DTMF tones, don't signal them to Asterisk,\n"
+		"        they will be transported inband.\n"
+		"   jb - Set jitter buffer length, optarg is length\n"
+		"   jt - Set jitter buffer upper threshold, optarg is threshold\n"
+		"   jn - Disable jitter buffer\n"
+		"    n - Don't have mISDN detect DTMF tones on called channel\n"
+		"    p - Caller ID presentation,\n"
+		"        optarg is either 'allowed' or 'restricted'\n"
+		"    s - Send Non-inband DTMF as inband\n"
+		"   vr - Rx gain control, optarg is gain\n"
+		"   vt - Tx gain control, optarg is gain\n"
 		);
 
 	
@@ -5481,7 +5470,10 @@
 			/* CRICH: callingpres!!! */
 			if (strstr(tok,"allowed")) {
 				ch->bc->pres = 0;
+			} else if (strstr(tok, "restricted")) {
+				ch->bc->pres = 1;
 			} else if (strstr(tok, "not_screened")) {
+				chan_misdn_log(0, ch->bc->port, "SETOPT: callerpres: not_screened is deprecated\n");
 				ch->bc->pres = 1;
 			}
 			break;

Modified: trunk/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/misdn/isdn_lib.c?view=diff&rev=138738&r1=138737&r2=138738
==============================================================================
--- trunk/channels/misdn/isdn_lib.c (original)
+++ trunk/channels/misdn/isdn_lib.c Mon Aug 18 16:07:28 2008
@@ -25,6 +25,14 @@
 #include "isdn_lib_intern.h"
 #include "isdn_lib.h"
 
+/* 
+ * Define ARRAY_LEN() because I cannot
+ * #include "asterisk/utils.h"
+ */
+#define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0]))
+
+#include "asterisk/causes.h"
+
 void misdn_join_conf(struct misdn_bchannel *bc, int conf_id);
 void misdn_split_conf(struct misdn_bchannel *bc, int conf_id);
 
@@ -137,17 +145,16 @@
 }
 
 
-struct misdn_stack* get_stack_by_bc(struct misdn_bchannel *bc)
-{
-	struct misdn_stack *stack=get_misdn_stack();
-
-	if (!bc) return NULL;
-	
-	for ( ; stack; stack=stack->next) {
-		int i;
-		for (i=0; i <=stack->b_num; i++) {
-			if ( bc->port == stack->port) return stack;
-		}
+struct misdn_stack *get_stack_by_bc(struct misdn_bchannel *bc)
+{
+	struct misdn_stack *stack = get_misdn_stack();
+
+	if (!bc)
+		return NULL;
+	
+	for ( ; stack; stack = stack->next) {
+		if (bc->port == stack->port)
+			return stack;
 	}
 
 	return NULL;
@@ -163,12 +170,13 @@
 	}
 	
 	if (stack) {
-		sprintf(buf, "* Port %d Type %s Prot. %s L2Link %s L1Link:%s Blocked:%d", stack->port, stack->nt?"NT":"TE", stack->ptp?"PTP":"PMP", stack->l2link?"UP":"DOWN", stack->l1link?"UP":"DOWN",stack->blocked);
-
+		sprintf(buf, "* Port %d Type %s Prot. %s L2Link %s L1Link:%s Blocked:%d",
+			stack->port, stack->nt ? "NT" : "TE", stack->ptp ? "PTP" : "PMP",
+			stack->l2link ? "UP" : "DOWN", stack->l1link ? "UP" : "DOWN",
+			stack->blocked);
 	} else {
 		buf[0]=0;
 	}
-	
 }
 
 
@@ -193,8 +201,9 @@
 
 
 struct misdn_lib {
+	/*! \brief mISDN device handle returned by mISDN_open() */
 	int midev;
-	int midev_nt;
+	int midev_nt;	/* Not used */
 
 	pthread_t event_thread;
 	pthread_t event_handler_thread;
@@ -262,9 +271,6 @@
 struct misdn_bchannel *stack_holder_find(struct misdn_stack *stack, unsigned long l3id);
 
 /* from isdn_lib.h */
-int init_bc(struct misdn_stack * stack,  struct misdn_bchannel *bc, int midev, int port, int bidx, char *msn, int firsttime);
-struct misdn_stack* stack_init(int midev,  int port, int ptp);
-void stack_destroy(struct misdn_stack* stack);
 	/* user iface */
 int te_lib_init( void ) ; /* returns midev */
 void te_lib_destroy(int midev) ;
@@ -439,8 +445,10 @@
 int misdn_inband_avail(struct misdn_bchannel *bc)
 {
 
-	/*if ! early_bconnect we have never inband available*/
-	if ( ! bc->early_bconnect ) return 0;
+	if (!bc->early_bconnect) {
+		/* We have opted to never receive any available inband recorded messages */
+		return 0;
+	}
 	
 	switch (bc->progress_indicator) {
 	case INFO_PI_INBAND_AVAILABLE:
@@ -517,7 +525,7 @@
 
  	if (dec) {
 		for (i = bnums; i >=0; i--) {
-			if (i != 15 && (channel < 0 || i == channel)) { /* skip E1 Dchannel ;) and work with chan preselection */
+			if (i != 15 && (channel < 0 || i == channel)) { /* skip E1 D channel ;) and work with chan preselection */
 				if (!stack->channels[i]) {
 					cb_log (3, stack->port, " --> found chan%s: %d\n", channel>=0?" (preselected)":"", i+1);
 					chan=i+1;
@@ -527,7 +535,7 @@
 		}
 	} else {
 		for (i = 0; i <= bnums; i++) {
-			if (i != 15 && (channel < 0 || i == channel)) { /* skip E1 Dchannel ;) and work with chan preselection */
+			if (i != 15 && (channel < 0 || i == channel)) { /* skip E1 D channel ;) and work with chan preselection */
 				if (!stack->channels[i]) {
 					cb_log (3, stack->port, " --> found chan%s: %d\n", channel>=0?" (preselected)":"", i+1);
 					chan=i+1;
@@ -540,13 +548,13 @@
 	if (!chan) {
 		cb_log (1, stack->port, " !! NO FREE CHAN IN STACK\n");
 		dump_chan_list(stack);
-		bc->out_cause=34;
+		bc->out_cause = AST_CAUSE_NORMAL_CIRCUIT_CONGESTION;
 		return -1;
 	}	
 
 	if (set_chan_in_stack(stack, chan)<0) {
 		cb_log (0, stack->port, "Channel Already in use:%d\n", chan);
-		bc->out_cause=44;
+		bc->out_cause = AST_CAUSE_REQUESTED_CHAN_UNAVAIL;
 		return -1;
 	}
 
@@ -683,9 +691,9 @@
 
 	bc->orig=0;
   
-	bc->cause=16;
-	bc->out_cause=16;
-	bc->pres=0 ; /* screened */
+	bc->cause = AST_CAUSE_NORMAL_CLEARING;
+	bc->out_cause = AST_CAUSE_NORMAL_CLEARING;
+	bc->pres = 0;	/* allowed */
 	
 	bc->evq=EVENT_NOTHING;
 
@@ -909,7 +917,7 @@
 			if (stack->procids[i]==0) break;
     
 		if (i== MAXPROCS) {
-			cb_log(0, stack->port, "Couldnt Create New ProcId.\n");
+			cb_log(0, stack->port, "Couldn't Create New ProcId.\n");
 			return -1;
 		}
 		stack->procids[i]=1;
@@ -990,13 +998,13 @@
 		case BCHAN_CLEANED:
 			break;
 		default:
-			cb_log(4, stack->port, "$$$ bc already upsetted stid :%x (state:%s)\n", b_stid, bc_state2str(bc->bc_state) );
+			cb_log(4, stack->port, "$$$ bc already setup stid :%x (state:%s)\n", b_stid, bc_state2str(bc->bc_state) );
 			return -1;
 	}
 	
 	cb_log(5, stack->port, "$$$ Setting up bc with stid :%x\n", b_stid);
 	
-	/*check if the b_stid is alread initialized*/
+	/*check if the b_stid is already initialized*/
 	for (i=0; i <= stack->b_num; i++) {
 		if (stack->bc[i].b_stid == b_stid) {
 			cb_log(0, bc->port, "setup_bc: b_stid:%x already in use !!!\n", b_stid);
@@ -1046,10 +1054,9 @@
 				li.name[l-1] = 0;
 			}
 			li.pid.layermask = ISDN_LAYER((4));
-			li.pid.protocol[4] = ISDN_PID_L4_B_USER
-;
+			li.pid.protocol[4] = ISDN_PID_L4_B_USER;
+
 			bc->layer=4;
-			
 		}  
 		
 		ret = mISDN_new_layer(midev, &li);
@@ -1138,7 +1145,7 @@
 
 
 /** IFACE **/
-int init_bc(struct misdn_stack *stack,  struct misdn_bchannel *bc, int midev, int port, int bidx,  char *msn, int firsttime)
+static int init_bc(struct misdn_stack *stack, struct misdn_bchannel *bc, int midev, int port, int bidx, char *msn, int firsttime)
 {
 	unsigned char buff[1025] = "";
 	iframe_t *frm = (iframe_t *)buff;
@@ -1151,7 +1158,9 @@
 	memset(bc, 0,sizeof(struct misdn_bchannel));
 
 	bc->send_lock=malloc(sizeof(struct send_lock));
-
+	if (!bc->send_lock) {
+		return -1;
+	}
 	pthread_mutex_init(&bc->send_lock->lock, NULL);
 	
 	if (msn) {
@@ -1176,6 +1185,9 @@
 		clear_ibuffer( ibuf);
 		
 		ibuf->rsem=malloc(sizeof(sem_t));
+		if (!ibuf->rsem) {
+			return -1;
+		}
 		
 		bc->astbuf=ibuf;
 
@@ -1202,7 +1214,7 @@
 
 
 
-struct misdn_stack* stack_init( int midev, int port, int ptp )
+static struct misdn_stack *stack_init(int midev, int port, int ptp)
 {
 	int ret;
 	unsigned char buff[1025];
@@ -1387,7 +1399,7 @@
 }
 
 
-void stack_destroy(struct misdn_stack* stack)
+static void stack_destroy(struct misdn_stack *stack)
 {
 	char buf[1024];
 	if (!stack) return;
@@ -1646,7 +1658,7 @@
 			struct misdn_bchannel dummybc;
       
 			if (!bc) {
-				cb_log(4, stack->port, " --> Didn't found BC so temporarly creating dummy BC (l3id:%x) on this port.\n", frm->dinfo);
+				cb_log(4, stack->port, " --> Didn't find BC so temporarily creating dummy BC (l3id:%x) on this port.\n", frm->dinfo);
 				misdn_make_dummy(&dummybc, stack->port, frm->dinfo, stack->nt, 0);
 				
 				bc=&dummybc; 
@@ -1673,7 +1685,7 @@
 				dump_chan_list(stack);
 
 				if (bc->stack_holder) {
-					cb_log(4,stack->port, "REMOVEING Holder\n");
+					cb_log(4,stack->port, "REMOVING Holder\n");
 					stack_holder_remove( stack, bc);
 					free(bc);
 				}
@@ -1692,7 +1704,7 @@
 }
 
 
-/*Emptys bc if it's reserved (no SETUP out yet)*/
+/* Empties bc if it's reserved (no SETUP out yet) */
 void misdn_lib_release(struct misdn_bchannel *bc)
 {
 	struct misdn_stack *stack=get_stack_by_bc(bc);
@@ -1801,10 +1813,10 @@
 	frm.addr=stack->upper_id | FLG_MSG_DOWN;
 
 	frm.prim = CC_RELEASE_CR|INDICATION;
-	cb_log(4, stack->port, " --> CC_RELEASE_CR: Faking Realease_cr for %x l3id:%x\n",frm.addr, frm.dinfo);
+	cb_log(4, stack->port, " --> CC_RELEASE_CR: Faking Release_cr for %x l3id:%x\n",frm.addr, frm.dinfo);
 	/** removing procid **/
 	if (!bc) {
-		cb_log(4, stack->port, " --> Didn't found BC so temporarly creating dummy BC (l3id:%x) on this port.\n", hh->dinfo);
+		cb_log(4, stack->port, " --> Didn't find BC so temporarily creating dummy BC (l3id:%x) on this port.\n", hh->dinfo);
 		misdn_make_dummy(&dummybc, stack->port, hh->dinfo, stack->nt, 0);
 		bc=&dummybc; 
 	}
@@ -1815,7 +1827,7 @@
 			stack->procids[bc->l3_id&0xff] = 0 ;
 		}
 	}
-	else cb_log(0, stack->port, "Couldnt find BC so I couldnt remove the Process!!!! this is a bad port.\n");
+	else cb_log(0, stack->port, "Couldn't find BC so I couldn't remove the Process!!!! this is a bad port.\n");
 
 	if (handle_cr(stack, &frm)<0) {
 	}
@@ -1868,7 +1880,7 @@
 			cb_log(4, stack->port, "bc_l3id:%x holded_bc_l3id:%x\n",bc->l3_id, hold_bc->l3_id);
 
 			if (hold_bc) {
-				cb_log(4, stack->port, "REMOVEING Holder\n");
+				cb_log(4, stack->port, "REMOVING Holder\n");
 
 				/*swap the backup to our new channel back*/
 				stack_holder_remove(stack, hold_bc);
@@ -2045,7 +2057,7 @@
 				cb_log(3 , stack->port, "%% GOT L2 DeActivate Info.\n");
 
 				if (stack->l2upcnt>3) {
-					cb_log(0 , stack->port, "!!! Could not Get the L2 up after 3 Attemps!!!\n");
+					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);
@@ -2077,7 +2089,7 @@
 		bc=find_bc_by_l3id(stack, hh->dinfo);
     
 		if (!bc) {
-			cb_log(4, stack->port, " --> Didn't found BC so temporarly creating dummy BC (l3id:%x).\n", hh->dinfo);
+			cb_log(4, stack->port, " --> Didn't find BC so temporarily creating dummy BC (l3id:%x).\n", hh->dinfo);
 			misdn_make_dummy(&dummybc, stack->port,  hh->dinfo, stack->nt, 0);
 			bc=&dummybc; 
 		}
@@ -2116,7 +2128,7 @@
 			} else {
 				if (reject) {
 					switch(bc->cause){
-						case 17:
+						case AST_CAUSE_USER_BUSY:
 							cb_log(1, stack->port, "Siemens Busy reject..\n");
 
 							break;
@@ -2678,12 +2690,12 @@
 				switch (response) {
 				case RESPONSE_IGNORE_SETUP_WITHOUT_CLOSE:
 
-					cb_log(0, stack->port, "TOTALY IGNORING SETUP \n");					
+					cb_log(0, stack->port, "TOTALLY IGNORING SETUP\n");					
 					
 					break;
 				case RESPONSE_IGNORE_SETUP:
 					/* I think we should send CC_RELEASE_CR, but am not sure*/
-					bc->out_cause=16;
+					bc->out_cause = AST_CAUSE_NORMAL_CLEARING;
 				
 				case RESPONSE_RELEASE_SETUP:
 					misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
@@ -2706,7 +2718,7 @@
 			}
 
 			if (event == EVENT_RELEASE_COMPLETE) {
-				/* release bchannel only after we've anounced the RELEASE_COMPLETE */
+				/* release bchannel only after we've announced the RELEASE_COMPLETE */
 				int channel=bc->channel;
 				int tmpcause=bc->cause;	
 				int tmp_out_cause=bc->out_cause;	
@@ -2715,8 +2727,8 @@
 				bc->out_cause=tmp_out_cause;
 				clean_up_bc(bc);
 				
-				if (tmpcause == 44) {
-					cb_log(0,stack->port,"**** Received CAUSE:44, so not cleaning up channel %d\n", channel);
+				if (tmpcause == AST_CAUSE_REQUESTED_CHAN_UNAVAIL) {
+					cb_log(0,stack->port,"**** Received CAUSE:%d, so not cleaning up channel %d\n", AST_CAUSE_REQUESTED_CHAN_UNAVAIL, channel);
 					cb_log(0,stack->port,"**** This channel is now no longer available,\nplease try to restart it with 'misdn send restart <port> <channel>'\n");
 					set_chan_in_stack(stack, channel);
 					bc->channel=channel;
@@ -2743,9 +2755,9 @@
 		} else {
 			struct misdn_bchannel dummybc;
 			if (frm->prim!=(CC_FACILITY|INDICATION))
-				cb_log(0, stack->port, " --> Didn't find BC so temporarly creating dummy BC (l3id:%x) on this port.\n", frm->dinfo);
+				cb_log(0, stack->port, " --> Didn't find BC so temporarily creating dummy BC (l3id:%x) on this port.\n", frm->dinfo);
 			else
-				cb_log(5, stack->port, " --> Using Dummy BC for FACILITy\n");
+				cb_log(5, stack->port, " --> Using Dummy BC for FACILITY\n");
 
 			memset (&dummybc,0,sizeof(dummybc));
 			dummybc.port=stack->port;
@@ -2787,7 +2799,7 @@
 		
 		for (i=0;i<=stack->b_num; i++) {
 			if (stack->bc[i].evq != EVENT_NOTHING) {
-				cb_log(4, stack->port, "Fireing Queued Event %s because L1 got up\n", isdn_get_info(msgs_g, stack->bc[i].evq, 0));
+				cb_log(4, stack->port, "Firing Queued Event %s because L1 got up\n", isdn_get_info(msgs_g, stack->bc[i].evq, 0));
 				misdn_lib_send_event(&stack->bc[i],stack->bc[i].evq);
 				stack->bc[i].evq=EVENT_NOTHING;
 			}
@@ -2973,7 +2985,7 @@
 		msg->len=r;
     
 		if (r==0) {
-			free_msg(msg); /* danger, cauz usualy freeing in main_loop */
+			free_msg(msg); /* danger, cause usually freeing in main_loop */
 			cb_log(6,0,"Got empty Msg..\n");
 			return NULL;
 		}
@@ -3014,6 +3026,7 @@
 	}
 }
 
+/* This is a thread */
 static void misdn_lib_isdn_event_catcher(void *arg)
 {
 	struct misdn_lib *mgr = arg;
@@ -3030,7 +3043,7 @@
 		
 		frm = (iframe_t*) msg->data;
 		
-		/** When we make a call from NT2Ast we get this frames **/
+		/** When we make a call from NT2Ast we get these frames **/
 		if (frm->len == 0 && frm->addr == 0 && frm->dinfo == 0 && frm->prim == 0 ) {
 			zero_frm++; 
 			free_msg(msg);
@@ -3094,7 +3107,7 @@
 	char buf[1024];
 	mISDN_write_frame(midev, buf, 0, MGR_DELENTITY | REQUEST, entity, 0, NULL, TIMEOUT_1SEC);
 
-	cb_log(4, 0, "Entetity deleted\n");
+	cb_log(4, 0, "Entity deleted\n");
 	mISDN_close(midev);
 	cb_log(4, 0, "midev closed\n");
 }
@@ -3157,7 +3170,7 @@
 	bc->need_disconnect=1;
 	bc->need_release=1;
 	bc->need_release_complete=1;
-	bc->cause=16;
+	bc->cause = AST_CAUSE_NORMAL_CLEARING;
 
 	if (++mypid>5000) mypid=1;
 	bc->pid=mypid;
@@ -3248,23 +3261,47 @@
 }
 
 
-static char *fac2str (enum FacFunction func)
-{
-	struct arr_el { 
-		enum FacFunction p; 
-		char *s ; 
+
+
+/* ******************************************************************* */
+/*!
+ * \internal
+ * \brief Convert the facility function enum value into a string.
+ *
+ * \return String version of the enum value
+ */
+static const char *fac2str(enum FacFunction facility)
+{
+	static const struct { 
+		enum FacFunction facility; 
+		char *name;
 	} arr[] = {
+/* *INDENT-OFF* */
 		{ Fac_None, "Fac_None" },
-		{ Fac_CD, "Fac_CD"},
+		{ Fac_GetSupportedServices, "Fac_GetSupportedServices" },
+		{ Fac_Listen, "Fac_Listen" },
+		{ Fac_Suspend, "Fac_Suspend" },
+		{ Fac_Resume, "Fac_Resume" },
+		{ Fac_CFActivate, "Fac_CFActivate" },
+		{ Fac_CFDeactivate, "Fac_CFDeactivate" },
+		{ Fac_CFInterrogateParameters, "Fac_CFInterrogateParameters" },
+		{ Fac_CFInterrogateNumbers, "Fac_CFInterrogateNumbers" },
+		{ Fac_CD, "Fac_CD" },
+		{ Fac_AOCDCurrency, "Fac_AOCDCurrency" },
+		{ Fac_AOCDChargingUnit, "Fac_AOCDChargingUnit" },
+/* *INDENT-ON* */
 	};
 	
-	int i;
-	
-	for (i=0; i < sizeof(arr)/sizeof( struct arr_el) ; i ++)
-		if ( arr[i].p==func) return arr[i].s;
-	
+	unsigned index;
+	
+	for (index = 0; index < ARRAY_LEN(arr); ++index) {
+		if (arr[index].facility == facility) {
+			return arr[index].name;
+		}
+	}	/* end for */
+
 	return "unknown";
-}
+}	/* end fac2str() */
 
 void misdn_lib_log_ies(struct misdn_bchannel *bc)
 {
@@ -3300,19 +3337,17 @@
 	cb_log(5, stack->port, " --> bc:%p h:%d sh:%d\n", bc, bc->holded, bc->stack_holder);
 }
 
-void misdn_send_lock(struct misdn_bchannel *bc);
-void misdn_send_unlock(struct misdn_bchannel *bc);
 
 #define RETURN(a,b) {retval=a; goto b;}
 
-void misdn_send_lock(struct misdn_bchannel *bc)
+static void misdn_send_lock(struct misdn_bchannel *bc)
 {
 	//cb_log(0,bc->port,"Locking bc->pid:%d\n", bc->pid);
 	if (bc->send_lock)
 		pthread_mutex_lock(&bc->send_lock->lock);
 }
 
-void misdn_send_unlock(struct misdn_bchannel *bc)
+static void misdn_send_unlock(struct misdn_bchannel *bc)
 {
 	//cb_log(0,bc->port,"UnLocking bc->pid:%d\n", bc->pid);
 	if (bc->send_lock)
@@ -3337,7 +3372,7 @@
 	misdn_send_lock(bc);
 
 
-	cb_log(6,stack->port,"SENDEVENT: stack->nt:%d stack->uperid:%x\n",stack->nt, stack->upper_id);
+	cb_log(6,stack->port,"SENDEVENT: stack->nt:%d stack->upperid:%x\n",stack->nt, stack->upper_id);
 
 	if ( stack->nt && !stack->l1link) {
 		/** Queue Event **/
@@ -3480,7 +3515,7 @@
 		bc->need_release_complete=0;
 
 		if (!stack->nt) {
-			/*create clenaup in TE*/
+			/*create cleanup in TE*/
 			int channel=bc->channel;
 
 			int tmpcause=bc->cause;	
@@ -3710,7 +3745,7 @@
 	iframe_t *frm;
 	struct misdn_stack *stack=find_stack_by_port(port);
 	if (!msg) {
-		cb_log(0, port, "misgn_lib_get_port: alloc_msg failed!\n");
+		cb_log(0, port, "misdn_lib_get_port_info: alloc_msg failed!\n");
 		return -1;
 	}
 	frm=(iframe_t*)msg->data;
@@ -3739,7 +3774,7 @@
 	msg_t *msg=alloc_msg(MAX_MSG_SIZE);
 	iframe_t *frm;
 	if (!msg) {
-		cb_log(0, bc->port, "misgn_lib_get_port: alloc_msg failed!\n");
+		cb_log(0, bc->port, "queue_cleanup_bc: alloc_msg failed!\n");
 		return -1;
 	}
 	frm=(iframe_t*)msg->data;
@@ -3769,7 +3804,7 @@
 	return 0;
 }
 
-/*Sends Restart message for every bchnanel*/
+/*Sends Restart message for every bchannel*/
 int misdn_lib_send_restart(int port, int channel)
 {
 	struct misdn_stack *stack=find_stack_by_port(port);
@@ -3851,6 +3886,7 @@
 
 sem_t handler_started; 
 
+/* This is a thread */
 static void manager_event_handler(void *arg)
 {
 	sem_post(&handler_started); 
@@ -3893,6 +3929,7 @@
 				free_msg(msg);	
 				break;
 			case MGR_SETSTACK | REQUEST :
+				/* Warning: memory leak here if we get this message */
 				break;
 			default:
 				mISDN_write(glob_mgr->midev, frm, mISDN_HEADER_LEN+frm->len, TIMEOUT_1SEC);
@@ -3947,8 +3984,10 @@
 }
 
 
-int misdn_lib_maxports_get() { /** BE AWARE WE HAVE NO CB_LOG HERE! **/
-	
+int misdn_lib_maxports_get(void)
+{
+	/* BE AWARE WE HAVE NO cb_log() HERE! */
+
 	int i = mISDN_open();
 	int max=0;
 	
@@ -4056,7 +4095,7 @@
 		stack=stack_init(midev, port, ptp);
     
 		if (!stack) {
-			perror("init_stack");
+			perror("stack_init");
 			exit(1);
 		}
     
@@ -4103,7 +4142,7 @@
 	return (mgr == NULL);
 }
 
-void misdn_lib_destroy()
+void misdn_lib_destroy(void)
 {
 	struct misdn_stack *help;
 	int i;
@@ -4327,9 +4366,6 @@
 	cb_log(4,stack->port, "*HOLDER: add %x\n",holder->l3_id);
 	
 	holder->stack_holder=1;
-
-	if (!stack ) return ;
-	
 	holder->next=NULL;
 	
 	if (!stack->holding) {

Modified: trunk/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/trunk/channels/misdn/isdn_lib.h?view=diff&rev=138738&r1=138737&r2=138738
==============================================================================
--- trunk/channels/misdn/isdn_lib.h (original)
+++ trunk/channels/misdn/isdn_lib.h Mon Aug 18 16:07:28 2008
@@ -11,7 +11,7 @@
  * the GNU General Public License
  */
 
-/*! \file 
+/*! \file
  * \brief Interface to mISDN
  *
  * \author Christian Richter <crich at beronet.com>
@@ -27,9 +27,9 @@
 /** end of init usage **/
 
 
-/* 
+/*
  * uncomment the following to make chan_misdn create
- * record files in /tmp/misdn-{rx|tx}-PortChannel format 
+ * record files in /tmp/misdn-{rx|tx}-PortChannel format
  * */
 
 /*#define MISDN_SAVE_DATA*/
@@ -50,9 +50,9 @@
 		     int tonedisable, int zerocoeff, int adapt, int nlp);
 
 void beroec_destroy(beroec_t *ec);
-int beroec_cancel_alaw_chunk(beroec_t *ec, 
-	char *send, 
-	char *receive , 
+int beroec_cancel_alaw_chunk(beroec_t *ec,
+	char *send,
+	char *receive,
 	int len);
 
 int beroec_version(void);
@@ -103,7 +103,7 @@
 	NUMPLAN_NATIONAL=0x2,
 	NUMPLAN_SUBSCRIBER=0x4,
 	NUMPLAN_UNKNOWN=0x0
-}; 
+};
 
 
 enum event_response_e {
@@ -158,7 +158,7 @@
 	EVENT_PORT_ALARM,
 	EVENT_NEW_CHANNEL,
 	EVENT_UNKNOWN
-}; 
+};
 
 
 enum ie_name_e {
@@ -192,7 +192,7 @@
 enum { /*CODECS*/
 	INFO_CODEC_ULAW=2,
 	INFO_CODEC_ALAW=3
-}; 
+};
 
 
 enum layer_e {
@@ -200,85 +200,173 @@
 	L2,
 	L1,
 	UNKNOWN
-}; 
+};
 
 
 
 struct misdn_bchannel {
+	/*! \brief B channel send locking structure */
 	struct send_lock *send_lock;
 
+	/*! \brief TRUE if this is a dummy BC record */
 	int dummy;
 
+	/*! \brief TRUE if NT side of protocol (TE otherwise) */
 	int nt;
+
+	/*! \brief TRUE if ISDN-PRI (ISDN-BRI otherwise) */
 	int pri;
 
+	/*! \brief Logical Layer 1 port associated with this B channel */
 	int port;
+
 	/** init stuff **/
+	/*! \brief B Channel mISDN driver stack ID */
 	int b_stid;
+
 	/* int b_addr; */
+
+	/*! \brief B Channel mISDN driver layer ID from mISDN_new_layer() */
 	int layer_id;
 
+	/*! \brief B channel layer; set to 3 or 4 */
 	int layer;
-	
-	/*state stuff*/
+
+	/* state stuff */
+	/*! \brief TRUE if DISCONNECT needs to be sent to clear a call */
 	int need_disconnect;
+
+	/*! \brief TRUE if RELEASE needs to be sent to clear a call */
 	int need_release;
+
+	/*! \brief TRUE if RELEASE_COMPLETE needs to be sent to clear a call */
 	int need_release_complete;
 
+	/*! \brief TRUE if allocate higher B channels first */
 	int dec;
-	/** var stuff**/
+
+	/* var stuff */
+	/*! \brief Layer 3 process ID */
 	int l3_id;
+
+	/*! \brief B channel process ID (1-5000) */
 	int pid;
+
+	/*! \brief Not used. Saved mISDN stack CONNECT_t ces value */
 	int ces;
 
+	/*! \brief B channel to restart if received a RESTART message */
 	int restart_channel;
+
+	/*! \brief Assigned B channel number B1, B2... 0 if not assigned */
 	int channel;
+
+	/*! \brief TRUE if the B channel number is preselected */
 	int channel_preselected;
-	
+
+	/*! \brief TRUE if B channel record is in use */
 	int in_use;
+
+	/*! \brief Time when empty_bc() last called on this record */
 	struct timeval last_used;
+
+	/*! \brief TRUE if call waiting */
 	int cw;
+
+	/*! \brief B Channel mISDN driver layer ID from mISDN_get_layerid() */
 	int addr;
 
-	char * bframe;
+	/*! \brief B channel speech sample data buffer */
+	char *bframe;
+
+	/*! \brief B channel speech sample data buffer size */
 	int bframe_len;
-	int time_usec;
-	
-	
+	int time_usec;	/* Not used */
+
+	/*! \brief Not used. Contents are setup but not used. */
 	void *astbuf;
 
-	void *misdnbuf;
-
+	void *misdnbuf;	/* Not used */
+
+	/*! \brief TRUE if the TE side should choose the B channel to use
+	 * \note This value is user configurable in /etc/asterisk/misdn.conf
+	 */
 	int te_choose_channel;
+
+	/*! \brief TRUE if the call progress indicators can indicate an inband audio message for the user to listen to
+	 * \note This value is user configurable in /etc/asterisk/misdn.conf
+	 */
 	int early_bconnect;
-	
-	/* dtmf digit */
+
+	/*! \brief Last decoded DTMF digit from mISDN driver */
 	int dtmf;
+
+	/*! \brief TRUE if we should produce DTMF tones ourselves
+	 * \note This value is user configurable in /etc/asterisk/misdn.conf
+	 */
 	int send_dtmf;
 
-	/* get setup ack */
+	/*! \brief TRUE if we send SETUP_ACKNOWLEDGE on incoming calls anyway (instead of PROCEEDING).
+	 *
+	 * This requests additional INFORMATION messages, so we can
+	 * wait for digits without issues.
+	 * \note This value is user configurable in /etc/asterisk/misdn.conf
+	 */
 	int need_more_infos;
 
-	/* may there be more infos ?*/
+	/*! \brief TRUE if all digits necessary to complete the call are available.
+	 * No more INFORMATION messages are needed.
+	 */
 	int sending_complete;
 
 
-	/* wether we should use jollys dsp or not */
+	/*! \brief TRUE if we will not use jollys dsp */
 	int nodsp;
-	
-	/* wether we should use our jitter buf system or not */
+
+	/*! \brief TRUE if we will not use the jitter buffer system */
 	int nojitter;
-	
+
+	/*! \brief Type-of-number in ISDN terms for the dialed/called number
+	 * \note This value is set to "dialplan" in /etc/asterisk/misdn.conf for outgoing calls
+	 */
 	enum mISDN_NUMBER_PLAN dnumplan;
+
+	/*! \brief Type-of-number in ISDN terms for the redirecting number which a call diversion or transfer was invoked.
+	 * \note Collected from the incoming SETUP message but not used.
+	 */
 	enum mISDN_NUMBER_PLAN rnumplan;
+
+	/*! \brief Type-of-number in ISDN terms for the originating/calling number (Caller-ID)
+	 * \note This value is set to "localdialplan" in /etc/asterisk/misdn.conf for outgoing calls
+	 */
 	enum mISDN_NUMBER_PLAN onumplan;
+
+	/*! \brief Type-of-number in ISDN terms for the connected party number
+	 * \note This value is set to "cpndialplan" in /etc/asterisk/misdn.conf for outgoing calls
+	 */
 	enum mISDN_NUMBER_PLAN cpnnumplan;
 
+	/*! \brief Progress Indicator IE coding standard field.
+	 * \note Collected from the incoming messages but not used.
+	 */
 	int progress_coding;
+
+	/*! \brief Progress Indicator IE location field.
+	 * \note Collected from the incoming messages but not used.
+	 */
 	int progress_location;
+
+	/*! \brief Progress Indicator IE progress description field.
+	 * Used to determine if there is an inband audio message present.
+	 */
 	int progress_indicator;
 
+	/*! \brief Inbound FACILITY message function type and contents */
 	struct FacParm fac_in;
+
+	/*! \brief Outbound FACILITY message function type and contents.
+	 * \note Filled in by misdn facility commands before FACILITY message sent.
+	 */
 	struct FacParm fac_out;
 
 	/* storing the current AOCD info here */
@@ -287,92 +375,194 @@
 		struct FacAOCDCurrency currency;
 		struct FacAOCDChargingUnit chargingUnit;
 	} AOCD;
+	/*! \brief TRUE if AOCDtype and AOCD data are ready to export to Asterisk */
 	int AOCD_need_export;
-	
+
+	/*! \brief Event waiting for Layer 1 to come up */
 	enum event_e evq;
-	
+
 	/*** CRYPTING STUFF ***/
-	
-	int crypt;
-	int curprx;
-	int curptx; 
+	int crypt;		/* Initialized, Not used */
+	int curprx;		/* Initialized, Not used */
+	int curptx;		/* Initialized, Not used */
+
+	/*! \brief Blowfish encryption key string (secret) */
 	char crypt_key[255];
-  

[... 598 lines stripped ...]



More information about the asterisk-commits mailing list