You are on page 1of 7

TutorialApplication:

Clock
Complexity:
Simple

SoftwareUsed:
AudiumBuilderforStudio

YouWillLearnHowTo:

Dynamicallyconfigureavoiceelement UseHotlinkelements

AdvancedTopic:

HowtousetheXMLAPIfordynamicconfiguration

Copyright20012005AudiumCorporation.AllRightsReserved.6/3/05

WhatItDoes
Thisapplicationinformsthecallerthattheycanstartoveratanytimebysayingtheword "home",andthenannouncesthecurrenttimebeforehangingup.Ifthecallersays "home"duringthefirstmessage,thefirstmessagewillberepeated.Ifthecallersaysit duringthetimeannouncement,thecallerwillreturntothefirstmessage(andthenhear thetimeagain).

HowToDoIt
Note!IfthisisyourfirsttimeusingAudiumStudio,pleasereadthetutorialfor
"HelloWorld"beforecontinuing.Inthistutorial,itisassumedthattheuserisfamiliarwith howtocreateanewAudiumStudioproject.

1.CreateanewAudiumproject(withdefaultsettings)named"Clock." 2.DoubleclickonClock'sapp.callflowintheNavigatorpane.Anewworkspaceisnow visible,includingaCallStartelement. 3.DraganAudiovoiceelementintotheworkspace. a.YoucanfindthiselementintheElementspane,directlyunderElements(i.e. notinasubfolder). 4.Nametheelement"Welcome". 5.DraganotherAudiovoiceelementintotheworkspace. 6.Nametheelement"Clock". 7.DragaHangUpelementintotheworkspace. 8.Linkthefollowingexitstates(seediagram1): a.LinkCallStart'sonlyexitstate(next)toWelcome. b.LinkWelcome'sonlyexitstate(done)toClock. c.LinkClock'sonlyexitstate(done)toHangUp. Copyright20012005AudiumCorporation.AllRightsReserved.6/3/05

Diagram1:Thecallflowsofar 9.SelecttheClockelement,sothatitsconfigurationappearsintheElement Configurationpane. 10.OntheGeneraltab,whichisselectedbydefault,checktheboxnexttoDynamic Configuration.ThistellsAudiumthateitheranexternalclassoraprogramthatis accessibleviaHTTP(i.e.thatusestheXMLAPI)willprovidetheconfigurationforthis element. Note!Whenwetalkaboutthe"configuration"ofanelement,wearereferringtoallof


theelement'ssettingsthatcanbefoundintheElementConfigurationpane.

Note!FormoreinformationabouttheXMLAPI,pleaserefertothe
AdvancedTopicofthistutorialandalsototheProgrammerGuide.

11.ChooseClassfromthedropdownmenuthatisunderthecheckboxfromstep10. 12.Inthetextfieldtotherightofthedropdownmenufromstep11,enterthetext "TimeOfDay"(seediagram2).ThisisthenameoftheJavaclassthattheClockelement willuseatruntimetoconfigureitself.Javaclassescanreacttodynamiccriteria,likethe time;theTimeOfDayclasswillcheckthetimeandthenconfiguretheClockelementto sayit.

Copyright20012005AudiumCorporation.AllRightsReserved.6/3/05

Diagram2:FinishedsettinguptheDynamicConfiguration Note!YouchecktheCreateBaseConfigurationboxwhenyouknowthatonlysomeof
thesettingswillbedynamic.Youthenconfiguretheelementasyounormallywould. WhentheclassorXMLAPIstartsitswork,itreceivesthisbaseconfiguration,andthen onlymodifiesthosesettingsthataredynamic.Forthistutorial,theTimeOfDayclass configureseverything,soitdoesnotneedabaseconfiguration.

13.DragaHotlinkelementintotheworkspace. a.YoucanfindthiselementintheElementspane,onthesamelevelasthe "Elements"folder(i.e.notinasubfolder). 14.Nametheelement"HomeLink". 15.SelectHomeLink,sothatitsconfigurationappearsintheElementConfiguration pane.FromtheSpeechdropdownmenu,chooseInline.ThismeansthatthisHotlink willuseaninlinevoicegrammartodeterminewhenitisactivated. Note!AHotlinkcanbeactivatedbyDTMF,voice,orboth.Inthistutorial,theHotlink


willonlybeactivatedbyvoice.Whenanutterancedefinedintheinlinegrammaris heard,theHotlink'sexitstateisfollowed.Thisallowsyoutogivethecallertheabilityto jumpfromplacetoplaceinthecallflow(e.g.thefunctionality"Say'operator'atanytime tobetransferredtotheoperator."canbeimplementedwithaHotlinkandaTransfer).

Copyright20012005AudiumCorporation.AllRightsReserved.6/3/05

Note!Usinganinlinegrammarmeansthatyouwilldefinethegrammar(listof
utterances)thatanelementusesdirectlyinAudiumBuilderforStudio.Usinganexternal grammarmeansthatyouwillprovideaURIthatpointstoagrammarfilelocated somewhereelse.Inthistutorial,weareusinganinlinegrammar.

15.ConnectthegotoexitstateofHomeLinktoWelcome.Now,whenthecallersays home,theywillbebroughttotheWelcomeelement,regardlessofwheretheywerein thecallflow.Thecallflowisnowcomplete(seediagram3).

Diagram3:Thecompletecallflow 16.TheJavaclassusedbythisapplication(TimeOfDay.class)canbefoundinthepre builtClocktutorialapplication.Itisinthedeploy\java\application\classesdirectoryof theapplication. Note!IfyouhavenotalreadydownloadedtheprebuiltClockapplication,you


cannotcontinuebeyondthispoint.

17.CopythisclassfileintotheClock>deploy>java>application>classesfolderin yourNavigatorpanebydraggingthefiledirectlyintoit(seediagram4).Youshould nowseetheclassfilelistedundertheclassesfolderinyourNavigatorpane.

Copyright20012005AudiumCorporation.AllRightsReserved.6/3/05

Diagram4:CopyingaJavaclassintotheproject 18.Yourapplicationiscomplete.YoucannowtestitonCallServices(refertothe HelloWorldtutorialforinstructions).

AdvancedTopic
UsingaJavaclassisnottheonlywaytodynamicallyconfigureavoiceelement,Audium alsogivesyoutheabilitytouseXMLdatasentoveranHTTPconnection(theXMLover HTTPAPI).SincethisinvolvesonlyXML,anyHTTPcompliantlanguagecanbeused (e.g.ASP,Perl,etc.).Inthisexample,aJavaServerPage(JSP)isused. Note!TheXMLoverHTTPAPIisoftenreferredtoastheXMLAPIforshort. WewillmodifytheClockelementtousetheXMLAPIforitsdynamicconfiguration insteadofaJavaclass.

Copyright20012005AudiumCorporation.AllRightsReserved.6/3/05

1.SelecttheClockelement. 2.IntheConfigurationPane,changethesettinginthedropdownmenufromClassto URI. 3.Inthetextfieldtotherightofthedropdownmenu,typethefollowing: http://<AppServerIP>:<PORT>/clock.jsp where<AppServerIP>istheIPthatyourapplicationserverisrunningon,and<PORT> istheportthatyourapplicationserverislisteningto(usually8080). 4.TheJavaServerPageusedbythisapplication(clock.jsp)canbefoundintheprebuilt Clocktutorialapplication.Itisinthesrc\webdirectoryoftheapplication. Note!YoucanviewtheJSPinatexteditortoseehowitworks.Itisessentiallyan
XMLfilethatusessomeJSPcodetofillinthedynamicparts.

5.Copyclock.jspintoyourapplicationserver'srootwebdirectory(e.g.inTomcatthe directoryis\webapps\ROOT\). 6.SaveanddeploythenewversionofClock,andtryit.Thetimewillnowbesetbythe JSPpageinsteadoftheTimeOfDayclass. Note!Ifyoudeployanapplicationthathasalreadybeendeployedbefore(i.e.anew


versionofit),youmustruntheupdateApp.bat(orupdateApp.sh,dependingonOS)script fromtheapplication'sadmindirectoryinordertousethenewversion.Formoredetails aboutadministrationscriptsanddeployingapplications,pleaserefertotheUserGuide.

Copyright20012005AudiumCorporation.AllRightsReserved.6/3/05