Skip to content

Commit

Permalink
Fix failing tests for pjproject 2.14.
Browse files Browse the repository at this point in the history
pjproject 2.14 introduced some changes that caused some of our tests to
fail. These tests ended up being either incorrect or not flexible enough
to handle them, so they have been updated to now pass with correct
behavior.

There are two changes that we were concerned with. The first was a
change to the on_media_update callback which allowed it to be called in
error scenarios, and another changed the way that PRACK is processed.
This resulted in getting CANCELs during INVITEs with invalid sdp,
getting additional BYEs in scenarios when multiple INVITEs were sent,
(e.g., reinvite_after_bye test), and the order in which we received the
200 for PRACK and 200 for the INVITE swapping the order in which they
arrived. Since all of these are valid scenarios, the tests have been
updated to reflect that.
  • Loading branch information
bkford authored and asterisk-org-access-app[bot] committed Feb 5, 2024
1 parent be42e8d commit be60ae8
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,21 @@
]]>
</send>

<pause/>
<recv request="CANCEL" rtd="true" crlf="true" timeout="500" ontimeout="sendtwohundred"/>

<send next="end">
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:]
[last_Call-ID:]
[last_CSeq:]
Content-Length: 0
]]>
</send>

<label id="sendtwohundred"/>
<send retrans="500">
<![CDATA[
SIP/2.0 200 OK
Expand Down Expand Up @@ -110,6 +123,7 @@
]]>
</send>

<label id="end"/>
<!-- Linger awhile in case we get some unexpected message. -->
<pause/>
<pause/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,21 @@
]]>
</send>

<pause/>
<recv request="CANCEL" rtd="true" crlf="true" timeout="500" ontimeout="sendtwohundred"/>

<send next="end">
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:]
[last_Call-ID:]
[last_CSeq:]
Content-Length: 0
]]>
</send>

<label id="sendtwohundred"/>

<send retrans="500">
<![CDATA[
Expand Down Expand Up @@ -59,6 +73,7 @@
]]>
</send>

<label id="end"/>
<!-- Linger awhile in case we get some unexpected message. -->
<pause/>
<pause/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,6 @@ ami-config:
match:
status: 'buba-NOANSWER'
count: '1'
-
type: 'headermatch'
id: '0'
conditions:
match:
Event: 'TestEvent'
State: 'PJSIP_SESSION_CANCELED'
Endpoint: 'buba'
requirements:
match:
SDP: 'complete'
count: '1'
# Carl events
-
type: 'headermatch'
Expand All @@ -104,18 +92,6 @@ ami-config:
match:
status: 'carl-NOANSWER'
count: '1'
-
type: 'headermatch'
id: '0'
conditions:
match:
Event: 'TestEvent'
State: 'PJSIP_SESSION_CANCELED'
Endpoint: 'carl'
requirements:
match:
SDP: 'incomplete'
count: '1'
# Dave events
-
type: 'headermatch'
Expand All @@ -129,43 +105,6 @@ ami-config:
match:
status: 'dave-NOANSWER'
count: '1'
-
type: 'headermatch'
id: '0'
conditions:
match:
Event: 'TestEvent'
State: 'PJSIP_SESSION_CANCELED'
Endpoint: 'dave'
requirements:
match:
SDP: 'incomplete'
count: '1'
# Evan events
-
type: 'headermatch'
id: '0'
conditions:
match:
Event: 'UserEvent'
UserEvent: 'DialResult'
status: 'evan-.*'
requirements:
match:
status: 'evan-ANSWER'
count: '1'
-
type: 'headermatch'
id: '0'
conditions:
match:
Event: 'TestEvent'
State: 'PJSIP_SESSION_CANCELED'
Endpoint: 'evan'
requirements:
match:
SDP: 'incomplete'
count: '1'
# Fred events
-
type: 'headermatch'
Expand All @@ -179,18 +118,6 @@ ami-config:
match:
status: 'fred-ANSWER'
count: '1'
-
type: 'headermatch'
id: '0'
conditions:
match:
Event: 'TestEvent'
State: 'PJSIP_SESSION_CANCELED'
Endpoint: 'fred'
requirements:
match:
SDP: 'incomplete'
count: '1'

properties:
dependencies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
]]>
</send>

<label id="waitbye"/>
<recv request="BYE" crlf="true" optional="true" next="respondbye"/>

<recv response="200" rtd="true">
</recv>

Expand Down Expand Up @@ -116,8 +119,10 @@
]]>
</send>

<recv request="BYE" crlf="true" />

<!-- Allow for 2 optional BYE's at the end. Depending on timing
we will handle either handle both at the end or one in the
middle. -->
<recv request="BYE" crlf="true" timeout="1000" ontimeout="end"/>
<send retrans="500">
<![CDATA[
SIP/2.0 200 OK
Expand All @@ -133,5 +138,41 @@
]]>
</send>

<recv request="BYE" crlf="true" timeout="1000" ontimeout="end"/>
<send retrans="500" next="end">
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:];tag=[call_number]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
Allow: INVITE, ACK, MESSAGE, BYE
Content-Type: application/sdp
Content-Length: 0
]]>
</send>

<label id="respondbye"/>
<send retrans="500" next="waitbye">
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:];tag=[call_number]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
Allow: INVITE, ACK, MESSAGE, BYE
Content-Type: application/sdp
Content-Length: 0
]]>
</send>

<label id="end"/>

<pause/>

</scenario>

Original file line number Diff line number Diff line change
Expand Up @@ -66,30 +66,9 @@
]]>
</send>

<recv response="200" >
<action>
<ereg regexp="2 PRACK"
header="CSeq:"
search_in="hdr"
check_it="true"
assign_to="1"/>
</action>
</recv>
<recv response="200" rtd="true"/>

<recv response="200" rtd="true">
<action>
<ereg regexp="1 INVITE"
header="CSeq:"
search_in="hdr"
check_it="true"
assign_to="1"/>
<ereg regexp="100rel"
header="Supported:"
search_in="hdr"
check_it="true"
assign_to="1"/>
</action>
</recv>
<recv response="200" rtd="true"/>

<send>
<![CDATA[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,30 +66,9 @@
]]>
</send>

<recv response="200" >
<action>
<ereg regexp="2 PRACK"
header="CSeq:"
search_in="hdr"
check_it="true"
assign_to="1"/>
</action>
</recv>
<recv response="200" rtd="true"/>

<recv response="200" rtd="true">
<action>
<ereg regexp="1 INVITE"
header="CSeq:"
search_in="hdr"
check_it="true"
assign_to="1"/>
<ereg regexp="100rel"
header="Supported:"
search_in="hdr"
check_it="true"
assign_to="1"/>
</action>
</recv>
<recv response="200" rtd="true"/>

<send>
<![CDATA[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,12 @@
]]>
</send>

<recv response="200" crlf="true">
</recv>
<recv response="200" crlf="true" optional="true" next="sendack"/>

<send>
<recv request="BYE" next="sendtwohundred"/>

<label id="sendack"/>
<send >
<![CDATA[
ACK sip:sipp@[remote_ip]:[remote_port] SIP/2.0
Expand All @@ -168,7 +170,22 @@
</send>

<recv request="BYE" timeout="5000"/>
<send next="end">
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:]
[last_Call-ID:]
[last_CSeq:]
[last_Event:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Length: 0
]]>
</send>

<label id="sendtwohundred"/>
<send>
<![CDATA[
Expand All @@ -183,5 +200,25 @@
Content-Length: 0
]]>
</send>

<recv response="200" crlf="true"/>

<send >
<![CDATA[
ACK sip:sipp@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port]
From: sip:sipp@[local_ip]:[local_port];tag=[pid]SIPpTag00[call_number]
To: sut <sip:sipp@[remote_ip]:[remote_port]>[$remote_tag]
Contact: sip:[service]@[local_ip]:[local_port]
Call-ID: [call_id]
CSeq: [cseq] ACK
Max-Forwards: 70
Content-Length: 0
]]>
</send>

<label id="end"/>
</scenario>

0 comments on commit be60ae8

Please sign in to comment.