- 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(scalar(@update)) {
- my $update_str = join(' and ',@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;
- }
- '';