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:

  1. Go to Call control > Policy profiles and select the policy profile containing the script you want to test.

    (Note that you must select an existing profile.)

  2. Select Test local service configuration policy, Test local participant policy or Test local media location policy as appropriate (at the bottom of the page).
  3. 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.
  4. To test your script, edit the Input and Script fields as required and then select Test option (at the bottom of the page).
  5. Check the Result and Diagnostic fields to see the effect of your script.
  6. 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.
  7. When you have finished testing your script:

    • Select Save changes and return to save the current contents of your script to your policy profile.
    • Select Cancel 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 History & Logs > Support log and then search for entries that contain pex_debug_log. See Basic pass-through service configuration script with call_info debug line for a full example script.