From Freeside
Jump to: navigation, search

Exports (provisioning)

Exports allow you to provision services to remote machines, databases and APIs. Some exports, such as sqlradius and sqlradius_withdomain, enable a feed for retrieving rating/usage data.

Exports can be added and edited under

Configuration -> Provisioning, services and packages -> View/edit exports

Most exports place jobs in the job queue for new, modified or deleted services. Jobs are run by [[Freeside::Documentation:Developer/bin/freeside-queued|freeside-queued]]. This daemon needs to be running before exports are acted upon.

Some exports use SSH, SCP or SFTP to communicate with external machines. See the documentation on SSH keys.

Click on Add a new export to create a new export. Select exports from the dropdown to show more information on each export, including available options, setup and usage.

Exports are activated by associating them with one or more service definitions.

Following is a list of which exports can be associated with each type of service.


  • Real-time export to Plesk managed mail service
  • Real-time export of accounts to SQL databases .
  • Real-time export to a CommuniGate Pro mail server
  • Real-time export to Cpanel control panel.
  • Real-time export to Critical Path Account Provisioning Protocol
  • Real-time export to Cyrus IMAP server
  • Real-time export to outsourced mail service
  • Real-time export to InfoStreet streetSmartAPI
  • Real-time export to LDAP
  • Real-time export to RADIATOR
  • Real-time export via remote SSH (vpopmail, ISPMan)
  • Real-time export to SQL-backed mail server
  • Real-time export to SQL-backed RADIUS (FreeRADIUS, ICRADIUS)
  • Real-time export to SQL-backed RADIUS (FreeRADIUS, ICRADIUS) with realms
  • Real-time export to vpopmail text files


  • Batch export to BIND named
  • Batch export to slave BIND named
  • Real-time export to a CommuniGate Pro mail server
  • Run remote commands via SSH, for domains (qmail, ISPMan).
  • Real time export of domains to SQL databases .
  • Send an HTTP or HTTPS GET or POST request
  • OpenSRS integration
  • Real-time export to SQL-backed mail server


  • Real-time export to a CommuniGate Pro mail server
  • Run remote commands via SSH, for forwards
  • Postfix text files
  • Real-time export to SQL-backed mail server


  • Export an Apache httpd.conf file snippet.
  • Real-time export to Plesk managed hosting service
  • Run remote commands via SSH, for virtual web sites (directory maintenance, FrontPage, ISPMan)


  • A meta-export that triggers other svc_broadband exports.
  • Real-time export to Northbound Interface
  • Send a command to a router.
  • Sends SNMP SETs to an SNMP agent.
  • Sends SNMP SETs to a Trango AP.


  • Grandstream phone and ATA provisioning. This blog article is a start at documentation.
  • Vitelity provisioning





Accounts (svc_acct)

Domains (svc_domain)

Forwards (svc_forward)

Hosting (svc_www)

Broadband (svc_broadband)

Phone (svc_phone)

External (svc_external)

DSL (svc_dsl)


Package Category

Package categories define groups of package classes.

Category name
defines an invoice section if that feature is enabled.
determines the order in which invoice_sections appear.
Collapse identical items into one
causes identical packages to appear folded into a single line item with a quantity when checked rather than the default once line item per package.

Price Plans

Common price plans

  • flat
  • subscription
  • prorate
  • sqlradacct_hour
  • voip_cdr
  • prepaid

Wholesale price plans

  • bulk

Other price plans

  • flat_delayed
  • flat_introrate
  • prorate_delayed
  • base_delayed
  • base_rate
  • sql_external
  • sql_generic

Price plans of questionable functionality

  • flat_comission_cust
  • flat_comission_pkg
  • flat_comission
  • voip_sqlradacct
  • sesmon_hour
  • sesmon_minute





Go to Configuration -> Employees -> Employees to view the existing employees and add new ones. It is highly recommended to add a separate account for each person rather than using role accounts.

  • To add a new employee, click on "Add an employee"
  • Or to edit an existing group, click on the employee number or name in the list of employees.
  • Enter or edit the username, password and name. If editing an existing employee and no password change is desired, the password fields can be left blank.
  • Check the "Disable employee" box to disable this employee.
  • In the "Employee groups" section, mark or unmark checkboxes to indicate the access groups for this employee.

Employee groups and access control

To setup employee access control or agent/reseller virtualization, you need to setup employee groups. Go to Configuration -> Employees -> Employee groups to view the existing groups and add new ones. The system starts with a "Superuser" group which has access to all functionality for the first agent.

  • To add a new group, click on "Add an employee group"
  • Or to edit an existing group, click on the group number or name in the list of groups.
  • Enter or edit the group name.
  • In the "Group limited to these agent(s)" section, mark checkboxes next to the agents this employee group should be able to see. Employees in this group will only see customers of the selected agents in the system and reports.
  • In the "Group access rights" section, mark or unmark checkboxes to indicate the access rights this employee group should have. Rights marked with an "*" are global rights which provide access to global data which is shared among all agents. Their use is not recommended for groups which are limited to a subset of agents.
  • After adding a new group, don't forget to go back and add or edit employees to place them into the new group.


Billing events

Billing events are the primary mechanism to implement your business rules. Rules such as resend invoices, retry cards, suspend or cancel accounts for non-payment, etc. are all handled by billing events.

At a high level, follow the following steps to create billing events:

  • Add a new Billing Event (Configuration > Billing > Billing events)
  • Name the event
  • Choose the type of event:
    • Package - Packages and associated dates (Including Commissions)
    • Invoice - Invoice status and dates
    • Customer - Customer Balances and Information
    • Batch Payment - Batch payment results
    • Statement - Send statement
  • Choose whether to apply to one or all agents
  • Choose the frequency for the system to check and see if the event should run.
  • Choose appropriate filters.
  • Choose appropriate actions.

The form is dynamic so changing the type of event will change the available filters and actions.

Daily and Monthly Scripts

  • The freeside-daily script should be run daily to bill customers and run invoice collection events.
    • Typically, this is accomplished with an entry in the freeside user's crontab such as:
      0 0 * * * /usr/local/bin/freeside-daily
    • If running freeside-daily manually, ensure the TZ variable is set to your timezone with a command such as:
      TZ="US/Pacific" freeside-daily fs_daily
  • If any monthly events are enabled, the freeside-monthly script should be run monthly.
  • Invoice events can also be used to implement agent-virtualized invoices. (add more info)
  • Be sure to include the full path of freeside-daily in your cron job.


Typeset (LaTeX) invoice templates


  • Almost all distributions include the necessary prerequisites listed here, manual installation is practically never necessary.
  • Install Ghostscript (gs)
  • Install teTeX or TeX Live
  • Ensure that the pslatex, dvips, and pdflatex command line utilities were installed

Logo setup

The EPS logo is for PDF and printed invoices.

  • For best results, save a vector format logo in EPS (Encapsulated PostScript) format.
    • Your graphic artist can create vector image from a bitmap (tracing etc).
    • Converting a bitmap such as a JPG can work (the bigger the better), but it may render in lower quality, blurry or with the "jaggies" (especially when actually printed, not just viewed as a PDF)
  • Resize the logo to 90pt X 36pt: epsffit -c 0 0 90 36 yourlogo.eps >logo.eps
    • ("no %%BoundingBox:" error? Fix with eps2eps)
  • Upload the resized logo as the logo.eps configuration option.
  • Problems? Try bin/strip-eps <oldlogo.eps >trynewlogo.eps

The PNG logo is for emailed and online invoices.

Freeside ships with a logo of 92 x 62. Any logo close to this size should work with the default HTML template.

Invoice Layout and Content

Basic Invoice Styles

Several variables make significant changes to the appearance of invoices.

enables the division of invoices into sections defined by package categories
package categories must be setup for this to work properly
Section the invoices based on location, instead of package category.

With sectionsWithout sections

Indicates that html and latex invoices should be in summary style and make use of invoice_latexsummary or invoice_htmlsummary.
Defines what information to use when displaying summaries on invoices. Locations and package categories currently supported.

With summaryWithout summary

enables the construction of a section per usage_class on invoices

Usage class as a section

enables the creation of a section for each svc_phone

svc_phone sections

Invoice Templates

  • {{#ifeq: latex | latex | LaTeX | HTML }} invoices use Text::Template with {{#ifeq: latex | latex | [@-- and --@] | <%= and %> }} delimiters.
  • {{#ifeq: latex | latex | Edit the invoice_latexcoupon, | The following can be set to override the default behaviour of using the invoice_latex* data transformed to HTML: }} invoice_latexreturnaddress, invoice_latexfooter, invoice_latexnotes, and invoice_latexsmallfooter configuration options. {{#ifeq: latex | latex | If you are adventurous, | You may }} edit invoice_latex as well.

Common VOIP plan options for invoice appearance

Certain configuration options on telephony plan packages can have significant impact on the appearances of invoices by changing the data calculated and stored at the time of invoice generation.

CDR invoice display format [output_format]
controls the data stored for the usage detail on the invoice. Current choices are
 default                   - date, time, destination, regionname, duration, price
 default with source       - source, date, time, destination, regionname, duration, price
 default with account code - date, time, account code, destination, regionname, duration, price
 simple                    - date, time, user, destination, duration, price
 simple with source        - date, time, source, destination, duration, price
Section in which to place usage charges (whether separated or not) [usage_section]
names an invoice section which is to contain the usage portion of the invoiced package. If the section is to be included in a summary page then you will need to ensure the spelling exactly matches a package category
Include usage summary with recurring charges when usage is in separate section [summarize_usage]
creates an additional (2nd) line on the invoice showing the total usage associated with the package. Typically appears below a 'setup' and 'recurring' line (if they exist).
Always put usage details in separate section [usage_mandate]
causes freeside to generate an extra section for the usage details even when freeside is not using invoice sections.

Other Variables Changing Invoice Layout at Billing Time

controls the splitting of the setup, recurring, and usage components of packages into separate line items at generation time. It is one of two mechanisms which cause one or more separate 'Usage' lines to appear for each package. The other is the usage_mandate on a telephony price plan.

Variables Neither Perfectly Rendering nor Perfectly Generational

describes the appearance of dates

Usage is not universal and in some instances date format may be frozen when data is stored in the database.

defines the symbol to be used for currency in many locations

Usage is not universal and may in some instances be stored permanently in the database.

declares the default payment terms for invoices

When this setting is changed, invoices which were not defaulted will retain their old value.

Boolean Rendering Variables

Show previous invoice due dates when showing prior balances. Default is to show invoice date.
Show an aging line after the prior balance section. Only valid when invoice_sections is enabled.
Display the notes section in a smaller font on invoices.
Display footers in a smaller font on invoices.
Include the shipping address on invoices.
Prevent freeside from automatically generating date ranges on invoice line items.
Disable inclusion of previous balance, payment, and credit lines on invoices.
Only show a single line summarizing the total previous balance rather than one line per invoice.
Place the balance due message below a line. Only meaningful when when invoice_sections is false.
enables a quantity (qty) field for quick charges, but otherwise only changes the rendering with the addition of qty and unit price columns on invoices

Freeside:Configuration:previous balance-section

Other Rendering Variables

Optional LaTeX invoice topmargin setting. Include units.
Optional LaTeX invoice headsep setting. Include units.
Optional LaTeX invoice separation between invoice data and the 'to' address (usually invoice_latexreturnaddress). Include units.
Optional LaTeX invoice textheight setting. Include units.
Optional LaTeX invoice textheight space to reserve for a tear off coupon. Include units.
Optional LaTeX invoice separation between tear off coupon and footer. Include units.
Optional LaTeX invoice separation between total due and amount enclosed line. Include units.
Optional LaTeX invoice separation between invoice data and the 'to' address (usually invoice_latexreturnaddress). Include units.
Place the return address under the company logo rather than beside it.
Add the company name to the 'To' address on the remittance coupon because the return address does not contain it.
Do not include previous balance in the 'Total' line. Only meaningful when invoice_sections is false. Optionally provide text to override the 'Total New Charges' description.
Your company name.
Your company address.
The default package class for late fee charges, used if the fee event does not specify a package class itself. Also used to determine which invoice_section is the finance section of the invoice.
Maximum number of the same service to list individually on invoices before condensing to a single line listing the number of services. Defaults to 5.
Consolidate service display into fewer lines on invoices rather than one per service.

Miscellaneous Variables Impacting Customer Perception of Invoices

These variables do not change the invoice per se, but do change what is emailed to a customer as an invoice.

Send PDF invoice as an attachment to emailed invoices. By default, includes the plain text invoice as the email body, unless invoice_email_pdf_note is set.
If defined, this text will replace the default plain text invoice as the body of emailed PDF invoices.
Enable the per-customer option for including CDR information as a CSV attachment on emailed invoices.

HTML invoice templates

  • Convert your logo to PNG format and upload it as the logo.png configuration option.
  • {{#ifeq: html | latex | LaTeX | HTML }} invoices use Text::Template with {{#ifeq: html | latex | [@-- and --@] | <%= and %> }} delimiters.
  • {{#ifeq: html | latex | Edit the invoice_htmlcoupon, | The following can be set to override the default behaviour of using the invoice_latex* data transformed to HTML: }} invoice_htmlreturnaddress, invoice_htmlfooter, invoice_htmlnotes, and invoice_htmlsmallfooter configuration options. {{#ifeq: html | latex | If you are adventurous, | You may }} edit invoice_html as well.

Plaintext invoice templates

  • See the Text::Template documentation for details on the substitution language.
  • You must call the invoice_lines() function at least once - pass it a number of lines, and it returns a list of array references, each of two elements: a service description column, and a price column. Alternatively, call invoice_lines() with no arguments, and pagination will be disabled - all invoice line items will print on one page, with no padding (recommended for email invoices).
  • Descriptions of variables are available in invoice_html


Manually setting next customer number sequence

  • With PostgreSQL, to number customers starting at 5000:
    SELECT SETVAL(pg_get_serial_sequence('cust_main', 'custnum'), 4999);
  • With MySQL, to number customers starting at 5000:
    ALTER TABLE cust_main AUTO_INCREMENT = 5000;

Manually setting next invoice number sequence

  • With PostgreSQL, to number invoices starting at 5000:
    SELECT SETVAL(pg_get_serial_sequence('cust_bill', 'invnum'), 4999);
  • With MySQL, to number invoices starting at 5000:
    ALTER TABLE cust_bill AUTO_INCREMENT = 5000;

Payment Receipts

The payment_receipt_email template is used for manually applied payments.

Credit cards and Electronic checks


This page is part of the Freeside Context Sensitive Help. Please review the Editing Guidelines before making modifications to this page.