This post explains the process for creating a TTS object, storing it, and then utilizing it in a script. 

 

Using TTS commands in XML seems to be a bit more difficult at first glance but once you understand the intricacies of HTML Entities and/or ISO Latin-1 codes and how to use them within the XML it becomes clear.  Fortunately there are only a few codes that need to be learned in order to be able to create the XML successfully.

 

First, let's take a look at the section of XML that will create the TTS Object and store it and see the special formatting that must be used. 

 

<TTSObjectCreateRequest xmlns="http://premconn.premiereconnect.com/2007/02">

    <ObjectStore>DOMAIN</ObjectStore>

    <ReplaceExisting>true</ReplaceExisting>

    <TTSObjectId ownership="user" objKind="sos_tts">SampleTTS</TTSObjectId>

    <TTSObjectContent>

        <TTSContent ref="MyTTS">

            <DocType>unspec</DocType>

            <Filename>Cool.ssml</Filename>

            <DocData format="text">&lt;speak version="1.0" xml:lang="en-US"&gt;&#xD;

&lt;voice gender="male"&gt;

&lt;insert keyword="insert[1]" segment="inserts" default="Copenhagen"/&gt;&#xD;

&lt;/voice&gt;&#xD;

&lt;/speak&gt;&#xD;</DocData>

          </TTSContent>

        </TTSObjectContent>

</TTSObjectCreateRequest>

Now if you were to open this same XML in a browser it would look totally different as you can see below. 

-

          <TTSObjectCreateRequest xmlns="http://premconn.premiereconnect.com/2007/02">

          <ObjectStore>DOMAIN</ObjectStore>

          <ReplaceExisting>true</ReplaceExisting>

         <TTSObjectId ownership="user" objKind="sos_tts">SampleTTS</TTSObjectId>

-    <TTSObjectContent> 

-        <TTSContent ref="MyTTS"> 

            <DocType>unspec</DocType>

            <Filename>Cool.ssml</Filename>

            <DocData format="text"><speak version="1.0" xml:lang="en-US"> <voice gender="male"> <insert keyword="insert[1]"      segment="inserts" default="Copenhagen"/> </voice> </speak></DocData>

        </TTSContent> 

    </TTSObjectContent> 

</TTSObjectCreateRequest> 

 

As you can see by the above, the HTML Codes were all translated by the browser into their appropriate counterparts.  This is one way you can check your XML after formatting it with the special codes.

Here are the special codes that are used in the above example:

 

html entity code            character 

===========            ======= 

&lt;                              < 

&gt;                            > 

&#xD;                          carriage return 

 

You can read more about the special codes and see a full table at the following link http://www.utexas.edu/learn/html/spchar.html

 

Some special consideration you must follow are that all of the codes must be started at the far left margin in the XML with no leading spaces. 

 

Now that we have covered the special formatting necessary to create the XML let's talk about the different XML elements and what they are used for. 

 

<TTSObjectCreateRequest xmlns="http://premconn.premiereconnect.com/2007/02">

    <ObjectStore>DOMAIN</ObjectStore>

    <ReplaceExisting>true</ReplaceExisting> 

 

As you can see by the first line above we are embedding the request TTSObjectCreateRequest.

 

The next line is directing it to store this object we are creating on a particular domain, i.e., xsi, test2, pt, etc.

 

Line 3 is either set to true or false and will either replace the existing TTS Object or create a new one.

 

  <TTSObjectId ownership="user" objKind="sos_tts">SampleTTS</TTSObjectId>

 

This line sets the ownership and the type of object and sets its name that it will be stored as.  The ownership value can be user, customer, group or domain.   

 

As you can see in my example I have it set to user which allow only that particular user to access this object by authentication of credentials.  The other settings can be used to make the object more readily usable by multiple users. 

 

The objKind is of course, sos_tts.  I set the name to SampleTTS.  The use of caps is just for readibility and is ignored in the system. 

 

The next few lines setup the type of object and prepare for its contents. 

    <TTSObjectContent>

        <TTSContent ref="MyTTS">

            <DocType>unspec</DocType>

            <Filename>Cool.ssml</Filename> 

 

It sets a reference value which will be returned on subsequent reports "MyTTS" (which can be any value) while setting the DocType to unspec and then setting the Filename with the extension .ssml.  Filename is not required but can be used to represent the file that is stored on your computer. 

 

Now we get into the meat of the XML, or setting up the commands that will be used during the execution. 

 

            <DocData format="text">&lt;speak version="1.0" xml:lang="en-US"&gt;&#xD;

&lt;voice gender="male"&gt;

&lt;insert keyword="insert[1]" segment="inserts" default="Copenhagen"/&gt;&#xD;

&lt;/voice&gt;&#xD;

&lt;/speak&gt;&#xD;</DocData>

          </TTSContent>

        </TTSObjectContent>

</TTSObjectCreateRequest> 

 

The first line specifying format of text will always be used and as you can see this is followed by the first special characters &lt which is equal to "<" followed by the xml lang version.  This line is always used.  This is followed by more special characters which equate to the ">" and a carriage return. 

 

The next line sets the voice gender to male, again on a line to itself. 

 

Now this next line is setting the code up so that inserts may be used in the calling XML which you will see by viewing the XML file that will follow this explanation.  By allowing inserts you can set the base TTS object to be a basic template and then use it over and over. 

 

The next few lines are the closing lines using special characters in order to close the brackets and generate line feeds. 

Now if you will view the attached file "VoiceContent.xml" you will see how the stored TTS Object is called and the insert passed to it.  The XML will then call the phone listed and play the message listed as the Insert in the XML.

 

I hope this gives you a better understanding of the use of creating, storing and using TTS objects.

AttachmentSize
VoiceContent.xml1.75 KB