Using SIPP to generate ping OPTIONS messages in TLS transport
Sometimes the far-end gateway may require some special headers in ping OPTIONS messages to maintain the ‘connected’ status of the far-end gateway. A good example is Microsoft Teams Direct Routing which requires Contact header in OPTIONS messages. This post presents the instructions to generate ping TLS traffic using SIPP.
Create cacert.pem and cakey.pem on FusionPBX:
Copy the output of the below command and paste in cacert.pem and cakey.pem files.
root@fusionpbx:/usr/src/sipp# cat /etc/freeswitch/tls/tls.pem
msg_OPTIONS.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">
<scenario name="Basic Sipstone UAC">
<send retrans="500">
<![CDATA[
OPTIONS sip:[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch]
Max-Forwards: 70
From: <sip:[local_ip]:[local_port]>;tag=[pid]rbs[call_number]
To: <sip:[remote_ip]:[remote_port]>
Call-ID: [call_id]
CSeq: [cseq] OPTIONS
User-Agent: FreeSWITCH
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
Supported: path, replaces
Allow-Events: talk, hold, conference, refer
Content-Length: 0
]]>
</send>
<recv response="200" rtd="true">
</recv>
<!-- definition of the response time repartition table (unit is ms) -->
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
<!-- definition of the call length repartition table (unit is ms) -->
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
</scenario>
Generating a single OPTIONS for testing to SIP_SERVER_IP:
root@fusionpbx:/usr/src/sipp# sipp -sf msg_OPTIONS.xml SIP_SERVER_IP:5061 -t l1 -m 1 -trace_err
Resolving remote host 'SIP_SERVER_IP'... Done.
------------------------------ Scenario Screen -------- [1-9]: Change Screen --
Call rate (length) Port Total-time Total-calls Remote-host
10.0(0 ms)/1.000s 5062 0.62 s 1 an_IP:5061(TLS)
Call limit 1 hit, 0.0 s period 0 ms scheduler resolution
0 calls (limit 30) Peak was 1 calls, after 0 s
0 Running, 3 Paused, 0 Woken up
0 dead call msg (discarded) 0 out-of-call msg (discarded)
0 open sockets 0/0/0 TLS errors (send/recv/cong)
0 open sockets 0/0/0 TLS errors (send/recv/cong)
Messages Retrans Timeout Unexpected-Msg
0 : OPTIONS ----------> 1 0 0
1 : 200 <---------- E-RTD1 1 0 0 0
------------------------------ Test Terminated --------------------------------
----------------------------- Statistics Screen ------- [1-9]: Change Screen --
Start Time | 2022-07-05 23:29:08.244560 1657078148.244560
Last Reset Time | 2022-07-05 23:29:08.876275 1657078148.876275
Current Time | 2022-07-05 23:29:08.878798 1657078148.878798
-------------------------+---------------------------+--------------------------
Counter Name | Periodic value | Cumulative value
-------------------------+---------------------------+--------------------------
Elapsed Time | 00:00:00:002000 | 00:00:00:002000
Call Rate | 0.000 cps | 1.577 cps
-------------------------+---------------------------+--------------------------
Incoming calls created | 0 | 0
Outgoing calls created | 0 | 1
Total Calls created | | 1
Current Calls | 0 |
-------------------------+---------------------------+--------------------------
Successful call | 0 | 1
Failed call | 0 | 0
-------------------------+---------------------------+--------------------------
Response Time 1 | 00:00:00:000000 | 00:00:00:000000
Call Length | 00:00:00:000000 | 00:00:00:000000
------------------------------ Test Terminated --------------------------------
An example of Contact header in OPTIONS:
Contact: <sip:sbc.mydomain.com@sbc.mydomain.com:5081;transport=tls;transport=tls;gw=2efa37e6-b176-4788-aed1-1263c7dd694d>