<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">
<scenario name="Basic INVITE with a 1 second wait and a BYE, Walter Doekes 2011">
  <label id="invite"/>

  <send retrans="500" start_txn="invite">
    <![CDATA[

      INVITE sip:[tel]@[remote_ip]:[remote_port] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: sip:[service]@[local_ip]:[local_port];tag=[pid]SIPpTag00[call_number]
      To: sip:[tel]@[remote_ip]:[remote_port]
      Contact: sip:[service]@[local_ip]:[local_port]
      Call-ID: [call_id]
      CSeq: [cseq] INVITE
      Max-Forwards: 70
      Content-Type: application/sdp
      Content-Length: [len]

      v=0
      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
      s=-
      c=IN IP[media_ip_type] [media_ip]
      t=0 0
      m=audio [media_port] RTP/AVP 8 0
      a=rtpmap:8 PCMA/8000
      a=rtpmap:0 PCMU/8000

    ]]>
  </send>

  <recv response="100" optional="true" response_txn="invite"/>

  <recv response="401" optional="true" next="invite-with-auth" auth="true" rrs="true" response_txn="invite">
    <action>
      <ereg regexp=";branch=[^;]*" search_in="hdr" header="Via" check_it="false" assign_to="1"/>
      <ereg regexp=";.*" search_in="hdr" header="To" check_it="false" assign_to="2"/>
    </action>
  </recv>

  <recv response="407" auth="true" rrs="true" response_txn="invite">
    <action>
      <ereg regexp=";branch=[^;]*" search_in="hdr" header="Via" check_it="false" assign_to="1"/>
      <ereg regexp=";.*" search_in="hdr" header="To" check_it="false" assign_to="2"/>
    </action>
  </recv>

  <label id="invite-with-auth"/>

  <send ack_txn="invite">
    <![CDATA[

      ACK sip:[tel]@[remote_ip]:[remote_port] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port][$1]
      [routes]
      From: sip:[service]@[local_ip]:[local_port];tag=[pid]SIPpTag00[call_number]
      To: sip:[tel]@[remote_ip]:[remote_port][$2]
      Contact: sip:[service]@[local_ip]:[local_port]
      Call-ID: [call_id]
      CSeq: [cseq] ACK
      Max-Forwards: 70
      Content-Length: 0

    ]]>
  </send>

  <send retrans="500" start_txn="invite">
    <![CDATA[

      INVITE sip:[tel]@[remote_ip]:[remote_port] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: sip:[service]@[local_ip]:[local_port];tag=[pid]SIPpTag00[call_number]
      To: sip:[tel]@[remote_ip]:[remote_port]
      Contact: sip:[service]@[local_ip]:[local_port]
      [authentication]
      Call-ID: [call_id]
      CSeq: [cseq] INVITE
      Max-Forwards: 70
      Content-Type: application/sdp
      Content-Length: [len]

      v=0
      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
      s=-
      c=IN IP[media_ip_type] [media_ip]
      t=0 0
      m=audio [media_port] RTP/AVP 8 0
      a=rtpmap:8 PCMA/8000
      a=rtpmap:0 PCMU/8000

    ]]>
  </send>

  <recv response="100" response_txn="invite"/>

  <recv response="180" optional="true" response_txn="invite"/>

  <recv response="183" optional="true" response_txn="invite"/>
  
  <recv response="200" rrs="true" response_txn="invite">
    <action>
      <ereg regexp=";branch=[^;]*" search_in="hdr" header="Via" check_it="false" assign_to="1"/>
      <ereg regexp=";.*" search_in="hdr" header="To" check_it="false" assign_to="2"/>
    </action>
  </recv>

  <send ack_txn="invite">
    <![CDATA[

      ACK [next_url] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port][$1]
      [routes]
      From: sip:[service]@[local_ip]:[local_port];tag=[pid]SIPpTag00[call_number]
      To: sip:[tel]@[remote_ip]:[remote_port][$2]
      Contact: sip:[service]@[local_ip]:[local_port]
      Call-ID: [call_id]
      CSeq: [cseq] ACK
      Max-Forwards: 70
      Content-Length: 0

    ]]>
  </send>

  <pause milliseconds="1000"/>
  
  <!-- Enable the below to play alaw audio. You may need to use the
       sipp(1) -i MY_IP option. -->
  <!--
  <nop>
    <action>
      <exec play_pcap_audio="../pcap/g711a.pcap"/>
    </action>
  </nop>
  <pause milliseconds="9000"/>
  -->
  
  <send start_txn="bye">
    <![CDATA[

      BYE [next_url] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      [routes]
      From: sip:[service]@[local_ip]:[local_port];tag=[pid]SIPpTag00[call_number]
      To: sip:[tel]@[remote_ip]:[remote_port][$2]
      Contact: sip:[service]@[local_ip]:[local_port]
      Call-ID: [call_id]
      CSeq: [cseq+1] BYE
      Max-Forwards: 70
      Content-Length: 0

    ]]>
  </send>

  <recv response="200" response_txn="bye"/>

</scenario>
