Create Service
Overview
The create_service.pl
program enables the creation of a new service for an existing customer from
the command line.
A new flow will be created and scheduled for the service, so that the service is ready to use immediately.
Running the program with the --help
command line option will show the program usage.
Parameters
The following options may be specified when executing create_service
.
Option | Type | Default | Description |
---|---|---|---|
--db-host |
String | localhost |
IP address or FQDN of the PostgreSQL database instance to connect to. |
--db-port |
Number | 5432 |
Port number of the PostgreSQL database instance to connect to. |
--db-name |
String | n2in_owner |
Name of the PostgreSQL database that contains the N2ACD schema. |
--db-connect |
PSQL DB Connection String | Alternative option to using --db-host --db-port and --db-name . Specified as a PostgreSQL connection string. See PostgreSQL Connection Strings for more information. |
|
--db-user |
String | n2acd_owner |
The username of the user to connect to the PostgreSQL database instance with. |
--db-password |
String | The password for the user specified with --db-user to connect to the PostgreSQL database instance with. |
|
--change-user |
String | [Required] An identifier to use in the database for the person creating the service. | |
--customer-id |
Number | [Conditional] The database identifier for the customer that the service should be owned by. One (and only one) of --customer-id or --customer-name is required. |
|
--customer-name |
String | [Conditional] The name of the customer that the service should be owned by. One (and only one) of --customer-id or --customer-name is required. |
|
--service-digits |
String | [Required] The telephony digits (0-9 , a-f , * , # ) to use to call the service. |
|
--service-profile |
String | (Platform default service profile.) | The name of a service profile to use when provisioning the service. |
--flow-type |
connect / json |
[Required] The type of flow to create for the service. | |
--flow-id |
Number | The database identifier for an existing flow owned by the target customer. If specified, the service’s flow will be created as a new version of this flow. Only one of --flow-id and --flow-name may be specified. |
|
--flow-name |
String | --service-digits |
If the target customer has an existing flow with this name, the service’s flow will be created as a new version of that flow. Otherwise the service’s flow will be created as a new flow with this name. Only one of --flow-id and --flow-name may be specified. |
--file |
String | flow.json |
[Conditional] The name of a file containing the JSON definition for new service’s flow. The Flow Editor export function can be used to produce a compliant file.Required when --flow-type is json . |
--destination-digits |
String | [Conditional] Telephony digits (0-9 , a-f , * , # ) specifying the destination that the service will attempt to terminate to.Required when --flow-type is connect . |
Usage
Example creating a service that terminates to a destination number, with a custom flow name:
perl create_service.pl --db-password password --change-user msmith --customer-id 15 --service-digits 0800123321 --flow-name 'My Connect Flow' --flow-type connect --destination-digits 061234567
-------------------------------------------------------------------------------
DB host = 'localhost'
DB port = '5432'
DB name = 'n2in'
DB user = 'n2acd_owner'
DB password = [specified]
change user = 'msmith'
customer ID = 15
service digits = '0800123321'
service profile = [not specified]
flow type = 'connect'
flow name = 'My Connect Flow'
destination digits = '061234567'
-------------------------------------------------------------------------------
Target customer is 'My Customer' (ID = 15).
Will create a new flow with name 'My Connect Flow'.
Will create service using default profile 'Default Network' (ID = 4).
Have valid flow version JSON.
Created service with ID 21408.
Created flow with ID 50233.
Created flow version with ID 55258 and version 1.
Created flow version schedule.
Success!
Example creating a service with a specified profile and custom JSON flow definition:
perl create_service.pl --db-password password --change-user jblogs --customer-name 'My Customer' --service-digits 0800123321 --service-profile 'My Network' --flow-type json --file my_flow.json
-------------------------------------------------------------------------------
DB host = 'localhost'
DB port = '5432'
DB name = 'n2in'
DB user = 'n2acd_owner'
DB password = [specified]
change user = 'jblogs'
customer name = 'My Customer'
service digits = '0800123321'
service profile = 'My Network'
flow type = 'json'
flow name = [not specified]
file = 'my_flow.json'
-------------------------------------------------------------------------------
Target customer is 'My Customer' (ID = 15).
Will create a new flow with name '0800123321'.
Will create service using profile 'My Network' (ID = 5).
Have valid flow version JSON.
Created service with ID 21407.
Created flow with ID 50232.
Created flow version with ID 55257 and version 1.
Created flow version schedule.
Success!