Steps involved to create an Auto-Attendant
Creating an Auto-attendant is a multistep process which involves a few different objects in the API and a deep understanding of our platform. The following tutorial will show how to create an Auto-attendant 4001 on domain abc-company.11111.service. If you are creating multiple auto attendants please replace any instance of 4001 with your own auto attendant subscriber number.
1. Create Auto-Attendant User
Create the Auto-Attendant user
curl https://pbx.skyswitch.com/ns-api/ \
-H 'Authorization: Bearer 7bet078rqljh451l31uh34lsd0f80dsf' \
-d object='subscriber' \
-d action='create' \
-d user='4001' \
-d first_name = 'Daytime' \
-d last_name = 'Auto-Attendant' \
-d subscriber_login = '4001@abc-company' \
-d uid = '[email protected]' \
-d dir_list = 'no' \
-d dir_anc = 'no' \
-d srv_code = 'system-aa' \
-d call_limit = '0' \
-d dial_plan = 'abc-company.11111.service_4001'
Important Notes
The srvcode must be system-aa and the dial_plan must be the domain.
The dial_plan must follow this format, [domain][subscriber] i.e. abc-company.11111.service_4001.
2. Create Answering Rule
Next you have to create the answering rule to forward to the prompt application within the system. The naming convention the portal uses is:
Prompt_[subscriber]01 i.e. Prompt_400101
curl https://pbx.skyswitch.com/ns-api/ \
-H 'Authorization: Bearer 7bet078rqljh451l31uh34lsd0f80dsf' \
-d object='answerrule' \
-d action='create' \
-d user='4001' \
-d domain = 'abc-company.11111.service' \
-d time_frame = '*' \
-d priority = '99' \
-d for_control = 'e' \
-d for_parameters = 'Prompt_400101' \
-d dnd_control = 'd' \
-d acp_control = 'd' \
-d rej_control = 'd' \
-d scr_control = 'd' \
-d fbu_control = 'd' \
-d fna_control = 'd' \
-d sim_control = 'd' \
-d fna_parameters = '' \
-d fbu_parameters = '' \
-d fnr_parameters = '' \
-d pna_parameters = '' \
-d acp_parameters = '' \
-d rej_parameters = '' \
-d sim_parameters = '' \
-d enable = 'yes' \
3. Create the Dial Plan and Dial Rules for Initial AA Setup
Create the Dial Plan specific to the new AA
curl https://pbx.skyswitch.com/ns-api/ \
-H 'Authorization: Bearer 7bet078rqljh451l31uh34lsd0f80dsf' \
-d object='dialplan' \
-d action='create' \
-d domain='abc-company.11111.service' \
-d dialplan= 'abc-company.11111.service_4001' \
-d plan_description = 'dialplan for AA 4001' \
Create the Dial Rule to catch the forward from the AA User
curl https://pbx.skyswitch.com/ns-api/ \
-H 'Authorization: Bearer 7bet078rqljh451l31uh34lsd0f80dsf' \
-d object='dialrule' \
-d action='create' \
-d matchrule='Prompt_400101' \
-d responder = 'Prompt' \
-d to_user = '400101' \
-d domain = 'abc-company.11111.service' \
-d to_host = 'abc-company.11111.service' \
-d plan_description = 'API AA designer: Day Time Auto-Attendant' \
-d dialplan = 'abc-company.11111.service_4001' \
Create the Dial Rule for Dial by Extension 3 Digits
curl https://pbx.skyswitch.com/ns-api/ \
-H 'Authorization: Bearer 7bet078rqljh451l31uh34lsd0f80dsf' \
-d object='dialrule' \
-d action='create' \
-d matchrule='Prompt_400101.Case_[0-9][0-9][0-9]' \
-d responder = 'sip:start@to-user' \
-d to_user = '[!!!!!!!!!!!!!!!!!!!*]' \
-d domain = 'abc-company.11111.service' \
-d to_host = 'abc-company.11111.service' \
-d plan_description = 'API AA designer: Dial Extension' \
-d dialplan = 'abc-company.11111.service_4001' \
Create Dial Rule for Dial by Extension 4 Digits
curl https://pbx.skyswitch.com/ns-api/ \
-H 'Authorization: Bearer 7bet078rqljh451l31uh34lsd0f80dsf' \
-d object='dialrule' \
-d action='create' \
-d matchrule='Prompt_400101.Case_[0-9][0-9][0-9][0-9]' \
-d responder = 'sip:start@to-user' \
-d to_user = '[!!!!!!!!!!!!!!!!!!!*]' \
-d domain = 'abc-company.11111.service' \
-d to_host = 'abc-company.11111.service' \
-d plan_description = 'API AA designer: Dial Extension' \
-d dialplan = 'abc-company.11111.service_4001' \
Create Default Dial Rule to Repeat the greeting Prompt
curl https://pbx.skyswitch.com/ns-api/ \
-H 'Authorization: Bearer 7bet078rqljh451l31uh34lsd0f80dsf' \
-d object='dialrule' \
-d action='create' \
-d matchrule='Prompt_999001.Default' \
-d responder = 'Prompt' \
-d to_user = '999001' \
-d domain = 'abc-company.11111.service' \
-d to_host = 'abc-company.11111.service' \
-d plan_description = 'AA designer: Digit Timeout: Repeat the greeting prompt' \
-d dialplan = 'abc-company.11111.service_698' \
Create Dial Rule to Repeat the prompt on an un-programmed input
curl https://pbx.skyswitch.com/ns-api/ \
-H 'Authorization: Bearer 7bet078rqljh451l31uh34lsd0f80dsf' \
-d object='dialrule' \
-d action='create' \
-d matchrule='Prompt_400101.*' \
-d responder = 'Prompt' \
-d to_user = '400101' \
-d domain = 'abc-company.11111.service' \
-d to_host = 'abc-company.11111.service' \
-d plan_description = 'API AA designer: Unknown Input: Repeat the greeting prompt' \
-d dialplan = 'abc-company.11111.service_4001' \
4. Special Configuration
To configure the individual digits with special routing please follow this format:
Prompt400101.Case
For example to program input of 1 to go to user 204 please see the example:
curl https://pbx.skyswitch.com/ns-api/ \
-H 'Authorization: Bearer 7bet078rqljh451l31uh34lsd0f80dsf' \
-d object='dialrule' \
-d action='create' \
-d matchrule='Prompt_400101.Case_1' \
-d responder = 'sip:start@to-user' \
-d to_user = '204' \
-d domain = 'abc-company.11111.service' \
-d to_host = 'abc-company.11111.service' \
-d plan_description = 'API AA designer: Unknown Input: To user 204' \
-d dialplan = 'abc-company.11111.service_4001' \
responder | to_user | to_host | description |
---|---|---|---|
sip:start@to-user | Send call to user | ||
sip:start@to-owned-device | Example: 204.abc-company.11111.service | conference-bridge | Send the call to a conference bridge |
sip:start@call-queuing | of the queue | Send call to queue | |
sip:start@directory | 999008 | Send call to the company directory | |
sip:start@to-vmail | Send call directly to a users voicemail | ||
sip:[email protected] | [*] | Send call to voicemail management | |
Prompt | Number part of the "Prompt_999001". To send the call back to replay the AA you would put 999001 or put another AA to create multi-tier AA's | Repeat the current AA or send the call to another AA |
5. Uploading Audio to the Auto-Attendant
The Content-Type of this request must be multipart/form-data. Also the index must match the number after Prompt_
curl https://pbx.skyswitch.com/ns-api/ \
-H 'Authorization: Bearer 7bet078rqljh451l31uh34lsd0f80dsf' \
-F object='audio' \
-F action='upload' \
-F type='greeting' \
-F owner = '4001' \
-F owner_domain = 'abc-company.11111.service' \
-F script = 'Day Time Auto Attendant' \
-F format = 'audio/wav' \
-F index = '400101' \
-F convert = 'wav'
-F file= '@/home/user/greeting.wav'