<?xml version="1.0" encoding="ISO-8859-1"?>
<cookbook xmlns:al="http://www.logilab.org/namespaces/Narval/1.2">


<!-- ********** engine control related recipes ********** -->

<al:recipe name="narval-shutdown" restart="yes">
  <al:description lang="en">
    ask your narval assistant to die now
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Basic.die"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'shutdown'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>

<al:recipe name="narval-start-plan" restart="yes">
  <al:description lang="en">
    start an arbitrary plan
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Basic.start-plan"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'start_plan'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>

<al:recipe name="narval-reschedule-plan" restart="yes">
  <al:description lang="en">
    reschedule the execution time of a plan (you need the original plan eid to reference it)
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Basic.reschedule-plan"/>
  <!-- FIXME: generated message is specific to delayed conferences... -->
  <al:step id="s3" type="action" target="Chat.notify-delayed-conf"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'reschedule_plan'</al:match>
    </al:condition>
  </al:transition>
  <al:transition id="t1">
    <al:in idref="s2"/>
    <al:out idref="s3"/>
  </al:transition>
</al:recipe>

<al:recipe name="narval-introspection" restart="yes">
  <al:description lang="en">
    use arbitrary python expression to inspect narval's memory
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Chat.dump-elements"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'introspect'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>

<al:recipe name="narval-log-started-plans" restart="yes">
  <al:description lang="en">
    log instantiated plan (except itself to avoid infinite loop...)
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Introspect.log-plans"/>
  <al:step id="s3" type="action" target="Basic.write-file"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition list="yes" use="yes">
      <al:match>isinstance(elmt, PlanElement) and elmt.name not in ('narval-log-started-plans', 'narval-log-ended-plans')</al:match>
    </al:condition>
  </al:transition>
  <al:transition id="t1">
    <al:in idref="s2"/>
    <al:out idref="s3"/>
  </al:transition>
</al:recipe>

<al:recipe name="narval-log-ended-plans" restart="yes">
  <al:description lang="en">
    log finished plan (except itself to avoid infinite loop...)
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Introspect.log-plans"/>
  <al:step id="s3" type="action" target="Basic.write-file"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition list="yes" use="yes">
      <al:match>isinstance(elmt, PlanElement) and elmt.state in ('done', 'failed') and elmt.name not in ('narval-log-started-plans', 'narval-log-ended-plans')</al:match>
    </al:condition>
  </al:transition>
  <al:transition id="t1">
    <al:in idref="s2"/>
    <al:out idref="s3"/>
  </al:transition>
</al:recipe>

<al:recipe name="narval-help" restart="yes">
  <al:description lang="en">
    generate chatbot help for available commands by introspecting active plan
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Chat.active-help"/>
  <al:step id="s3" type="action" target="Chat.data2msg"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'help'</al:match>
    </al:condition>
  </al:transition>
  <al:transition id="t1">
    <al:in idref="s2"/>
    <al:out idref="s3"/>
  </al:transition>
</al:recipe>

<al:recipe name="narval-generate-docbook" restart="yes">
  <al:description lang="en">
    generate docbook documentation file for actions / recipes
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="recipe" target="autodoc.docbook-documentation"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'document'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>


<!-- ********** chat control related recipes ********** -->

<al:recipe name="chat-reload-ail-brain" restart="yes">
  <al:description lang="en">
    force reloading of the ail brain
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Chat.reload-ail-brain"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'chat_reload_ail_brain'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>

<al:recipe name="chat-subscribe" restart="yes">
  <al:description lang="en">
    ask your assistant to add a known jabber id to its personal roster
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Chat.subscribe-to-user"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'chat_subscribe'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>

<al:recipe name="chat-conf-setup" restart="yes">
  <al:description lang="en">
    ask your assistant to setup a conference
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Chat.conf-setup"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'conf_setup'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>

<al:recipe name="chat-delayed-conf-setup" restart="yes">
  <al:description lang="en">
    ask your assistant to setup a conference latter
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Basic.start-plan"/>
  <al:step id="s3" type="action" target="Chat.notify-delayed-conf"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'conf_setup_delayed'</al:match>
    </al:condition>
  </al:transition>
  <al:transition id="t1">
    <al:in idref="s2"/>
    <al:out idref="s3"/>
  </al:transition>
</al:recipe>

<al:recipe name="chat-conf-kickout" restart="yes">
  <al:description lang="en">
    ask your assistant to leave a conference room
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Chat.conf-kickout"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'conf_leave'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>

<al:recipe name="chat-filtered-response" restart="yes">
  <al:description lang="en">
    automatically transfert some predefined answers to some input sentences. 
    You should not have to trigger this recipe manually.
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="AlRDF.is-a-human-stmt"/>
  <al:step id="s3" type="action" target="kb-backend.search-stmts"/>
  <al:step id="s4" type="action" target="Chat.command2msg"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'response'</al:match>
    </al:condition>
  </al:transition>
  <al:transition id="t1">
    <al:in idref="s2"/>
    <al:out idref="s3"/>
  </al:transition>
  <al:transition id="t2">
    <al:in idref="s3"/>
    <al:out idref="s4"/>
  </al:transition>
</al:recipe>

<al:recipe name="chat-start-templated-discussion" restart="yes">
  <al:description lang="en">
    start a discussion to fill some data governed by a template
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Chat.start-templated-discussion"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'fill_template'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>

<al:recipe name="chat-continue-templated-discussion" restart="yes">
  <al:description lang="en">
    continue a discussion to fill some data governed by a template
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Chat.continue-templated-discussion"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <!-- don't use the adapted element for later test since we want
           actual message element, not adapted commands for instance
        -->
      <al:match>IIMessage(elmt) and elmt.type == 'incoming' and elmt.discussion_mode == 'fillingtemplate'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>

<al:recipe name="chat-when-user-will-be-back" restart="yes">
  <al:description lang="en">
    start a discussion to fill some data governed by a template
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Presence.when-user-will-be-back"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'guess_user_time_back'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>


<!-- ********** KB related recipes ********** -->


<al:recipe name="kb-search" restart="yes">
  <al:description lang="en">
    search matching statements in the knowledge base
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="recipe" target="kb.search-stmts"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'kb_search_stmts' and IIMessage(elmt).discussion_mode == 'default'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>

<al:recipe name="kb-rdql-query" restart="yes">
  <al:description lang="en">
    run a RDQL query against the knowledge base
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="recipe" target="kb.rdql-search-stmts"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'kb_rdql'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>

<al:recipe name="kb-add-stmts" restart="yes">
  <al:description lang="en">
    add statement(s) to the knowledge base
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="kb-backend.add-stmts"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'kb_add_stmt' and IIMessage(elmt).discussion_mode == 'default'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>

<al:recipe name="kb-add-rule" restart="yes">
  <al:description lang="en">
    add a rule to the knowledge base
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="recipe" target="kb.add-rule-from-text"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'kb_add_rule'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>

<al:recipe name="kb-rdf-export" restart="yes">
  <al:description lang="en">
    export the knowledge base's content as XML-RDF
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="recipe" target="bots.xmlrdf-export"/>
  <al:transition id="t0">
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'kb_rdf_export'</al:match>
    </al:condition>
    <al:in idref="s1"/>
    <al:out idref="s2"/>
  </al:transition>
</al:recipe>

<al:recipe name="kb-rdf-import" restart="yes">
  <al:description lang="en">
    import some XML-RDF to the knowledge base
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="recipe" target="kb.xmlrdf-import"/>
  <al:transition id="t0">
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'kb_rdf_import'</al:match>
    </al:condition>
    <al:in idref="s1"/>
    <al:out idref="s2"/>
  </al:transition>
</al:recipe>

<al:recipe name="kb-rdf-extract" restart="yes">
  <al:description lang="en">
    export the knowledge base's content as XML-RDF, formatted to be given to another agent
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Chat.handle-rdf-extract-command"/>
  <al:transition id="t0">
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'kb_rdf_extract'</al:match>
    </al:condition>
    <al:in idref="s1"/>
    <al:out idref="s2"/>
  </al:transition>
</al:recipe>

<al:recipe name="kb-foaf-export" restart="yes">
  <al:description lang="en">
    export FOAF related data from the knowledge base
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="recipe" target="kb.show-foaf"/>
  <al:transition id="t0">
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'kb_foaf_export'</al:match>
    </al:condition>
    <al:in idref="s1"/>
    <al:out idref="s2"/>
  </al:transition>
</al:recipe>

<al:recipe name="kb-foaf-import" restart="yes">
  <al:description lang="en">
    import some FOAF data to the knowledge base
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="recipe" target="kb.foaf-import"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'kb_foaf_import'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>

<al:recipe name="kb-foaf-extract" restart="yes">
  <al:description lang="en">
    export the knowledge base's content as FOAF XML-RDF, formatted to be given to another agent
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Chat.handle-foaf-extract-command"/>
  <al:transition id="t0">
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'kb_foaf_extract'</al:match>
    </al:condition>
    <al:in idref="s1"/>
    <al:out idref="s2"/>
  </al:transition>
</al:recipe>

<al:recipe name="kb-respond-to-presence" restart="yes">
  <al:description lang="en">
    detect if a user is a narval on incoming presence elements
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="recipe" target="kb.respond-to-presence"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>IIPresence(elmt).type == 'incoming' and IIPresence(elmt).get_type() in ('available', 'subscribe')</al:match>
    </al:condition>
  </al:transition>
</al:recipe>

<al:recipe name="kb-state-you-are-a-narval" restart="yes">
  <al:description lang="en">
    respond to the "are you a narval?" question
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="AlRDF.state-you-are-a-narval"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'kb_state_you_are_a_narval'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>

<al:recipe name="kb-register-user-type" restart="yes">
  <al:description lang="en">
    add jabber user information to the knowledge base
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="recipe" target="kb.register-user"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'kb_add_user_info'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>


<!-- ********** Metalog related recipes ********** -->

<al:recipe name="metalog-categorize" restart="yes">
  <al:description lang="en">
    categorize using metalog
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Metalog.handle-metalog"/>
  <al:step id="s31" type="action" target="Metalog.insert-metalog"/>
  <al:step id="s32" type="action" target="Metalog.query-metalog"/>
  <al:step id="s4" type="action" target="Basic.NOP"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'log_categorize' and IIMessage(elmt).discussion_mode == 'metalog'</al:match>
    </al:condition>
  </al:transition>
  <al:transition id="t1">
    <al:in idref="s2"/>
    <al:out idref="s31"/>
    <al:out idref="s32"/>
  </al:transition>
  <al:transition id="t21">
    <al:in idref="s31"/>
    <al:out idref="s4"/>
  </al:transition>
  <al:transition id="t22">
    <al:in idref="s32"/>
    <al:out idref="s4"/>
  </al:transition>
</al:recipe>


<!-- ********** entertainment related recipes ********** -->

<al:recipe name="entertainment" restart="yes">
  <al:description lang="en">
    XMLTV / ALLOCINE handling
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="recipe" target="entertainment.films"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name in ('search_film', 'init_xmltv', 'select_film', 'enter_postcode')</al:match>
    </al:condition>
  </al:transition>
</al:recipe>


<!-- ********** activity report related recipes ********** -->

<al:recipe name="activity-notify" restart="yes">
  <al:description lang="en">
    notify daily activity
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Activity.activity-notify-command"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'activity_notify'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>

<al:recipe name="activity-report" restart="yes">
  <al:description lang="en">
    print the current report of activity
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Activity.activity-report-command"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'activity_report'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>

<al:recipe name="activity-flush" restart="yes">
  <al:description lang="en">
    reset the current report of activity
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Activity.activity-flush-command"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'activity_flush'</al:match>
    </al:condition>
  </al:transition>
</al:recipe>

<al:recipe name="activity-wait" restart="yes">
  <al:description lang="en">
    wait for daily activity notification and generate daily report if the full day activity has been reported
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Activity.check-today-activity">
    <al:input id="reports" from_context="memory"/>
  </al:step>
  <al:step id="s3" type="action" target="Email.send-mail"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>IActivity(elmt)</al:match>
    </al:condition>
  </al:transition>
  <al:transition id="t1">
    <al:in idref="s2"/>
    <al:out idref="s3"/>
  </al:transition>
</al:recipe>


<!-- ********** communication related recipes ********** -->

<al:recipe name="comm-tell-master" restart="yes">
  <al:description lang="en">
    forward a message to master via email or instant messaging
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Chat.handle-tell-master-command" />
  <al:step id="s3" type="action" target="Email.send-mail"/>
  <al:step id="s5" type="action" target="Basic.NOP"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'tell_master'</al:match>
    </al:condition>
  </al:transition>
  <al:transition id="t11" priority="1" from_context="step" to_context="step">
    <al:in idref="s2"/>
    <al:out idref="s3"/>
    <al:condition use="yes">
      <al:match>isinstance(elmt, EmailElement)</al:match>
    </al:condition>
  </al:transition>
  <al:transition id="t2" priority="0">
    <al:in idref="s2"/>
    <al:out idref="s5"/>
  </al:transition>
  <al:transition id="t4">
    <al:in idref="s3"/>
    <al:out idref="s5"/>
  </al:transition>
</al:recipe>


<al:recipe name="comm-shtoom-tell-master" restart="yes">
  <al:description lang="en">
    forward a message to master via phone, email or instant messaging (require the Shtoom actions module)
  </al:description>
  <al:step id="s1" type="action" target="Basic.NOP"/>
  <al:step id="s2" type="action" target="Chat.handle-tell-master-command" />
  <al:step id="s3" type="action" target="Email.send-mail"/>
  <al:step id="s4" type="action" target="Shtoom.make-phone-call"/>
  <al:step id="s5" type="action" target="Basic.NOP"/>
  <al:transition id="t0">
    <al:in idref="s1"/>
    <al:out idref="s2"/>
    <al:condition use="yes">
      <al:match>ICommand(elmt).name == 'tell_master'</al:match>
    </al:condition>
  </al:transition>
  <al:transition id="t11" priority="1" from_context="step" to_context="step">
    <al:in idref="s2"/>
    <al:out idref="s3"/>
    <al:condition use="yes">
      <al:match>isinstance(elmt, EmailElement)</al:match>
    </al:condition>
  </al:transition>
  <al:transition id="t12" priority="1" from_context="step" to_context="step">
    <al:in idref="s2"/>
    <al:out idref="s4"/>
    <al:condition use="yes">
      <al:match>IPhoneCall(elmt)</al:match>
    </al:condition>
  </al:transition>
  <al:transition id="t2" priority="0">
    <al:in idref="s2"/>
    <al:out idref="s5"/>
  </al:transition>
  <al:transition id="t3">
    <al:in idref="s3"/>
    <al:out idref="s4"/>
  </al:transition>
  <al:transition id="t4">
    <al:in idref="s4"/>
    <al:out idref="s5"/>
  </al:transition>
</al:recipe>


</cookbook>