Display of Remaining Credit Time

The softphone supports a diplaying of the remaining credit time during an active call.

The remaining credit time means how long user can talk before his account balance reaches zero.

On below screenshot you can see that user is talking already 1 minute 36 seconds and the remaining credit time is 6 minutes 24 seconds. The remaining credit time is decreased automatically every second.

Display of Remaining Credit Time

 

In order to make the remaining credit time feature to work, the server should support it also.

The remaining credit time is calculated with the following formula:

CREDIT_TIME_IN_SECONDS = BALANCE / RATE * 60

Where:

BALANCE is an account balance, which was retrieved previously from the server (Read Display of Balance)

RATE is a cost of one minute to specified destination number (read below).

 

Example:

BALANCE = $1.00
RATE = $0.05
CREDIT_TIME_IN_SECONDS= 1.00 / 0.05 * 60 = 1200 seconds (or 20 minutes)

 

RATE is retrieved from the server with one of following methods:

  1. HTTP request
  2. Parse Rate value from SIP headers (preferred method)
  3. Parse Credit Time value from SIP headers

 

1. HTTP request

The softpone makes a request to a billing server via HTTP protocol (see below diagram).

Request of Remaining Credit Time via HTTP


The softphone sends HTTP GET request to a Web server. It requests a web-page with URL like:
http://www.miaphone.net/rate.php?login=1234&destination=9876543, where 1234 is a login and 9876543 is a destination number, for which rate is requested.

The web server returns a simple web-page with the rate for specified destination (cost of one minute of a call).

 

2. Parse Rate value from SIP headers

Some SIP softswitches support a sending of rate value inside SIP headers.

The rate value is encoded inside SIP response message to INVITE request, for example:

SIP/2.0 200 OK
CSeq: 2 INVITE
From: ...
To: ...
Rate: 0.05

In above example, SIP message contains a custom header "Rate", which is added by billing system. It has value 0.05

This header is parsed by softphone and the calculated the remaining credit time is displayed on the main application window.

 

The header name (in above example it is "Rate") is configured inside configuration file installer-brand.nsi.

 

3. Parse Credit Time value from SIP headers

Some softswitches may send already calculated the remaining credit time value.

So, no calculation on the softphone side is necessary.

Credit time value (in seconds) can be retrieved from SIP message. In this case Rate and Balance is not necessary.
SIP 200 OK message, which is sent in response to SIP INVITE message, should contain balance value, for example:

SIP/2.0 200 OK
CSeq: 2 INVITE
From: ...
To: ...
Credit-time: 1200

In above example 1200 is maximum possible duration of the current call.

"Credit-time" is a header name, which is added by billing system to SIP message.

This header name should be configured inside installer-brand.nsi file.

 

Comments (0)