X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_export%2Fphone_sqlopensips.pm;h=7b07ecf4a5813cbf2a274d9a3b33001e7925ee98;hb=25efd7207d9ea9be4bea1093917c0d8dc4b1e87a;hp=e91713fe47491f295497afb2fd3c6abb39359b08;hpb=5cae209e7a123e2fb4da3eb720b54a0b83368977;p=freeside.git diff --git a/FS/FS/part_export/phone_sqlopensips.pm b/FS/FS/part_export/phone_sqlopensips.pm index e91713fe4..7b07ecf4a 100644 --- a/FS/FS/part_export/phone_sqlopensips.pm +++ b/FS/FS/part_export/phone_sqlopensips.pm @@ -16,13 +16,16 @@ tie %options, 'Tie::IxHash', '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 = ( - 'svc' => 'svc_phone', - 'desc' => 'Export DIDs to OpenSIPs dr_rules table', - 'options' => \%options, - 'notes' => 'Export DIDs to OpenSIPs dr_rules table', + 'svc' => 'svc_phone', + 'desc' => 'Export DIDs to OpenSIPs dr_rules table', + 'options' => \%options, + 'no_machine' => 1, + 'notes' => 'Export DIDs to OpenSIPs dr_rules table', ); sub rebless { shift; } @@ -32,18 +35,16 @@ sub _export_insert { 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,40 +56,7 @@ sub opensips_connect { } 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 ',@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; - } - ''; + ''; } sub _export_suspend { @@ -126,3 +94,4 @@ sub dr_reload { ''; } +1;