Difference between revisions of "Freeside:3:Documentation:Developer/FS/svc pbx"

From Freeside
Jump to: navigation, search
m (Edit via perl MediaWiki framework (1.13))
(No difference)

Revision as of 20:06, 27 June 2012

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

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 number.
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.

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 271:
You can't have =items (as at line 275) unless the first thing after the =over is an =item