Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ compile_commands.json
CMakeCache.txt
CMakeFiles/
cmake_install.cmake
build/

# Ignore *.xml in root dir, but not in regression tests dir.
/*.xml
Expand All @@ -54,3 +55,7 @@ cmake_install.cmake
# Ignore autogenerated version.h.
/include/version.cmake
/version.h

# Ignore debug files from regression tests
regress/*/debug*_*
regress/*/srtpctx*
3 changes: 3 additions & 0 deletions include/call.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ class call : virtual public task, virtual public listener, public virtual socket
char* createSendingMessage(char* src, int P_index, bool skip_sanity=false);
char* createSendingMessage(SendingMessage*src, int P_index, char *msg_buffer, int buflen, int *msgLen=nullptr);

// Helper method to resolve timeout values with variables
unsigned int resolveTimeoutValue(const char* timeout_str);

// method for the management of unexpected messages
bool checkInternalCmd(char* cmd); // check of specific internal command
// received from the twin socket
Expand Down
2 changes: 2 additions & 0 deletions include/scenario.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ class message
unsigned int retrans_delay;
/* The receive/send timeout. */
unsigned int timeout;
/* The timeout string for variable substitution */
char * timeout_str;

/* 3pcc extended mode: if this is a sendCmd */
char * peer_dest;
Expand Down
30 changes: 30 additions & 0 deletions regress/github-#0801/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh
# Test to verify timeout variable functionality works correctly
. "`dirname "$0"`/../functions"; init

# Create test data with different timeout values
echo "SEQUENTIAL" > test_data.csv
echo "call1;user1;100;1000" >> test_data.csv # 1000ms timeout
echo "call2;user2;200;500" >> test_data.csv # 500ms timeout

# Test 1: Parse scenario with CSV field timeout - should not produce parsing errors
timeout 3 "`get_sipp`" -sf uac_csv.xml -inf test_data.csv -p 5070 -m 0 127.0.0.1 2>&1 | grep -q "timeout.*field" && fail "parsing error with CSV field timeout"

# Test 2: Parse scenario with variable timeout - should not produce parsing errors
timeout 3 "`get_sipp`" -sf uac_variable.xml -inf test_data.csv -p 5071 -m 0 127.0.0.1 2>&1 | grep -q "timeout.*variable" && fail "parsing error with variable timeout"

# Test 3: Verify timeout variable resolution doesn't cause parse errors
# Run with very short timeout to minimize test time, looking for variable resolution errors
echo "SEQUENTIAL" > timeout_test.csv
echo "call1;user1;100;100" >> timeout_test.csv # 100ms timeout for quick test
timeout 5 "`get_sipp`" -sf uac_csv.xml -inf timeout_test.csv -p 5072 -m 1 127.0.0.1 -nostdin -timeout 2 2>&1 | grep -iE "(invalid.*timeout|timeout.*not.*valid|variable.*error)" && fail "timeout variable resolution failed"

# Test 4: Verify computed variable timeout doesn't cause parse errors
echo "SEQUENTIAL" > var_test.csv
echo "call1;user1;100;150" >> var_test.csv # 150ms timeout for quick test
timeout 5 "`get_sipp`" -sf uac_variable.xml -inf var_test.csv -p 5073 -m 1 127.0.0.1 -nostdin -timeout 2 2>&1 | grep -iE "(invalid.*timeout|timeout.*not.*valid|variable.*error)" && fail "variable timeout resolution failed"

# Clean up
rm -f test_data.csv timeout_test.csv var_test.csv

ok
65 changes: 65 additions & 0 deletions regress/github-#0801/uac_csv.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">

<scenario name="UAC CSV timeout test">
<send retrans="500">
<![CDATA[
INVITE sip:[field1]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
To: [field1] <sip:[field1]@[remote_ip]:[remote_port]>
Call-ID: [call_id]
CSeq: 1 INVITE
Contact: sip:sipp@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Performance Test - [field0]
Content-Type: application/sdp
Content-Length: [len]

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

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

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

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

<!-- Test CSV field variable in timeout parameter - should wait [field3] milliseconds -->
<recv request="BYE" timeout="[field3]">
</recv>

<send>
<![CDATA[
200 OK SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [field1] <sip:[field1]@[remote_ip]:[remote_port]>[peer_tag_param]
To: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
Call-ID: [call_id]
CSeq: [cseq] BYE
Content-Length: 0
]]>
</send>

</scenario>
72 changes: 72 additions & 0 deletions regress/github-#0801/uac_variable.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">

<scenario name="UAC Variable timeout test">
<nop>
<action>
<assignstr assign_to="timervalue" value="[field3]" />
<todouble assign_to="tmresult" variable="timervalue" />
</action>
</nop>

<send retrans="500">
<![CDATA[
INVITE sip:[field1]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
To: [field1] <sip:[field1]@[remote_ip]:[remote_port]>
Call-ID: [call_id]
CSeq: 1 INVITE
Contact: sip:sipp@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Performance Test - [field0]
Content-Type: application/sdp
Content-Length: [len]

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

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

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

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

<!-- Test computed variable in timeout parameter - should wait [$tmresult] milliseconds -->
<recv request="BYE" timeout="[$tmresult]">
</recv>

<send>
<![CDATA[
200 OK SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [field1] <sip:[field1]@[remote_ip]:[remote_port]>[peer_tag_param]
To: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
Call-ID: [call_id]
CSeq: [cseq] BYE
Content-Length: 0
]]>
</send>

</scenario>
65 changes: 65 additions & 0 deletions regress/github-#0801/uas_csv.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">

<scenario name="UAS CSV timeout test">
<recv request="INVITE" crlf="true">
</recv>

<send>
<![CDATA[
SIP/2.0 100 Trying
[last_Via:]
[last_From:]
[last_To:];tag=[pid]SIPpTag01[call_number]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Length: 0
]]>
</send>

<send retrans="500">
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:];tag=[pid]SIPpTag01[call_number]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Type: application/sdp
Content-Length: [len]

v=0
o=uas 1 1 IN IP[local_ip_type] [local_ip]
s=-
c=IN IP[local_ip_type] [local_ip]
t=0 0
m=audio [media_port] RTP/AVP 0
a=rtpmap:0 PCMU/8000
]]>
</send>

<recv request="ACK" rtd="true" crlf="true">
</recv>

<!-- Wait 1 second before sending BYE to test timeout -->
<pause milliseconds="1000"/>

<send retrans="500">
<![CDATA[
BYE sip:[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [last_To:]
To: [last_From:]
[last_Call-ID:]
CSeq: 1 BYE
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Length: 0
]]>
</send>

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

</scenario>
65 changes: 65 additions & 0 deletions regress/github-#0801/uas_variable.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">

<scenario name="UAS Variable timeout test">
<recv request="INVITE" crlf="true">
</recv>

<send>
<![CDATA[
SIP/2.0 100 Trying
[last_Via:]
[last_From:]
[last_To:];tag=[pid]SIPpTag01[call_number]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Length: 0
]]>
</send>

<send retrans="500">
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:];tag=[pid]SIPpTag01[call_number]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Type: application/sdp
Content-Length: [len]

v=0
o=uas 1 1 IN IP[local_ip_type] [local_ip]
s=-
c=IN IP[local_ip_type] [local_ip]
t=0 0
m=audio [media_port] RTP/AVP 0
a=rtpmap:0 PCMU/8000
]]>
</send>

<recv request="ACK" rtd="true" crlf="true">
</recv>

<!-- Wait 1 second before sending BYE to test timeout -->
<pause milliseconds="1000"/>

<send retrans="500">
<![CDATA[
BYE sip:[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [last_To:]
To: [last_From:]
[last_Call-ID:]
CSeq: 1 BYE
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Length: 0
]]>
</send>

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

</scenario>
Loading
Loading