From 8cd0512234f3f939f1eeaeac34f91e7095fcd05f Mon Sep 17 00:00:00 2001 From: levinse Date: Tue, 18 Jan 2011 03:44:29 +0000 Subject: [PATCH] OpenSIPS provisioning improvements, RT10993 --- FS/FS/Schema.pm | 2 -- FS/FS/part_export/phone_sqlopensips.pm | 49 ++++++---------------------------- FS/FS/svc_phone.pm | 14 ---------- 3 files changed, 8 insertions(+), 57 deletions(-) diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 33167ec30..e9977e74c 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -2975,8 +2975,6 @@ sub tables_hashref { 'pbxsvc', 'int', 'NULL', '', '', '', 'domsvc', 'int', 'NULL', '', '', '', 'locationnum', 'int', 'NULL', '', '', '', - 'route', 'varchar', 'NULL', $char_d, '', '', - 'gwlist', 'varchar', 'NULL', $char_d, '', '', 'forwarddst', 'varchar', 'NULL', 15, '', '', 'email', 'varchar', 'NULL', 255, '', '', 'lnp_status', 'varchar', 'NULL', $char_d, '', '', diff --git a/FS/FS/part_export/phone_sqlopensips.pm b/FS/FS/part_export/phone_sqlopensips.pm index e91713fe4..3d01c1624 100644 --- a/FS/FS/part_export/phone_sqlopensips.pm +++ b/FS/FS/part_export/phone_sqlopensips.pm @@ -16,6 +16,8 @@ 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 = ( @@ -32,18 +34,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 +55,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 { diff --git a/FS/FS/svc_phone.pm b/FS/FS/svc_phone.pm index deb12c29a..3d02ca4a3 100644 --- a/FS/FS/svc_phone.pm +++ b/FS/FS/svc_phone.pm @@ -79,14 +79,6 @@ Voicemail PIN Optional svcnum from svc_pbx -=item route - -Route id/number - -=item gwlist - -OpenSIPS dr_rules gwlist - OpenSIPS dynamic routing - =item forwarddst Forwarding destination @@ -179,10 +171,6 @@ sub table_info { disable_inventory => 1, disable_select => 1, }, - 'route' => { label => 'Route', - %dis2, - }, - 'gwlist' => { label => 'OpenSIPS gwlist', %dis2 }, 'forwarddst' => { label => 'Forward Destination', %dis2, }, @@ -482,8 +470,6 @@ sub check { || $self->ut_foreign_keyn('pbxsvc', 'svc_pbx', 'svcnum' ) || $self->ut_foreign_keyn('domsvc', 'svc_domain', 'svcnum' ) || $self->ut_foreign_keyn('locationnum', 'cust_location', 'locationnum') - || $self->ut_textn('route') - || $self->ut_textn('gwlist') || $self->ut_numbern('forwarddst') || $self->ut_textn('email') || $self->ut_numbern('lrn') -- 2.11.0