Test the dialplan
testDialplan simulates a call without placing it: it authenticates the call, finds the tariff and rate, and returns the routes the switch would try in order. It is the API behind Test Dialplan in the panel. Only customers with system management rights may call it.
The method supports trusted mode with i_customer.
You test one of two kinds of call:
- Authenticated Call: a call already authenticated as an account. Send
fallback_i_accountandis_ivr_originated. - Not Authenticated Call: a call arriving from the network that the switch must authenticate first. Send
remote_ip,i_protocoland the SIP domains.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
cld |
string | yes | Called number (CLD) |
cli |
string | no | Calling number (CLI) |
call_start_time |
string | no | Simulated start of the call (Call Start Date/Time) in UTC, in the form 09:57:29.000 GMT Mon May 29 2017 |
fallback_i_account |
int | no | Authenticated call: ID of the account the call is authenticated as (Authenticated as) |
is_ivr_originated |
boolean | no | Authenticated call: True |
remote_ip |
string | no | Not authenticated call: source IP address of the call (Remote Address) |
remote_udp_port |
string | no | Not authenticated call: source port (the :Port part of Remote Address) |
i_protocol |
int | no | Not authenticated call: signalling protocol (Protocol). IDs from the protocols dictionary |
to_domain |
string | no | Not authenticated call: domain of the To header (To Domain) |
from_domain |
string | no | Not authenticated call: domain of the From header (From Domain) |
nated |
boolean | no | True: the caller is behind NAT (Caller is behind NAT) |
pai_hdr |
string | no | Content of the P-Asserted-Identity header (P-Asserted-Identity) |
rpid_hdr |
string | no | Content of the Remote-Party-ID header (Remote-Party-Id) |
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK when the call can be routed, Failure when it cannot |
cause |
string | With Failure: why the call fails, for example Invalid CLD length |
cli, cld |
string | The numbers after translation |
lrn_cli, lrn_cld |
string | The numbers after an LRN lookup, when the routing group uses LRN |
i_account |
int | Account the call was authenticated as |
i_authentication |
int | Authentication rule that matched |
i_did, did |
int, string | DID that matched, for a call to a DID |
i_did_authorization |
int | Authentication rule of the DID that matched |
i_ivr_application |
int | IVR application that answers the call |
i_tariff, tariff_name |
int, string | Tariff used to rate the call |
i_rate, prefix |
int, string | Rate and its prefix |
price_1, price_n |
double | Prices per minute of the rate |
i_routing_group, routing_group_name |
int, string | Routing group used |
routes |
array | Routes in the order they are tried. See the route fields |
onnet_account |
struct | For an on-net call to another account of the switch: i_account, username, i_did and routes with the same fields. routes at the top level is then not used |
With cause set to Invalid CLD length the response also has dest_prefix and i_destination, the destination whose length limits failed, and min_length and max_length, each a number or None.
Route fields
Section titled “Route fields”| Name | Description |
|---|---|
cli, cld |
Numbers sent to this route, after the connection’s translation rules |
prefix |
Matching prefix of the destination set |
i_destination_set, destination_set_name |
Destination set of the route |
i_route |
ID of the route |
i_vendor, vendor_name |
Vendor |
i_connection, connection_name |
Connection |
system_connection |
The route goes to a system connection |
i_media_relay |
Media relay used |
capacity, num_sessions |
Channel limit of the connection and calls in progress on it |
preference |
Preference of the route |
quality_monitor_enabled, connection_quality, quality_monitor_action |
Quality monitoring of the connection: connection_quality is 1 when the quality is good; quality_monitor_action is block when bad quality blocks the connection |
estimated_cost |
Estimated cost of the call through this route |
free_seconds, connect_fee, grace_period, post_call_surcharge, interval_1, interval_N, price_1, price_N, area_name |
Billing parameters of the route |
forbidden |
The route is forbidden and is not tried |
onnet_route_type |
1 listen to voicemail, 2 record voicemail, 3 on-net route, 7 service code, None vendor route |
error |
Optional: why the route is skipped, for example loss_protection |
error_cause |
Optional: explanation of error |
Example
Section titled “Example”call("testDialplan", { "cli": "15555550100", "cld": "442071234567", "fallback_i_account": 3092, "is_ivr_originated": True,}){ "result": "OK", "cli": "15555550100", "cld": "442071234567", "i_account": 3092, "i_tariff": 12, "tariff_name": "Retail USD", "prefix": "4420", "price_1": 0.02, "price_n": 0.02, "i_routing_group": 14, "routing_group_name": "Wholesale LCR", "routes": [ { "prefix": "4420", "i_destination_set": 118, "destination_set_name": "Carrier A - wholesale", "i_vendor": 12, "vendor_name": "Carrier A", "i_connection": 41, "connection_name": "Carrier A - SIP", "preference": 5, "estimated_cost": 0.012, "forbidden": False, "onnet_route_type": None, # … the other route fields }, ],}Errors
Section titled “Errors”| faultCode | Cause |
|---|---|
407 |
A not authenticated call matched no authentication rule. Check remote_ip, the protocol and the domains |
Related
Section titled “Related”- Test Dialplan: the same test in the panel
- Routing
- Manage routing groups
- Authentication