% include( '/elements/header.html', 'Developer Documentation' ) %> <& /elements/menubar.html, 'Freeside Perl Modules' => $fsurl.'docs/library/FS.html', 'Complete Index' => $fsurl.'docs/library/index.html', &>
FS::svc_pbx - Object methods for svc_pbx records
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;
An FS::svc_pbx object represents a PBX tenant. FS::svc_pbx inherits from FS::svc_Common. The following fields are currently supported:
Primary key (assigned automatcially for new accounts)
(Unique?) number of external record
PBX name
Maximum number of extensions
Maximum number of simultaneous users
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.
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.
Class method which returns an SQL fragment to search for the given string.
Returns the title field for this PBX tenant.
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 this record from the database.
Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
Called by the suspend method of FS::cust_pkg (see FS::cust_pkg).
Called by the unsuspend method of FS::cust_pkg (see FS::cust_pkg).
Called by the cancel method of FS::cust_pkg (see FS::cust_pkg).
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.
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.
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.
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.
FS::svc_Common, FS::Record, FS::cust_svc, FS::part_svc, FS::cust_pkg, schema.html from the base documentation.
Hey! The above document had some coding errors, which are explained below:
You can't have =items (as at line 264) unless the first thing after the =over is an =item