Web Responders

Control live calls from your own web application by returning simple XML instructions.

A Web Responder hands control of a call to your own web application. When a call reaches the Web Responder, Level365 sends an HTTP request to your URL with details about the call. Your application replies with XML instructions, called verbs, such as "say this", "collect digits", or "forward the call", and Level365 carries them out.

Because the logic runs in your code, you can build call flows that a standard dial plan can't, for example:

  • Look up the caller in your CRM and route them to their account manager
  • Build a custom IVR that answers with text-to-speech and understands spoken answers
  • Stream live call audio to your own service for transcription, analysis, or an AI voice agent
📘

Web Responders are set up by Level365

Connecting a Web Responder to your phone system requires configuration that Level365 staff make for you. See Requesting setup for what to include in your request. Level365 support can help with Web Responder setup and troubleshooting.

How it works

  1. A call reaches the Web Responder, either an inbound call routed to it, or an outbound call started through the API.
  2. Level365 sends an HTTP request to your Web Responder URL, including parameters that describe the call.
  3. Your application responds with XML containing one or more verbs.
  4. Level365 carries out the verbs. If a verb has an action attribute, Level365 sends a new request to that URL when the verb finishes, and your application responds with the next set of verbs.
  5. When there are no more verbs to run and no action to follow, the Web Responder's work is done.

A minimal response looks like this:

<Response>
  <Say>Thanks for calling. Please hold while we connect you.</Say>
  <Forward>13175551234</Forward>
</Response>

Call ownership

For verbs to work as expected, every call handled by a Web Responder needs an owner: a user on your domain that the call leg belongs to. The owner's settings, such as their dial plan, are used to process the call, and the call is counted against them for limits and statistics.

🚧

Route calls through a system user

We strongly recommend routing calls to the Web Responder through a system user, rather than sending them straight to the Web Responder. Without an owner, some verbs, including <Forward>, don't work. This is the same requirement that applies to call queues and conferences.

If a call must go directly to the Web Responder without passing through a user first, add ByCaller="yes" to any <Forward> verb so the forward uses the caller's dial plan instead:

<Forward ByCaller="yes">+13175551234</Forward>

This works, but routing through a system user is the supported, recommended setup.

Inbound calls

For inbound calls, Level365 routes the call to a system user, whose answering rule forwards it to a dial plan entry that uses the To Web application. That entry holds your Web Responder URL.

Inbound call flow: the call enters the Core Module, routes to system user 8080, whose Forward Always answering rule sends it to a To Web dial translation, which sends the call to the Web Responder.

In this example, calls to system user 8080 are forwarded to webresponder8080, which matches a dial translation that uses the To Web application.

Outbound calls

To place an outbound call that's controlled by your Web Responder, start the call with the API:

  1. Your application calls Make a new Call.
  2. Level365 calls the first party, the person you want to reach.
  3. When they answer, the call is connected to the system user that routes to your Web Responder, and your application takes over.
Outbound call flow: an API call reaches the Core Module, which calls the destination; once answered, the call routes through system user 8080 and its To Web dial translation to the Web Responder.
curl -X POST https://api.365sip.com/ns-api/v2/domains/yourdomain/users/8080/calls \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "synchronous": "yes",
    "call-id": "a1b2c3d4e5f6g7h8",
    "call-orig-user": "13175551234",
    "call-term-user": "8080"
  }'

Here, call-orig-user is the person being called and call-term-user is the system user that routes to the Web Responder. Generate a unique call-id for each call and keep it if you want to look the call up or end it later.

Requesting setup

Contact Level365 support to set up a Web Responder. Include:

ItemDetails
Web Responder URLThe HTTPS URL of your application, for example https://ivr.example.com/start.php.
HTTP methodWhether requests should be sent as GET or POST. POST is recommended when your application expects larger request payloads.
Request signingWhether requests should be signed with a secret, so your application can confirm they came from Level365. See Security.
Domain and system userThe domain, and the system user (or extension) the Web Responder should be attached to.
Inbound routingWhich phone numbers, users, or answering rules should send calls to the Web Responder.
Voice settingsIf you use <Say> or speech recognition: the default text-to-speech voice and language. Speech recognition and the enhanced voice attributes use Deepgram.

Request parameters

Each time Level365 calls your Web Responder, the request includes these parameters:

ParameterDescription
NmsAniThe caller, for example 1001
NmsDnisThe number that was called, for example 13175551234
AccountUserThe user that owns the call
AccountDomainThe owner's domain
AccountLastDialThe last digits dialed by the owner
AccountLastFromThe last "from" address on the call, for example sip:1001@yourdomain
ToUserThe user the call was sent to the Web Responder as
ToDomainThe domain the call was sent to the Web Responder as
OrigCallIDCall ID of the originating leg
TermCallIDCall ID of the terminating leg
DigitsDigits collected by the previous <Gather>, if any
SpeechResultSpeech transcript collected by the previous <Gather>, if any

Responding to requests

  • Return the verbs as XML with the header Content-Type: text/xml.
  • Wrap multiple verbs in a <Response> element. Level365 runs them in order.
  • action URLs can be relative to your Web Responder URL, for example action="next.php". Use the query string to carry state between steps, for example action="menu.php?step=2".

See Web Responder XML Verbs for every verb and attribute, and Web Responder Examples for complete applications.

Security

Level365 can sign every request to your Web Responder with a secret key, so your application can reject requests that didn't come from Level365. Signing can use one secret for all Web Responders, or a separate secret for each one. Ask Level365 support to enable signing when you request setup; they'll provide the secret and how to verify the signature.

Also:

  • Serve your Web Responder over HTTPS.
  • Treat request parameters as untrusted input. Validate Digits and SpeechResult before using them, for example in a database lookup.

Troubleshooting

Web Responders appear as a participant in call traces. In a trace of a call that reached your Web Responder, look for a WebResponder column and a POST message to it. Selecting the message shows the URL that was requested and the parameters that were sent, which is the quickest way to confirm what your application received.

Forwarding doesn't work

The call probably has no owner. Route the call through a system user, or add ByCaller="yes" to the <Forward> verb. See Call ownership.

The call disconnects after the first verb

When a verb without an action finishes and nothing else is left to run, the Web Responder ends. Add an action so Level365 requests your next set of verbs, or include the following verbs in the same <Response>.

Spoken answers aren't collected

<Gather> collects only keypad digits unless you add input="speech" or input="dtmf speech". Speech recognition also has to be configured for your domain; ask Level365 support if it isn't.

Known limitations

  • Recording with streaming: call recording doesn't capture a Web Responder's own leg while <Stream> is in use, because the streamed media doesn't pass through the usual media path. Record the caller's leg or the connection instead.
  • Limited set of verbs: only the verbs in Web Responder XML Verbs are supported. For anything else, use <Forward> to send the call to a user, queue, or other destination that provides it.
  • Forwarding needs an owner: to forward calls, the call leg must belong to a user. See Call ownership.

Next steps


Did this page help you?