Difference between revisions of "Freeside:1.9:Documentation:Developer/FS/cdr"
From Freeside
m (Edit via perl MediaWiki framework (1.13)) |
|||
Line 20: | Line 20: | ||
An FS::cdr object represents an Call Data Record, typically from a telephony system or provider of some sort. FS::cdr inherits from FS::Record. The following fields are currently supported: | An FS::cdr object represents an Call Data Record, typically from a telephony system or provider of some sort. FS::cdr inherits from FS::Record. The following fields are currently supported: | ||
− | ; acctid - primary key; calldate - Call timestamp (SQL timestamp); clid - Caller*ID with text; src - Caller*ID number / Source number; dst - Destination extension; dcontext - Destination context; channel - Channel used; dstchannel - Destination channel if appropriate; lastapp - Last application if appropriate; lastdata - Last application data; startdate - Start of call (UNIX-style integer timestamp); answerdate - Answer time of call (UNIX-style integer timestamp); enddate - End time of call (UNIX-style integer timestamp); duration - Total time in system, in seconds; billsec - Total time call is up, in seconds; disposition - What happened to the call: ANSWERED, NO ANSWER, BUSY; amaflags - What flags to use: BILL, IGNORE etc, specified on a per channel basis like accountcode.; accountcode - CDR account number to use: account; uniqueid - Unique channel identifier (Unitel/RSLCOM Event ID); userfield - CDR user-defined field; cdr_type - CDR type - see [[Freeside:1.9:Documentation:Developer/FS/cdr type|FS::cdr_type]] (Usage = 1, S&E = 7, OC&C = 8); charged_party - Service number to be billed; upstream_currency - Wholesale currency from upstream; upstream_price - Wholesale price from upstream; upstream_rateplanid - Upstream rate plan ID; rated_price - Rated (or re-rated) price; distance - km (need units field?); islocal - Local - 1, Non Local = 0; calltypenum - Type of call - see [[Freeside:1.9:Documentation:Developer/FS/cdr calltype|FS::cdr_calltype]]; description - Description (cdr_type 7&8 only) (used for cust_bill_pkg.itemdesc); quantity - Number of items (cdr_type 7&8 only); carrierid - Upstream Carrier ID (see [[Freeside:1.9:Documentation:Developer/FS/cdr carrier|FS::cdr_carrier]]); upstream_rateid - Upstream Rate ID; svcnum - Link to customer service (see [[Freeside:1.9:Documentation:Developer/FS/cust svc|FS::cust_svc]]); freesidestatus - NULL, done (or something); cdrbatch | + | ; acctid - primary key |
+ | ; calldate - Call timestamp (SQL timestamp) | ||
+ | ; clid - Caller*ID with text | ||
+ | ; src - Caller*ID number / Source number | ||
+ | ; dst - Destination extension | ||
+ | ; dcontext - Destination context | ||
+ | ; channel - Channel used | ||
+ | ; dstchannel - Destination channel if appropriate | ||
+ | ; lastapp - Last application if appropriate | ||
+ | ; lastdata - Last application data | ||
+ | ; startdate - Start of call (UNIX-style integer timestamp) | ||
+ | ; answerdate - Answer time of call (UNIX-style integer timestamp) | ||
+ | ; enddate - End time of call (UNIX-style integer timestamp) | ||
+ | ; duration - Total time in system, in seconds | ||
+ | ; billsec - Total time call is up, in seconds | ||
+ | ; disposition - What happened to the call: | ||
+ | ; ANSWERED, NO ANSWER, BUSY | ||
+ | ; amaflags - What flags to use: | ||
+ | ; BILL, IGNORE etc, specified on a per channel basis like accountcode. | ||
+ | ; accountcode - CDR account number to use: | ||
+ | ; account | ||
+ | ; uniqueid - Unique channel identifier (Unitel/RSLCOM Event ID) | ||
+ | ; userfield - CDR user-defined field | ||
+ | ; cdr_type - CDR type - see [[Freeside:1.9:Documentation:Developer/FS/cdr type|FS::cdr_type]] (Usage = 1, S&E = 7, OC&C = 8) | ||
+ | ; charged_party - Service number to be billed | ||
+ | ; upstream_currency - Wholesale currency from upstream | ||
+ | ; upstream_price - Wholesale price from upstream | ||
+ | ; upstream_rateplanid - Upstream rate plan ID | ||
+ | ; rated_price - Rated (or re-rated) price | ||
+ | ; distance - km (need units field?) | ||
+ | ; islocal - Local - 1, Non Local = 0 | ||
+ | ; calltypenum - Type of call - see [[Freeside:1.9:Documentation:Developer/FS/cdr calltype|FS::cdr_calltype]] | ||
+ | ; description - Description (cdr_type 7&8 only) (used for cust_bill_pkg.itemdesc) | ||
+ | ; quantity - Number of items (cdr_type 7&8 only) | ||
+ | ; carrierid - Upstream Carrier ID (see [[Freeside:1.9:Documentation:Developer/FS/cdr carrier|FS::cdr_carrier]]) | ||
+ | ; upstream_rateid - Upstream Rate ID | ||
+ | ; svcnum - Link to customer service (see [[Freeside:1.9:Documentation:Developer/FS/cust svc|FS::cust_svc]]) | ||
+ | ; freesidestatus - NULL, done (or something) | ||
+ | ; cdrbatch | ||
==METHODS== | ==METHODS== | ||
; new HASHREF | ; new HASHREF |
Revision as of 08:12, 1 April 2010
NAME
FS::cdr - Object methods for cdr records
SYNOPSIS
use FS::cdr; $record = new FS::cdr \%hash; $record = new FS::cdr { 'column' => 'value' }; $error = $record->insert; $error = $new_record->replace($old_record); $error = $record->delete; $error = $record->check;
DESCRIPTION
An FS::cdr object represents an Call Data Record, typically from a telephony system or provider of some sort. FS::cdr inherits from FS::Record. The following fields are currently supported:
- acctid - primary key
- calldate - Call timestamp (SQL timestamp)
- clid - Caller*ID with text
- src - Caller*ID number / Source number
- dst - Destination extension
- dcontext - Destination context
- channel - Channel used
- dstchannel - Destination channel if appropriate
- lastapp - Last application if appropriate
- lastdata - Last application data
- startdate - Start of call (UNIX-style integer timestamp)
- answerdate - Answer time of call (UNIX-style integer timestamp)
- enddate - End time of call (UNIX-style integer timestamp)
- duration - Total time in system, in seconds
- billsec - Total time call is up, in seconds
- disposition - What happened to the call:
- ANSWERED, NO ANSWER, BUSY
- amaflags - What flags to use:
- BILL, IGNORE etc, specified on a per channel basis like accountcode.
- accountcode - CDR account number to use:
- account
- uniqueid - Unique channel identifier (Unitel/RSLCOM Event ID)
- userfield - CDR user-defined field
- cdr_type - CDR type - see FS::cdr_type (Usage = 1, S&E = 7, OC&C = 8)
- charged_party - Service number to be billed
- upstream_currency - Wholesale currency from upstream
- upstream_price - Wholesale price from upstream
- upstream_rateplanid - Upstream rate plan ID
- rated_price - Rated (or re-rated) price
- distance - km (need units field?)
- islocal - Local - 1, Non Local = 0
- calltypenum - Type of call - see FS::cdr_calltype
- description - Description (cdr_type 7&8 only) (used for cust_bill_pkg.itemdesc)
- quantity - Number of items (cdr_type 7&8 only)
- carrierid - Upstream Carrier ID (see FS::cdr_carrier)
- upstream_rateid - Upstream Rate ID
- svcnum - Link to customer service (see FS::cust_svc)
- freesidestatus - NULL, done (or something)
- cdrbatch
METHODS
- new HASHREF
- Creates a new CDR. To add the CDR 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.
- insert
- Adds this record to the database. If there is an error, returns the error, otherwise returns false.
- 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.
- check
- Checks all fields to make sure this is a valid CDR. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
- Note: Unlike most types of records, we don't want to "reject" a CDR and we want to process them as quickly as possible, so we allow the database to check most of the data.
- set_status_and_rated_price STATUS [ RATED_PRICE ]
- Sets the status to the provided string. If there is an error, returns the error, otherwise returns false.
- calldate_unix
- Parses the calldate in SQL string format and returns a UNIX timestamp.
- startdate_sql
- Parses the startdate in UNIX timestamp format and returns a string in SQL format.
- cdr_carrier
- Returns the FS::cdr_carrier object associated with this CDR, or false if no carrierid is defined.
- carriername
- Returns the carrier name (see FS::cdr_carrier), or the empty string if no FS::cdr_carrier object is assocated with this CDR.
- cdr_calltype
- Returns the FS::cdr_calltype object associated with this CDR, or false if no calltypenum is defined.
- calltypename
- Returns the call type name (see FS::cdr_calltype), or the empty string if no FS::cdr_calltype object is assocated with this CDR.
- cdr_upstream_rate
- Returns the upstream rate mapping (see FS::cdr_upstream_rate), or the empty string if no FS::cdr_upstream_rate object is associated with this CDR.
- _convergent_format COLUMN [ COUNTRYCODE ]
- Returns the number in COLUMN formatted as follows:
- If the country code does not match COUNTRYCODE (default "61"), it is returned unchanged.
- If the country code does match COUNTRYCODE (default "61"), it is removed. In addiiton, "0" is prepended unless the number starts with 13, 18 or 19. (???)
- downstream_csv [ OPTION => VALUE, ... ]
CLASS METHODS
- invoice_formats
- Returns an ordered list of key value pairs containing invoice format names as keys (for use with part_pkg::voip_cdr) and "pretty" format names as values.
- invoice_header FORMAT
- Returns a scalar containing the CSV column header for invoice format FORMAT.
- import_formats
- Returns an ordered list of key value pairs containing import format names as keys (for use with batch_import) and "pretty" format names as values.
- batch_import HASHREF
- Imports CDR records. Available options are:
- file
- Filename
- format
- ; params
- Hash reference of preset fields, typically cdrbatch
- empty_ok
- Set true to prevent throwing an error on empty imports
- process_batch_import
BUGS
SEE ALSO
FS::Record, schema.html from the base documentation.