[svn-commits] moy: branch moy/mfcr2 r115577 - in /team/moy/mfcr2: channels/ configs/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri May 9 00:47:33 CDT 2008


Author: moy
Date: Fri May  9 00:47:29 2008
New Revision: 115577

URL: http://svn.digium.com/view/asterisk?view=rev&rev=115577
Log:
added basic pulse metering handling

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=115577&r1=115576&r2=115577
==============================================================================
--- team/moy/mfcr2/channels/chan_zap.c (original)
+++ team/moy/mfcr2/channels/chan_zap.c Fri May  9 00:47:29 2008
@@ -415,6 +415,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_metering_pulse_timeout = -1;
 static int mfcr2_cur_max_ani = 10;
 static int mfcr2_cur_max_dnis = 4;
 static int mfcr2_cur_get_ani_first = 0;
@@ -1443,10 +1444,10 @@
 			}
 		} else {
 			/* being the backward side and not UP yet, we only need to request hangup */
+			/* TODO: what about doing this same thing when were AST_STATE_UP? */
 			ast_queue_hangup(p->owner, zt_r2_cause_to_ast_cause(cause));
 		}	
 	}
-	openr2_chan_disconnect_call(r2chan, OR2_CAUSE_NORMAL_CLEARING);
 }
 
 static void zt_r2_write_log(openr2_log_level_t level, char *logmessage)
@@ -8803,6 +8804,7 @@
 					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);
+					openr2_context_set_metering_pulse_timeout(zap_r2->protocol_context, mfcr2_cur_metering_pulse_timeout);
 					if (ast_strlen_zero(mfcr2_cur_logdir)) {
 						openr2_context_set_log_directory(zap_r2->protocol_context, "/tmp");
 					} else {
@@ -13039,6 +13041,7 @@
 				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 R2 Metering Pulse Timeout: %dms\n", openr2_context_get_metering_pulse_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));
@@ -14967,7 +14970,12 @@
 					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");
+					ast_log(LOG_WARNING, "MF timeout less than 500ms is not recommended, you have been warned!\n");
+				}
+			} else if (!strcasecmp(v->name, "mfcr2_metering_pulse_timeout")) {
+				mfcr2_cur_metering_pulse_timeout = atoi(v->value);
+				if (mfcr2_cur_metering_pulse_timeout > 500) {
+					ast_log(LOG_WARNING, "Metering pulse timeout greater 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);

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=115577&r1=115576&r2=115577
==============================================================================
--- team/moy/mfcr2/configs/zapata.conf.sample (original)
+++ team/moy/mfcr2/configs/zapata.conf.sample Fri May  9 00:47:29 2008
@@ -853,9 +853,10 @@
 ; MFC/R2 variant. This depends on the OpenR2 supported variants
 ; A list of values can be found at libopenr2.org
 ; some valid values are:
+; ar (Argentina)
+; br (Brazil)
 ; mx (Mexico)
-; br (Brazil)
-; ar (Argentina)
+; ph (Philippines)
 ; itu (per ITU spec)
 ; mfcr2_variant=mx
 
@@ -912,9 +913,25 @@
 
 ; 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
+; and can cause malfunctioning. If you experience protocol error
+; due to MF timeout try incrementing this value in 500ms steps
 ; mfcr2_mfback_timeout=-1
+
+; MFC/R2 value in milliseconds for the metering pulse timeout. 
+; Metering pulses are sent by some telcos for some R2 variants
+; during a call presumably for billing purposes to indicate costs,
+; however this pulses use the same signal that is used to indicate
+; call hangup, therefore a timeout is sometimes required to distinguish
+; between a *real* hangup and a billing pulse that should not
+; last more than 500ms, If you experience call drops after some 
+; minutes of being stablished try setting a value of some ms here, 
+; values greater than 500ms are not recommended.
+; BE AWARE that choosing the proper protocol mfcr2_variant parameter
+; implicitly sets a good recommended value for this timer, use this
+; parameter only when you *really* want to override the default, otherwise
+; just comment out this value or put a -1
+; Any negative value means 'default'. 
+; mfcr2_metering_pulse_timeout=-1
 
 ; ---------------- END of options to be used with signalling=mfcr2
 




More information about the svn-commits mailing list