[freeside-commits] freeside/FS/FS/part_export phone_sqlopensips.pm, 1.1.2.4, 1.1.2.5

Erik Levinson levinse at wavetail.420.am
Mon Jan 17 19:44:33 PST 2011


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

Modified Files:
      Tag: FREESIDE_2_1_BRANCH
	phone_sqlopensips.pm 
Log Message:
OpenSIPS provisioning improvements, RT10993

Index: phone_sqlopensips.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/phone_sqlopensips.pm,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -w -d -r1.1.2.4 -r1.1.2.5
--- phone_sqlopensips.pm	18 Jan 2011 02:19:39 -0000	1.1.2.4
+++ phone_sqlopensips.pm	18 Jan 2011 03:44:31 -0000	1.1.2.5
@@ -16,6 +16,8 @@
   'username' => { label=>'Database username' },
   'password' => { label=>'Database password' },
   'xmlrpc_url' => { label=>'XMLRPC URL' },
+  # XXX: in future, add non-agent-virtualized config, i.e. per-export setting of gwlist, routeid, description, etc.
+  # and/or setting description from the phone_name column
 ;
 
 %info = (
@@ -32,18 +34,16 @@
 
   my $conf = new FS::Conf;
   my $agentnum = $svc_x->cust_svc->cust_pkg->cust_main->agentnum || 0;
-  my $gwlist = $conf->config('opensips_gwlist',$agentnum) 
-		|| $svc_x->phone_name;
-  my $description = $conf->config('opensips_description',$agentnum)
-		|| $svc_x->gwlist;
-  my $route = $conf->config('opensips_route',$agentnum) || $svc_x->route;
+  my $gwlist = $conf->config('opensips_gwlist',$agentnum) || '';
+  my $description = $conf->config('opensips_description',$agentnum) || '';
+  my $route = $conf->config('opensips_route',$agentnum) || '';
 
   my $dbh = $self->opensips_connect;
   my $sth = $dbh->prepare("insert into dr_rules ".
 	    "( groupid, prefix, timerec, routeid, gwlist, description ) ".
 	    " values ( ?, ?, ?, ?, ?, ? )") or die $dbh->errstr;
-  $sth->execute('0',$svc_x->phonenum,'',$route,$gwlist,
-		$description) or die $sth->errstr;
+  $sth->execute('0',$svc_x->phonenum,'',$route,$gwlist,$description)
+	    or die $sth->errstr;
   $dbh->disconnect;
   $self->dr_reload; # XXX: if this fails, do we delete what we just inserted?
 }
@@ -55,39 +55,6 @@
 }
 
 sub _export_replace {
-    # disabled the below for now as we went with a agent-virtualized config for the params
-return '';
-
-
-  my( $self, $new, $old ) = (shift, shift, shift);
-    my @update = ();
-    my @paramvalues = ();
-
-    if($old->route ne $new->route){
-	push @update, 'routeid = ?';
-	push @paramvalues, $new->route;
-    }
-
-    if($old->phone_name ne $new->phone_name) {
-	push @update, 'description = ?';
-	push @paramvalues, $new->phone_name;
-    }
-
-    if($old->gwlist ne $new->gwlist) {
-	push @update, 'gwlist = ?';
-	push @paramvalues, $new->gwlist;
-    }
-
-    if(scalar(@update)) {
-      my $update_str = join(' and ', at update);
-      my $dbh = $self->opensips_connect;
-      my $sth = $dbh->prepare("update dr_rules set $update_str " . 
-	    " where prefix = ? ") or die $dbh->errstr;
-      push @paramvalues, $old->phonenum;
-      $sth->execute(@paramvalues) or die $sth->errstr;
-      $dbh->disconnect;
-      return $self->dr_reload;
-    }
   '';
 }
 



More information about the freeside-commits mailing list