# Call Billing for SIP Gateway

## Description

When MiVoice Business acts as a SIP trunking gateway to a third-party PSTN service provider, sufficient billing information must be conveyed to the service provider. With this feature enabled, the SIP trunking gateway does not extract billing or caller ID information from the DID Ranges for CPN Substitution or the SIP Peer Profile form, which in some cases does not provide correct billing data (see Deployment scenarios for details on when this billing method is not sufficient). Instead, MiVoice Business sends the appropriate billing information to the gateway, using the P-Asserted-Identity (PAI) and, if required, P-Preferred Identity (PPI) headers. A user-specific billing number can be provisioned and this number can be different than the CPN Substitution (public) number for the same user. Both numbers can be configured using the Associated Directory Numbers (ADN) or the User and Services Configuration (USC) form.

In addition, MiVoice Business can be provisioned with a Default Billing Number and/or a Default Calling Party Number (CPN) for each network zone. These default numbers are usually the same, but can be different and they can be sent instead of the caller's or diverting party's billing or CPN Substitution number.

Depending on the configuration, the following calling party numbers can be provided for outgoing calls:

- The public (callback) number - the user's CPN Substitution Number (configured in the USC or the ADN form) or the zone's Default CPN (Network Zones form), or, if both are not programmed, any other CPN Substitution number (such as, SIP Peer Default CPN)

- The user's billing number - Billing Number configured in the ADN and USC forms

- The zone's default billing number - Default Billing Number configured in the Network Zones form

### Billing algorithm

The billing data is delivered based on the following algorithm:

- If the calling or diverting party's billing number is programmed and the COS option "Use default billable number for trunk billing" is not selected, then this number is sent as the billable number.

NOTE: A call made or diverted to an External Hot Desk User (EHDU) is charged to the EHDU, not the calling or diverting party. See EHDU calls.

- If the user's billing number is not configured, but the network zone's Default Billing Number is, then the following information is sent:

- Default Billing Number - as the billable number (PAI: header)

- user's CPN Substitution number or zone's Default CPN (as configured) - to identify the caller (FROM: header)

- If both the user's and the default billing numbers are configured, calls will be charged to the user's billing number, unless the COS option Use Default Billable Number For Trunk Billing is enabled.

With the COS option enabled, the Default Billing Number is sent as the billable number (PAI header), and the CPN Substitution number or the zone's Default CPN (as configured) is sent as the caller's ID (FROM header). In addition, you can use the PPI header to also provide the user's billing number (SIP Peer Profile option "Use P-Preferred Identity Header" must be set to User Associated Billing. See Notes).

NOTES

- If using the PPI option:

- The information included in this header is not designated for users; it is up to the service provider to ensure that the User Associated Billing information is used for internal purposes only (such as billing) and not be displayed to end-users. Otherwise, the "User Associated Billing" option should not be selected.

- If the caller is a public trunk, and the call is transferred/diverted, etc. to a public SIP trunk, then the received original public trunk CPN will be sent in the PPI header as the billing number.

- If the COS option is enabled, but the Default Billing Number is not configured, then the PAI header will contain the user's CPN information.

- If no user's or default billing number is programmed, MiVoice Business will use available CPN (either user associated or SIP Peer profile associated) information in the PAI header.

See Rules for Determining Billable Number for a complete list of various call scenarios and the associated billing information sent during a SIP trunk call.

### Diverted Calls

For calls diverted to a SIP trunk, if users' billing and public (CPN) numbers are not configured, the following information is sent:

- Default CPN for the caller (FROM: header)

- Default Billing Number for the diverting party (PAI: header)

- Default CPN for the diverting party (Diversion: header)

The following programmable entities in MiVoice Business cannot have a public number:

- ACDX Group

- ACD Path

- Ring Group

- Hunt Group

- Network Hunt Group

When one of the above entities diverts a call to a SIP trunk, the programmed Default CPN of zone 1 is sent as the diverting party’s public number. If no Default CPN is programmed in zone 1, then no diverting party public number information is sent; the SIP trunking gateway must perform CPN Substitution lookups to obtain billing information.

### EHDU calls

Calls made or diverted to an EHDU are billed to the EHDU or EHDU's Personal Ring Group (PRG), not the caller. See Rules for Determining Billable Device for details.

When a call made to an EHDU is passed over SIP trunking gateway, the following information is sent:

- the caller's public number, if programmed (FROM: header)

- EHDU's billing or default billing number (PAI header)

When a call is diverted to an EHDU that passes it across a SIP trunking gateway, the billable device is the EHDU, not the diverting party, so no diverting information is sent to the gateway. The Default Billing Number (if configured) or the EHDU's billing number is sent for billing (PAI: header).

### Rules for Determining Billable Device

When a SIP trunk call is made, in most cases the caller is the billable device. Otherwise, the following rules determine whom to charge for the call (that is, the billable device).

Call is... | Billable device is:
Made or diverted to a PRG, and the PRG has an EHDU member that passes the call across a SIP trunk | PRG
Made directly to an EHDU or diverted to an EHDU that passes the call across a SIP trunk, and the EHDU is a member of a PRG NOTE: If an EHDU is not a member of a PRG, then the billable device is the EHDU. | PRG
Made by a member of a suite or a linked suite OR diverted by a suite or a linked suite | First programmed member of the suite or the linked suite
Made to an HDU that has system rerouting enabled and diverts calls over SIP trunking | HDU
Diverted across a SIP trunk | Last diverting party

Billing rules for an MdUG (Multi-Device User Group) with an EHDU are the same as for a PRG.

### Rules for Determining Billable Number

Once the billable device is determined, the billable number for a call is the billing number programmed for that billable device.

If the billable device has no billing number programmed, then the Default Billing Number from the billable device's network zone will be used.

If the billable device has no billing number and no Default Billing Number programmed, then the Call Billing for SIP Gateway feature is essentially disabled and billing information would be determined through DID Substitution or Default CPN programming in the SIP trunk gateway.

## Deployment scenarios

The following sections describe billing configuration for various SIP PSTN network deployment scenarios.

### Single MiVoice Business System or Cluster

In this deployment, a customer has a single MiVoice Business system or cluster that has exclusive access to a SIP trunking gateway. For this deployment, the following billing alternatives are available:

- If a customer wants to use the SIP trunking gateway’s default CPN for all billable trunk calls, then this feature is not required.

- If a customer has a more elaborate billing scheme where several billable numbers are possible (for example, several MiVoice Business instances share the same SIP trunking gateway), then this feature is required.

In general, it is recommended that this feature be enabled.

To manage billable numbers and public numbers within the cluster, configure the following parameters:

- Default Billing Number and Default CPN for all active zones

- Billing Number and/or CPN Substitution digits in the Associated Directory Numbers or User and Services Configuration form, for any device that require a unique billing and/or public number

Configuring billing information at the SIP trunking gateway is no longer required.

### Multiple MiVoice Business Systems or Cluster

In this deployment, multiple customers share access to a single SIP trunking gateway. Each customer can be a standalone MiVoice Business system or a cluster.

For this deployment, each customer must implement this feature. The following parameters must be configured:

- a unique Default Billing Number and a unique Default CPN for the switch or cluster

- Billing Number and/or CPN Substitution digits in the Associated Directory Numbers or User and Services Configuration form, for any device that require a unique billing and/or public number

When the feature is implemented, every standalone MiVoice Business system or cluster sends its own unique billing number to the SIP trunking gateway.

NOTE: MiVoice Business instances owned by different customers do not share their Network Zone data via SDS. Each customer must be defined in its own cluster. Different customers can be in the same network, but not in the same cluster. Sharing of the Network Zones form must be limited to cluster-wide only.

### Scenarios that still require CPN Substitution lookups or the SIP Peer’s Default CPN

In the following few scenarios, a SIP trunking gateway must perform CPN Substitution lookups or use the SIP Peer’s Default CPN. The Default Billing Number and Default CPN must not be programmed in the Network Zones form.

- A customer wishes to use the SIP Peer’s Default CPN as the calling party for all SIP trunk calls. For this customer, no public numbers would be configured for any devices hosted by the MiVoice Business system.

- A call originates from a device with no public number (there are no CPN Substitution digits programmed in the Associated Directory Number form). A CPN Substitution lookup into the DID Ranges for CPN Substitution form would be performed for the caller.

- A diverting party’s public number is not available in some scenarios (like diverted calls from a Hunt Group). A CPN Substitution lookup would be performed for the diverting party.

- An incoming PSTN call is received by MiVoice Business and passes through it to a SIP trunk. If the Public Calling Party Number Passthrough field is set to false in the SIP Peer Profile form, then the Default CPN configured for the SIP Peer Profile is to replace the public number provided by the PSTN trunk.

## Switch Upgrade Procedures

To activate the enhancements provided by this feature, a simultaneous network-wide upgrade of customer’s cluster of switches is not required. However, a site administrator can perform a partial upgrade in the following order:

1. Any switch that acts as a SIP trunking gateway must be upgraded first.

2. The SIP Peer Profile form must be configured correctly to present billing information to the SIP Service Provider.

3. If a SIP Service Provider requires a billable number in every outbound trunk call, a Default CPN must be programmed in the SIP Peer Profile form. This Default CPN will be used as the billable number when no billing information is provided during an outbound trunk call.

2. Once a SIP trunking gateway is upgraded, it should provide the same billing behavior since the end-user switches are not sending any billable numbers. More specifically, the SIP trunking gateway will still derive billing information from the caller’s public number, or through a lookup into the “DID Ranges for CPN Substitution” form, or it can use the programmed SIP Peer’s Default CPN.

3. End-user switches that use the SIP trunking gateway should be upgraded next. Once the end-user switch is upgraded, a Default Billing Number and a Default CPN must be configured for all active zones.

4. Tandem switches (switches that act as an intermediate switch) do not have to be upgraded for this feature to work. However, it is best practice to have all switches in a cluster running the same level of software.

NOTE: If the end-user switch is upgraded before the SIP trunking gateway switch, no serious issues should be observed. The new billing information sent to the SIP trunking gateway will be ignored. The SIP trunking gateway will perform a lookup into the "DID Ranges for CPN Substitution" form or Default CPN in the SIP Peer Profile form to determine billing information for a call.

## Conditions and Feature Interactions

- If programmed, default CPN and Default Billing Number will be sent to SIP trunking gateway for all SIP trunking calls.

## Programming

1. Network Zones form

- On the end-user switch, configure a unique Default Billing Number and Default CPN for each zone in a cluster.

These numbers will be used for billing and caller's ID if the billable device has no billing number or CPN Substitution digits assigned in Associated Directory Number form.

2. SIP Peer Profile form

- On the gateway, set the "Use P-Asserted-Identify for Billing" field to Yes.

3. If you want to assign a specific billing number or caller ID to a specific user, configure the Associated Directory Numbers form ( ) (end-user switch). Alternatively, you can use the User and Services Configuration form ( ) to provision the user's CPN Substitution and Billing Numbers.

4. If the Associate Directory Numbers form is configured, but you don't want to use user-specific billing numbers, enable option "Use Default Billable Number for Trunk Billing" in the Class of Service Options form. ( )

5. If you wish to send both zone's Default Billing Number and the user's Billing Number, enable the COS option "Use default Billable Number for Trunk Billing" and set the SIP Peer Profile option "Use P-Preferred Identity Header" to "User Associated Billing".

Related Topics

- SIP Trunking for Service Provider

- Program SIP Trunks