[Freeswitch-svn] [commit] r10526 - in freeswitch/trunk/scripts/contrib/intralanman/C/lcr: . mod_lcr sql

FreeSWITCH SVN intralanman at freeswitch.org
Mon Nov 24 08:13:09 PST 2008


Author: intralanman
Date: Mon Nov 24 11:13:08 2008
New Revision: 10526

Log:
adding simple conf file and rupa's patches for (en|dis)abling gateways and carriers

Added:
   freeswitch/trunk/scripts/contrib/intralanman/C/lcr/lcr.conf.xml
Modified:
   freeswitch/trunk/scripts/contrib/intralanman/C/lcr/mod_lcr/mod_lcr.c
   freeswitch/trunk/scripts/contrib/intralanman/C/lcr/sql/mysql-5.0.sql
   freeswitch/trunk/scripts/contrib/intralanman/C/lcr/sql/postgres-8.3.sql

Added: freeswitch/trunk/scripts/contrib/intralanman/C/lcr/lcr.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/C/lcr/lcr.conf.xml	Mon Nov 24 11:13:08 2008
@@ -0,0 +1,6 @@
+<configuration name="lcr.conf" description="LIMIT Configuration">
+  <settings>
+    <!--<param name="odbc-dsn" value="freeswitch-mysql:freeswitch:Fr33Sw1tch"/>-->
+    <param name="odbc-dsn" value="freeswitch-pgsql:freeswitch:Fr33Sw1tch"/>
+  </settings>
+</configuration>

Modified: freeswitch/trunk/scripts/contrib/intralanman/C/lcr/mod_lcr/mod_lcr.c
==============================================================================
--- freeswitch/trunk/scripts/contrib/intralanman/C/lcr/mod_lcr/mod_lcr.c	(original)
+++ freeswitch/trunk/scripts/contrib/intralanman/C/lcr/mod_lcr/mod_lcr.c	Mon Nov 24 11:13:08 2008
@@ -284,16 +284,16 @@
 	sql_stream.write_function(&sql_stream, 
 							  "SELECT l.digits, c.carrier_name, l.rate, cg.prefix AS gw_prefix, cg.suffix AS gw_suffix, l.lead_strip, l.trail_strip, l.prefix, l.suffix "
 							  );
-	sql_stream.write_function(&sql_stream, "FROM lcr l JOIN carriers c ON l.carrier_id=c.id JOIN carrier_gateway cg ON c.id=cg.carrier_id WHERE digits IN (");
+	sql_stream.write_function(&sql_stream, "FROM lcr l JOIN carriers c ON l.carrier_id=c.id JOIN carrier_gateway cg ON c.id=cg.carrier_id WHERE c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1' AND digits IN (");
 	for (n = digit_len; n > 0; n--) {
 		digits_copy[n] = '\0';
 		sql_stream.write_function(&sql_stream, "%s%s", (n==digit_len ? "" : ", "), digits_copy);
 	}
-	sql_stream.write_function(&sql_stream, ") AND CURRENT_TIMESTAMP BETWEEN date_start AND date_end AND enabled='1' ");
+	sql_stream.write_function(&sql_stream, ") AND CURRENT_TIMESTAMP BETWEEN date_start AND date_end ");
 	if(lcr_profile > 0) {
 		sql_stream.write_function(&sql_stream, "AND lcr_profile=%d ", lcr_profile);
 	}
-	sql_stream.write_function(&sql_stream, "ORDER BY digits DESC, rate;");
+	sql_stream.write_function(&sql_stream, "ORDER BY digits DESC, rate, random();");
 	
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s\n", (char *)sql_stream.data);    
 	

Modified: freeswitch/trunk/scripts/contrib/intralanman/C/lcr/sql/mysql-5.0.sql
==============================================================================
--- freeswitch/trunk/scripts/contrib/intralanman/C/lcr/sql/mysql-5.0.sql	(original)
+++ freeswitch/trunk/scripts/contrib/intralanman/C/lcr/sql/mysql-5.0.sql	Mon Nov 24 11:13:08 2008
@@ -52,6 +52,7 @@
 CREATE TABLE `carriers` (
   `id` int(11) NOT NULL auto_increment,
   `carrier_name` varchar(255) default NULL,
+  `enabled` boolean NOT NULL DEFAULT '1';
   PRIMARY KEY  (`id`)
 ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;
 
@@ -65,6 +66,7 @@
   `carrier_id` int(11) default NULL,
   `prefix` varchar(255) NOT NULL,
   `suffix` varchar(255) NOT NULL,
+  `enabled` boolean NOT NULL DEFAULT '1';
   PRIMARY KEY  (`id`),
   KEY `carrier_id` (`carrier_id`)
 ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1;

Modified: freeswitch/trunk/scripts/contrib/intralanman/C/lcr/sql/postgres-8.3.sql
==============================================================================
--- freeswitch/trunk/scripts/contrib/intralanman/C/lcr/sql/postgres-8.3.sql	(original)
+++ freeswitch/trunk/scripts/contrib/intralanman/C/lcr/sql/postgres-8.3.sql	Mon Nov 24 11:13:08 2008
@@ -6,6 +6,7 @@
 (
   id serial NOT NULL,
   carrier_name VARCHAR(255) NOT NULL,
+  enabled boolean NOT NULL DEFAULT 'true',
   CONSTRAINT carriers_pkey PRIMARY KEY (id)
 );
 
@@ -19,6 +20,7 @@
   carrier_id integer REFERENCES carriers(id),
   prefix VARCHAR(128) NOT NULL DEFAULT '',
   suffix VARCHAR(128) NOT NULL DEFAULT '',
+  enabled boolean NOT NULL DEFAULT 'true',
   CONSTRAINT carrier_gateway_pkey PRIMARY KEY (id)
 );
 



More information about the Freeswitch-svn mailing list