Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Use Session Initiation Protocol (SIP) to connect your existing telephony infrastructure to a Microsoft Foundry voice agent. You can route inbound calls from a SIP trunk or session border controller (SBC) to the agent and place outbound calls through a SIP connection.
Important
Items marked preview in this article are currently in preview. This preview is provided without a service-level agreement, and Microsoft doesn't recommend it for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.
Caution
SIP calling isn't currently supported for voice agents in network-isolated projects, such as projects that use virtual network injection or a Foundry resource with public network access disabled.
Prerequisites
Before you begin, ensure you have:
- A saved voice agent in a Foundry project that passes testing. For outbound calls, publish the agent first. See Quickstart: Create a voice-based prompt agent.
Important
SIP inbound connection currently requires a Foundry resource in East US 2, France Central, Southeast Asia, Sweden Central, West US.
SIP outbound connection currently requires a Foundry resource in Southeast Asia.
- The Foundry User role on the project.
Important
The Foundry RBAC roles were recently renamed. Foundry User, Foundry Owner, Foundry Account Owner, and Foundry Project Manager were previously named Azure AI User, Azure AI Owner, Azure AI Account Owner, and Azure AI Project Manager. You might still see the previous names in some places while the rename rolls out. The role IDs and core permissions are unchanged by the rename.
- Permission to update the agent and its channels, manage project connections, and create or update telephony bindings.
- A SIP trunk or SBC that supports SIP over TLS and, for outbound calls, non-ICE SDES-SRTP (
srtp). - The SIP authentication information required by your telephony.
For inbound calling, create a SipInbound project connection. For outbound calling, create a SipOutbound project connection. Create both connections if your agent needs to receive and place calls.
Store SIP credentials in the project connection. Don't include credentials in binding or call-job requests.
Note
Direct SIP connectivity doesn't require an Azure Communication Services resource, a Teams resource account, a Twilio account, or an Event Grid subscription.
How SIP calls reach the agent
For inbound calling, the call follows this path:
Caller
-> telephony provider or enterprise telephony system
-> SIP trunk or SBC
-> Foundry SIP endpoint
-> telephony binding
-> voice agent
When you create a SIP telephony binding, Foundry generates a SIP or SIPS ingress URI. Configure your trunk or SBC to route inbound calls to this URI.
Foundry authenticates the SIP peer through the associated SipInbound connection and routes the call to the agent that owns the binding.
For outbound calling, the agent uses a SipOutbound project connection to route the call through your telephony infrastructure. An inbound binding isn't required for outbound-only scenarios.
Set up your interface
Complete the configuration by using the Foundry portal or the REST API.
Open your project in the Foundry portal.
Use the portal to create SIP project connections and configure inbound SIP calling. To place outbound calls, use the Python SDK or REST API.
Configure SIP project connections
Create a direction-specific project connection.
| Direction | Connection category | Purpose |
|---|---|---|
| Inbound | SipInbound |
Authenticates inbound SIP traffic and is referenced by a telephony binding. |
| Outbound | SipOutbound |
Routes outbound call jobs through a SIP trunk or SBC. |
SIP connections support Digest authentication or source IP access control.
For outbound calling, you can also configure the preferred codec order.
- Open your Foundry project.
- Open the project connections page.
- Create a connection with the
SipInboundorSipOutboundcategory. - Select Digest authentication or source IP access control.
- Enter the requested credentials or source IP ranges.
- For an outbound connection:
- Enter the target trunk or SBC address provided by your SIP provider, in the format
<dns-host>[:<port>], for example,sbc.contoso.com:5061. Don't enter a SIP URI, IP address, path, or URI parameters. - Optionally configure the preferred codecs.
- Enter the target trunk or SBC address provided by your SIP provider, in the format
- Save the connection.
Caution
If you use source IP access control, allowing all source IP addresses can expose the SIP endpoint to unwanted traffic. Restrict access to your trunk or SBC egress addresses whenever possible.
Configure inbound SIP calling
A SIP telephony binding connects one SipInbound project connection to one voice agent. When you create the binding, Foundry generates a SIP or SIPS ingress URI that you configure on your trunk or SBC.
You can optionally add a display label, a display phone number, and inbound caller-number restrictions. The display phone number isn't used as the SIP routing key.
The source IP policy on the SipInbound connection and the caller-number restrictions on the binding are independent controls.
Create an inbound SIP binding
- In the Foundry portal, open Build > Agents.
- Select your voice agent.
- Open Channels.
- Under Phone numbers, select Add a number.
- Select Direct SIP.
- Select a compatible
SipInboundconnection. - Enter an optional label and display phone number.
- Optionally configure allowed caller numbers. You can add up to 64 patterns, each up to 256 characters. Patterns must use the supported anchored E.164 syntax with ASCII digits, digit ranges, and bounded quantifiers. Arbitrary regular expressions aren't supported.
- Review the connection and access restrictions.
- Create the binding.
- Copy the generated SIP or SIPS ingress URI.
- Configure your trunk or SBC to route inbound calls to the ingress URI.
To allow all caller numbers, leave the allowed-caller list empty.
Place outbound calls through SIP
To place an outbound call, create a call job that references a SipOutbound project connection. You don't need an inbound telephony binding.
SipOutbound connections support IP ACL authentication only. Digest authentication isn't supported. You don't need to specify source IP ranges; an empty IP ACL allows all source IP addresses.
Provide a SipOutbound connection name, an authorized E.164 source number, and the recipient's E.164 destination number. Use only destinations that you have permission to call.
Note
Create the SipOutbound project connection in the Foundry portal. Use the Python SDK or REST API to create and manage outbound call jobs.
This section covers outbound calls through the API. Select Python SDK or REST to create, read, or cancel a call job. You can use a project connection created in the portal without creating an inbound binding.
Test SIP calling
Test inbound calling
- Wait for trunk routing and access-control changes to take effect.
- Place a call from a controlled caller through your SIP trunk.
- Confirm that the agent answers.
- Complete a short conversation.
- Interrupt the agent while it's speaking.
- Test an approved tool or knowledge path.
- Test the expected human-handoff behavior, if configured.
- End the call.
- Confirm that monitoring and trace data are available.
Record the following information:
- Test timestamp and time zone.
- Voice-agent name and version.
SipInboundconnection name.- Generated SIP or SIPS ingress URI.
- SIP authentication mode.
- Calling and called numbers.
- Trunk or SBC call identifier.
- Foundry session or trace identifier.
Test outbound calling
Create a call job for an approved test recipient and record:
- Call-job ID.
- Source and destination numbers.
- Job status.
- Attempt count.
- Terminal reason.
- Trunk or SBC call identifier.
Don't treat 202 Accepted as confirmation that the call connected.
Troubleshoot SIP connectivity
Inbound and trunk connectivity
| Symptom | What to check |
|---|---|
| An inbound SIP call is rejected before the agent answers | Confirm that the connection category is SipInbound. Check the selected authentication mode. For Digest authentication, verify the username and password. For source IP access control, verify that the observed source IP is allowed. |
| The call reaches Foundry, but the agent doesn't answer | Confirm that the binding belongs to the intended agent, references the correct SipInbound connection, and uses the correct SIP or SIPS ingress URI. Verify that the allowed-caller configuration permits the normalized caller number. |
| An outbound job is accepted but doesn't reach the trunk | Confirm that the connection category is SipOutbound, the authentication settings are valid, the source number is authorized, and the trunk supports the configured codecs. |
| The outbound destination doesn't ring | Check the job status, attempt count, schedule, and terminal reason. Verify caller authorization, trunk routing, and provider connectivity. |
REST API requests
| Symptom | What to check |
|---|---|
Outbound creation returns 400 Bad Request |
Check connection_name, the E.164 source and destination numbers, required structured_inputs, and the idempotency key. |
Outbound creation returns 409 Conflict |
The idempotency key was used with a different request. Repeat the original request or use a new key for a new call intent. |
| Outbound creation returns a dispatch-not-configured error | Outbound SIP dispatch isn't configured for the service instance. Contact support to confirm availability. An inbound binding doesn't enable outbound dispatch. |
| An update or deletion fails with a precondition error | Read the resource again and retry the request with its latest ETag. |
Disconnect inbound SIP calling
Disconnecting removes the mapping between the SIP ingress URI and the voice agent. It doesn't delete the SIP project connection or update your trunk configuration.
- Open the voice agent's Channels tab.
- Under Phone numbers, open the connected SIP endpoint's actions menu.
- Select Disconnect number.
- Confirm the operation.
- Remove or update the corresponding route on your trunk or SBC.
Security recommendations
- Store SIP Digest credentials only in the Foundry project connection.
- Rotate SIP credentials immediately if they're exposed.
- Restrict source IP addresses when your trunk or SBC uses stable egress addresses.
- Avoid allowing all source IP addresses unless you intend to allow unrestricted source access.
- Use caller-number restrictions when the scenario requires inbound caller filtering.
- Treat caller ID as asserted signaling data, not proof of caller identity.
- Use Microsoft Entra authentication for Foundry API requests.
- Use the latest ETag when updating or deleting a binding through the SDK or REST API.
- Don't persist service-generated callback or media tokens.
- Apply applicable recording, consent, disclosure, retention, and privacy requirements.
- Limit access to traces that contain calling or called numbers.
- Avoid reading sensitive caller information aloud or storing it unnecessarily.