projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
5332373
)
OpenSIPS provisioning, RT10993
author
levinse
<levinse>
Sun, 16 Jan 2011 03:33:59 +0000
(
03:33
+0000)
committer
levinse
<levinse>
Sun, 16 Jan 2011 03:33:59 +0000
(
03:33
+0000)
FS/FS/Schema.pm
patch
|
blob
|
history
FS/FS/part_export/phone_sqlopensips.pm
patch
|
blob
|
history
FS/FS/svc_phone.pm
patch
|
blob
|
history
httemplate/edit/svc_phone.cgi
patch
|
blob
|
history
httemplate/view/svc_phone.cgi
patch
|
blob
|
history
diff --git
a/FS/FS/Schema.pm
b/FS/FS/Schema.pm
index
93c2c95
..
33167ec
100644
(file)
--- a/
FS/FS/Schema.pm
+++ b/
FS/FS/Schema.pm
@@
-2976,6
+2976,7
@@
sub tables_hashref {
'domsvc', 'int', 'NULL', '', '', '',
'locationnum', 'int', 'NULL', '', '', '',
'route', 'varchar', 'NULL', $char_d, '', '',
'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, '', '',
'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
8a3d3a1
..
cb644a0
100644
(file)
--- a/
FS/FS/part_export/phone_sqlopensips.pm
+++ b/
FS/FS/part_export/phone_sqlopensips.pm
@@
-7,6
+7,7
@@
use FS::Record qw( dbh qsearch qsearchs );
use FS::part_export;
use FS::svc_phone;
use FS::export_svc;
use FS::part_export;
use FS::svc_phone;
use FS::export_svc;
+use LWP::UserAgent;
@ISA = qw(FS::part_export);
@ISA = qw(FS::part_export);
@@
-14,6
+15,7
@@
tie %options, 'Tie::IxHash',
'datasrc' => { label=>'DBI data source ' },
'username' => { label=>'Database username' },
'password' => { label=>'Database password' },
'datasrc' => { label=>'DBI data source ' },
'username' => { label=>'Database username' },
'password' => { label=>'Database password' },
+ 'xmlrpc_url' => { label=>'XMLRPC URL' },
;
%info = (
;
%info = (
@@
-31,10
+33,10
@@
sub _export_insert {
my $sth = $dbh->prepare("insert into dr_rules ".
"( groupid, prefix, timerec, routeid, gwlist, description ) ".
" values ( ?, ?, ?, ?, ?, ? )") or die $dbh->errstr;
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,'',$svc_x->route,
''
,
+ $sth->execute('0',$svc_x->phonenum,'',$svc_x->route,
$svc_x->gwlist
,
$svc_x->phone_name) or die $sth->errstr;
$dbh->disconnect;
$svc_x->phone_name) or die $sth->errstr;
$dbh->disconnect;
-
''
;
+
$self->dr_reload
;
}
sub opensips_connect {
}
sub opensips_connect {
@@
-58,6
+60,11
@@
sub _export_replace {
push @paramvalues, $new->phone_name;
}
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;
if(scalar(@update)) {
my $update_str = join(' and ',@update);
my $dbh = $self->opensips_connect;
@@
-66,6
+73,7
@@
sub _export_replace {
push @paramvalues, $old->phonenum;
$sth->execute(@paramvalues) or die $sth->errstr;
$dbh->disconnect;
push @paramvalues, $old->phonenum;
$sth->execute(@paramvalues) or die $sth->errstr;
$dbh->disconnect;
+ return $self->dr_reload;
}
'';
}
}
'';
}
@@
-87,6
+95,21
@@
sub _export_delete {
or die $dbh->errstr;
$sth->execute($svc_x->phonenum) or die $sth->errstr;
$dbh->disconnect;
or die $dbh->errstr;
$sth->execute($svc_x->phonenum) or die $sth->errstr;
$dbh->disconnect;
- '';
+ $self->dr_reload;
+}
+
+sub dr_reload {
+ my $self = shift;
+ my $reqxml = "<?xml version=\"1.0\"?>
+<methodCall>
+ <methodName>dr_reload</methodName>
+</methodCall>";
+ my $ua = LWP::UserAgent->new;
+ my $resp = $ua->post( $self->option('xmlrpc_url'),
+ Content_Type => 'text/xml',
+ Content => $reqxml );
+ return "invalid HTTP response from OpenSIPS: " . $resp->status_line
+ unless $resp->is_success;
+ '';
}
}
diff --git
a/FS/FS/svc_phone.pm
b/FS/FS/svc_phone.pm
index
cffe1e3
..
deb12c2
100644
(file)
--- a/
FS/FS/svc_phone.pm
+++ b/
FS/FS/svc_phone.pm
@@
-83,6
+83,10
@@
Optional svcnum from svc_pbx
Route id/number
Route id/number
+=item gwlist
+
+OpenSIPS dr_rules gwlist - OpenSIPS dynamic routing
+
=item forwarddst
Forwarding destination
=item forwarddst
Forwarding destination
@@
-178,6
+182,7
@@
sub table_info {
'route' => { label => 'Route',
%dis2,
},
'route' => { label => 'Route',
%dis2,
},
+ 'gwlist' => { label => 'OpenSIPS gwlist', %dis2 },
'forwarddst' => { label => 'Forward Destination',
%dis2,
},
'forwarddst' => { label => 'Forward Destination',
%dis2,
},
@@
-478,6
+483,7
@@
sub check {
|| $self->ut_foreign_keyn('domsvc', 'svc_domain', 'svcnum' )
|| $self->ut_foreign_keyn('locationnum', 'cust_location', 'locationnum')
|| $self->ut_textn('route')
|| $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')
|| $self->ut_numbern('forwarddst')
|| $self->ut_textn('email')
|| $self->ut_numbern('lrn')
diff --git
a/httemplate/edit/svc_phone.cgi
b/httemplate/edit/svc_phone.cgi
index
1623ed3
..
f542ec2
100644
(file)
--- a/
httemplate/edit/svc_phone.cgi
+++ b/
httemplate/edit/svc_phone.cgi
@@
-38,6
+38,7
@@
push @fields, { field => 'pbxsvc',
maxlength => $conf->config('svc_phone-phone_name-max_length'),
},
'route',
maxlength => $conf->config('svc_phone-phone_name-max_length'),
},
'route',
+ 'gwlist',
'forwarddst',
'email',
'forwarddst',
'email',
diff --git
a/httemplate/view/svc_phone.cgi
b/httemplate/view/svc_phone.cgi
index
7b0ea70
..
433ea17
100644
(file)
--- a/
httemplate/view/svc_phone.cgi
+++ b/
httemplate/view/svc_phone.cgi
@@
-19,7
+19,7
@@
my %labels = map { $_ => ( ref($fields->{$_})
my @fields = qw( countrycode phonenum );
push @fields, 'domain' if $conf->exists('svc_phone-domain');
my @fields = qw( countrycode phonenum );
push @fields, 'domain' if $conf->exists('svc_phone-domain');
-push @fields, qw( pbx_title sip_password pin phone_name route forwarddst email );
+push @fields, qw( pbx_title sip_password pin phone_name route
gwlist
forwarddst email );
if ( $conf->exists('svc_phone-lnp') ) {
push @fields, 'lnp_status',
if ( $conf->exists('svc_phone-lnp') ) {
push @fields, 'lnp_status',