flow:
  - start|DEFAULT_ONREPLY:
  - start|REPLY_ROUTE_NAT:
  - start|ROUTE_ENTRY:
  - return|ROUTE_ENTRY:
  - start|ROUTE_APPLY_HEADER_RULES:
  - return|ROUTE_APPLY_HEADER_RULES:
  - start|ROUTE_PREPARE_UA:
  - return|ROUTE_PREPARE_UA:
  - start|REPLY_ROUTE_NAT_CONTINUE:
  - start|ROUTE_EXIT:
  - start|ROUTE_RUNTIME:
  - return|ROUTE_RUNTIME:
  - exit|ROUTE_EXIT:
  - start|FAILURE_ROUTE_LOCAL:
  - start|ROUTE_INITVARS:
  - return|ROUTE_INITVARS:
  - start|ROUTE_STOP_RTPPROXY_BRANCH:
  - start|ROUTE_RESTORE_CLUSTERSET:
  - return|ROUTE_RESTORE_CLUSTERSET:
  - return|ROUTE_STOP_RTPPROXY_BRANCH:
  - start|ROUTE_LOAD_CALLER_PREF:
  - start|ROUTE_CLEAR_CALLER_PREF:
  - return|ROUTE_CLEAR_CALLER_PREF:
  - start|ROUTE_CHECK_UA:
  - return|ROUTE_CHECK_UA:
  - start|ROUTE_LOAD_CALLER_CONTRACT_PREF:
  - return|ROUTE_LOAD_CALLER_CONTRACT_PREF:
  - return|ROUTE_LOAD_CALLER_PREF:
  - start|ROUTE_SET_HIH_CF:
  - return|ROUTE_SET_HIH_CF:
  - start|ROUTE_FIND_CALLEE:
  - start|ROUTE_CLEAR_CALLEE_PREF:
  - return|ROUTE_CLEAR_CALLEE_PREF:
  - start|ROUTE_LOAD_CALLEE_PREF:
  - start|ROUTE_LOAD_CALLEE_CONTRACT_PREF:
  - return|ROUTE_LOAD_CALLEE_CONTRACT_PREF:
  - start|ROUTE_SET_CALLEE_DIALOG:
  - start|ROUTE_CNT_DLG_CHECK:
  - return|ROUTE_CNT_DLG_CHECK:
  - return|ROUTE_SET_CALLEE_DIALOG:
  - start|ROUTE_BLOCK_IN:
  - return|ROUTE_BLOCK_IN:
  - return|ROUTE_LOAD_CALLEE_PREF:
  - start|ROUTE_NCOS_CHECK:
  - start|ROUTE_NCOS:
  - return|ROUTE_NCOS:
  - start|ROUTE_NCOS:
  - return|ROUTE_NCOS:
  - start|ROUTE_NCOS:
  - return|ROUTE_NCOS:
  - start|ROUTE_NCOS:
  - return|ROUTE_NCOS:
  - return|ROUTE_NCOS_CHECK:
  - start|ROUTE_BLOCK_OUT:
  - return|ROUTE_BLOCK_OUT:
  - start|ROUTE_CHECK_PBX:
  - return|ROUTE_CHECK_PBX:
  - start|ROUTE_CALLEE_DISPATCH:
  - start|ROUTE_INVITE_TO_INT:
  - start|ROUTE_APPLY_HEADER_RULES:
  - return|ROUTE_APPLY_HEADER_RULES:
  - start|ROUTE_CF_CFU:
  - return|ROUTE_CF_CFU:
  - start|ROUTE_CNT_DLG_CHECK:
  - return|ROUTE_CNT_DLG_CHECK:
  - start|ROUTE_CHECK_LOCATIONS:
  - start|ROUTE_LOOKUP_SUBSCRIBER_LOCATIONS:
  - return|ROUTE_LOOKUP_SUBSCRIBER_LOCATIONS:
  - start|ROUTE_OUTBOUND:
  - start|ROUTE_ACC_CALLER:
  - start|ROUTE_SET_ACC_CALLER_CALL_COUNTERS:
  - return|ROUTE_SET_ACC_CALLER_CALL_COUNTERS:
  - return|ROUTE_ACC_CALLER:
  - start|ROUTE_ACC_CALLEE:
  - start|ROUTE_SET_ACC_CALLEE_CALL_COUNTERS:
  - return|ROUTE_SET_ACC_CALLEE_CALL_COUNTERS:
  - return|ROUTE_ACC_CALLEE:
  - start|ROUTE_ADD_AOC_HEADER:
  - return|ROUTE_ADD_AOC_HEADER:
  - start|BRANCH_ROUTE_SBC:
  - start|ROUTE_LOAD_CALLEE_CONTRACT_PREF:
  - return|ROUTE_LOAD_CALLEE_CONTRACT_PREF:
  - start|ROUTE_SET_CALLEE_DIALOG:
  - start|ROUTE_CNT_DLG_CHECK:
  - return|ROUTE_CNT_DLG_CHECK:
  - return|ROUTE_SET_CALLEE_DIALOG:
  - start|ROUTE_SET_BRANCH_HDRS:
  - start|ROUTE_PREPARE_UA:
  - return|ROUTE_PREPARE_UA:
  - return|ROUTE_SET_BRANCH_HDRS:
  - start|ROUTE_SET_RUSER:
  - return|ROUTE_SET_RUSER:
  - start|ROUTE_BRANCH_ACC_RTP:
  - return|ROUTE_BRANCH_ACC_RTP:
  - start|ROUTE_FILTER_PRACK:
  - return|ROUTE_FILTER_PRACK:
  - start|ROUTE_PREPARE_SST:
  - return|ROUTE_PREPARE_SST:
  - start|ROUTE_PREPARE_MOH:
  - return|ROUTE_PREPARE_MOH:
  - start|ROUTE_SET_CALLER_CLI:
      $avp(forwarder_domain_userprov): ['invite-redirect-tel-uri.scenarios.test']
  - start|ROUTE_PREPARE_CALLER_CLI:
  - return|ROUTE_PREPARE_CALLER_CLI:
  - start|ROUTE_PREPARE_CALLER_CLI:
  - return|ROUTE_PREPARE_CALLER_CLI:
  - start|ROUTE_PREPARE_CALLER_CLI:
  - return|ROUTE_PREPARE_CALLER_CLI:
  - start|ROUTE_PREPARE_CALLER_CLI:
  - return|ROUTE_PREPARE_CALLER_CLI:
  - start|ROUTE_PREPARE_CALLER_CLI:
  - return|ROUTE_PREPARE_CALLER_CLI:
  - start|ROUTE_PREPARE_CALLER_CLI:
  - return|ROUTE_PREPARE_CALLER_CLI:
  - return|ROUTE_SET_CALLER_CLI:
      $var(ccli_domain): invite-redirect-tel-uri.scenarios.test
      $var(diversion_uri): sip:\+[% invite_redirect_tel_uri_scenarios_test.testuser1001.phone_number %]@invite-redirect-tel-uri.scenarios.test
  - start|ROUTE_SET_CALLEE:
  - return|ROUTE_SET_CALLEE:
  - start|ROUTE_ADD_CALLINFO:
  - start|ROUTE_ADD_CALLINFO_CALLER_PRIMARY:
  - return|ROUTE_ADD_CALLINFO_CALLER_PRIMARY:
  - start|ROUTE_ADD_CALLINFO_CALLEE_PRIMARY:
  - return|ROUTE_ADD_CALLINFO_CALLEE_PRIMARY:
  - return|ROUTE_ADD_CALLINFO:
  - start|ROUTE_APPLY_HEADER_RULES:
  - return|ROUTE_APPLY_HEADER_RULES:
  - return|BRANCH_ROUTE_SBC:
  - start|DEFAULT_SEND:
  - exit|DEFAULT_SEND:
  - exit|DEFAULT_SEND:
  - start|ROUTE_EXIT:
  - start|ROUTE_RUNTIME:
  - return|ROUTE_RUNTIME:
  - exit|ROUTE_EXIT:
  - exit|ROUTE_EXIT:
sip_in:
  # From: <sip:0967451213@gp.dauphintelecom.com;user=phone>;tag=<something>
  # To: <sip:590590779990@74.116.94.226:5060>
  # Diversion: <sip:590590779990@74.116.94.226:5060;rinstance=d99c86941fbe0e10;user=phone>
  - '^SIP/2.0 302 Moved Temporarily'
  - 'From: <sip:[% invite_redirect_tel_uri_scenarios_test.testuser1000.phone_number %]@invite-redirect-tel-uri.scenarios.test'
  - 'To: <sip:\+[% invite_redirect_tel_uri_scenarios_test.testuser1001.phone_number %]@invite-redirect-tel-uri.scenarios.test'
  - 'CSeq: 2 INVITE'
  - 'Contact: <sip:[% scenarios.0.responders.1.username %]@invite-redirect-tel-uri.scenarios.test(;alias=[% scenarios.0.responders.0.ip %]~[% scenarios.0.responders.0.port %]~1)?;transport=UDP>'
  - 'Diversion: <sip:[% invite_redirect_tel_uri_scenarios_test.testuser1001.phone_number %]@invite-redirect-tel-uri.scenarios.test'
  # particular case when customer adds one more Diversion into the call
sip_out:
  - [
      '^ACK sip:[% scenarios.0.responders.0.username %]@',
      'From: <sip:[% invite_redirect_tel_uri_scenarios_test.testuser1000.phone_number %]@invite-redirect-tel-uri.scenarios.test',
      'To: <sip:\+[% invite_redirect_tel_uri_scenarios_test.testuser1001.phone_number %]@invite-redirect-tel-uri.scenarios.test',
      'CSeq: \d+ ACK',
      'Max-Forwards: 68',
      'Content-Length: 0'
    ]
  - [
    # we make sure that Diversion has domain part
    # we make sure that From/To/Diversion/PAI headers have SIP scheme
      '^INVITE sip:[% scenarios.0.responders.1.username %]@[% scenarios.0.ip %]',
      'From: <sip:[% invite_redirect_tel_uri_scenarios_test.testuser1000.phone_number %]@invite-redirect-tel-uri.scenarios.test>;tag=[\w-]+',
      'To: <sip:\+[% invite_redirect_tel_uri_scenarios_test.testuser1001.phone_number %]@invite-redirect-tel-uri.scenarios.test',
      'CSeq: \d+ INVITE',
      'Contact: <sip:[% scenarios.0.username %]@[% scenarios.0.ip %]:[% scenarios.0.port %](;[^>]+)?>',
      'Max-Forwards: 68',
      'Content-Type: application/sdp',
      'P-Asserted-Identity: <sip:[% invite_redirect_tel_uri_scenarios_test.testuser1000.phone_number %]@invite-redirect-tel-uri.scenarios.test',
      'Diversion: <sip:\+[% invite_redirect_tel_uri_scenarios_test.testuser1001.phone_number %]@invite-redirect-tel-uri.scenarios.test',
      'P-App-Name: sbc'
    ]