cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

Custom Audio/Say It Smart plugin for DigitbyDigit (Includes 10, 11, 12...)

570
Views
0
Helpful
0
Comments
This document was generated from CDN thread

Created by: Ruzel Jamilon on 23-07-2013 09:38:55 AM
Hello, Im new with Call studio abd Im still doing my research and trying to trace the Audio and Say-it-smart codes, but if you could point me where I should start looking, it would be a big help.

We need to create a custom Audio/Say-It-Smart element that accepts a delimited string of numbers (ex: 1-2-10-12) and the Initial Audio Group we will choose Say It Smart (instead of Audio File/TTS) and in the Type is Digit-By-Digit, and the plug in can say "one" "two" "ten" "twelve".

In the standard element, we can only give a string of numbers (without delimiters) and it will read 121012 as "one", "two", "one, zero" (should  be read ten), "one, two" (should be read twelve)

Thank you!

Subject: RE: Custom Audio/Say It Smart plugin for DigitbyDigit (Includes 10, 11, 12.
Replied by: Bill Webb on 23-07-2013 11:12:02 AM
This is an off-the-cuff reply, but check the Say-It-Smart reference/developer guide. You will need to do some manipulation of the string to add delimiters (I believe it needs to be the pipe "|") in order to speak out the double-digit numbers individually.

 - Bill

Subject: Re: New Message from Ruzel Jamilon in Customer Voice Portal (CVP) - General
Replied by: Janine Graves on 23-07-2013 12:06:48 PM
Hi Ruzel , You must either write your own say it smart to have it ignore the dashes and play each entry as a number; or write an element that will give you back each substring between the dashes, then use the Number say it smart to speak that part of the code. On 7/23/2013 10:39 AM, Cisco Developer Community Forums wrote: Ruzel Jamilon has created a new message in the forum "General Discussion - All Versions": -------------------------------------------------------------- Hello, Im new with Call studio abd Im still doing my research and trying to trace the Audio and Say-it-smart codes, but if you could point me where I should start looking, it would be a big help. We need to create a custom Audio/Say-It-Smart element that accepts a delimited string of numbers (ex: 1-2-10-12) and the Initial Audio Group we will choose Say It Smart (instead of Audio File/TTS) and in the Type is Digit-By-Digit, and the plug in can say "one" "two" "ten" "twelve". In the standard element, we can only give a string of numbers (without delimiters) and it will read 121012 as "one", "two", "one, zero" (should be read ten), "one, two" (should be read twelve) Thank you! -- To respond to this post, please click the following link: http://developer.cisco.com/web/cvp/community/-/message_boards/view_message/17522433 or simply reply to this email. -- Janine Graves

Subject: RE: Re: New Message from Ruzel Jamilon in Customer Voice Portal (CVP) - Gen
Replied by: Ruzel Jamilon on 23-07-2013 02:27:31 PM
Thanks Janine and Bill for the quick reply.

@Bill.I am now looking through the Say it Smart Reference guide, I didnt know they had one specifially for this plug in. I will see how the "|" delimiter could work for me. Thanks!

@Janine. This is the second custom element I will be creating, (and two revisions on current custom elements we have) and I must say I have learned a lot from your post (speciall on custom DB element) so thank you for that as well.

I finally pulled out the Standard Audio Element Code (im still checking jar per jar for codes lol) and I am still figuring out how the Audio elements passes the String to the Say It Smart Plugin. Im sure I will get to this later, and then I will know how I can apply your two brilliant suggestion (I like the element to parse the dashes and use Number Say-It-Smart).

Thank you again and I will post whatever method I use (or errors that I will have) here to make it available for anyone else probably having the same questions I have.

Subject: RE: Re: New Message from Ruzel Jamilon in Customer Voice Portal (CVP) - Gen
Replied by: Ruzel Jamilon on 24-07-2013 05:10:24 PM
So I have made a custom plugin and it is showing up in Builder. My convertToFiles method goes like this:

public SayItSmartContent convertToFiles(Object dataAsObject, String inputFormat, String outputFormat, String fileset) throws SayItSmartException {
/*  80 */     validateArguments(dataAsObject, inputFormat, outputFormat, fileset);
/*     */
/*  82 */     String data = dataAsObject.toString().trim();
/*     */
/*  84 */     String[] parsedNum = data.split("-");
/*  85 */     SayItSmartContent toReturn = new SayItSmartContent();
/*  86 */     for (int i = 0; i < parsedNum.length; ++i) {
/*  87 */       if (parsedNum.matches("[0-9]+")) {
/*  88 */         toReturn.add(parsedNum, (String)NUMBERS.get(parsedNum), false);
/*     */       }
/*     */     }
/*  91 */     return toReturn;
/*     */   }

But it is giving the error:

ALL_BB_Action_Get_BB_States,enter,
ALL_BB_Action_Get_BB_States,custom,ActiveBBs,2-
ALL_BB_Action_Get_BB_States,custom,errorFlag,0
ALL_BB_Action_Get_BB_States,exit,done
ALL_BB_Action_Get_BB_States_Decision,enter,
ALL_BB_Action_Get_BB_States_Decision,exit,Success
ALL_BB_Action_Play_Active_BB,enter,
ALL_BB_Action_Play_Active_BB,element,error,A built-in element encountered an exception of type com.audium.server.xml.ElementConfigException.
ALL_BB_Action_Play_Active_BB,exit,
,element,error,

Any ideas?
And also, for debugging purposes, can anybody tell me how I can write to logfile from a plugin? From the custome element, i use the actionData.addlog but this is not available in the plugin so I am not sure how.

Thanks!

Subject: RE: Re: New Message from Ruzel Jamilon in Customer Voice Portal (CVP) - Gen
Replied by: Janine Graves on 25-07-2013 07:01:09 AM
In your code toReturn.add(parsedNum, (String)NUMBERS.get(parsedNum), false);
where is NUMBERS defined? Looks like a hashmap or something.

The SayItSmarts aren't passed the SessionAPI - so they can't write to the activity log.
Use System.out.println for debugging - it prints to Tomcat/logs/stdout






Subject: RE: Re: New Message from Ruzel Jamilon in Customer Voice Portal (CVP) - Gen
Replied by: Ruzel Jamilon on 25-07-2013 09:17:30 AM
Yes, correct, its the same NUMBERS hashmap that the standard SayItSmartNumbers used. I actually based my code on that module.

Thanks for the  Tomcat/logs/stdout - I was wondering where it will print out

Subject: RE: Re: New Message from Ruzel Jamilon in Customer Voice Portal (CVP) - Gen
Replied by: Ruzel Jamilon on 25-07-2013 04:34:41 PM
Hi Janine, I came across one of your post in this forum wherein you made a plugin :JaninesAlphanumSayItSmartLowerCase

I just want to ask some points:

1. in your convertToFiles method, you put a " " after the theString. Do we need to put space everytime?
String theString = data.substring(i,i+1);
toReturn.add(theString, theString+" ", false);

2. Your fileset:
toReturn.addFileset("filesetLower","LowerCase File Names","");

As I understood it, the filesets is something configured in the system. (Or am I wrong?) Does this mean you have a fileset named filesetLower for you to be able to use this fileset?

3. We both used  for loop to put the characters inside toReturn, something that I wasnt sure that would work until I saw your code Does this mean, that we are actually putting the audio file filename and the say it smart plug in will take care of playing it back to the caller? - if that is the case, can I use fileset "none" (saw in Literal - Custom Content) since we have all the number (1-99) audio files?

I am unable to test the code until tomorrow afternoon as our non prod is down currently so any inputs would be appreciated while I wait to see how the fileset = none will work. Thanks!

Subject: RE: Re: New Message from Ruzel Jamilon in Customer Voice Portal (CVP) - Gen
Replied by: Janine Graves on 25-07-2013 05:04:49 PM
1.The job of SIS is to return a list of audio files and TTS backup using toReturn.add(file, TTS, boolean) for each audio file.
The vxml server then adds the Default Audio Path and file extension based upon the selection in the GUI Say it Smart window about whether or not to use Default AUdio path, type of audio file (.wav).

2. I use the space " " in case a person using the Say it Smart does NOT specify to use Recorded Audio - if they're just using TTS. With TTS only, the Say it Smart needs to add a space, otherwise it would result in <prompt>SMITH</prompt> instead of <prompt>S M I T H</prompt>     

3. Fileset just gives the user an option of selecting different possible ways for the system to speak the audio. For example, you could have the same files recorded in male or female voices. So you coudl have Filesets named 'male' or 'female'.   It's up to who ever uses your Say it Smart to ensure they've recorded all the required audio files and have them on the media server. In your case, 0-99 are already there, so you should name the display name of the fileset "Numbers 0-99"  For the real name, just use "numbers"    toReturn.addFileset("numbers","Numbers 0-99", "description");

In my case, I wanted to give the user a choice depending upon whether their audio files are Upper case (A.wav, B.wav, C.wav) or lower case (a.wav,  b.wav, c.wav). IIS isn't case sensitive, but Apache and Tomcat are.

Subject: Re: New Message from Ruzel Jamilon in Customer Voice Portal (CVP) - General
Replied by: Janine Graves on 02-08-2013 10:09:54 AM
Use the Studio debugger, and see what  audio URI's are being created. Then try to execute that from a web browser.   On 8/2/2013 10:04 AM, Cisco Developer Community Forums wrote: Ruzel Jamilon has created a new message in the forum "General Discussion - All Versions": -------------------------------------------------------------- Was just able to test the custom SIS and it seems it cannot find the media file. I was able to print in log the data being received and its correct. I checked in the folder and wav files are there. I will be searching for this in cisco docs but if anyone gets here before me that knows the answer, can you tell me where or how I can check what path the system is referring to when looking for the wav files. Or is there anything I should be looking into at? These is my SIS setting and itbasically parses the input and returns it. toReturn.addInputFormat("input", "1-2-10-11", ""); toReturn.addOutputFormat("output","Numbers",""); toReturn.addFileset("numbers","Numbers 0-99",""); public SayItSmartContent convertToFiles(Object dataAsObject, String inputFormat, String outputFormat, String fileset) throws SayItSmartException { //validateArguments(dataAsObject, inputFormat, outputFormat, fileset); SayItSmartContent toReturn = new SayItSmartContent(); String data = dataAsObject.toString().trim(); System.out.println("(FILESET_None) Shaw SIS - Data received: " + data ); String[] parsedNum = data. split("-"); for (int i = 0; i < parsedNum.length; i++){ System.out.println("(FILESET_None) Shaw SIS - Parsed Input: " + i + " - "+parsedNum); toReturn.add(parsedNum, parsedNum+" ", false); } return toReturn; } This is the log file we are getting: 10.1.253.97.1375455081551.18.ALL_BB_IVR,08/02/2013 08:51:35.863,ALL_BB_Action_No_Active_BB,enter, 10.1.253.97.1375455081551.18.ALL_BB_IVR,08/02/2013 08:51:35.863,ALL_BB_Action_No_Active_BB,interaction,audio_group,initial_audio_group 10.1.253.97.1375455081551.18.ALL_BB_IVR,08/02/2013 08:51:35.879,ALL_BB_Action_No_Active_BB,exit,done 10.1.253.97.1375455081551.18.ALL_BB_IVR,08/02/2013 08:51:35.879,ALL_BB_Main_Res_Action_Menu,enter, 10.1.253.97.1375455081551.18.ALL_BB_IVR,08/02/2013 08:51:35.879,ALL_BB_Main_Res_Action_Menu,interaction,audio_group,initial_audio_group 10.1.253.97.1375455081551.18.ALL_BB_IVR,08/02/2013 08:51:36.098,ALL_BB_Main_Res_Action_Menu,element,error,error.badfetch.http.404 10.1.253.97.1375455081551.18.ALL_BB_IVR,08/02/2013 08:51:36.098,ALL_BB_Main_Res_Action_Menu,exit, 10.1.253.97.1375455081551.18.ALL_BB_IVR,08/02/2013 08:51:36.098,Application_Error,enter, 10.1.253.97.1375455081551.18.ALL_BB_IVR,08/02/2013 08:51:36.098,Application_Error,interaction,audio_group,initial_audio_group 10.1.253.97.1375455081551.18.ALL_BB_IVR,08/02/2013 08:51:36.098,Application_Error,exit,done and the stdout is: (first number is just counter) (FILESET_None) Shaw SIS - Data received: 1-2-3-4-6-0-7 (FILESET_None) Shaw SIS - Parsed Input: 0 - 1 (FILESET_None) Shaw SIS - Parsed Input: 1 - 2 (FILESET_None) Shaw SIS - Parsed Input: 2 - 3 (FILESET_None) Shaw SIS - Parsed Input: 3 - 4 (FILESET_None) Shaw SIS - Parsed Input: 4 - 6 (FILESET_None) Shaw SIS - Parsed Input: 5 - 0 (FILESET_None) Shaw SIS - Parsed Input: 6 - 7 -- To respond to this post, please click the following link: http://developer.cisco.com/web/cvp/forums/-/message_boards/view_message/17913096 or simply reply to this email. -- Janine Graves

Subject: RE: Re: New Message from Ruzel Jamilon in Customer Voice Portal (CVP) - Gen
Replied by: Steve Earl on 02-08-2013 10:14:33 AM
Enable debug logging or turn on http client error debugging in your gateway (debug http client error).  Use term mon to see the gateway output and you should see the exact prompt urls that are 404'ing.

Subject: RE: CUSTOM  SayItSmartPlugin
Replied by: Ruzel Jamilon on 02-08-2013 10:04:45 AM
Was just able to test the custom SIS and it seems it cannot find the media file.
I was able to print in log the data being received and its correct. I checked in the folder and wav files are there.

I will be searching for this in cisco docs but if anyone gets here before me that knows the answer, can you tell me where or how I can check what path the system is referring to when looking for the wav files.

Or is there anything I should be looking into at?

These is my SIS setting and itbasically parses the input and returns it.

toReturn.addInputFormat("input", "1-2-10-11", "");
toReturn.addOutputFormat("output","Numbers","");
toReturn.addFileset("numbers","Numbers 0-99","");

public SayItSmartContent convertToFiles(Object dataAsObject, String inputFormat, String outputFormat, String fileset) throws SayItSmartException  {
  //validateArguments(dataAsObject, inputFormat, outputFormat, fileset);
     SayItSmartContent toReturn = new SayItSmartContent();
 
     String data = dataAsObject.toString().trim();
  System.out.println("(FILESET_None) Shaw SIS - Data received: " + data );
  String[] parsedNum = data. split("-");
 
  for (int i = 0; i < parsedNum.length; i++){
   System.out.println("(FILESET_None) Shaw SIS - Parsed Input: " +  i + " - "+parsedNum);    toReturn.add(parsedNum, parsedNum+" ", false);
  }
  return toReturn;
   }

This is the log file we are getting:

10.1.253.97.1375455081551.18.ALL_BB_IVR,08/02/2013 08:51:35.863,ALL_BB_Action_No_Active_BB,enter,
10.1.253.97.1375455081551.18.ALL_BB_IVR,08/02/2013 08:51:35.863,ALL_BB_Action_No_Active_BB,interaction,audio_group,initial_audio_group
10.1.253.97.1375455081551.18.ALL_BB_IVR,08/02/2013 08:51:35.879,ALL_BB_Action_No_Active_BB,exit,done
10.1.253.97.1375455081551.18.ALL_BB_IVR,08/02/2013 08:51:35.879,ALL_BB_Main_Res_Action_Menu,enter,
10.1.253.97.1375455081551.18.ALL_BB_IVR,08/02/2013 08:51:35.879,ALL_BB_Main_Res_Action_Menu,interaction,audio_group,initial_audio_group
10.1.253.97.1375455081551.18.ALL_BB_IVR,08/02/2013 08:51:36.098,ALL_BB_Main_Res_Action_Menu,element,error,error.badfetch.http.404
10.1.253.97.1375455081551.18.ALL_BB_IVR,08/02/2013 08:51:36.098,ALL_BB_Main_Res_Action_Menu,exit,
10.1.253.97.1375455081551.18.ALL_BB_IVR,08/02/2013 08:51:36.098,Application_Error,enter,
10.1.253.97.1375455081551.18.ALL_BB_IVR,08/02/2013 08:51:36.098,Application_Error,interaction,audio_group,initial_audio_group
10.1.253.97.1375455081551.18.ALL_BB_IVR,08/02/2013 08:51:36.098,Application_Error,exit,done

and the stdout is: (first number is just counter)
(FILESET_None) Shaw SIS - Data received: 1-2-3-4-6-0-7
(FILESET_None) Shaw SIS - Parsed Input: 0 - 1
(FILESET_None) Shaw SIS - Parsed Input: 1 - 2
(FILESET_None) Shaw SIS - Parsed Input: 2 - 3
(FILESET_None) Shaw SIS - Parsed Input: 3 - 4
(FILESET_None) Shaw SIS - Parsed Input: 4 - 6
(FILESET_None) Shaw SIS - Parsed Input: 5 - 0
(FILESET_None) Shaw SIS - Parsed Input: 6 - 7

Subject: RE: Re: New Message from Ruzel Jamilon in Customer Voice Portal (CVP) - Gen
Replied by: Ruzel Jamilon on 02-08-2013 10:33:17 AM
Thanks @Steve and @Janine, I still have to study how to use debugger or turn on http client error debugging so that would be my next step.
I was trying to trace via code what java code accepts the list of filenames the system is supposed to play but cannot find it. I found out that the developer specified path as:

http://{Data.Session.mediaserver}/en/sys

without the "/" in the end. Would this rresult in :

http://{Data.Session.mediaserver}/en/sys2.wav
or would the plugin knows to append "/" in the URI?

Subject: RE: Re: New Message from Ruzel Jamilon in Customer Voice Portal (CVP) - Gen
Replied by: Ruzel Jamilon on 02-08-2013 01:43:13 PM
Woohoo!! Its working now finally.

It turns out there there is an wav file that was not in the server and we saw it because we turned on http debugging in gateway (thank you Steve) and saw that apart from the list of audio files the say it smart plugin was trying to play is actually another wav file that was not on the server.

I would have to learn how to use the Studio Debugger as per Janine's suggestion. Im sure its going to save me alot of time in the future.
Thanks everyone!
CreatePlease to create content