Basix XML Fetch Fallback

The XML Elements <Redirect/>, <GetDigits/>, <GetInput/> <Record> and <Transfer> allow to specify a location to where to fetch more XML instructions to handle the call.

This is done by the Redirect text, GetDigits/GetInput/Record attribute action and Transfer attribute failureAction.

They can be used in fallback fashion: you can specify as many URLs as you need and they will be tried in order till one of them succeeds in returning a XML (but of course, we should not try each URL for long as the customer might hangup if she has to wait for too long)

The supported URL schemas are:

http:// (some URL in the internet)
https:// (some URL in the internet)
file://FILE_PATH (some file inside your Basix pbx folder)
section://SECTION_NAME (some section in the current XML document)

The http:// and https:// schemas support timeout by adding (timeout=SECONDS) between the schema and the path.

Here is one example:

Suppose that we want to try to get the XML file for a Redirect this way:

First try

https://xxx.com/myivr for 5 seconds

then try

https://yyy.com/myivr for 30 seconds

Then as a last resort, get file fallback.xml from your Basix pbx folder.

This can be done this way:

1
2
3
4
<IVR>
  <Speak voice="en-US-Standard-C">Please wait.</Speak>
  <Redirect>https://(timeout=5)xxx.com/myivr,https://(timeout=30)yyy.com/myivr,file://fallback.xml</Redirect>
</IVR>

So in fallback.xml you could have some error handling code like this:

1
2
3
<IVR>
  <Speak voice="en-US-Standard-C">We are sorry. We could not process your call. Please try again later.</Speak>
</IVR>

Also, it could be done like this with fallback to a Section in the current XML document:

1
2
3
4
5
6
7
8
9
<IVR>
  <Section name="main">
    <Speak voice="en-US-Standard-C">Please wait.</Speak>
    <Redirect>https://(timeout=5)xxx.com/myivr,https://(timeout=30)yyy.com/myivr,section://fallback</Redirect>
  </Section>
  <Section name="fallback">
    <Speak voice="en-US-Standard-C">We are sorry. We could not process your call. Please try again later.</Speak>
  </Section>
</IVR>

And the URL schema section:// is optional so it can also be done like this:

1
2
3
4
5
6
7
8
9
<IVR>
  <Section name="main">
    <Speak voice="en-US-Standard-C">Please wait.</Speak>
    <Redirect>https://(timeout=5)xxx.com/myivr,https://(timeout=30)yyy.com/myivr,fallback</Redirect>
  </Section>
  <Section name="fallback">
    <Speak voice="en-US-Standard-C">We are sorry. We could not process your call. Please try again later.</Speak>
  </Section>
</IVR>

This should work fine for Redirect, GetDigits, GetInput and Record.

However, it might not work properly with Transfer with fallback to Section:

The problem is that Transfer is a special case: when transfer is done, the XML handing session ends and the XML structure is flushed from our app.

So when the transfer fails and failureAction is processed, if we detect we need to go to a Section we will first try to load the original XML again from the original URL. This might not work if the XML server is offline. This will be eventually solved on a future version of our app but even so, our recommendation is to use fallback to a xml file in case of Transfer.

Also this same mechanism can be used in case of the handling of the initial XML request: if we cannot contact the servers to do the initial processing of the call, we can fallback to a XML file to play some message to the caller.