WaitForMsg command

This command waits for a message from a specified address and saves its content into a variable. The command has got 3 states: Execute, OnMessge and OnTimeout. The Execute section will be executed, when the WaitForMsg command started. If a message arrives from the specified address, the commands in the OnMessage part will be executed. The commands between the OnTimeout node will be performed only if there is no message arrives within the give time limit.

Parameters

Parameter name Example value Description Mandatory
FromAddress test.ozeki@gmail.com The address where we expect the message from. no
FromConnection gmail_client_1@localhost The name of the connection where we expect the message from. yes
Timeout 90 Specifies how many seconds the system waits for the message. If there is no incoming message from the specified connection within the specified time, the call ends. The default value is 90 seconds. no

OzML example

This example shows the full capability of the WaitForMsg command. When the WaitForMsg command is executed, the Speak commands runs first. If the message is received, the system will read it to the caller. If there is no incoming message from 'admin@localhost' within 60 seconds, the system executes the Speak command between the 'OnTimeout' nodes and then the call ends.

<Response>
  <WaitForMsg FromConnection='admin@localhost' Timeout='60'>
    <Execute>
      <Speak>Waiting for a message from 'admin@localhost'.</Speak>
    </Execute>
    <OnMessage>
      <Speak>Message received from $FromConnection</Speak>
      <Speak>The message is as follows: $Text</Speak>
    </OnMessage>
    <OnTimeout>
      <Speak>Time out.</Speak>
    </OnTimeout>
  </WaitForMsg>
</Response>

More information