<?xml version="1.0" encoding="utf-8"?>
<!--
//  Copyright (C) 2006 Microsoft Corporation.  All rights reserved.
//  The xml file that describes the finite state machine.
-->
<FiniteStateMachine>
	<FsmModule>
		<RetrieveVoicemail id="800" firstActivityId="801">

			<!-- Uncaught quota exception -->
			<Transition event="quotaExceeded" action="null" refId="QuotaExceededError"/>
			<Transition event="xsoError" action="null" refId="ErrorMenu"/>

			<!-- Get New Messages State =======================================================================-->
			<Menu id="801" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Transition event="noKey" action="getNewMessages" heavyaction="true" refId="803"/>
				<Transition event="noNewMessages" action="null" refId="802"/>
			</Menu>
			<!-- Get Saved Messages State =======================================================================-->
			<Menu id="802" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Transition event="noKey" action="getSavedMessages" heavyaction="true" refId="803"/>
				<Transition event="noSavedMessages" action="null" refId="814"/>
			</Menu>
			<!-- Play PlaybackMenu Message Prompt=======================================================-->
			<Menu id="803" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<!-- main menu --><Transition event="noKey" action="getMessageReadProperty" refId="ExitDtmfVoicemail"/>
				<Transition event="currentNewMessage" action="null" refId="804"/>
				<Transition event="currentSavedMessage" action="null" refId="805"/>
			</Menu>
			<!-- Play First New Message Prompt=======================================================-->
			<Menu id="804" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Transition event="noKey" action="null" refId="806"/>
				<Prompt type="statement" name="tuiFirstNewVoiceMessage"/>
			</Menu>
			<!-- Play First Saved Message Prompt=======================================================-->
			<Menu id="805" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Transition event="noKey" action="null" refId="806"/>
				<Prompt type="statement" name="tuiFirstSavedVoiceMessage"/>
			</Menu>
			<!---Play the header ==============================================================-->
			<Menu id="806" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<FsmImport href="AsrVoicemail.fsm" module="VmailHeaderPrompts"/>
				<Transition event="noKey" action="null" refId="808"/>
			</Menu>
			<!---Play the current  Message==============================================================-->
			<MessagePlayer id = "808" firstActivityId="100">
				<Menu id = "100" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
					<Transition event="noKey" action="firstMessagePart" heavyaction="true" refId="101"/>
					<Transition event="endOfSection" action="null" refId="103"/>
					<Transition event="xsoError" action="null" refId="104"/>
				</Menu>
				<PlayBackMenu id="101" minDtmfSize="0" maxDtmfSize="2" dtmfInputValue="option" stopPromptOnBargeIn="false">
					<Prompt condition="playMixedContentIntro" type="statement" name="tuiMixedAudioTextContent"/>
					<Prompt condition="playAudioContentIntro" type="statement" name="tuiPlayingAudioSection"/>
					<Prompt condition="playTextContentIntro" type="statement" name="tuiPlayingTextSection"/>
					<Prompt condition="wavePart" type="tempwave" name="messagePart" prosodyRate="user"/>
					<Prompt condition="textPart" type="email" name="messagePart" prosodyRate="user"/>
					<Transition event="1" action="rewind" heavyaction="true" refId="101" playbackAction="true"/>
					<Transition event="2" action="pause" refId="PauseMessageStatement"/>
					<Transition event="3" action="fastForward" refId="101" playbackAction="true"/>
					<Transition event="4" action="slowDown" refId="101"/>
					<Transition event="5" action="getEnvelopInfo" heavyaction="true" refId="out-860"/>
					<Transition event="6" action="speedUp" refId="101"/>
					<Transition event="7" action="deleteVoiceMail" heavyaction="true" refId="out-870"/>
					<!-- Undelete    --><Transition event="*7" condition="canUndelete" action="undeleteVoiceMail" heavyaction="true" refId="out-871"/>
					<!-- CantUndel   --><Transition event="*7" condition="NOT canUndelete" action="null" refId="out-NothingToUndeleteStatement"/>
					<!-- Reply       --><Transition event="8" action="null" refId="out-817"/>
					<!-- Mark unread --><Transition event="9" action="markUnreadVoiceMail" refId="out-852"/>
					<!-- Next        --><Transition event="#" action="saveVoiceMail" heavyaction="true" refId="out-809"/>
					<!-- Main menu   --><Transition event="*" action="null" refId="out-899"/>
					<Transition event="11" action="firstMessagePart" heavyaction="true" refId="out-806"/>
					<Transition event="33" action="nextMessageSection" refId="101"/>
					<Transition event="44" action="flagVoiceMail" heavyaction="true" refId="out-FlaggedForFollowUpStatement"/>
					<Transition event="0" action="pause" refId="102"/>
					<Transition event="00" action="null" refId="out-850"/>
					<Transition event="noKey" action="nextMessagePart" heavyaction="true" refId="101"/>
					<Transition event="endOfSection" action="null" refId="103"/>
					<Transition event="xsoError" action="null" refId="104"/>
					<Transition event="anyKey" action="null" refId="101" playbackAction="true"/>

					<!-- Action auto-events -->
					<Transition event="maxProsodyRate" action="null" refId="SpeedMaximumStatement"/>
					<Transition event="minProsodyRate" action="null" refId="SpeedMinimumStatement"/>
				</PlayBackMenu>
				<Menu id="102" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
					<Prompt type="statement" name="tuiMessagePlaybackOptions"/>
					<Transition event="noKey" action="null" refId="101"/>
				</Menu>
				<Menu id="103" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
					<Prompt condition="isEmptyText" type="statement" name="tuiMessageBodyEmpty"/>
					<Prompt condition="isEmptyWave" type="statement" name="tuiWaveFileEmpty"/>
					<Transition event="noKey" action="nextMessageSection" refId="101"/>
					<Transition event="xsoError" action="null" refId="104"/>
					<Transition event="endOfSection" action="null" refId="EndOfMessageStatement"/>
				</Menu>
				<Menu id="104" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
					<Prompt type="statement" name="tuiMessagePlaybackMenuError"/>
					<Transition event="noKey" action="null" refId="103"/>
				</Menu>
				<Menu id="EndOfMessageStatement" dtmfInputValue="option">
					<Prompt type="statement" name="tuiEndOfMessage"/>
					<Transition event="noKey" action="saveVoiceMail" heavyaction="true" refId="out-850"/>
				</Menu>

				<!-- Paused State -->	
				<Menu id="PauseMessageStatement" minDtmfSize="0" maxDtmfSize="1" dtmfInputValue="option">
					<Prompt condition="NOT (lastActivity EQ @PauseContinueStatement)" type="statement" name="tuiPauseInitialStatement"/>
					<Prompt type="silence" name="10s"/>
					<Transition event="anyKey" action="null" refId="101"/>
					<Transition event="noKey" action="null" refId="PauseContinueStatement"/>
				</Menu>
				<Menu id="PauseContinueStatement" minDtmfSize="0" maxDtmfSize="1" dtmfInputValue="option">
					<Prompt type="statement" name="tuiPauseContinueVmailStatement"/>
					<Prompt type="silence" name="5s"/>
					<Transition event="noKey" action="null" refId="PauseDisconnectStatement"/>
					<Transition event="#" action="more" refId="PauseMessageStatement"/>
					<Transition event="anyKey" action="null" refId="101"/>
				</Menu>
				<Menu id="PauseDisconnectStatement" dtmfInputValue="option">
					<Prompt type="statement" name="tuiPauseDisconnectStatement"/>
					<Transition event="noKey" action="disconnect" refId="PauseDisconnectStatement"/>
				</Menu>

				<!-- Statments about increase/decrease of speed on header -->
				<Menu id="SpeedMaximumStatement" dtmfInputValue="option">
					<Prompt type="statement" name="tuiPlaybackSpeedMaximum"/>
					<Transition event="noKey" action="resetPlayback" refId="101"/>
				</Menu>
				<Menu id="SpeedMinimumStatement" dtmfInputValue="option">
					<Prompt type="statement" name="tuiPlaybackSpeedMinimum"/>
					<Transition event="noKey" action="resetPlayback" refId="101"/>
				</Menu>
			
			</MessagePlayer>
			<!--Get Next  Messages State==============================================================-->
			<Menu id="809" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Transition event="noKey" action="getNextMessage" heavyaction="true" refId="810"/>
				<Transition event="xsoError" action="null"  refId="ErrorRetryNext"/>
				<Transition event="noNewMessages" action="null" refId="811"/>
				<Transition event="noSavedMessages" action="null" refId="813"/>
			</Menu>
			<!--Next  Messages Prompt==============================================================-->
			<Menu id="810" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Transition event="noKey" action="null" refId="806"/>
				<Prompt type="statement" name="tuiVmailNext"/>
			</Menu>
			<!--Last New Messages Prompt==============================================================-->
			<Menu id="811" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Transition event="noKey" action="null" refId="812"/>
				<Prompt type="statement" name="tuiEndOfNewVoiceMessages"/>
			</Menu>
			<!-- Get Saved Messages State 2=======================================================================-->
			<Menu id="812" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Transition event="noKey" action="getSavedMessages" heavyaction="true" refId="805"/>
				<Transition event="noSavedMessages" action="null" refId="813"/>
			</Menu>
			<!--Last saved Messages Prompt==============================================================-->
			<Menu id="813" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<!-- main menu --><Transition event="noKey" action="null" refId="ExitDtmfVoicemail"/>
				<Prompt type="statement" name="tuiEndOfMessages"/>
			</Menu>
			<!-- No Message Prompt=======================================================-->
			<Menu id="814" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<!-- main menu --><Transition event="noKey" action="null" refId="ExitDtmfVoicemail"/>
				<Prompt type="statement" name="tuiNoNewVoiceMessages"/>
			</Menu>
			<!--Get Previous Message State==============================================================-->
			<Menu id="815" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Transition event="noKey" action="getPreviousMessage" refId="816"/>
				<Transition event="xsoError" action="null" refId="ErrorRetryPrevious"/>
				<Transition event="noPreviousNewMessages" action="null" refId="FirstMessageStatement"/>
			</Menu>
			<!--Previous Message Prompt==============================================================-->
			<Menu id="816" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Transition event="noKey" action="null" refId="806"/>
				<Prompt type="statement" name="tuiVmailPrevious"/>
			</Menu>

			<!-- Error states -->
			<Menu id="ErrorRetryNext" dtmfInputValue="option">
				<Transition event="noKey" action="getNextMessage" heavyaction="true" refId="810"/>
				<Transition event="xsoError" action="null"  refId="ErrorMenu"/>
				<Transition event="noNewMessages" action="null" refId="811"/>
				<Transition event="noSavedMessages" action="null" refId="813"/>
			</Menu>

			<Menu id="ErrorRetryPrevious" dtmfInputValue="option">
				<Transition event="noKey" action="getPreviousMessage" refId="816"/>
				<Transition event="xsoError" action="null" refId="ErrorMenu"/>
				<Transition event="noPreviousNewMessages" action="null" refId="FirstMessageStatement"/>
			</Menu>

			<Menu id = "ErrorMenu" minDtmfSize="1" maxDtmfSize="1" dtmfInputValue="option">
				<Prompt type = "statement" name = "tuiItemError"/>				
				<Prompt type = "statement" name = "tuiCommonNextMessage"/>
				<Prompt type = "statement" name = "tuiCommonExit"/>
				<Transition event="#" action="null" refId="ErrorRetryNext"/>
				<Transition event="*" action="null" refId="ExitDtmfVoicemail"/>
			</Menu>

			<Menu id="FatalErrorStatement" dtmfInputValue="option">
				<Prompt type="statement" name="tuiVmailFatalError"/>
				<Transition event="noKey" action="null" refId="ExitDtmfVoicemail"/>
			</Menu>
			<Menu id = "QuotaExceededError" uninterruptible="true">
				<Prompt type = "statement" name = "tuiErrorQuotaExceeded"/>				
				<Transition event="noKey" action="null" refId="850"/>
			</Menu>

			<!-- This is your first message -->
			<Menu id="FirstMessageStatement" dtmfInputValue="option">
				<Prompt type="statement" name="tuiStartOfMessages"/>
				<Transition event="noKey" action="null" refId="850"/>
			</Menu>

			<!--Reply to sender state ==============================================================-->
			<Menu id="817" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Transition event="noKey" condition="knowVoicemailSender" action="replyVoiceMail" refId="890"/>
				<Transition event="noKey" condition="NOT knowVoicemailSender" action="null" refId="818"/>
			</Menu>
			<Menu id="818" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Transition event="noKey" action="null" refId="850"/>
				<Prompt type="statement" name="tuiCannotReplyUnresolvedSender"/>
			</Menu>
			
			<!-- After Message Menu for  messages ================================================-->
			<Menu id="850" minDtmfSize="1" maxDtmfSize="2" dtmfInputValue="option">
				<Condition value="NOT more">
					<!-- To replay this message, press 1 -->
					<Prompt type="statement" name="tuiCommonReplay"/>
					<!-- To delete, press 7 -->
					<Prompt type="statement" name="tuiCommonDelete"/>
					<!-- To reply, press 8 -->
					<Prompt type="statement" name="tuiCommonReplyToSender" condition="knowVoicemailSender"/>
					<!-- To mark as unread, press 9 -->
					<Prompt type="statement" name="tuiCommonMarkAsUnread"/>
					<!-- For the next message, press the pound key -->
					<Prompt type="statement" name="tuiCommonNextMessage"/>
					<!-- To exit, press the star key -->
					<Prompt type="statement" name="tuiCommonExit"/>
					<!-- To repeat this menu, press 0 -->
					<Prompt type="statement" name="tuiCommonRepeatMenu"/>
					<!-- To hear more options, press 0 0 -->
					<Prompt type="statement" name="tuiCommonMoreOptions"/>
				</Condition>
				<Condition value="more">
					<!-- For the previous message, press 1 1 -->
					<Prompt type="statement" name="tuiCommonPreviousMessage"/>
					<!-- To call this contact, press 2 -->
					<Prompt type="statement" name="tuiCommonCallContact" condition="knowSenderPhoneNumber"/>
					<!-- To flag the message for follow-up, press 4 4 -->
					<Prompt type="statement" name="tuiCommonFlagForFollowUp" />
					<!-- For envelope information, press 5 -->
					<Prompt type="statement" name="tuiCommonEnvelopInfo"/>
					<!-- To forward this message, press 6 -->
					<Prompt type="statement" name="tuiCommonForwardMessage"/>
					<!-- To exit, press the star key -->
					<Prompt type="statement" name="tuiCommonExit"/>
					<!-- To repeat this menu, press 0 -->
					<Prompt type="statement" name="tuiCommonRepeatMenu"/>
					<!-- To return to the previous menu, press 0 0 -->
					<Prompt type="statement" name="tuiCommonReturnPrevious"/>
				</Condition>
				<!-- Replay     --><Transition event="1" action="null" refId="808"/>
				<!-- Call Sender--><Transition event="2" condition="knowSenderPhoneNumber" action="getEnvelopInfo" heavyaction="true" refId="900"/>
				<!-- Call Sender--><Transition event="2" condition="NOT knowSenderPhoneNumber" action="null" refId="905"/>
				<!-- Reply      --><Transition event="8" condition="knowVoicemailSender" action="replyVoiceMail" refId="890"/>
				<!-- Reply      --><Transition event="8" condition="NOT knowVoicemailSender" action="null" refId="818"/>
				<!-- GetEnvelope--><Transition event="5" action="getEnvelopInfo" heavyaction="true" refId="865"/>
				<!-- Forward    --><Transition event="6" action="forwardVoiceMail" refId="880"/>
				<!-- Delete     --><Transition event="7" action="deleteVoiceMail" heavyaction="true" refId="870"/>
				<!-- Undelete    --><Transition event="*7" condition="canUndelete" action="undeleteVoiceMail" heavyaction="true" refId="871"/>
				<!-- CantUndel   --><Transition event="*7" condition="NOT canUndelete" action="null" refId="NothingToUndeleteStatement"/>
				<!-- Mark unread--><Transition event="9" action="markUnreadVoiceMail" refId="852"/>
				<!-- Previous   --><Transition event="11" action="null" refId="815"/>
				<!-- Follow-up  --><Transition event="44" action="flagVoiceMail" heavyaction="true" refId="FlaggedForFollowUpStatement"/>
				<!-- Next       --><Transition event="#" action="saveVoiceMail" heavyaction="true" refId="809"/>
				<!-- Main menu  --><Transition event="*" action="null" refId="ExitDtmfVoicemail"/>
				<Transition event="0" action="null" refId="850"/>
				<Transition event="00" action="more" refId="850"/>
			</Menu>

			<!-- Flagged for follow-up -->
			<Menu id = "FlaggedForFollowUpStatement" dtmfInputValue="option">
				<Prompt type="statement" name="tuiMessageFlagged"/>
				<Transition event="noKey" action="null" refId="809"/>
			</Menu>

			<!-- There's nothing to undelete -->
			<Menu id = "NothingToUndeleteStatement" dtmfInputValue="option">
				<Prompt type="statement" name="tuiNoUndelete"/>
				<Transition event="noKey" action="null" refId="850"/>
			</Menu>

			<!--Message Marked Unread Prompt==============================================================-->
			<Menu id="852" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Transition event="noKey" action="null" refId="809"/>
				<Prompt type="statement" name="tuiMessageMarkedUnread"/>
			</Menu>
			
			<!--Message Saved Prompt==============================================================-->
			<Menu id="855" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Transition event="noKey" action="null" refId="809"/>
				<Prompt type="statement" name="tuiMessageSaved"/>
			</Menu>

			<!--Envelop Information: During Playback -->
			<Menu id="860" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Prompt type="statement" name="tuiVoiceMessageEnvelope" condition="NOT IsNull(senderInfo)">
					<Prompt type="time" name="messageReceivedTime"/>
					<Prompt type="text" name="senderInfo"/>
				</Prompt>
				<Prompt type="statement" name="tuiMessageReceived" condition="IsNull(senderInfo)">
					<Prompt type="time" name="messageReceivedTime"/>
				</Prompt>
				<Condition value = "isHighPriority">
					<Prompt type="statement" name="tuiSentImportant"/>
				</Condition>
				<Prompt type="multiStatement" name="tuiVoiceMessageDuration">
					<Prompt type="cardinal" name="durationMinutes" suffix="singularPlural"/>
					<Prompt type="cardinal" name="durationSeconds" suffix="singularPlural"/>
				</Prompt>
				<Transition event="noKey" action="null" refId="808"/>
			</Menu>

			<!--Envelop Information: After Playback -->
			<Menu id="865" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Prompt type="statement" name="tuiVoiceMessageEnvelope" condition="NOT IsNull(senderInfo)">
					<Prompt type="time" name="messageReceivedTime"/>
					<Prompt type="text" name="senderInfo"/>
				</Prompt>
				<Prompt type="statement" name="tuiMessageReceived" condition="IsNull(senderInfo)">
					<Prompt type="time" name="messageReceivedTime"/>
				</Prompt>
				<Condition value = "isHighPriority">
					<Prompt type="statement" name="tuiSentImportant"/>
				</Condition>
				<Prompt type="multiStatement" name="tuiVoiceMessageDuration">
					<Prompt type="cardinal" name="durationMinutes" suffix="singularPlural"/>
					<Prompt type="cardinal" name="durationSeconds" suffix="singularPlural"/>
				</Prompt>
				<Transition event="noKey" action="null" refId="850"/>
			</Menu>

			<!-- Delete Message : get the next message or goto after message menu -->
			<Menu id="870" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Prompt type="statement" name="tuiMessageDeleted"/>
				<Prompt condition="NOT playedUndelete" type="statement" name="tuiUndelete"/>
				<Transition event="noKey" action="null" refId="809"/>
			</Menu>
			<Menu id="871" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Prompt type="statement" name="tuiRestored"/>
				<Transition event="noKey" action="null" refId="850"/>
			</Menu>

			<!-- Reply voicemail -->
			<Menu id="890" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Prompt type="statement" name="tuiReplyingToSender"/>
				<Transition event="noKey" action="null" refId="891"/>
			</Menu>

			<!-- Forward voicemail -->
			<Menu id="880" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Prompt type="statement" name="tuiForwardingMessage"/>
				<Transition event="noKey" action="null" refId="1400"/>
			</Menu>

			<!-- 
				===== Call Sender state =====
				For voicemails we always call the number they used to leave the message
			-->
			<Menu id="900" minDtmfSize="0" maxDtmfSize="1" dtmfInputValue="option">
				<Prompt type="statement" name="tuiToCancelCallTransfer"/>
				<Prompt type="statement" name="tuiCallTransferIntro" condition="NOT IsNull(senderInfo)">
					<Prompt type="text" name="senderInfo"/>
				</Prompt>
				<Transition event="noKey" action="null" refId="901" />
				<Transition event="*" action="null" refId="904" />
			</Menu>
			<CallTransfer id="901" type="blind" numberType="variable" number="targetPhoneNumber">
				<Transition event="transferFailed" action="null" refId="902"/>
			</CallTransfer>
			<Menu id="902" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option" >
				<Prompt type="statement" name="tuiCallTransferFailed"/>
				<Prompt type="statement" name="tuiReturningToPreviousMenu"/>
				<Transition event="noKey" refId="850" action="null"/>
			</Menu>
			<Menu id="904" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option" >
				<Prompt type="statement" name="tuiCallTransferCancelled"/>
				<Transition event="noKey" refId="850" action="null"/>
			</Menu>
			<Menu id="905" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option" >
				<Prompt type="statement" name="tuiTransferUserNoPhone"/>
				<Prompt type="statement" name="tuiReturningToPreviousMenu"/>
				<Transition event="noKey" refId="850" action="null"/>
			</Menu>

			<!-- Directory search for forward voicemail -->
			<DirectorySearch id="1400" firstActivityId="1302" searchPurpose="sendMessage">

				<!-- Contact Search Menu -->
				<!-- NOTE: dtmfStopTones=noKey forces the recognizer to honor interDigitTimeout before returning a partial match -->
				<Menu id="1301" minDtmfSize="1" maxDtmfSize="name" dtmfInputValue="name" interDigitTimeout="3" dtmfStopTones="noKey">
					<Condition value="newSearch">
						<Prompt type="statement" name="tuiPersonalContacts"/>
						<Prompt type="statement" name="tuiForwardLastFirstNoEmail"/>
						<Prompt type="statement" name="tuiToFindSomeoneInDirectory"/>
						<Prompt type="statement" name="tuiToCancelPressStar"/>
					</Condition>
					<Prompt condition="NOT newSearch" type="statement" name="tuiContinueName" />

					<Transition condition="newSearch" event="*" refId="out-502" action="null" />
					<Transition condition="NOT newSearch" event="*" refId="1301" action="startNewSearch" />
					<Transition event="0" refId="1301" action="null" />
					<Transition event="00" refId="1302" action="changeSearchTarget" />
					<Transition event="anyKey" refId="1301" action="searchDirectory" heavyaction="true" />
					<Transition event="resultsLessThanAllowed" refId="1303" action="null"/>
					<Transition event="resultsMoreThanAllowed" refId="1301" action="continueSearch"/>
					<Transition event="noResultsMatched" refId="1326" action="null"/>
					<Transition event="invalidSearchKey" action="handleInvalidSearchKey" refId="1411" />

					<Transition event="adTransientError" action="null" refId="adTransientErrorPrompt" />
				</Menu>

				<!-- GAL Search Menu -->
				<!-- NOTE: dtmfStopTones=noKey forces the recognizer to honor interDigitTimeout before returning a partial match -->
				<Menu id="1302" minDtmfSize="1" maxDtmfSize="name" dtmfInputValue="name" interDigitTimeout="3" dtmfStopTones="noKey">

					<!-- Directory Search -->
					<Prompt type="statement" name="tuiDirectorySearch"/>

					<Condition value="newSearch">
						<!-- two different search modes -->
						<Condition value="(secondarySearchMode NE none) AND (primarySearchMode NE secondarySearchMode)">
							<!-- one of the search modes is email, use simplified name wording -->
							<Condition value="(primarySearchMode EQ emailAlias) OR (secondarySearchMode EQ emailAlias)">
								<Prompt condition="(currentSearchMode EQ lastNameFirstName)" type="statement" name="tuiForwardLastFirst" />
								<Prompt condition="(currentSearchMode EQ firstNameLastName)" type="statement" name="tuiForwardFirstLast" />
								<Prompt condition="(currentSearchMode EQ emailAlias)" type="statement" name="tuiForwardEmail" />
							</Condition>
							<!-- only two possible search modes, the different name orderings -->
							<Condition value="NOT((primarySearchMode EQ emailAlias) OR (secondarySearchMode EQ emailAlias))">
								<Prompt condition="(currentSearchMode EQ lastNameFirstName)" type="statement" name="tuiForwardLastFirstFirstLast" />
								<Prompt condition="(currentSearchMode EQ firstNameLastName)" type="statement" name="tuiForwardFirstLastLastFirst" />
							</Condition>
						</Condition>
						<!-- only one search mode set, or both modes are the same -->
						<Condition value="(secondarySearchMode EQ none) OR (primarySearchMode EQ secondarySearchMode)">
							<Prompt condition="(currentSearchMode EQ lastNameFirstName)" type="statement" name="tuiForwardLastFirstNoEmail" />
							<Prompt condition="(currentSearchMode EQ firstNameLastName)" type="statement" name="tuiForwardFirstLastNoEmail" />
							<Prompt condition="(currentSearchMode EQ emailAlias)" type="statement" name="tuiForwardEmailNoName" />
						</Condition>
					</Condition>

					<Prompt condition = "NOT newSearch" type="statement" name="tuiContinueName" />
					<Prompt type="statement" name="tuiIfYouKnowExtension"/>
					<Prompt type="statement" name="tuiToSendToContact"/>
					<Prompt condition="newSearch" type="statement" name="tuiToCancelPressStar"/>

					<Transition event="#" refId="1320" action="null" />
					<Transition condition="(secondarySearchMode NE none) AND (primarySearchMode NE secondarySearchMode)" event="##" refId="1302" action="changeSearchMode" />
					<Transition event="00" refId="1301" action="changeSearchTarget" />

					<Transition condition="newSearch" event="*" refId="out-502" action="null" />
					<Transition condition="NOT newSearch" event="*" refId="1302" action="startNewSearch" />
					<Transition event="anyKey" refId="1302" action="searchDirectory" heavyaction="true" />
					<Transition event="resultsLessThanAllowed" refId="1303" action="null"/>
					<Transition event="resultsMoreThanAllowed" refId="1302" action="continueSearch"/>
					<Transition event="noResultsMatched" refId="1327" action="null"/>
					<Transition event="invalidSearchKey" action="handleInvalidSearchKey" refId="1412" />

					<Transition event="adTransientError" action="null" refId="adTransientErrorPrompt" />
				</Menu>

				<!-- play out the results -->
				<Menu id="1303" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
					<Condition value="(promptindex EQ 1)">
						<Prompt type="statement" name="tuiForUserPress1">
							<Prompt type="name" name="userName"/>
						</Prompt>
					</Condition>
					<Condition value="(promptindex EQ 2)">
						<Prompt type="statement" name="tuiForUserPress2">
							<Prompt type="name" name="userName"/>
						</Prompt>
					</Condition>
					<Condition value="(promptindex EQ 3)">
						<Prompt type="statement" name="tuiForUserPress3">
							<Prompt type="name" name="userName"/>
						</Prompt>
					</Condition>
					<Condition value="(promptindex EQ 4)">
						<Prompt type="statement" name="tuiForUserPress4">
							<Prompt type="name" name="userName"/>
						</Prompt>
					</Condition>
					<Condition value="(promptindex EQ 5)">
						<Prompt type="statement" name="tuiForUserPress5">
							<Prompt type="name" name="userName"/>
						</Prompt>
					</Condition>
					<Condition value="(promptindex EQ 6)">
						<Prompt type="statement" name="tuiForUserPress6">
							<Prompt type="name" name="userName"/>
						</Prompt>
					</Condition>
					<Condition value="(promptindex EQ 7)">
						<Prompt type="statement" name="tuiForUserPress7">
							<Prompt type="name" name="userName"/>
						</Prompt>
					</Condition>
					<Condition value="(promptindex EQ 8)">
						<Prompt type="statement" name="tuiForUserPress8">
							<Prompt type="name" name="userName"/>
						</Prompt>
					</Condition>
					<Condition value="(promptindex EQ 9)">
						<Prompt type="statement" name="tuiForUserPress9">
							<Prompt type="name" name="userName"/>
						</Prompt>
					</Condition>

					<Transition event="noKey" action="anyMoreResultsToPlay" heavyaction="true" refId="1303" />
					<Transition event="noMoreResultsToPlay" action="null" refId="1304" />
					<Transition event="moreResultsToPlay" action="null" refId="1303" />
				</Menu>

				<!-- this menu is for taking input from user for the option he wants to select -->
				<Menu id="1304" minDtmfSize="1" maxDtmfSize="1" dtmfInputValue="option" interDigitTimeout="2">
					<Prompt type="statement" name="tuiNoneCorrect"/>
					<Prompt type="statement" name="tuiToRepeatNames"/>

					<Transition event="anyKey" action="validateSearchSelection" heavyaction="true" refId="1303" />
					<Transition event="validSelection" action="null" refId="out-506" />
					<Transition event="invalidSelection" action="null" refId="1410" />
					<Transition condition="searchTarget EQ personalContacts" event="*" action="continueSearch" refId="1301" />
					<Transition condition="searchTarget EQ globalAddressList" event="*" action="continueSearch" refId="1302" />
					<Transition event="0" action="replayResults" heavyaction="true" refId="1303" />
					<!-- If we have a # in the buffer repeat the results (to avoid the 'number is not valid' message) -->
					<Transition event="#" action="replayResults" heavyaction="true" refId="1303" />
				</Menu>

				<!-- enter user by extension -->
				<Menu id="1320" minDtmfSize="extension" maxDtmfSize="extension" dtmfInputValue="extension" interDigitTimeout="5" inputTimeout="20">
					<Prompt type="statement" name="tuiForwardExtension"/>

					<!-- lookup user -->
					<Transition event="anyKey" action="searchDirectoryByExtension" heavyaction="true" refId="1320"/>
					<Transition event="resultsLessThanAllowed" action="null" refId="out-506"/>
					<Transition event="noResultsMatched" action="null" refId="1325"/>
					<Transition event="*" action="null" refId="1302"/>
					<Transition event="timeout" condition="NOT IsNull(lastInput)" action="null" refId="1325"/>
				</Menu>	

				<!-- wrong extension entered, or no user matched -->
				<Menu id="1325" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option" interDigitTimeout="2">
					<!--The keys entered do not match a recognized name.  -->
					<Prompt type="statement" name="tuiKeysNotName"/>
					<Transition event="noKey" action="null" refId="1320"/>
				</Menu>

				<!-- wrong dtmf map entered, or no user matched -->
				<Menu id="1326" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option" interDigitTimeout="2">
					<!--The keys entered do not match a recognized name.  -->
					<Prompt type="statement" name="tuiDtmfMapNotName"/>
					<Transition event="noKey" action="startNewSearch" refId="1301"/>
				</Menu>

				<!-- wrong dtmf map entered, or no user matched -->
				<Menu id="1327" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option" interDigitTimeout="2">
					<!--The keys entered do not match a recognized name.  -->
					<Prompt condition="currentSearchMode NE emailAlias" type="statement" name="tuiDtmfMapNotName"/>
					<!--The keys entered do not match a recognized e-mail alias.  -->
					<Prompt condition="currentSearchMode EQ emailAlias" type="statement" name="tuiKeysNotAlias"/>
					<Transition event="noKey" action="startNewSearch" refId="1302"/>
				</Menu>

				<!-- invalid selection in contact search -->
				<Menu id="1410" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
					<Prompt type="statement" name="tuiInvalidKeys">
						<Prompt type="text" name="invalidSearchSelection"/>
					</Prompt>
					<Transition event="noKey" action="replayResults" heavyaction="true" refId="1303" />
				</Menu>	

				<!-- invalid search input. User entered key =1,0,* in Contact Search  -->
				<Menu id="1411" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
					<Transition event="noKey" action="null" refId="1301"/>
					<Prompt type="statement" name="tuiInvalidKeys">
						<Prompt type="digit" name="searchInput"/>
					</Prompt>
				</Menu>

				<!-- invalid search input. User entered key =1,0,* in directory Search  -->
				<Menu id="1412" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
					<Transition event="noKey" action="null" refId="1302"/>
					<Prompt type="statement" name="tuiInvalidKeys">
						<Prompt type="digit" name="searchInput"/>
					</Prompt>
				</Menu>

				<Menu id="adTransientErrorPrompt" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
					<Prompt condition="searchTarget EQ personalContacts" type="statement" name="tuiSorryContactsSearchError"/>
					<Prompt condition="searchTarget EQ globalAddressList" type="statement" name="tuiSorryADSearchError"/>
					<Transition condition="searchTarget EQ personalContacts" event="noKey" action="startNewSearch" refId="1301" />
					<Transition condition="searchTarget EQ globalAddressList" event="noKey" action="startNewSearch" refId="1302" />
				</Menu>
			</DirectorySearch>

			<!-- cancel out of directory search goes here -->
			<Menu id="502" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Transition condition="numRecipients LT 1" event="noKey" action="cancelMessage" refId="503"/>
				<Transition condition="numRecipients GT 0" event="noKey" action="null" refId="505"/>
			</Menu>

			<!-- "message cancelled" -->
			<Menu id="503" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Prompt type="statement" name="tuiMessageCancelled"/>
				<Transition event="noKey" action="null" refId="850"/>
			</Menu>

			<!-- "[name] added" -->
			<Menu id="504" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Prompt type="statement" name="tuiUserAddedToMessage">
					<Prompt type="name" name="userName"/>
				</Prompt>
				<Transition event="noKey" action="null" refId="505"/>
			</Menu>

			<!-- Submit Message Menu -->
			<Menu id = "505" minDtmfSize = "1" maxDtmfSize = "1" dtmfInputValue = "option">
				<Prompt type = "statement" name = "tuiSubmitMessageMenu" />
				<Transition event = "1" action = "null" refId = "891"/>
				<Transition event = "2" action = "null" refId = "1400"/>
				<Transition event = "3" action = "removeRecipient" refId = "505"/>
				<Transition event = "*" action = "cancelMessage" refId = "503"/>
				<Transition event = "0" action = "null" refId = "505"/>
				<Transition event="noRecipients" action="null" refId="1400"/>			
			</Menu>

			<!-- Directory search menu goes here after successfully finding a recipient -->
			<Menu id="506" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Transition event="noKey" action="addRecipientBySearch" refId="504"/>
				<Transition event="unknownRecipient" action="null" refId="507"/>
			</Menu>

			<!-- Played if the user selected through directory search doesn't have a valid address -->
			<Menu id="507" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<Prompt type="statement" name="tuiUserNotAddedToMessageEmail"/>
				<Transition event="noKey" action="null" refId="1400"/>
			</Menu>

			<!-- At the tone, please record your reply -->
			<Menu id="891" minDtmfSize="0" maxDtmfSize="1" dtmfInputValue="option">
				<Prompt condition="forwardIntro" type="statement" name="tuiForwardMessageCue"/>
				<Prompt condition="replyIntro" type="statement" name="tuiReplyMessageCue"/>
				<Prompt condition="replyAllIntro" type="statement" name="tuiReplyMessageCue"/>
				<Transition event="noKey" action="null" refId="892"/>
				<Transition event = "#" condition="NOT replyIntro AND NOT replyAllIntro" action = "sendMessage" heavyaction="true" refId = "897"/>
				<Transition event = "#" condition="replyIntro OR replyAllIntro" action = "null" heavyaction="false" refId = "892"/>
				<Transition event="*" action="cancelMessage" refId="894"/>
			</Menu>

			<!-- *Beep* -->
			<Record id = "892" dtmfStopTones="#*"  type="message">
				<Transition event = "*" action = "cancelMessage" refId = "894" />
				<Transition event = "anyKey" action = "null" refId = "896" />
				<Transition event = "silence" condition="IsNull(recording)" action = "null" refId = "893" />			
				<Transition event = "silence" condition="NOT IsNull(recording)" action = "null" refId = "896" />			
				<Transition event = "timeout" action = "null" refId = "898" />			
				<Transition event = "userHangup" action = "sendMessage" heavyaction="false" refId = "DisconnectState" />
			</Record>

			<!-- Are you still there? -->
			<Menu id = "893" minDtmfSize = "0" maxDtmfSize = "0" dtmfInputValue = "option">
				<Prompt type = "statement" name = "tuiAreYouThere" />
				<Transition event = "noKey" action = "appendRecording" refId = "891"/>
			</Menu>

			<!-- Recording cancelled -->
			<Menu id = "894" minDtmfSize = "0" maxDtmfSize = "0" dtmfInputValue = "option">
				<Prompt type="statement" name="tuiMessageCancelled"/>
				<Transition event = "noKey" action = "null" refId = "850"/>			
			</Menu>

			<!-- Recoding too long -->
			<Menu id = "898" minDtmfSize = "0" maxDtmfSize = "0" dtmfInputValue = "option">
				<Prompt type="statement" name="tuiRecordingTooLong"/>
				<Transition event = "noKey" action = "null" refId = "896"/>			
			</Menu>

			<!-- Replay recording -->
			<Menu id = "895" minDtmfSize = "0" maxDtmfSize = "0" dtmfInputValue = "option">
				<Prompt type = "tempwave" name = "recording" />
				<Transition event = "noKey" action = "null" refId = "896"/>
			</Menu>

			<!-- After recording menu -->
			<Menu id = "896" minDtmfSize = "1" maxDtmfSize = "2" dtmfInputValue = "option">
				<Prompt type = "statement" name = "tuiAfterRecordingMenu" />
				<Transition event = "1" action = "sendMessage" heavyaction="true" refId = "897" />
				<Transition event = "11" action = "sendMessageUrgent" heavyaction="true" refId = "897" />
				<Transition event = "2" action = "null" refId = "895" />
				<Transition event = "3" action = "clearRecording" refId = "891" />
				<Transition event = "4" condition="NOT recordingTimedOut" action = "appendRecording" refId = "910" />
				<Transition event = "4" condition="recordingTimedOut" action = "null" refId = "898" />
				<Transition event = "*" action = "cancelMessage" refId = "894" />
				<Transition event = "0" action = "null" refId = "896" />
				<Transition event = "userHangup" action = "sendMessage" heavyaction="false" refId = "DisconnectState" />
			</Menu>

			<!-- "Message Sent".  For declines, send them to the next message -->
			<Menu id = "897" minDtmfSize = "0" maxDtmfSize = "0" dtmfInputValue = "option">
				<Prompt type = "statement" name = "tuiMessageSent" />
				<Transition event = "noKey" action = "null" refId = "850" />
			</Menu>

			<!-- Dummy state to exit to main menu -->
			<Menu id="899" minDtmfSize="0" maxDtmfSize="0" dtmfInputValue="option">
				<!-- main menu --><Transition event="noKey" action="null" refId="ExitDtmfVoicemail"/>
			</Menu>

			<!-- Continue recording -->
			<Menu id = "910" minDtmfSize = "0" maxDtmfSize = "0" dtmfInputValue = "option">
				<Prompt type = "statement" name = "tuiContinueRecording"/>
				<Transition event = "noKey" action = "null" refId = "892" />
			</Menu>

			<!-- Dummy State for disconnect -->
			<Menu id = "DisconnectState">
				<Transition event = "noKey" action="disconnect" refId="DisconnectState"/>
			</Menu>

			<!-- Decides whether to go back to the main menu or disconnect the call -->
			<Menu id = "ExitDtmfVoicemail">
				<Transition event="noKey" condition="IsNull(ocFeature)" action="null" refId="out-106"/>
				<Transition event="noKey" condition="NOT IsNull(ocFeature)" action="null" refId="DisconnectState"/>
			</Menu>
		</RetrieveVoicemail>
	</FsmModule>
</FiniteStateMachine>




