diff options
| -rw-r--r-- | FS/FS/Conf.pm | 27 | ||||
| -rw-r--r-- | FS/FS/part_export/phone_sqlopensips.pm | 21 | ||||
| -rw-r--r-- | httemplate/config/config-view.cgi | 2 | 
3 files changed, 45 insertions, 5 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index c049d41f9..0cd112c86 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -4182,6 +4182,33 @@ and customer address. Include units.',      'description' => 'Enable DID activity summary for past 30 days on invoices, showing # DIDs activated/deactivated/ported-in/ported-out and total minutes usage',      'type'        => 'checkbox',    }, +   +  { +    'key'         => 'opensips_gwlist', +    'section'     => 'opensips', +    'description' => 'For svc_phone OpenSIPS dr_rules export, gwlist column value, per-agent', +    'type'        => 'text', +    'per_agent'   => 1, +    'agentonly'   => 1, +  }, + +  { +    'key'         => 'opensips_description', +    'section'     => 'opensips', +    'description' => 'For svc_phone OpenSIPS dr_rules export, description column value, per-agent', +    'type'        => 'text', +    'per_agent'   => 1, +    'agentonly'   => 1, +  }, +   +  { +    'key'         => 'opensips_route', +    'section'     => 'opensips', +    'description' => 'For svc_phone OpenSIPS dr_rules export, routeid column value, per-agent', +    'type'        => 'text', +    'per_agent'   => 1, +    'agentonly'   => 1, +  },    { key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },    { key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" }, diff --git a/FS/FS/part_export/phone_sqlopensips.pm b/FS/FS/part_export/phone_sqlopensips.pm index cb644a0a1..e91713fe4 100644 --- a/FS/FS/part_export/phone_sqlopensips.pm +++ b/FS/FS/part_export/phone_sqlopensips.pm @@ -29,14 +29,23 @@ sub rebless { shift; }  sub _export_insert {    my($self, $svc_x) = (shift, shift); + +  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 $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,'',$svc_x->route,$svc_x->gwlist, -		$svc_x->phone_name) or die $sth->errstr; +  $sth->execute('0',$svc_x->phonenum,'',$route,$gwlist, +		$description) or die $sth->errstr;    $dbh->disconnect; -  $self->dr_reload; +  $self->dr_reload; # XXX: if this fails, do we delete what we just inserted?  }  sub opensips_connect { @@ -46,6 +55,10 @@ 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 = (); @@ -95,7 +108,7 @@ sub _export_delete {      or die $dbh->errstr;    $sth->execute($svc_x->phonenum) or die $sth->errstr;    $dbh->disconnect; -  $self->dr_reload; +  $self->dr_reload; # XXX: if this fails, do we re-insert what we just deleted?  }  sub dr_reload { diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index 11e75707c..a939b19e0 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -349,7 +349,7 @@ my @config_items = grep { $page_agent ? $_->per_agent : 1 }  my @deleteable = qw( invoice_latexreturnaddress invoice_htmlreturnaddress );  my %deleteable = map { $_ => 1 } @deleteable; -my @sections = qw(required billing invoicing notification UI self-service username password session shell BIND ); +my @sections = qw(required billing invoicing notification UI self-service username password session shell BIND opensips );  push @sections, '', 'deprecated';  my %section_items = ();  | 
