Freeside:3:Documentation:Developer/FS/svc pbx

From Freeside
Jump to: navigation, search

NAME

FS::svc_pbx - Object methods for svc_pbx records

SYNOPSIS

 use FS::svc_pbx;

 $record = new FS::svc_pbx \%hash;
 $record = new FS::svc_pbx { 'column' => 'value' };

 $error = $record->insert;

 $error = $new_record->replace($old_record);

 $error = $record->delete;

 $error = $record->check;

 $error = $record->suspend;

 $error = $record->unsuspend;

 $error = $record->cancel;

DESCRIPTION

An FS::svc_pbx object represents a PBX tenant. FS::svc_pbx inherits from FS::svc_Common. The following fields are currently supported:

svcnum
Primary key (assigned automatcially for new accounts)
id
(Unique?) number of external record
title
PBX name
max_extensions
Maximum number of extensions
max_simultaneous
Maximum number of simultaneous users
ip_addr
The IP address of this PBX, if that's relevant. This must be a valid IP address (or blank), but it's not checked for block assignment or uniqueness.

METHODS

new HASHREF
Creates a new PBX tenant. To add the PBX tenant to the database, see "insert".
Note that this stores the hash reference, not a distinct copy of the hash it points to. You can ask the object for a copy with the hash method.
search_sql STRING
Class method which returns an SQL fragment to search for the given string.
label
Returns the title field for this PBX tenant.
insert
Adds this record to the database. If there is an error, returns the error, otherwise returns false.
The additional fields pkgnum and svcpart (see FS::cust_svc) should be defined. An FS::cust_svc record will be created and inserted.
delete
Delete this record from the database.
replace OLD_RECORD
Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
suspend
Called by the suspend method of FS::cust_pkg (see FS::cust_pkg).
unsuspend
Called by the unsuspend method of FS::cust_pkg (see FS::cust_pkg).
cancel
Called by the cancel method of FS::cust_pkg (see FS::cust_pkg).
check
Checks all fields to make sure this is a valid PBX tenant. If there is an error, returns the error, otherwise returns false. Called by the insert and repalce methods.
psearch_cdrs OPTIONS
Returns a paged search (FS::PagedSearch) for Call Detail Records associated with this service. By default, "associated with" means that the "charged_party" field of the CDR matches the "title" field of the service. To access the CDRs themselves, call "->fetch" on the resulting object.
Accepts the following options:
for_update => 1: SELECT the CDRs "FOR UPDATE".
status => "" (or "done"): Return only CDRs with that processing status.
inbound => 1: No-op for svc_pbx CDR processing.
default_prefix => "XXX": Also accept the phone number of the service prepended with the chosen prefix.
disable_src => 1: No-op for svc_pbx CDR processing.
by_svcnum => 1: Select CDRs where the svcnum field matches, instead of title/charged_party. Normally this field is set after processing.
by_ip_addr => 'src' or 'dst': Select CDRs where the src_ip_addr or dst_ip_addr field matches title. In this case, some special logic is applied to allow title to indicate a range of IP addresses.
begin, end: Start and end of date range, as unix timestamp.
cdrtypenum: Only return CDRs with this type.
calltypenum: Only return CDRs with this call type.
get_cdrs (DEPRECATED)
Like psearch_cdrs, but returns all the FS::cdr objects at once, in a single list. Arguments are the same as for psearch_cdrs. This can take an unreasonably large amount of memory and is best avoided.
sum_cdrs
Takes the same options as psearch_cdrs, but returns a single row containing "count" (the number of CDRs) and the sums of the following fields: duration, billsec, rated_price, rated_seconds, rated_minutes.
Note that if any calls are not rated, their rated_* fields will be null. If you want to use those fields, pass the 'status' option to limit to calls that have been rated. This is intentional; please don't "fix" it.

BUGS

SEE ALSO

FS::svc_Common, FS::Record, FS::cust_svc, FS::part_svc, FS::cust_pkg, schema.html from the base documentation.

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 285:
You can't have =items (as at line 289) unless the first thing after the =over is an =item