Outbound tutorial¶
Preparation¶
We need two groups of peers. The agent and client.
Add the agent(sip) info¶
Add the agent info to the /etc/asterisk/sip.conf
This sip info is act like an agent.
Assume that we have below agent info.
[agent-01]
type=friend
secret=*****
host=dynamic
[agent-02]
type=friend
secret=*****
host=dynamic
[agent-03]
type=friend
secret=*****
host=dynamic
Add the client/customer(sip) info¶
Add the client info to the /etc/asterisk/sip.conf
This sip info is act like an client(customer).
Assume that we have a below client info.
[300]
type=friend
secret=*****
host=dynamic
[301]
type=friend
secret=*****
host=dynamic
[302]
type=friend
secret=*****
host=dynamic
Settings¶
saturn*CLI> sip show peers
Name/username Host Dyn Forcerport Comedia ACL Port Status Description
300/83916470 192.168.200.1 D No Auto (Yes) 56389 OK (1 ms)
301/19563407 192.168.200.1 D No Auto (Yes) 56389 OK (1 ms)
302/52704186 192.168.200.1 D No Auto (Yes) 56389 OK (1 ms)
303/84613297 192.168.200.1 D No Auto (Yes) 56389 OK (7 ms)
agent-01/59041286 192.168.200.1 D No Auto (Yes) 56389 OK (1 ms)
agent-02/20369415 192.168.200.1 D No Auto (Yes) 56389 OK (1 ms)
agent-03/26315780 192.168.200.1 D No Auto (Yes) 56389 OK (1 ms)
...
17 sip peers [Monitored: 7 online, 0 offline Unmonitored: 0 online, 10 offline]
Basic tutorial¶
Dial to the customer. After the customer answered call, the call will be transfferred to the parking lot.
- Create a plan.
- Create a destination.
- Create dlma and dial list.
- Create a campaign.
- Update campaign status to start.
- Check dial list status.
Create plan¶
$ curl -X POST http://192.168.200.10:8081/plans -d
'{"name":"basic tutorial plan", "detail":"test plan for basic tutorial", "tech_name":"sip", "dial_mode":1}'
{
"api_ver": "0.1",
"timestamp": "2017-03-08T01:42:40.668089274Z",
"statuscode": 200,
"result": {
"tm_delete": null,
"caller_id": null,
"uuid": "50fd1e1f-920b-477a-b84c-afe58928dadc",
"name": "basic tutorial plan",
"detail": "test plan for basic tutorial",
"max_retry_cnt_1": 5,
"max_retry_cnt_7": 5,
"in_use": 1,
"max_retry_cnt_8": 5,
"service_level": 0,
"dial_timeout": 30000,
"variables": null,
"dial_mode": 1,
"codecs": null,
"dl_end_handle": 1,
"retry_delay": 60,
"trunk_name": null,
"early_media": null,
"max_retry_cnt_2": 5,
"tech_name": "sip",
"max_retry_cnt_4": 5,
"max_retry_cnt_3": 5,
"max_retry_cnt_5": 5,
"max_retry_cnt_6": 5,
"tm_create": "2017-03-08T01:42:40.551073859Z",
"tm_update": null
}
}
Create destination¶
$ curl -X POST http://192.168.200.10:8081/destinations -d
'{"name": "basic tutorial destination", "detail":"test pln for basic tutorial", "type":1, "application": "park"}'
{
"api_ver": "0.1",
"result": {
"application": "park",
"context": null,
"data": null,
"detail": "test pln for basic tutorial",
"exten": null,
"in_use": 1,
"name": "basic tutorial destination",
"priority": null,
"tm_create": "2017-03-08T01:46:42.781526492Z",
"tm_delete": null,
"tm_update": null,
"type": 1,
"uuid": "36a8a632-569d-414a-94e1-f92c8e0d505e",
"variables": null
},
"statuscode": 200,
"timestamp": "2017-03-08T01:46:42.830332118Z"
}
Create dlma and dial list¶
Create dlma.
$ curl -X POST http://192.168.200.10:8081/dlmas -d
'{"name": "basic tutorial dlma", "detail": "test dlma for basic tutorial"}'
{
"api_ver": "0.1",
"result": {
"detail": "test dlma for basic tutorial",
"dl_table": "42b72a18_a6c5_43bf_b9aa_6043ff32128d",
"in_use": 1,
"name": "basic tutorial dlma",
"tm_create": "2017-03-08T01:51:40.978836362Z",
"tm_delete": null,
"tm_update": null,
"uuid": "42b72a18-a6c5-43bf-b9aa-6043ff32128d",
"variables": null
},
"statuscode": 200,
"timestamp": "2017-03-08T01:51:41.37138842Z"
}
Create dial list
$ curl -X POST http://192.168.200.10:8081/dls -d
'{"dlma_uuid":"42b72a18-a6c5-43bf-b9aa-6043ff32128d", "name": "basic tutorial test customer 1", "detail": "test customer for basic tutorial", "number_1": "300"}'
{
"api_ver": "0.1",
"result": {
"detail": "test customer for basic tutorial",
"dialing_camp_uuid": null,
"dialing_plan_uuid": null,
"dialing_uuid": null,
"dlma_uuid": "42b72a18-a6c5-43bf-b9aa-6043ff32128d",
"email": null,
"in_use": 1,
"name": "basic tutorial test customer 1",
"number_1": "300",
"number_2": null,
"number_3": null,
"number_4": null,
"number_5": null,
"number_6": null,
"number_7": null,
"number_8": null,
"res_dial": 0,
"res_dial_detail": null,
"res_hangup": 0,
"res_hangup_detail": null,
"resv_target": null,
"status": 0,
"tm_create": "2017-03-08T01:55:07.911271576Z",
"tm_delete": null,
"tm_last_dial": null,
"tm_last_hangup": null,
"tm_update": null,
"trycnt_1": 0,
"trycnt_2": 0,
"trycnt_3": 0,
"trycnt_4": 0,
"trycnt_5": 0,
"trycnt_6": 0,
"trycnt_7": 0,
"trycnt_8": 0,
"ukey": null,
"uuid": "7d760dd1-8ba5-48d9-989d-415d610ffe57",
"variables": null
},
"statuscode": 200,
"timestamp": "2017-03-08T01:55:07.936731333Z"
}
Create campaign¶
Create campaign using above information.
$ curl -X POST http://192.168.200.10:8081/campaigns -d
'{"name": "basic tutorial campaign", "detail": "test campaign for basic tutorial", \
"plan":"50fd1e1f-920b-477a-b84c-afe58928dadc", "dest":"36a8a632-569d-414a-94e1-f92c8e0d505e", \
"dlma":"42b72a18-a6c5-43bf-b9aa-6043ff32128d"}'
{
"api_ver": "0.1",
"result": {
"dest": "36a8a632-569d-414a-94e1-f92c8e0d505e",
"detail": "test campaign for basic tutorial",
"dlma": "42b72a18-a6c5-43bf-b9aa-6043ff32128d",
"in_use": 1,
"name": "basic tutorial campaign",
"next_campaign": null,
"plan": "50fd1e1f-920b-477a-b84c-afe58928dadc",
"sc_date_end": null,
"sc_date_list": null,
"sc_date_list_except": null,
"sc_date_start": null,
"sc_day_list": null,
"sc_mode": 0,
"sc_time_end": null,
"sc_time_start": null,
"status": 0,
"tm_create": "2017-03-08T01:59:48.604422007Z",
"tm_delete": null,
"tm_update": null,
"uuid": "30097375-df96-4ca4-829b-b1e3100a2221"
},
"statuscode": 200,
"timestamp": "2017-03-08T01:59:48.722673874Z"
}
Update Campaign status to start¶
$ curl -X PUT http://192.168.200.10:8081/campaigns/30097375-df96-4ca4-829b-b1e3100a2221 -d '{"status": 1}'
{
"api_ver": "0.1",
"result": {
"dest": "36a8a632-569d-414a-94e1-f92c8e0d505e",
"detail": "test campaign for basic tutorial",
"dlma": "42b72a18-a6c5-43bf-b9aa-6043ff32128d",
"in_use": 1,
"name": "basic tutorial campaign",
"next_campaign": null,
"plan": "50fd1e1f-920b-477a-b84c-afe58928dadc",
"sc_date_end": null,
"sc_date_list": null,
"sc_date_list_except": null,
"sc_date_start": null,
"sc_day_list": null,
"sc_mode": 0,
"sc_time_end": null,
"sc_time_start": null,
"status": 1,
"tm_create": "2017-03-08T01:59:48.604422007Z",
"tm_delete": null,
"tm_update": "2017-03-08T02:02:19.305706615Z",
"uuid": "30097375-df96-4ca4-829b-b1e3100a2221"
},
"statuscode": 200,
"timestamp": "2017-03-08T02:02:19.345044282Z"
}
Check dial list status¶
After update the campaign status, the aserisk will make a call to peer 300. And if the client answer the call the call transfers to the parking lot.
Then, if we check the dial list status later, we can see the updated dial list information.
$ curl -X GET http://192.168.200.10:8081/dls/7d760dd1-8ba5-48d9-989d-415d610ffe57
{
"api_ver": "0.1",
"timestamp": "2017-03-08T02:05:54.905205247Z",
"statuscode": 200,
"result": {
"tm_last_dial": "2017-03-08T02:02:19.561972329Z",
"number_4": null,
"email": null,
"trycnt_5": 0,
"uuid": "7d760dd1-8ba5-48d9-989d-415d610ffe57",
"dlma_uuid": "42b72a18-a6c5-43bf-b9aa-6043ff32128d",
"res_hangup": 16,
"detail": "test customer for basic tutorial",
"in_use": 1,
"res_hangup_detail": "Normal Clearing",
"number_3": null,
"name": "basic tutorial test customer 1",
"status": 0,
"trycnt_7": 0,
"ukey": null,
"dialing_uuid": null,
"resv_target": null,
"trycnt_6": 0,
"trycnt_3": 0,
"variables": null,
"trycnt_2": 0,
"number_8": null,
"dialing_camp_uuid": null,
"number_2": null,
"dialing_plan_uuid": null,
"res_dial": 4,
"number_1": "300",
"tm_create": "2017-03-08T01:55:07.911271576Z",
"trycnt_1": 1,
"number_5": null,
"trycnt_8": 0,
"number_6": null,
"number_7": null,
"trycnt_4": 0,
"res_dial_detail": "Remote end has answered",
"tm_delete": null,
"tm_update": null,
"tm_last_hangup": "2017-03-08T02:02:38.294239075Z"
}
}
And also, we can see the dial try result in a file.
$ tail -n 1 /opt/bin/outbound_result.json
{
"uuid": "7ac02fb2-abe9-4882-a023-bbba573fc220",
"name": null,
"res_hangup_detail": "Normal Clearing",
"status": 7,
"action_id": "7f2aab69-4d09-4756-ac9a-f522c9e12f47",
"res_dial_detail": "Remote end has answered",
"dial_addr": "300",
"res_dial": 4,
"tm_update": "2017-03-08T02:02:38.225648380Z",
"res_hangup": 16,
"uuid_camp": "30097375-df96-4ca4-829b-b1e3100a2221",
"uuid_plan": "50fd1e1f-920b-477a-b84c-afe58928dadc",
"uuid_dest": "36a8a632-569d-414a-94e1-f92c8e0d505e",
"dial_data": "",
"uuid_dlma": "42b72a18-a6c5-43bf-b9aa-6043ff32128d",
"dial_channel": "sip/300",
"uuid_dl_list": "7d760dd1-8ba5-48d9-989d-415d610ffe57",
"tm_create": "2017-03-08T02:02:19.491821216Z",
"dial_trycnt": 1,
"dial_application": "park",
"dial_type": 1,
"dial_index": 1,
"dial_timeout": 30000,
"dial_exten": null,
"tm_delete": null
}
Normal call distribute¶
Dial to the customer. After the customer answered call, the call will be distributed to the waiting agents.
- Create a queue and add memeber to queue.
- Create a destination.
- Create dlma and dial list.
- Create a campaign.
- Update campaign status to start
- Check result
Create a queue and add memeber to queue¶
Add the queue info to the /etc/asterisk/queues.conf
Assume that we have a below queue info.
[sales_1]
musicclass = default
strategy = ringall
joinempty = yes
Add the all agents to the queue.
pluto*CLI> queue add member sip/agent-01 to sales_1
Added interface 'sip/agent-01' to queue 'sales_1'
pluto*CLI> queue add member sip/agent-02 to sales_1
Added interface 'sip/agent-02' to queue 'sales_1'
pluto*CLI> queue add member sip/agent-03 to sales_1
Added interface 'sip/agent-03' to queue 'sales_1'
Check the queue status
pluto*CLI> queue show sales_1
sales_1 has 0 calls (max unlimited) in 'ringall' strategy (0s holdtime, 0s talktime), W:0, C:0, A:0, SL:0.0% within 0s
Members:
sip/agent-01 (ringinuse enabled) (dynamic) (Not in use) has taken no calls yet
sip/agent-02 (ringinuse enabled) (dynamic) (Not in use) has taken no calls yet
sip/agent-03 (ringinuse enabled) (dynamic) (Not in use) has taken no calls yet
No Callers
Create plan¶
$ curl -X POST http://192.168.200.10:8081/plans -d
'{"name":"normal call distribute plan", "detail":"test plan for normal call distribute", "tech_name":"sip", "dial_mode":1}'
{
"api_ver": "0.1",
"result": {
"caller_id": null,
"codecs": null,
"detail": "test plan for normal call distribute",
"dial_mode": 1,
"dial_timeout": 30000,
"dl_end_handle": 1,
"early_media": null,
"in_use": 1,
"max_retry_cnt_1": 5,
"max_retry_cnt_2": 5,
"max_retry_cnt_3": 5,
"max_retry_cnt_4": 5,
"max_retry_cnt_5": 5,
"max_retry_cnt_6": 5,
"max_retry_cnt_7": 5,
"max_retry_cnt_8": 5,
"name": "normal call distribute plan",
"retry_delay": 60,
"service_level": 0,
"tech_name": "sip",
"tm_create": "2017-03-08T02:26:58.135746353Z",
"tm_delete": null,
"tm_update": null,
"trunk_name": null,
"uuid": "2410fdf4-5633-4b84-917b-c66cc5e94d0c",
"variables": null
},
"statuscode": 200,
"timestamp": "2017-03-08T02:26:58.194401817Z"
}
Create destination¶
$ curl -X POST http://192.168.200.10:8081/destinations -d
'{"name": "normal call distribute destination", "detail":"test pln for normal call distribute", "type":1, "application": "queue", "data":"sales_1"}'
{
"api_ver": "0.1",
"result": {
"application": "queue",
"context": null,
"data": "sales_1",
"detail": "test pln for normal call distribute",
"exten": null,
"in_use": 1,
"name": "normal call distribute destination",
"priority": null,
"tm_create": "2017-03-08T02:30:28.856570883Z",
"tm_delete": null,
"tm_update": null,
"type": 1,
"uuid": "cc260c6a-80b5-434b-8d68-d2486eeb2c01",
"variables": null
},
"statuscode": 200,
"timestamp": "2017-03-08T02:30:28.877500393Z"
}
Create dlma and dial list¶
Create Dlma
$ $ curl -X POST http://192.168.200.10:8081/dlmas -d
'{"name": "normal call distribute dlma", "detail": "test dlma for normal call distribute"}'
{
"api_ver": "0.1",
"result": {
"detail": "test dlma for normal call distribute",
"dl_table": "b0d73193_2787_4341_8c32_bc051bad9f94",
"in_use": 1,
"name": "normal call distribute dlma",
"tm_create": "2017-03-08T02:31:30.747154596Z",
"tm_delete": null,
"tm_update": null,
"uuid": "b0d73193-2787-4341-8c32-bc051bad9f94",
"variables": null
},
"statuscode": 200,
"timestamp": "2017-03-08T02:31:30.764677718Z"
}
Create dial list.
$ curl -X POST http://192.168.200.10:8081/dls -d
'{"dlma_uuid":"b0d73193-2787-4341-8c32-bc051bad9f94", "name": "normal call distribute test customer 1", "detail": "test customer for normal call distribute", "number_1": "300"}'
{
"api_ver": "0.1",
"result": {
"detail": "test customer for normal call distribute",
"dialing_camp_uuid": null,
"dialing_plan_uuid": null,
"dialing_uuid": null,
"dlma_uuid": "b0d73193-2787-4341-8c32-bc051bad9f94",
"email": null,
"in_use": 1,
"name": "normal call distribute test customer 1",
"number_1": "300",
"number_2": null,
"number_3": null,
"number_4": null,
"number_5": null,
"number_6": null,
"number_7": null,
"number_8": null,
"res_dial": 0,
"res_dial_detail": null,
"res_hangup": 0,
"res_hangup_detail": null,
"resv_target": null,
"status": 0,
"tm_create": "2017-03-08T02:32:52.786548232Z",
"tm_delete": null,
"tm_last_dial": null,
"tm_last_hangup": null,
"tm_update": null,
"trycnt_1": 0,
"trycnt_2": 0,
"trycnt_3": 0,
"trycnt_4": 0,
"trycnt_5": 0,
"trycnt_6": 0,
"trycnt_7": 0,
"trycnt_8": 0,
"ukey": null,
"uuid": "d0527ab9-c240-49a4-a001-1d3adecebbcb",
"variables": null
},
"statuscode": 200,
"timestamp": "2017-03-08T02:32:52.812825540Z"
}
Create campaign and status update¶
Create campaign.
$ curl -X POST http://192.168.200.10:8081/campaigns -d
'{"name": "normal call distribute campaign", "detail": "test campaign for normal call distribute", \
"plan":"2410fdf4-5633-4b84-917b-c66cc5e94d0c", "dest":"cc260c6a-80b5-434b-8d68-d2486eeb2c01", \
"dlma":"b0d73193-2787-4341-8c32-bc051bad9f94"}'
{
"api_ver": "0.1",
"result": {
"dest": "cc260c6a-80b5-434b-8d68-d2486eeb2c01",
"detail": "test campaign for normal call distribute",
"dlma": "b0d73193-2787-4341-8c32-bc051bad9f94",
"in_use": 1,
"name": "normal call distribute campaign",
"next_campaign": null,
"plan": "2410fdf4-5633-4b84-917b-c66cc5e94d0c",
"sc_date_end": null,
"sc_date_list": null,
"sc_date_list_except": null,
"sc_date_start": null,
"sc_day_list": null,
"sc_mode": 0,
"sc_time_end": null,
"sc_time_start": null,
"status": 0,
"tm_create": "2017-03-08T02:35:01.122129833Z",
"tm_delete": null,
"tm_update": null,
"uuid": "ed40ec12-9d39-4594-823c-0a2b5d86d9b6"
},
"statuscode": 200,
"timestamp": "2017-03-08T02:35:01.142891513Z"
}
Update campaign status.
$ curl -X PUT http://192.168.200.10:8081/campaigns/ed40ec12-9d39-4594-823c-0a2b5d86d9b6 -d '{"status": 1}'
{
"api_ver": "0.1",
"result": {
"dest": "cc260c6a-80b5-434b-8d68-d2486eeb2c01",
"detail": "test campaign for normal call distribute",
"dlma": "b0d73193-2787-4341-8c32-bc051bad9f94",
"in_use": 1,
"name": "normal call distribute campaign",
"next_campaign": null,
"plan": "2410fdf4-5633-4b84-917b-c66cc5e94d0c",
"sc_date_end": null,
"sc_date_list": null,
"sc_date_list_except": null,
"sc_date_start": null,
"sc_day_list": null,
"sc_mode": 0,
"sc_time_end": null,
"sc_time_start": null,
"status": 1,
"tm_create": "2017-03-08T02:35:01.122129833Z",
"tm_delete": null,
"tm_update": "2017-03-08T02:36:31.509227769Z",
"uuid": "ed40ec12-9d39-4594-823c-0a2b5d86d9b6"
},
"statuscode": 200,
"timestamp": "2017-03-08T02:36:31.526276933Z"
}
Check dial list status¶
After update the campaign status, the aserisk will make a call to peer 300. And if the client answer the call, the agent’s device will be ringing.
If the one of the agent is answered the call, the other’s device’s ringing will be stopped.
Then, if we check the dial list status later, we can see the updated dial list information.
$ curl -X GET http://192.168.200.10:8081/dls/d0527ab9-c240-49a4-a001-1d3adecebbcb
{
"api_ver": "0.1",
"result": {
"detail": "test customer for normal call distribute",
"dialing_camp_uuid": null,
"dialing_plan_uuid": null,
"dialing_uuid": null,
"dlma_uuid": "b0d73193-2787-4341-8c32-bc051bad9f94",
"email": null,
"in_use": 1,
"name": "normal call distribute test customer 1",
"number_1": "300",
"number_2": null,
"number_3": null,
"number_4": null,
"number_5": null,
"number_6": null,
"number_7": null,
"number_8": null,
"res_dial": 4,
"res_dial_detail": "Remote end has answered",
"res_hangup": 18,
"res_hangup_detail": "No user responding",
"resv_target": null,
"status": 0,
"tm_create": "2017-03-08T02:32:52.786548232Z",
"tm_delete": null,
"tm_last_dial": "2017-03-08T02:36:31.704367362Z",
"tm_last_hangup": "2017-03-08T02:37:36.836258185Z",
"tm_update": null,
"trycnt_1": 1,
"trycnt_2": 0,
"trycnt_3": 0,
"trycnt_4": 0,
"trycnt_5": 0,
"trycnt_6": 0,
"trycnt_7": 0,
"trycnt_8": 0,
"ukey": null,
"uuid": "d0527ab9-c240-49a4-a001-1d3adecebbcb",
"variables": null
},
"statuscode": 200,
"timestamp": "2017-03-08T02:38:56.518844830Z"
}
$ tail -n 1 /opt/bin/outbound_result.json
{
"uuid": "363f21fc-d7f1-43bb-868e-37b7c7ede07c",
"name": null,
"res_hangup_detail": "No user responding",
"status": 7,
"action_id": "92746286-f090-418b-9411-c0ee43b96664",
"res_dial_detail": "Remote end has answered",
"dial_addr": "300",
"res_dial": 4,
"tm_update": "2017-03-08T02:37:36.621821426Z",
"res_hangup": 18,
"uuid_camp": "ed40ec12-9d39-4594-823c-0a2b5d86d9b6",
"uuid_plan": "2410fdf4-5633-4b84-917b-c66cc5e94d0c",
"uuid_dest": "cc260c6a-80b5-434b-8d68-d2486eeb2c01",
"dial_data": "sales_1",
"uuid_dlma": "b0d73193-2787-4341-8c32-bc051bad9f94",
"dial_channel": "sip/300",
"uuid_dl_list": "d0527ab9-c240-49a4-a001-1d3adecebbcb",
"tm_create": "2017-03-08T02:36:31.649998750Z",
"dial_trycnt": 1,
"dial_application": "queue",
"dial_type": 1,
"dial_index": 1,
"dial_timeout": 30000,
"dial_exten": null,
"tm_delete": null
}