Skip to main content

FusionPBX

xDR files

In order to set up xDR files integration, please follow the steps below.

Configure CDR CSV module

  1. Login to your FusionPBX server over SSH.
  2. Paste following configuration into /etc/freeswitch/autoload_configs/cdr_csv.conf.xml:
    /etc/freeswitch/autoload_configs/cdr_csv.conf.xml
    <configuration name="cdr_csv.conf" description="CDR CSV Format">
    <settings>
    <!-- 'cdr-csv' will always be appended to log-base -->
    <!--<param name="log-base" value="/var/log"/>-->
    <param name="default-template" value="jerasoft"/>
    <!-- This is like the info app but after the call is hung up -->
    <!--<param name="debug" value="true"/>-->
    <param name="rotate-on-hup" value="true"/>
    <!-- may be a b or ab -->
    <param name="legs" value="ab"/>
    <!-- Only log in Master.csv -->
    <param name="master-file-only" value="true"/>
    </settings>
    <templates>
    <template name="jerasoft">"${uuid}","${originating_leg_uuid}","${context}","${direction}","${network_addr}","${sip_from_uri}","${sip_to_uri}","${caller_id_number}","${destination_number}","${start_stamp}","${answer_stamp}","${end_stamp}","${billsec}","${hangup_cause}","${progresssec}","${read_codec}","${write_codec}"</template>
    </templates>
    </configuration>

Enable CDR CSV module

  1. Open FusionPBX web interface and go to "Advanced → Modules".
  2. Find "CDR CSV" under "Event Handlers", click to edit and set "Enabled" field to "True"

JeraSoft Billing side

Configure a gateway

Perform configuration on the JeraSoft Billing side using Billing configuration article. When selecting a files collector for the gateway you will have the following choice:

  • FusionPBX Multi-Tenant (Domain-Only) works for a pure multi-tenant environment, where the customers are allowed to configure their own extensions and you bill them by the full domain name. In this scenario, you will have to create a single Account per each Client with "Name" identification type and its value matching to the domain name of the customer.

  • FusionPBX Multi-Tenant (Domain + Extension) works for extensions-based billing, where you want to bill or see statistics for each single extension. In this scenario, you will have to create an Account for each extension with "Name" identification type and its value matching to the extension@domain. Be careful when using this collector: if the customer is allowed to manage list of extensions themselves, all extensions have to be added to the billing system.

Traffic processing

All numbers will come to the billing system as dialed. Therefore, some cases would require configuration of the Traffic Processing rules in the JeraSoft Billing. For example:

  • If the call goes to the internal extensions (e.g. 101), it will come to billing as 101. Consequentially it may be recognized as "US" because it starts with 1. For the correct processing of this scenario, you need to add a Traffic Processing rule like this:

    • Type: Initial
    • Dst Match: ^.{0,4}$ (where 4 defines maximum length for the extension)
    • Dst Replace: LOCAL#\1

    After that you will be able to simply add rate for the code LOCAL# which will track all those calls.

  • If the call goes to international, typically some prefix like 00 is used. At the same time for billing purposes it is strictly recommended to use E.164 prefix format, which just starts with the country code right away. So in order to handle this case you need to create a Traffic Processing rule like the following:

    • Type: Initial
    • Dst Match: ^00(.*)$
    • Dst Replace: \1

External routing

info

The configuration for SIP routing assumes that the multi-tenant scenario is used and identifies the customer by their domain name, not by each separate extension.

In order to set up external routing, please follow the steps below.

Set routing server IP

  1. In the FusionPBX web interface go to "Advanced → Variables".

  2. Find the "Defaults" section and click plus icon to add a new variable. Routing server variable

  3. Add a new variable according to the following example: Routing server variable

    FieldDescription
    NameSet to jera-routing
    ValueSet to IP of the JeraSoft Billing followed by :5060
    HostnameKeep empty (optional)
    CategorySelect "Defaults"
    EnabledSelect "True"
    OrderSelect "000"
  4. Click "Save".

Create dial plan

  1. In the FusionPBX web interface go to "Dialplan → Dialplan Manager".

  2. Click plus icon at the top to create a new dial plan.

  3. Fill in parameters as shown below (the create form doesn't allow to set all parameters as needed due to limitation of the FusionPBX UI, so we will edit some of the values on the next step): Create dial plan

    FieldDescription
    NameSet to jera-routing-plan
    Condition 1Select "destination_number" and enter 000
    Condition 2Keep empty
    Action 1Select "Hangup"
    Action 2Keep empty
    ContextLeave empty (for all context) or specify the one you need
    OrderSet to 200
    EnabledSelect "True"
  4. Find newly created dial plan in the list and open to edit.

  5. Re-check parameters to match the following example (do not save yet): Edit dial plan

    FieldDescription
    NameKeep jera-routing-plan
    NumberSet to .*
    ContinueShould be "False"
    OrderSet to 060
    DomainSelect "Global"
  6. Configure rules according to the given list: Dial plan rules

    TagTypeDataGroupOrder
    conditiondestination_number^00.*$01
    actionsetprocess_cdr=false010
    actionsethangup_after_bridge=true020
    actionsetfail_on_single_reject=USER_BUSY030
    actionsetcontinue_on_fail=true040
    actionbridge{sip_invite_call_id=${uuid},sip_invite_from_uri=sip:${context}${sip_network_ip}}sofia/external/${destination_number}${jera-routing}0100
    actionsetsip_ignore_remote_cause=true0110
    actionhangupUNALLOCATED_NUMBER0120
  7. Click "Save".

This dial plan is configured for ^00.*$ destination, which means that it works for numbers that start with 00. If you have a different schema – the pattern has to be changed.

Traffic processing

You may need to add a Traffic Processing rule to strip 00 from the number, if you haven't done this yet within xDR files integration. The parameters for the rule are the following:

  • Type: Initial
  • Dst Match: ^00(.*)$
  • Dst Replace: \1
info

For this integration please use "Default RFC" SIP collector in the JeraSoft Billing.