flow:
  - start|DEFAULT_ROUTE:
  - start|ROUTE_ENTRY:
  - return|ROUTE_ENTRY:
  - start|ROUTE_NET_INFO:
  - return|ROUTE_NET_INFO:
  - start|ROUTE_CHECK_TEL_URI:
  - return|ROUTE_CHECK_TEL_URI:
  - start|ROUTE_PRX_REQUEST:
  - start|ROUTE_INITVARS:
  - return|ROUTE_INITVARS:
  - start|ROUTE_INVITE:
  - start|ROUTE_LOAD_CALLEE_DOMAIN_PREF:
  - start|ROUTE_CLEAR_CALLEE_DOMAIN_PREF:
  - return|ROUTE_CLEAR_CALLEE_DOMAIN_PREF:
  - return|ROUTE_LOAD_CALLEE_DOMAIN_PREF:
  - start|ROUTE_FIND_CALLER:
  - start|ROUTE_AUTH:
  - start|ROUTE_AUTH_HELPER:
  - return|ROUTE_AUTH_HELPER:
  - start|ROUTE_ADD_CALLINFO_REPLY:
  - start|ROUTE_ADD_CALLINFO_CALLER_PRIMARY:
  - return|ROUTE_ADD_CALLINFO_CALLER_PRIMARY:
  - return|ROUTE_ADD_CALLINFO_REPLY:
  - return|ROUTE_AUTH:
  - return|ROUTE_FIND_CALLER:
  - 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_DLG_MANAGE:
  - return|ROUTE_DLG_MANAGE:
  - start|ROUTE_APPLY_HEADER_RULES:
  - return|ROUTE_APPLY_HEADER_RULES:
  - start|ROUTE_GET_CALLER_CLI:
  - return|ROUTE_GET_CALLER_CLI:
  - start|ROUTE_GET_FORWARDER_CLI:
  - return|ROUTE_GET_FORWARDER_CLI:
  - start|ROUTE_APPLY_CALLER_RWR:
  - start|ROUTE_APPLY_REWRITE_RULE:
  - return|ROUTE_APPLY_REWRITE_RULE:
  - return|ROUTE_APPLY_CALLER_RWR:
  - start|ROUTE_CLIR:
  - return|ROUTE_CLIR:
  - start|ROUTE_CALLER_BLOCK_CLI:
  - return|ROUTE_CALLER_BLOCK_CLI:
  - start|ROUTE_CHECK_USERPROV_CLI:
  - start|ROUTE_CHECK_CLI_ALLOWED:
  - return|ROUTE_CHECK_CLI_ALLOWED:
  - return|ROUTE_CHECK_USERPROV_CLI:
  - start|ROUTE_FIND_CALLEE:
  - start|ROUTE_APPLY_REWRITE_RULE:
  - return|ROUTE_APPLY_REWRITE_RULE:
  - start|ROUTE_EMERGENCY:
  - start|ROUTE_CNT_DLG_CHECK:
  - return|ROUTE_CNT_DLG_CHECK:
  - start|ROUTE_EMERGENCY_OBJ:
      $xavp(caller_real_prefs=>emergency_location_format): cirpack
  - return|ROUTE_EMERGENCY_OBJ:
  - start|ROUTE_CHECK_PBX:
  - return|ROUTE_CHECK_PBX:
  - start|ROUTE_PSTN:
  - start|ROUTE_APPLY_HEADER_RULES:
  - return|ROUTE_APPLY_HEADER_RULES:
  - start|ROUTE_CNT_DLG_CHECK:
  - return|ROUTE_CNT_DLG_CHECK:
  - start|ROUTE_PSTN_SELECT_PEER:
      $avp(lua_dlg_profile): [
        "outgoing",
        "emergency"
      ]
  - start|ROUTE_CHECK_PEER_PROBE:
  - return|ROUTE_CHECK_PEER_PROBE:
  - start|ROUTE_CLEAR_PEER_OUT_PREF:
  - return|ROUTE_CLEAR_PEER_OUT_PREF:
  - start|ROUTE_LOAD_PEER_OUT_PREF:
  - return|ROUTE_LOAD_PEER_OUT_PREF:
  - return|ROUTE_PSTN_SELECT_PEER:
  - start|ROUTE_OUTBOUND:
      $avp(lua_dlg_profile): [
        "relay",
        "peerout:[% peer_invite_emergency_cirpack.id %]",
        "peer:[% peer_invite_emergency_cirpack.id %]",
        "outgoing",
        "emergency"
      ]
  - start|ROUTE_ACC_CALLER:
  - start|ROUTE_SET_ACC_CALLER_CALL_COUNTERS:
  - return|ROUTE_SET_ACC_CALLER_CALL_COUNTERS:
  - start|ROUTE_APPLY_REWRITE_RULE:
  - return|ROUTE_APPLY_REWRITE_RULE:
  - return|ROUTE_ACC_CALLER:
  - start|ROUTE_ACC_CALLEE:
  - start|ROUTE_SET_ACC_CALLEE_CALL_COUNTERS:
  - return|ROUTE_SET_ACC_CALLEE_CALL_COUNTERS:
  - start|ROUTE_APPLY_REWRITE_RULE:
  - return|ROUTE_APPLY_REWRITE_RULE:
  - return|ROUTE_ACC_CALLEE:
  - start|ROUTE_ADD_AOC_HEADER:
  - return|ROUTE_ADD_AOC_HEADER:
  - start|BRANCH_ROUTE_SBC:
  - start|ROUTE_SET_BRANCH_HDRS:
  - start|ROUTE_PREPARE_UA:
  - return|ROUTE_PREPARE_UA:
  - return|ROUTE_SET_BRANCH_HDRS:
  - start|ROUTE_BRANCH_ACC_RTP:
  - return|ROUTE_BRANCH_ACC_RTP:
  - start|ROUTE_FILTER_PRACK:
  - return|ROUTE_FILTER_PRACK:
  - start|ROUTE_PREPARE_SST:
  - start|ROUTE_REMOVE_TIMER_SUPP_REQ:
  - return|ROUTE_REMOVE_TIMER_SUPP_REQ:
  - return|ROUTE_PREPARE_SST:
  - start|ROUTE_PREPARE_MOH:
  - return|ROUTE_PREPARE_MOH:
  - start|ROUTE_SET_CALLER_CLI:
  - start|ROUTE_APPLY_CALLER_RWR_FIRST:
  - start|ROUTE_APPLY_REWRITE_RULE:
  - return|ROUTE_APPLY_REWRITE_RULE:
  - start|ROUTE_APPLY_REWRITE_RULE:
  - return|ROUTE_APPLY_REWRITE_RULE:
  - return|ROUTE_APPLY_CALLER_RWR_FIRST:
  - 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:
  - start|ROUTE_SET_CALLEE:
  - start|ROUTE_APPLY_REWRITE_RULE:
  - return|ROUTE_APPLY_REWRITE_RULE:
  - 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:
      $avp(lua_dlg_profile): [
        "relay",
        "peerout:[% peer_invite_emergency_cirpack.id %]",
        "peer:[% peer_invite_emergency_cirpack.id %]",
        "outgoing",
        "emergency"
      ]
sip_in:
  - 'INVITE sip:112@invite-emergency-cirpack.scenarios.test SIP/2.0'
  - 'From: <sip:[% scenarios.0.username %]@invite-emergency-cirpack.scenarios.test>;tag=[\w-]+'
  - 'To: <sip:112@invite-emergency-cirpack.scenarios.test>'
  - 'CSeq: \d+ INVITE'
  - 'Contact: <sip:[% scenarios.0.username %]@[% scenarios.0.ip %]:[% scenarios.0.port %](;[^>]+)?>'
  - 'Proxy-Authorization: Digest username="[% scenarios.0.username %]",realm="invite-emergency-cirpack.scenarios.test",uri="sip:[% server_ip %]:5060",nonce=".+",response=".+",algorithm=MD5'
  - 'Content-Type: application/sdp'
  - 'Content-Length:\s+\d+'
  - 'P-NGCP-Src-Ip: [% scenarios.0.ip %]'
  - 'P-NGCP-Src-Port: [% scenarios.0.port %]'
  - 'P-NGCP-Src-Proto: udp'
  - 'P-NGCP-Src-Af: 4'
  - 'P-Sock-Info: udp:[% server_ip %]:5060'
  - 'P-LB-Uptime: \d+'
sip_out:
  - [
      'SIP/2.0 100 Trying',
      'From: <sip:[% scenarios.0.username %]@invite-emergency-cirpack.scenarios.test>;tag=[\w-]+',
      'To: <sip:112@invite-emergency-cirpack.scenarios.test>',
      'CSeq: \d+ INVITE',
      'P-Out-Socket: udp:[% server_ip %]:5060',
      'P-NGCP-Auth-IP: [% scenarios.0.ip %]',
      'P-NGCP-Auth-UA: <null>',
      'Server: Sipwise NGCP Proxy',
      'Content-Length: 0',
    ]
  - [
      'SIP/2.0 101 Connecting',
      'From: <sip:[% scenarios.0.username %]@invite-emergency-cirpack.scenarios.test>;tag=[\w-]+',
      'To: <sip:112@invite-emergency-cirpack.scenarios.test>',
      'CSeq: \d+ INVITE',
      'P-Out-Socket: udp:[% server_ip %]:5060',
      'P-NGCP-Auth-IP: [% scenarios.0.ip %]',
      'P-NGCP-Auth-UA: <null>',
      'P-NGCP-Authorization: [% scenarios.0.username %]@invite-emergency-cirpack.scenarios.test',
      'P-NGCP-Authorized: 1',
      'P-NGCP-Caller-Info: <sip:[% scenarios.0.username %]@invite-emergency-cirpack.scenarios.test>;ip=[% scenarios.0.ip %];port=[% scenarios.0.port %];primary=[% invite_emergency_cirpack_scenarios_test.testuser1002.phone_number %]',
      'P-Caller-UUID: [% invite_emergency_cirpack_scenarios_test.testuser1002.uuid %]',
      'Server: Sipwise NGCP Proxy',
      'Content-Length: 0',
    ]
  - [
      'INVITE sip:E1112@[% scenarios.0.responders.0.ip %]:[% scenarios.0.responders.0.port %];transport=udp SIP/2.0',
      'From: <sip:[% invite_emergency_cirpack_scenarios_test.testuser1002.phone_number %]@invite-emergency-cirpack.scenarios.test>;tag=[\w-]+',
      'To: <sip:112@invite-emergency-cirpack.scenarios.test>',
      'CSeq: \d+ INVITE',
      'Contact: <sip:[% scenarios.0.username %]@[% scenarios.0.ip %]:[% scenarios.0.port %](;[^>]+)?>',
      'Content-Type: application/sdp',
      'Content-Length:\s+\d+',
      'P-LB-Uptime: \d+',
      'P-Asserted-Identity: <sip:[% invite_emergency_cirpack_scenarios_test.testuser1002.phone_number %]@invite-emergency-cirpack.scenarios.test>',
      'P-Caller-UUID: [% invite_emergency_cirpack_scenarios_test.testuser1002.uuid %]',
      'P-Callee-UUID: 0',
      'P-Called-Party-ID: <sip:E1112@[% scenarios.0.responders.0.ip %]>',
      'P-App-Param: ;calltimer=21600;aleg_sst_enable=no;sst_enable=no;hold_alter_b2b_bleg=no;hold_alter_b2b_aleg=no',
      'P-App-Name: sbc',
      'P-NGCP-Caller-Info: <sip:[% scenarios.0.username %]@invite-emergency-cirpack.scenarios.test>;ip=[% scenarios.0.ip %];port=[% scenarios.0.port %];primary=[% invite_emergency_cirpack_scenarios_test.testuser1002.phone_number %]',
      'P-NGCP-Callee-Info: <sip:emergency_112@invite-emergency-cirpack.scenarios.test>;ip=[% scenarios.0.responders.0.ip %];port=[% scenarios.0.responders.0.port %]',
      'P-D-Uri: sip:127.0.0.1:5060;received=sip:[% scenarios.0.responders.0.ip %]:[% scenarios.0.responders.0.port %]%3blr%3btransport%3dudp',
      'P-Proxy-Uri: sip:127.0.0.1:5062',
    ]
