C# Class SIPSorcery.Entities.CustomerAccountDataLayer

Datei anzeigen Open project: sipsorcery/sipsorcery

Public Methods

Method Description
Add ( CustomerAccount customerAccount ) : void

Adds a new customer account.

CheckAccountCode ( string owner, string accountCode ) : CustomerAccount

Checks the account code is valid and if not will also check the account number.

Get ( string owner, string accountNumber ) : CustomerAccount
GetBalance ( string accountCode ) : decimal
GetRate ( string owner, string rateCode, string destination, int ratePlan ) : Rate

This method acts as a call rate lookup engine. It's very basic and simply matches the call destination based on the record that has the longest matching prefix.

GetRtccCustomer ( string owner, string accountNumber ) : SIPSorcery.SIP.App.RtccCustomerAccount
GetRtccRate ( string owner, string rateCode, string destination, int ratePlan ) : SIPSorcery.SIP.App.RtccRate
IsAccountCodeInUse ( string accountCode, string updatingID ) : bool

Checks whether the account code is already in use for the system.

IsAccountNameInUse ( string owner, string accountName, string updatingID ) : bool

Checks whether the account name is already in use for this owner.

IsAccountNumberInUse ( string owner, string accountNumber, string updatingID ) : bool

Checks whether the account number is already in use for this owner.

ReserveCredit ( int seconds, string rtccID ) : bool

This method attempts to reserve a chunk of credit for to allow a call to continue.

ReserveInitialCredit ( string accountCode, string rateID, SIPCDR cdr, int &initialSeconds ) : decimal

This method attempts to reserve a the initial amount of credit for a call.

ReturnUnusedCredit ( string rtccID ) : decimal

This method should be called once a billable call has been completed. It will calculate the final cost of the call and return any usused credit back to the customer account.

SetCDRIsHangingUp ( string rtccID ) : void
Update ( CustomerAccount customerAccount ) : void

Updates an existing customer account.

UpdateRealTimeCallControlCDRID ( string oldCDRID, SIPCDR newCDR ) : void

Private Methods

Method Description
CheckUniqueFields ( CustomerAccount customerAccount ) : void

Method Details

Add() public method

Adds a new customer account.
public Add ( CustomerAccount customerAccount ) : void
customerAccount CustomerAccount The customer account to add.
return void

CheckAccountCode() public method

Checks the account code is valid and if not will also check the account number.
public CheckAccountCode ( string owner, string accountCode ) : CustomerAccount
owner string The owner of the customer accounts to check.
accountCode string
return CustomerAccount

Get() public method

public Get ( string owner, string accountNumber ) : CustomerAccount
owner string
accountNumber string
return CustomerAccount

GetBalance() public method

public GetBalance ( string accountCode ) : decimal
accountCode string
return decimal

GetRate() public method

This method acts as a call rate lookup engine. It's very basic and simply matches the call destination based on the record that has the longest matching prefix.
public GetRate ( string owner, string rateCode, string destination, int ratePlan ) : Rate
owner string The owner the call rate lookup is for.
rateCode string The rate code for the call. If specified and a matching rate is found it will /// take precedence over the destination.
destination string The call desintation the rate lookup is for.
ratePlan int
return Rate

GetRtccCustomer() public method

public GetRtccCustomer ( string owner, string accountNumber ) : SIPSorcery.SIP.App.RtccCustomerAccount
owner string
accountNumber string
return SIPSorcery.SIP.App.RtccCustomerAccount

GetRtccRate() public method

public GetRtccRate ( string owner, string rateCode, string destination, int ratePlan ) : SIPSorcery.SIP.App.RtccRate
owner string
rateCode string
destination string
ratePlan int
return SIPSorcery.SIP.App.RtccRate

IsAccountCodeInUse() public method

Checks whether the account code is already in use for the system.
public IsAccountCodeInUse ( string accountCode, string updatingID ) : bool
accountCode string The account code to check.
updatingID string An optional parameter that can be supplied when the check is being made for an account /// that is being updated and in which case this ID is for the record being updated.
return bool

IsAccountNameInUse() public method

Checks whether the account name is already in use for this owner.
public IsAccountNameInUse ( string owner, string accountName, string updatingID ) : bool
owner string The owner of the customer accounts to check.
accountName string The account name to check.
updatingID string An optional parameter that can be supplied when the check is being made for an account /// that is being updated and in which case this ID is for the record being updated.
return bool

IsAccountNumberInUse() public method

Checks whether the account number is already in use for this owner.
public IsAccountNumberInUse ( string owner, string accountNumber, string updatingID ) : bool
owner string The owner of the customer accounts to check.
accountNumber string The account number to check.
updatingID string An optional parameter that can be supplied when the check is being made for an account /// that is being updated and in which case this ID is for the record being updated.
return bool

ReserveCredit() public method

This method attempts to reserve a chunk of credit for to allow a call to continue.
public ReserveCredit ( int seconds, string rtccID ) : bool
seconds int The number of seconds the reservation is being requested for.
rtccID string
return bool

ReserveInitialCredit() public method

This method attempts to reserve a the initial amount of credit for a call.
public ReserveInitialCredit ( string accountCode, string rateID, SIPCDR cdr, int &initialSeconds ) : decimal
accountCode string The accountCode the credit should be reserved against.
rateID string
cdr SIPSorcery.SIP.SIPCDR
initialSeconds int IF the reservation is successful this parameter will hold the number of seconds that were reserved for the initial reservation.
return decimal

ReturnUnusedCredit() public method

This method should be called once a billable call has been completed. It will calculate the final cost of the call and return any usused credit back to the customer account.
public ReturnUnusedCredit ( string rtccID ) : decimal
rtccID string
return decimal

SetCDRIsHangingUp() public method

public SetCDRIsHangingUp ( string rtccID ) : void
rtccID string
return void

Update() public method

Updates an existing customer account.
public Update ( CustomerAccount customerAccount ) : void
customerAccount CustomerAccount The customer account to update.
return void

UpdateRealTimeCallControlCDRID() public method

public UpdateRealTimeCallControlCDRID ( string oldCDRID, SIPCDR newCDR ) : void
oldCDRID string
newCDR SIPSorcery.SIP.SIPCDR
return void