[freeside-commits] freeside/FS/FS/part_pkg voip_cdr.pm,1.5,1.6

Ivan,,, ivan at wavetail.420.am
Sat Mar 15 14:14:28 PDT 2008


Update of /home/cvs/cvsroot/freeside/FS/FS/part_pkg
In directory wavetail.420.am:/tmp/cvs-serv3887/part_pkg

Modified Files:
	voip_cdr.pm 
Log Message:
configurable disable_src, domestic_prefix and international_prefix options for voip price plan

Index: voip_cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/voip_cdr.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- voip_cdr.pm	13 Feb 2008 23:42:00 -0000	1.5
+++ voip_cdr.pm	15 Mar 2008 21:14:26 -0000	1.6
@@ -53,6 +53,22 @@
                           'default' => '+1',
                         },
 
+    'disable_src' => { 'name' => 'Disable rating of CDR records based on the "src" field in addition to "charged_party"',
+                       'type' => 'checkbox'
+                     },
+
+    'domestic_prefix' => { 'name'    => 'Destination prefix for domestic CDR records',
+                           'default' => '1',
+                         },
+
+#    'domestic_prefix_required' => { 'name' => 'Require explicit destination prefix for domestic CDR records',
+#                                    'type' => 'checkbox',
+#                                  },
+
+    'international_prefix' => { 'name'    => 'Destination prefix for international CDR records',
+                                'default' => '011',
+                              },
+
     #XXX also have option for an external db??
 #    'cdr_location' => { 'name' => 'CDR database location'
 #                        'type' => 'select',
@@ -144,10 +160,12 @@
 #        $dest =~ s/^(\w+):// and $proto = $1; #sip:
 #        my $siphost = '';
 #        $dest =~ s/\@(.*)$// and $siphost = $1; # @10.54.32.1, @sip.example.com
+
+        my $intl = $self->option('international_prefix') || '011';
   
         #determine the country code
         my $countrycode;
-        if (    $number =~ /^011(((\d)(\d))(\d))(\d+)$/
+        if (    $number =~ /^$intl(((\d)(\d))(\d))(\d+)$/
              || $number =~ /^\+(((\d)(\d))(\d))(\d+)$/
            )
         {
@@ -166,8 +184,8 @@
           }
   
         } else {
-          $countrycode = '1';
-          $number =~ s/^1//;# if length($number) > 10;
+          $countrycode = $self->option('domestic_prefix') || '1';
+          $number =~ s/^$countrycode//;# if length($number) > 10;
         }
   
         warn "rating call $to_or_from +$countrycode $number\n" if $DEBUG;



More information about the freeside-commits mailing list