[asterisk-commits] moy: branch moy/mfcr2 r115074 - in /team/moy/mfcr2: channels/ configs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 1 17:17:13 CDT 2008


Author: moy
Date: Thu May  1 17:17:12 2008
New Revision: 115074

URL: http://svn.digium.com/view/asterisk?view=rev&rev=115074
Log:
added documentation and support for configurable timeout. Also fixed minor bugs.

Modified:
    team/moy/mfcr2/channels/chan_zap.c
    team/moy/mfcr2/configs/zapata.conf.sample

Modified: team/moy/mfcr2/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/moy/mfcr2/channels/chan_zap.c?view=diff&rev=115074&r1=115073&r2=115074
==============================================================================
--- team/moy/mfcr2/channels/chan_zap.c (original)
+++ team/moy/mfcr2/channels/chan_zap.c Thu May  1 17:17:12 2008
@@ -414,6 +414,7 @@
 
 static struct zt_mfcr2 r2links[NUM_SPANS];
 static openr2_variant_t mfcr2_cur_variant = OR2VAR_UNKNOWN;
+static int mfcr2_cur_mfback_timeout = -1;
 static int mfcr2_cur_max_ani = 10;
 static int mfcr2_cur_max_dnis = 4;
 static int mfcr2_cur_get_ani_first = 0;
@@ -8765,6 +8766,7 @@
 					openr2_context_set_log_level(zap_r2->protocol_context, mfcr2_cur_loglevel);
 					openr2_context_set_ani_first(zap_r2->protocol_context, mfcr2_cur_get_ani_first);
 					openr2_context_set_mf_threshold(zap_r2->protocol_context, threshold);
+					openr2_context_set_mf_back_timeout(zap_r2->protocol_context, mfcr2_cur_mfback_timeout);
 					if (ast_strlen_zero(mfcr2_cur_logdir)) {
 						openr2_context_set_log_directory(zap_r2->protocol_context, "/tmp");
 					} else {
@@ -12400,7 +12402,7 @@
 	char channo[5];
 	char anino[5];
 	char dnisno[5];
-	struct zt_pvt *tmp;
+	struct zt_pvt *p;
 	openr2_context_t *r2context;
 	openr2_variant_t r2variant;
 	switch (cmd) {
@@ -12431,23 +12433,23 @@
 	}
 	ast_cli(a->fd, FORMAT, "Chan", "Variant", "Max ANI", "Max DNIS", "ANI First", "Tx State", "Rx State");
 	ast_mutex_lock(&iflock);
-	tmp = iflist;
-	while (tmp) {
-		if (!(tmp->sig & SIG_MFCR2)) {
-			tmp = tmp->next;
+	p = iflist;
+	while (p) {
+		if (!(p->sig & SIG_MFCR2) || !p->r2chan) {
+			p = p->next;
 			continue;
 		}
 		if (filtertype) {
 			switch(filtertype) {
 			case 1: /* mfcr2 show channels group <group> */
-				if (tmp->group != targetnum) {
-					tmp = tmp->next;
+				if (p->group != targetnum) {
+					p = p->next;
 					continue;
 				}
 				break;
 			case 2: /* mfcr2 show channels context <context> */
-				if (strcasecmp(tmp->context, a->argv[4])) {
-					tmp = tmp->next;
+				if (strcasecmp(p->context, a->argv[4])) {
+					p= p->next;
 					continue;
 				}
 				break;
@@ -12455,15 +12457,15 @@
 				;
 			}
 		}
-		r2context = openr2_chan_get_context(tmp->r2chan);
+		r2context = openr2_chan_get_context(p->r2chan);
 		r2variant = openr2_context_get_variant(r2context);
-		snprintf(channo, sizeof(channo), "%d", tmp->channel);
+		snprintf(channo, sizeof(channo), "%d", p->channel);
 		snprintf(anino, sizeof(anino), "%d", openr2_context_get_max_ani(r2context));
 		snprintf(dnisno, sizeof(dnisno), "%d", openr2_context_get_max_dnis(r2context));
 		ast_cli(a->fd, FORMAT, channo, openr2_proto_get_variant_string(r2variant), 
 				anino, dnisno, openr2_context_get_ani_first(r2context) ? "Yes" : "No",  
-				openr2_proto_get_tx_state_string(tmp->r2chan), openr2_proto_get_rx_state_string(tmp->r2chan));
-		tmp = tmp->next;
+				openr2_proto_get_tx_state_string(p->r2chan), openr2_proto_get_rx_state_string(p->r2chan));
+		p = p->next;
 	}
 	ast_mutex_unlock(&iflock);
 	return CLI_SUCCESS;
@@ -12515,7 +12517,7 @@
 	ast_mutex_lock(&iflock);
 	p = iflist;
 	while (p) {
-		if (!(p->sig & SIG_MFCR2)) {
+		if (!(p->sig & SIG_MFCR2) || !p->r2chan) {
 			p = p->next;
 			continue;
 		}
@@ -12563,7 +12565,7 @@
 	ast_mutex_lock(&iflock);
 	p = iflist;
 	while (p) {
-		if (!(p->sig & SIG_MFCR2)) {
+		if (!(p->sig & SIG_MFCR2) || !p->r2chan) {
 			p = p->next;
 			continue;
 		}
@@ -12621,7 +12623,7 @@
 	ast_mutex_lock(&iflock);
 	p = iflist;
 	while (p) {
-		if (!(p->sig & SIG_MFCR2)) {
+		if (!(p->sig & SIG_MFCR2) || !p->r2chan) {
 			p = p->next;
 			continue;
 		}
@@ -13000,6 +13002,7 @@
 				ast_cli(a->fd, "MFC/R2 Max ANI: %d\n", openr2_context_get_max_ani(r2context));
 				ast_cli(a->fd, "MFC/R2 Max DNIS: %d\n", openr2_context_get_max_dnis(r2context));
 				ast_cli(a->fd, "MFC/R2 Get ANI First: %s\n", openr2_context_get_ani_first(r2context) ? "Yes" : "No");
+				ast_cli(a->fd, "MFC/R2 MF Back Timeout: %dms\n", openr2_context_get_mf_back_timeout(r2context));
 				ast_cli(a->fd, "MFC/R2 Rx State: %s\n", openr2_proto_get_rx_state_string(tmp->r2chan));
 				ast_cli(a->fd, "MFC/R2 Tx State: %s\n", openr2_proto_get_tx_state_string(tmp->r2chan));
 				ast_cli(a->fd, "MFC/R2 MF Tx Signal: %d\n", openr2_proto_get_mf_tx(tmp->r2chan));
@@ -14922,6 +14925,14 @@
 				if (OR2VAR_UNKNOWN == mfcr2_cur_variant) {
 					ast_log(LOG_WARNING, "Unknown MFC/R2 variant '%s' at line %d.\n", v->value, v->lineno);
 				}
+			} else if (!strcasecmp(v->name, "mfcr2_mfback_timeout")) {
+				mfcr2_cur_mfback_timeout = atoi(v->value);
+				if (!mfcr2_cur_mfback_timeout) {
+					ast_log(LOG_WARNING, "MF timeout of 0? hum, I will protect you from your ignorance. Setting default.\n");
+					mfcr2_cur_mfback_timeout = -1;
+				} else if (mfcr2_cur_mfback_timeout > 0 && mfcr2_cur_mfback_timeout < 500) {
+					ast_log(LOG_WARNING, "MF less than 500ms is not recommended, you have been warned!\n");
+				}
 			} else if (!strcasecmp(v->name, "mfcr2_get_ani_first")) {
 				mfcr2_cur_get_ani_first = ast_true(v->value);
 			} else if (!strcasecmp(v->name, "mfcr2_max_ani")) {

Modified: team/moy/mfcr2/configs/zapata.conf.sample
URL: http://svn.digium.com/view/asterisk/team/moy/mfcr2/configs/zapata.conf.sample?view=diff&rev=115074&r1=115073&r2=115074
==============================================================================
--- team/moy/mfcr2/configs/zapata.conf.sample (original)
+++ team/moy/mfcr2/configs/zapata.conf.sample Thu May  1 17:17:12 2008
@@ -226,6 +226,7 @@
 ; sf_featb:       SF Feature Group B (MF (domestic, US))
 ; e911:           E911 (MF) style signalling
 ; ss7:            Signalling System 7
+; mfcr2:          MFC/R2 Signalling. To specify the country variant see 'mfcr2_variant'
 ;
 ; The following are used for Radio interfaces:
 ; fxs_rx:         Receive audio/COR on an FXS kewlstart interface (FXO at the
@@ -847,6 +848,76 @@
 ;context=default
 ;channel => 1 
 
+; ---------------- Options for use with signalling=mfcr2 --------------
+
+; MFC/R2 variant. This depends on the OpenR2 supported variants
+; A list of values can be found at libopenr2.org
+; some valid values are:
+; mx (Mexico)
+; br (Brazil)
+; ar (Argentina)
+; itu (per ITU spec)
+; mfcr2_variant=mx
+
+; whether or not to get the ANI before getting DNIS.
+; some telcos require ANI first some others do not care
+; if this go wrong, change this value
+; mfcr2_get_ani_first=no
+
+; Max amount of ANI to ask for
+; mfcr2_max_ani=10
+
+; Max amount of DNIS to ask for
+; mfcr2_max_dnis=4
+
+; Caller Category to send
+; national_subscriber
+; national_priority_subscriber
+; international_subscriber
+; international_priority_subscriber
+; usually national_subscriber works just fine
+; you can change this setting from the dialplan
+; by setting the variable MFCR2_CATEGORY
+; MFCR2_CATEGORY will also be a variable available
+; on incoming calls set to the value received from
+; the far end
+; mfcr2_category=national_subscriber
+
+; Call logging is stored at the Asterisk
+; logging directory specified in asterisk.conf
+; plus mfcr2/<whatever you put here>
+; For call logging to work the directory must exists
+; if you specify 'span1' here and asterisk.conf has
+; as logging directory /var/log/asterisk then the full
+; path to your MFC/R2 call logs will be /var/log/asterisk/mfcr2/span1
+; mfcr2_logdir=span1
+
+; MFC/R2 valid logging values are: all,error,warning,debug,notice,cas,mf,stack,nothing
+; error,warning,debug and notice are self-descriptive
+; 'cas' is for logging ABCD CAS tx and rx 
+; 'mf' is for logging of the Multi Frequency tones
+; 'stack' is for very verbose output of the channel and context call stack, only useful
+; if you are debugging a crash or want to learn how the library works. The stack logging
+; will be only enabled if the openr2 library was compiled with -DOR2_TRACE_STACKS
+; You can mix up values, like: loglevel=error,debug,mf to log just error, debug and 
+; multi frequency messages
+; 'all' is a special value to log all the activity
+; 'nothing' is a clean-up value, in case you want to not log any activity for
+; a channel or group of channels 
+; BE AWARE that the level of output logged will ALSO depend on
+; the value you have in logger.conf, if you disable output in logger.conf
+; then it does not matter you specify 'all' here, nothing will be logged
+; so logger.conf has the last word on what is going to be logged
+; mfcr2_logging=all
+
+; MFC/R2 value in milliseconds for the MF timeout. Any negative value
+; means 'default', smaller values than 500ms are not recommended
+; and can cause malfunctioning. If you experiment protocol error
+; due to MF timeout try incrementing this value
+; mfcr2_mfback_timeout=-1
+
+; ---------------- END of options to be used with signalling=mfcr2
+
 ; ---------------- Options for use with signalling=ss7 -----------------
 ; None of them can be changed by a reload.
 ;




More information about the asterisk-commits mailing list