Overview

When your agent receives calls during simulation testing, you may need to verify whether a call is from a Roark simulation and retrieve details about the specific test being executed. Roark provides a dedicated API endpoint to identify simulations based on phone numbers and call timing.

Identifying Simulation Calls

Using the Simulation Job Lookup API

To verify if a call is coming from a simulated Roark agent or to retrieve simulation details, use the Lookup Simulation Job by Phone Numbers API. This API allows you to:
  • Verify if an incoming or outgoing call is part of a simulation test
  • Retrieve the specific simulation job details
  • Track which persona and scenario are being tested in the simulation

API Parameters

The API requires specific parameters to identify the simulation:
ParameterDescriptionUsage
roarkAgentPhoneNumberThe Roark agent’s phone numberSee direction-specific details below
callStartedAtWhen the call was initiatedMust be within the simulation’s active window

Understanding the roarkAgentPhoneNumber parameter

The roarkAgentPhoneNumber parameter depends on the call direction: For Inbound Calls:
  • Roark initiates the call from a dynamically provisioned number
  • Your agent receives the call from this number
  • In this scenario, roarkAgentPhoneNumber is the number that dials your agent
For Outbound Calls:
  • Roark provisions a number for each test case in a simulation
  • When a simulation for a test case starts, this number is either sent via an HTTP request for your agent to trigger the outbound call, or manually dialed at runtime based on the number shown on the dashboard. See this page for more information.
  • The Roark simulation agent receives this call and starts the simulation
  • In this scenario, roarkAgentPhoneNumber is the number you receive via the HTTP request, or the number displayed on the simulation run page for manual calls

Understanding the callStartedAt parameter

While a phone number is assigned to only one simulation at a time, once the simulation ends it may be reused for other simulations. As such, the callStartedAt timestamp is critical for matching the correct simulation:
  • Timing Window: The call must occur within the simulation’s execution timeframe. Any time between the simulation test case starting and the call ending is valid.
  • Default Value: Current date. This is useful when calling the endpoint to match a call in real-time (examples 1 and 2 below). For historical calls, you should pass the call creation time to match the correct call.
  • Valid examples:
    1. Using current date as callStartedAt whenever you receive an inbound call from Roark in your agent’s inbound webhook (dependent on the provider)
    2. Using current date as callStartedAt whenever you receive an HTTP request to trigger an outbound call for a Roark simulation.
    3. Using any time between the above two options and the end time of the call.
  • Format: ISO 8601 timestamp (e.g., 2024-01-15T14:30:00Z)
The callStartedAt parameter helps distinguish between multiple simulations that might use the same phone numbers at different times.

Best Practices

Integration Recommendations


Next Steps