Testing local policy scripts
To help you construct and test your scripts, Pexip Infinity has a built-in script testing facility. It allows you to provide some test configuration data, run your script against that test data and check the output produced by your script.
To test your scripts:
-
Go to
and select the policy profile containing the script you want to test.(Note that you must select an existing profile.)
- Select , or as appropriate (at the bottom of the page).
-
You are taken to a script testing page where you can provide test input data and edit your script:
- The Input field contains some example call_info and either some service_config data (for service configuration scripts), some participant data (for participant scripts), or some suggested_media_overflow_locations data (for media location scripts), in JSON format, that you can use as input data to test your script. You can use this data as is, or change the data to suit your needs, by adding or removing data elements. Ensure that you use valid data elements and maintain the correct JSON formatting.
- The Script field is initially populated with your current script from your policy profile. You can edit the script as required.
- The Result field shows the result of running the input data against your script. If there is an error when running the script this field will contain a "reject" action.
- The Diagnostics field contains any additional information (if available) pertaining to errors arising from running the test script against the test input.
- To test your script, edit the Input and Script fields as required and then select option (at the bottom of the page).
- Check the Result and Diagnostic fields to see the effect of your script.
- You can continue to edit the Input and Script fields and test your script until you are happy that the script is performing as expected.
-
When you have finished testing your script:
- Select to save the current contents of your script to your policy profile.
- Select to return to your policy profile without saving the changes to your script.
Checking call information (call_info)
The contents of the call_info variable can vary within your Pexip Infinity system depending on the types of devices and call protocols in use. A good way to identify what information is actually being presented to your script is to include a pex_debug_log filter such as:
{{pex_debug_log("Call information ", call_info) }}
You can then make some test calls and look in the support log to see the actual call information that is being passed through to your script. To see the call information data go to pex_debug_log. See Basic pass-through service configuration script with call_info debug line for a full example script.
and then search for entries that contain