LeadML Voice
LeadDesk’s LeadML Voice allows you to handle calls your way. In LeadML’s terminology most of the XML document can be split into two main categories, verbs and nouns.
- – Verbs can be thought to be the top level elements or parent nodes in the XML document.
- – Nouns are the children nodes.
Both verbs and nouns can also implement attributes which are used to further specify how to execute certain commands. The examples below will show you how to start reading and building LeadML documents.
List of supported commands:
Command | Description |
---|---|
say | Text-to-speech. Reads text to the caller |
pause | Pause the call. Line will be silent |
queue | Send the channel to a queue |
number | Dial a phone number |
gather | Gather DTMF digits |
redirect | Fetch next XML document |
hangup | Hang up the call |
reject | Hang up the call |
play | Play an audio file to the caller |
In addition, Response is the top/root level element of every LeadML XML document and should always be present. You will see its use in all of the examples, below.
Examples
Hangup
Hangup is one of the simplest verbs, it does not support any nouns or attributes. Using it will hang up the call.
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Hangup/>
</Response>
Reject
A close relative to hangup, the reject command rejects the call, hanging it up.
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Reject/>
</Response>
Say
Use the Say verb to read text in a language you specify.
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say language="en-US">Hello</Say>
</Response>
In this example the caller would hear the word Hello spoken to them in English with a US dialect.
Number
Nouns are things that are nested inside verbs. In the previous example, the word Hello is a noun since it is acted upon inside the verb’s context. In a more complicated situation a noun can also be an XML element.
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>
<Number>0401234567</Number>
<Dial>
</Response>
In this case Dial verb tells that the current caller should be connected with some other party. The Number noun then connects the call to the phone number 0401234567. The Dial verb supports multiple different nouns that can be used to connect the caller to different places. For example a queue is a valid target:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>
<Queue>QueueName</Queue>
<Dial>
</Response>
Calls can also be made out to multiple numbers at once. The first number to pick up will be connected and rest of the calls will be hung up:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>
<Number>0401234567</Number>
<Number>0401234568</Number>
<Number>0401234569</Number>
<Dial>
</Response>
Combining verbs
It is also possible to define multiple verbs inside a single document. Verbs will be acted upon in order:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>Hello</Say>
<Pause length="10"/>
<Say>Anybody there?</Say>
<Pause length="10"/>
<Hangup/>
</Response>
In the above example, the caller would hear the word Hello, the call would be silent for 10 seconds, then they would hear Anybody there? followed by another 10 seconds of silence. Finally the call would be hung up.
It can be useful to compartmentalise instructions so they can be reused in other ways. If we already had code that did the second half of this, we could use the Redirect verb to connect the two.
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>Hello</Say>
<Pause length="10"/>
<Redirect>https://leadml.leaddesk.com/path/to/some/other/document</Redirect>
</Response>
This would also greet the caller with the word Hello and then pause the call for 10 seconds. After that a new LeadML document would be fetched using the Redirect verb, whose noun in this case is the URL of the new document: https://leadml.leaddesk.com/path/to/some/other/document.
To copy the behaviour of the earlier example, that document would need to contain:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>Anybody there?</Say>
<Pause length="10"/>
<Hangup/>
</Response>