From b2f7d2acf216399f8cf563b5672ae15b78c21ded Mon Sep 17 00:00:00 2001 From: Jeannot Langlois Date: Sun, 9 Aug 2020 16:02:09 -0400 Subject: [PATCH] Gateway RTP/SRTP bit pattern testing support (SIPP-RTPCHECK-3.6) [Detailed feature documentation available upon request] --- Makefile.am | 192 + commandlines.rtpcheck | 6 + commandlines.srtpcheck | 6 + include/actions.hpp | 20 +- include/call.hpp | 63 +- include/defines.h | 1 + include/jlsrtp.hpp | 1193 ++++++ include/message.hpp | 38 +- include/rtpstream.hpp | 208 +- include/scenario.hpp | 15 + include/sipp.hpp | 28 +- include/stat.hpp | 6 +- regress/github-#0192/uac.xml | 2 +- regress/github-#0196/uac.xml | 2 +- regress/github-#0259/uac.xml | 2 +- sipp.dtd | 5 + sipp_scenarios/mcd_register.xml | 75 + sipp_scenarios/pfca_uac.xml | 136 + sipp_scenarios/pfca_uac_apattern.xml | 194 + .../pfca_uac_apattern_crypto_simple.xml | 142 + ..._apattern_crypto_simple_aescm128sha132.xml | 142 + ...attern_crypto_simple_aescm128sha132_ue.xml | 142 + ..._apattern_crypto_simple_aescm128sha180.xml | 142 + ...attern_crypto_simple_aescm128sha180_ue.xml | 142 + .../pfca_uac_apattern_crypto_simple_g711a.xml | 142 + .../pfca_uac_apattern_crypto_simple_g711u.xml | 142 + .../pfca_uac_apattern_crypto_simple_g722.xml | 142 + .../pfca_uac_apattern_crypto_simple_g729.xml | 142 + ..._uac_apattern_crypto_simple_nullsha132.xml | 142 + ..._uac_apattern_crypto_simple_nullsha180.xml | 142 + ...c_apattern_crypto_simple_renegotiation.xml | 216 + ...to_simple_renegotiation_aescm128sha132.xml | 216 + ...to_simple_renegotiation_aescm128sha180.xml | 216 + ...crypto_simple_renegotiation_nullsha132.xml | 216 + ...crypto_simple_renegotiation_nullsha180.xml | 216 + ...tern_crypto_simple_renegotiation_reuse.xml | 216 + sipp_scenarios/pfca_uac_apattern_g711a.xml | 194 + sipp_scenarios/pfca_uac_apattern_g711u.xml | 194 + sipp_scenarios/pfca_uac_apattern_g722.xml | 194 + sipp_scenarios/pfca_uac_apattern_g729.xml | 194 + sipp_scenarios/pfca_uac_avpattern.xml | 216 + .../pfca_uac_bpattern_crypto_simple.xml | 159 + ..._bpattern_crypto_simple_aescm128sha132.xml | 159 + ...attern_crypto_simple_aescm128sha132_ue.xml | 159 + ..._bpattern_crypto_simple_aescm128sha180.xml | 159 + ...attern_crypto_simple_aescm128sha180_ue.xml | 159 + ..._uac_bpattern_crypto_simple_nullsha132.xml | 159 + ..._uac_bpattern_crypto_simple_nullsha180.xml | 159 + ...c_bpattern_crypto_simple_renegotiation.xml | 250 ++ ...to_simple_renegotiation_aescm128sha132.xml | 250 ++ ...to_simple_renegotiation_aescm128sha180.xml | 250 ++ ...crypto_simple_renegotiation_nullsha132.xml | 250 ++ ...crypto_simple_renegotiation_nullsha180.xml | 250 ++ ...tern_crypto_simple_renegotiation_reuse.xml | 250 ++ sipp_scenarios/pfca_uac_vpattern.xml | 196 + .../pfca_uac_vpattern_crypto_simple.xml | 144 + ..._vpattern_crypto_simple_aescm128sha132.xml | 144 + ...attern_crypto_simple_aescm128sha132_ue.xml | 144 + ..._vpattern_crypto_simple_aescm128sha180.xml | 144 + ...attern_crypto_simple_aescm128sha180_ue.xml | 144 + ..._uac_vpattern_crypto_simple_nullsha132.xml | 144 + ..._uac_vpattern_crypto_simple_nullsha180.xml | 144 + ...c_vpattern_crypto_simple_renegotiation.xml | 220 + ...to_simple_renegotiation_aescm128sha132.xml | 220 + ...to_simple_renegotiation_aescm128sha180.xml | 220 + ...crypto_simple_renegotiation_nullsha132.xml | 220 + ...crypto_simple_renegotiation_nullsha180.xml | 220 + ...tern_crypto_simple_renegotiation_reuse.xml | 220 + sipp_scenarios/pfca_uas.xml | 114 + sipp_scenarios/pfca_uas_audio.xml | 114 + .../pfca_uas_audio_crypto_simple.xml | 135 + ...uas_audio_crypto_simple_aescm128sha132.xml | 129 + ..._audio_crypto_simple_aescm128sha132_ue.xml | 129 + ...uas_audio_crypto_simple_aescm128sha180.xml | 129 + ..._audio_crypto_simple_aescm128sha180_ue.xml | 129 + .../pfca_uas_audio_crypto_simple_g711a.xml | 129 + .../pfca_uas_audio_crypto_simple_g711u.xml | 129 + .../pfca_uas_audio_crypto_simple_g722.xml | 129 + .../pfca_uas_audio_crypto_simple_g729.xml | 129 + ...fca_uas_audio_crypto_simple_nullsha132.xml | 129 + ...fca_uas_audio_crypto_simple_nullsha180.xml | 129 + ..._uas_audio_crypto_simple_renegotiation.xml | 184 + ...to_simple_renegotiation_aescm128sha132.xml | 184 + ...to_simple_renegotiation_aescm128sha180.xml | 184 + ...crypto_simple_renegotiation_nullsha132.xml | 184 + ...crypto_simple_renegotiation_nullsha180.xml | 184 + ...udio_crypto_simple_renegotiation_reuse.xml | 184 + sipp_scenarios/pfca_uas_audio_g711a.xml | 114 + sipp_scenarios/pfca_uas_audio_g711u.xml | 114 + sipp_scenarios/pfca_uas_audio_g722.xml | 114 + sipp_scenarios/pfca_uas_audio_g729.xml | 114 + sipp_scenarios/pfca_uas_audiovideo.xml | 127 + .../pfca_uas_both_crypto_simple.xml | 152 + ..._uas_both_crypto_simple_aescm128sha132.xml | 145 + ...s_both_crypto_simple_aescm128sha132_ue.xml | 145 + ..._uas_both_crypto_simple_aescm128sha180.xml | 145 + ...s_both_crypto_simple_aescm128sha180_ue.xml | 145 + ...pfca_uas_both_crypto_simple_nullsha132.xml | 145 + ...pfca_uas_both_crypto_simple_nullsha180.xml | 145 + ...a_uas_both_crypto_simple_renegotiation.xml | 215 + ...to_simple_renegotiation_aescm128sha132.xml | 215 + ...to_simple_renegotiation_aescm128sha180.xml | 215 + ...crypto_simple_renegotiation_nullsha132.xml | 215 + ...crypto_simple_renegotiation_nullsha180.xml | 215 + ...both_crypto_simple_renegotiation_reuse.xml | 215 + sipp_scenarios/pfca_uas_video.xml | 115 + .../pfca_uas_video_crypto_simple.xml | 134 + ...uas_video_crypto_simple_aescm128sha132.xml | 128 + ..._video_crypto_simple_aescm128sha132_ue.xml | 128 + ...uas_video_crypto_simple_aescm128sha180.xml | 128 + ..._video_crypto_simple_aescm128sha180_ue.xml | 128 + ...fca_uas_video_crypto_simple_nullsha132.xml | 128 + ...fca_uas_video_crypto_simple_nullsha180.xml | 128 + ..._uas_video_crypto_simple_renegotiation.xml | 184 + ...to_simple_renegotiation_aescm128sha132.xml | 184 + ...to_simple_renegotiation_aescm128sha180.xml | 184 + ...crypto_simple_renegotiation_nullsha132.xml | 184 + ...crypto_simple_renegotiation_nullsha180.xml | 184 + ...ideo_crypto_simple_renegotiation_reuse.xml | 184 + sipp_scenarios/uc360_register.xml | 64 + sipp_scenarios/uc360_register_challenge.xml | 62 + src/actions.cpp | 500 ++- src/call.cpp | 2976 +++++++++++++- src/jlsrtp.cpp | 3580 +++++++++++++++++ src/logger.cpp | 6 +- src/message.cpp | 37 +- src/rtpstream.cpp | 3280 +++++++++++++-- src/scenario.cpp | 107 +- src/screen.cpp | 44 +- src/sipp.cpp | 147 +- src/sipp_unittest.cpp | 2 +- src/stat.cpp | 10 + 132 files changed, 29238 insertions(+), 529 deletions(-) create mode 100644 Makefile.am create mode 100644 commandlines.rtpcheck create mode 100644 commandlines.srtpcheck create mode 100644 include/jlsrtp.hpp create mode 100644 sipp_scenarios/mcd_register.xml create mode 100644 sipp_scenarios/pfca_uac.xml create mode 100644 sipp_scenarios/pfca_uac_apattern.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_crypto_simple.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_crypto_simple_aescm128sha132.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_crypto_simple_aescm128sha132_ue.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_crypto_simple_aescm128sha180.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_crypto_simple_aescm128sha180_ue.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_crypto_simple_g711a.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_crypto_simple_g711u.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_crypto_simple_g722.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_crypto_simple_g729.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_crypto_simple_nullsha132.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_crypto_simple_nullsha180.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation_aescm128sha132.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation_aescm128sha180.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation_nullsha132.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation_nullsha180.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation_reuse.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_g711a.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_g711u.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_g722.xml create mode 100644 sipp_scenarios/pfca_uac_apattern_g729.xml create mode 100644 sipp_scenarios/pfca_uac_avpattern.xml create mode 100644 sipp_scenarios/pfca_uac_bpattern_crypto_simple.xml create mode 100644 sipp_scenarios/pfca_uac_bpattern_crypto_simple_aescm128sha132.xml create mode 100644 sipp_scenarios/pfca_uac_bpattern_crypto_simple_aescm128sha132_ue.xml create mode 100644 sipp_scenarios/pfca_uac_bpattern_crypto_simple_aescm128sha180.xml create mode 100644 sipp_scenarios/pfca_uac_bpattern_crypto_simple_aescm128sha180_ue.xml create mode 100644 sipp_scenarios/pfca_uac_bpattern_crypto_simple_nullsha132.xml create mode 100644 sipp_scenarios/pfca_uac_bpattern_crypto_simple_nullsha180.xml create mode 100644 sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation.xml create mode 100644 sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation_aescm128sha132.xml create mode 100644 sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation_aescm128sha180.xml create mode 100644 sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation_nullsha132.xml create mode 100644 sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation_nullsha180.xml create mode 100644 sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation_reuse.xml create mode 100644 sipp_scenarios/pfca_uac_vpattern.xml create mode 100644 sipp_scenarios/pfca_uac_vpattern_crypto_simple.xml create mode 100644 sipp_scenarios/pfca_uac_vpattern_crypto_simple_aescm128sha132.xml create mode 100644 sipp_scenarios/pfca_uac_vpattern_crypto_simple_aescm128sha132_ue.xml create mode 100644 sipp_scenarios/pfca_uac_vpattern_crypto_simple_aescm128sha180.xml create mode 100644 sipp_scenarios/pfca_uac_vpattern_crypto_simple_aescm128sha180_ue.xml create mode 100644 sipp_scenarios/pfca_uac_vpattern_crypto_simple_nullsha132.xml create mode 100644 sipp_scenarios/pfca_uac_vpattern_crypto_simple_nullsha180.xml create mode 100644 sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation.xml create mode 100644 sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation_aescm128sha132.xml create mode 100644 sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation_aescm128sha180.xml create mode 100644 sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation_nullsha132.xml create mode 100644 sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation_nullsha180.xml create mode 100644 sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation_reuse.xml create mode 100644 sipp_scenarios/pfca_uas.xml create mode 100644 sipp_scenarios/pfca_uas_audio.xml create mode 100644 sipp_scenarios/pfca_uas_audio_crypto_simple.xml create mode 100644 sipp_scenarios/pfca_uas_audio_crypto_simple_aescm128sha132.xml create mode 100644 sipp_scenarios/pfca_uas_audio_crypto_simple_aescm128sha132_ue.xml create mode 100644 sipp_scenarios/pfca_uas_audio_crypto_simple_aescm128sha180.xml create mode 100644 sipp_scenarios/pfca_uas_audio_crypto_simple_aescm128sha180_ue.xml create mode 100644 sipp_scenarios/pfca_uas_audio_crypto_simple_g711a.xml create mode 100644 sipp_scenarios/pfca_uas_audio_crypto_simple_g711u.xml create mode 100644 sipp_scenarios/pfca_uas_audio_crypto_simple_g722.xml create mode 100644 sipp_scenarios/pfca_uas_audio_crypto_simple_g729.xml create mode 100644 sipp_scenarios/pfca_uas_audio_crypto_simple_nullsha132.xml create mode 100644 sipp_scenarios/pfca_uas_audio_crypto_simple_nullsha180.xml create mode 100644 sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation.xml create mode 100644 sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation_aescm128sha132.xml create mode 100644 sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation_aescm128sha180.xml create mode 100644 sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation_nullsha132.xml create mode 100644 sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation_nullsha180.xml create mode 100644 sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation_reuse.xml create mode 100644 sipp_scenarios/pfca_uas_audio_g711a.xml create mode 100644 sipp_scenarios/pfca_uas_audio_g711u.xml create mode 100644 sipp_scenarios/pfca_uas_audio_g722.xml create mode 100644 sipp_scenarios/pfca_uas_audio_g729.xml create mode 100644 sipp_scenarios/pfca_uas_audiovideo.xml create mode 100644 sipp_scenarios/pfca_uas_both_crypto_simple.xml create mode 100644 sipp_scenarios/pfca_uas_both_crypto_simple_aescm128sha132.xml create mode 100644 sipp_scenarios/pfca_uas_both_crypto_simple_aescm128sha132_ue.xml create mode 100644 sipp_scenarios/pfca_uas_both_crypto_simple_aescm128sha180.xml create mode 100644 sipp_scenarios/pfca_uas_both_crypto_simple_aescm128sha180_ue.xml create mode 100644 sipp_scenarios/pfca_uas_both_crypto_simple_nullsha132.xml create mode 100644 sipp_scenarios/pfca_uas_both_crypto_simple_nullsha180.xml create mode 100644 sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation.xml create mode 100644 sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation_aescm128sha132.xml create mode 100644 sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation_aescm128sha180.xml create mode 100644 sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation_nullsha132.xml create mode 100644 sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation_nullsha180.xml create mode 100644 sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation_reuse.xml create mode 100644 sipp_scenarios/pfca_uas_video.xml create mode 100644 sipp_scenarios/pfca_uas_video_crypto_simple.xml create mode 100644 sipp_scenarios/pfca_uas_video_crypto_simple_aescm128sha132.xml create mode 100644 sipp_scenarios/pfca_uas_video_crypto_simple_aescm128sha132_ue.xml create mode 100644 sipp_scenarios/pfca_uas_video_crypto_simple_aescm128sha180.xml create mode 100644 sipp_scenarios/pfca_uas_video_crypto_simple_aescm128sha180_ue.xml create mode 100644 sipp_scenarios/pfca_uas_video_crypto_simple_nullsha132.xml create mode 100644 sipp_scenarios/pfca_uas_video_crypto_simple_nullsha180.xml create mode 100644 sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation.xml create mode 100644 sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation_aescm128sha132.xml create mode 100644 sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation_aescm128sha180.xml create mode 100644 sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation_nullsha132.xml create mode 100644 sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation_nullsha180.xml create mode 100644 sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation_reuse.xml create mode 100644 sipp_scenarios/uc360_register.xml create mode 100644 sipp_scenarios/uc360_register_challenge.xml create mode 100644 src/jlsrtp.cpp diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..aeb8739d --- /dev/null +++ b/Makefile.am @@ -0,0 +1,192 @@ +@AM_GIT_VERSION@ + +bin_PROGRAMS = sipp + +TESTS = sipp_unittest + +check_PROGRAMS = $(TESTS) + +AM_CFLAGS=-I$(srcdir)/include -Wall -pedantic +AM_CXXFLAGS=-I$(srcdir)/include -Wall -pedantic + +# For BSD-style elements in udphdr struct (uh_dport instead of dest) +# among others. +AM_CPPFLAGS=-D_BSD_SOURCE -D_DEFAULT_SOURCE + +CLEANFILES = +EXTRA_DIST = \ + $(srcdir)/example/fortune.cpp \ + $(srcdir)/LICENSE.txt \ + $(srcdir)/README.md \ + $(srcdir)/THANKS \ + $(srcdir)/sipp.dtd \ + $(srcdir)/cpplint.py + +if HAVE_OPENSSL +DEFS += -DUSE_TLS -DUSE_OPENSSL +ssl_incl = \ + include/sslsocket.hpp +ssl_SOURCES = \ + $(ssl_incl) \ + src/sslsocket.cpp +endif + +if HAVE_PCAP +DEFS += -DPCAPPLAY +pcap_incl = \ + include/prepare_pcap.h \ + include/send_packets.h +pcap_SOURCES = \ + $(pcap_incl) \ + src/prepare_pcap.c \ + src/send_packets.c +endif + +if HAVE_RTP +DEFS += -DRTP_STREAM +rtp_SOURCES = \ + src/rtpstream.cpp \ + include/rtpstream.hpp +endif + +if HAVE_SCTP +DEFS += -DUSE_SCTP +endif + +if HAVE_GSL +DEFS += -DHAVE_GSL +endif + +if HAVE_EPOLL +DEFS += -DHAVE_EPOLL +endif + +common_incl = \ + include/comp.h \ + include/infile.hpp \ + include/listener.hpp \ + include/logger.hpp \ + include/md5.h \ + include/message.hpp \ + include/milenage.h \ + include/call_generation_task.hpp \ + include/ratetask.hpp \ + include/reporttask.hpp \ + include/rijndael.h \ + include/scenario.hpp \ + include/sip_parser.hpp \ + include/screen.hpp \ + include/socket.hpp \ + include/socketowner.hpp \ + include/stat.hpp \ + include/strings.hpp \ + include/task.hpp \ + include/time.hpp \ + include/variables.hpp \ + include/watchdog.hpp \ + include/xp_parser.h \ + include/actions.hpp \ + include/call.hpp \ + include/auth.hpp \ + include/deadcall.hpp \ + include/jlsrtp.hpp + +common_SOURCES = \ + src/actions.cpp \ + src/auth.cpp \ + src/comp.c \ + src/call.cpp \ + src/deadcall.cpp \ + src/infile.cpp \ + src/listener.cpp \ + src/logger.cpp \ + src/md5.c \ + src/message.cpp \ + src/milenage.c \ + src/call_generation_task.cpp \ + src/ratetask.cpp \ + src/reporttask.cpp \ + src/rijndael.c \ + src/scenario.cpp \ + src/sip_parser.cpp \ + src/screen.cpp \ + src/socket.cpp \ + src/socketowner.cpp \ + src/stat.cpp \ + src/strings.cpp \ + src/task.cpp \ + src/time.cpp \ + src/variables.cpp \ + src/watchdog.cpp \ + src/xp_parser.c \ + $(common_incl) \ + $(ssl_SOURCES) \ + $(pcap_SOURCES) \ + $(rtp_SOURCES) \ + src/jlsrtp.cpp + +sipp_SOURCES = \ + $(common_SOURCES) \ + src/sipp.cpp \ + include/sipp.hpp + +sipp_CFLAGS = $(AM_CFLAGS) @GSL_CFLAGS@ +sipp_CXXFLAGS = $(AM_CXXFLAGS) @GSL_CXXFLAGS@ +sipp_LDADD = @LIBOBJS@ @GSL_LIBS@ + +# call.cpp and sipp.cpp use version.h; see AM_GIT_VERSION. +src/call.cpp: include/version.h +src/sipp.cpp: include/version.h + +gtest_SOURCES = \ + gtest/src/gtest-death-test.cc \ + gtest/src/gtest-filepath.cc \ + gtest/src/gtest-internal-inl.h \ + gtest/src/gtest-port.cc \ + gtest/src/gtest-printers.cc \ + gtest/src/gtest-test-part.cc \ + gtest/src/gtest-typed-test.cc \ + gtest/src/gtest.cc \ + gmock/src/gmock-internal-utils.cc \ + gmock/src/gmock-matchers.cc + +sipp_unittest_SOURCES = \ + $(common_SOURCES) \ + src/sipp_unittest.cpp \ + src/xp_parser_ut.cpp \ + $(gtest_SOURCES) + +sipp_unittest_CFLAGS = $(AM_CFLAGS) -DGTEST=1 \ + -I$(srcdir)/gtest/include \ + -I$(srcdir)/gmock/include \ + -I$(srcdir)/gtest \ + -I$(srcdir)/gmock \ + @GSL_CFLAGS@ + +sipp_unittest_CXXFLAGS = $(AM_CXXFLAGS) -DGTEST=1 \ + -I$(srcdir)/gtest/include \ + -I$(srcdir)/gmock/include \ + -I$(srcdir)/gtest \ + -I$(srcdir)/gmock \ + @GSL_CXXFLAGS@ + +sipp_unittest_LDADD = @LIBOBJS@ @GSL_LIBS@ + +# Ensure that after a reconfigure the source is cleaned. +.autoclean: Makefile + make clean + echo > .autoclean +BUILT_SOURCES = .autoclean + +if HAVE_HELP2MAN +man_MANS = sipp.1 +CLEANFILES += $(man_MANS) + +sipp.1: ./sipp $(sipp_SOURCES) + $(HELP2MAN) --output=$@ -v "-v" --no-info \ + --name='SIP testing tool and traffic generator' \ + ./sipp +else +sipp.1: + @echo "Warning: help2man not available, no man page is created." +endif diff --git a/commandlines.rtpcheck b/commandlines.rtpcheck new file mode 100644 index 00000000..51a881fd --- /dev/null +++ b/commandlines.rtpcheck @@ -0,0 +1,6 @@ +SET-SIDE command line: +./sipp 192.168.1.250:5060 -sf sipp_scenarios/pfca_uac_pattern.xml -i 192.168.1.147 -t u1 -p 5060 -mp 4000 -m 1 -s 16002 + +ICP-SIDE command line: +./sipp -sf sipp_scenarios/pfca_uas.xml -i 192.168.1.250 -t u1 -p 5060 -mp 5000 -m 1 -s 16001 -rtp_echo + diff --git a/commandlines.srtpcheck b/commandlines.srtpcheck new file mode 100644 index 00000000..a3a03a48 --- /dev/null +++ b/commandlines.srtpcheck @@ -0,0 +1,6 @@ +SET-SIDE command line: +./sipp 192.168.1.250:5060 -sf sipp_scenarios/pfca_uac_bpattern_crypto_simple.xml -i 192.168.1.147 -t u1 -p 5060 -mp 4000 -m 1 -s 16002 -rtpcheck_debug -srtpcheck_debug + +ICP-SIDE command line: +./sipp -sf sipp_scenarios/pfca_uas_both_crypto_simple.xml -i 192.168.1.250 -t u1 -p 5060 -mp 5000 -m 1 -s 16001 -srtpcheck_debug + diff --git a/include/actions.hpp b/include/actions.hpp index 6c97ad7a..e7db3eea 100644 --- a/include/actions.hpp +++ b/include/actions.hpp @@ -80,6 +80,18 @@ class CAction E_AT_RTP_STREAM_RESUME, E_AT_RTP_STREAM_PLAY, E_AT_RTP_ECHO, + E_AT_RTP_STREAM_PAUSEAPATTERN, + E_AT_RTP_STREAM_RESUMEAPATTERN, + E_AT_RTP_STREAM_PLAYAPATTERN, + E_AT_RTP_STREAM_PAUSEVPATTERN, + E_AT_RTP_STREAM_RESUMEVPATTERN, + E_AT_RTP_STREAM_PLAYVPATTERN, + E_AT_RTP_STREAM_RTPECHO_UPDATEAUDIO, + E_AT_RTP_STREAM_RTPECHO_STARTAUDIO, + E_AT_RTP_STREAM_RTPECHO_STOPAUDIO, + E_AT_RTP_STREAM_RTPECHO_UPDATEVIDEO, + E_AT_RTP_STREAM_RTPECHO_STARTVIDEO, + E_AT_RTP_STREAM_RTPECHO_STOPVIDEO, #endif E_AT_NB_ACTION }; @@ -136,7 +148,8 @@ class CAction pcap_pkts *getPcapPkts(); /* send_packets specific function */ #endif #ifdef RTP_STREAM - rtpstream_actinfo_t *getRTPStreamActInfo(); /* return stored rtp stream playback params */ + rtpecho_actinfo_t* getRTPEchoActInfo(); /* returns stored rtp echo params */ + rtpstream_actinfo_t* getRTPStreamActInfo(); /* return stored rtp stream playback params */ #endif void setActionType (T_ActionType P_value); @@ -165,7 +178,9 @@ class CAction void setPcapArgs (pcap_pkts * P_value); /* send_packets specific function */ #endif #ifdef RTP_STREAM - void setRTPStreamActInfo(const char* P_value); /* parse rtp stream playback values from string */ + void setRTPEchoActInfo(const char* P_value); /* parses rtp echo params from string */ + void setRTPEchoActInfo(rtpecho_actinfo_t* P_value); /* copy stored rtp echo params */ + void setRTPStreamActInfo(const char *P_value); /* parse rtp stream playback values from string */ void setRTPStreamActInfo(rtpstream_actinfo_t* P_value); /* copy stored rtp stream playback params */ #endif @@ -220,6 +235,7 @@ class CAction pcap_pkts * M_pcapArgs; #endif #ifdef RTP_STREAM + rtpecho_actinfo_t M_rtpecho_actinfo; rtpstream_actinfo_t M_rtpstream_actinfo; #endif void setSubString(char** P_target, const char* P_source, int P_start, int P_stop); diff --git a/include/call.hpp b/include/call.hpp index c62034dd..dbc0c677 100644 --- a/include/call.hpp +++ b/include/call.hpp @@ -34,7 +34,10 @@ #endif #ifdef RTP_STREAM #include "rtpstream.hpp" -#endif +#include "jlsrtp.hpp" +#endif // RTP_STREAM + +#include #ifndef MAX #define MAX(a, b) ((a) > (b) ? (a) : (b)) @@ -59,6 +62,18 @@ struct txnInstanceInfo { int ackIndex; }; +typedef enum +{ + eNoSession, + eOfferReceived, + eOfferSent, + eOfferRejected, + eAnswerReceived, + eAnswerSent, + eCompleted, + eNumSessionStates +} SessionState; + class call : virtual public task, virtual public listener, public virtual socketowner { public: @@ -106,6 +121,9 @@ class call : virtual public task, virtual public listener, public virtual socket private: /* This is the core constructor function. */ void init(scenario * call_scenario, SIPpSocket *socket, struct sockaddr_storage *dest, const char * p_id, int userId, bool ipv6, bool isAutomatic, bool isInitCall); + + bool checkAckCSeq(const char* msg); + /* This this call for initialization? */ bool initCall; @@ -145,6 +163,8 @@ class call : virtual public task, virtual public listener, public virtual socket int last_recv_index; char * last_recv_msg; + unsigned long int last_recv_invite_cseq; + /* Recv message characteristics when we sent a valid message * (scneario, no retrans) just after a valid reception. This was * a cause relationship, so the next time this cookie will be recvd, @@ -171,7 +191,19 @@ class call : virtual public task, virtual public listener, public virtual socket #ifdef RTP_STREAM rtpstream_callinfo_t rtpstream_callinfo; -#endif + JLSRTP _txUACAudio; + JLSRTP _rxUACAudio; + JLSRTP _txUASAudio; + JLSRTP _rxUASAudio; + JLSRTP _txUACVideo; + JLSRTP _rxUACVideo; + JLSRTP _txUASVideo; + JLSRTP _rxUASVideo; +#ifdef USE_OPENSSL + char _pref_audio_cs_out[24]; + char _pref_video_cs_out[24]; +#endif // USE_OPENSSL +#endif // RTP_STREAM /* holds the auth header and if the challenge was 401 or 407 */ char * dialog_authentication; @@ -224,7 +256,8 @@ class call : virtual public task, virtual public listener, public virtual socket E_AR_TEST_DOESNT_MATCH, E_AR_TEST_SHOULDNT_MATCH, E_AR_STRCMP_DOESNT_MATCH, - E_AR_STRCMP_SHOULDNT_MATCH + E_AR_STRCMP_SHOULDNT_MATCH, + E_AR_RTPECHO_ERROR }; /* Store the last action result to allow */ @@ -306,22 +339,40 @@ class call : virtual public task, virtual public listener, public virtual socket void get_remote_media_addr(std::string const &msg); #ifdef RTP_STREAM - void extract_rtp_remote_addr(const char* message); -#endif + std::string extract_rtp_remote_addr(const char * message, int &ip_ver, int &audio_port, int &video_port); +#ifdef USE_OPENSSL + int check_audio_ciphersuite_match(SrtpAudioInfoParams &pA); + int check_video_ciphersuite_match(SrtpVideoInfoParams &pV); + int extract_srtp_remote_info(const char * msg, SrtpAudioInfoParams &pA, SrtpVideoInfoParams &pV); +#endif // USE_OPENSSL +#endif // RTP_STREAM bool lost(int index); + void setRtpEchoErrors(int value); + int getRtpEchoErrors(); + void computeStat (CStat::E_Action P_action); void computeStat (CStat::E_Action P_action, unsigned long P_value); void computeStat (CStat::E_Action P_action, unsigned long P_value, int which); - void queue_up(const char* msg); char *queued_msg; int _callDebug(const char *fmt, ...) __attribute__((format(printf, 2, 3))); char *debugBuffer; int debugLength; + +#ifdef USE_OPENSSL + FILE* _srtpctxdebugfile; + int logSrtpInfo(const char *fmt, ...); +#endif // USE_OPENSSL + + SessionState _sessionStateCurrent; + SessionState _sessionStateOld; + void setSessionState(SessionState state); + SessionState getSessionStateCurrent(); + SessionState getSessionStateOld(); }; diff --git a/include/defines.h b/include/defines.h index 2e9ad15a..a65d734d 100644 --- a/include/defines.h +++ b/include/defines.h @@ -38,5 +38,6 @@ extern "C" { #define EXIT_OTHER 99 #define EXIT_FATAL_ERROR -1 #define EXIT_BIND_ERROR -2 +#define EXIT_RTPCHECK_FAILED -3 #endif /* __DEFINES_H__ */ diff --git a/include/jlsrtp.hpp b/include/jlsrtp.hpp new file mode 100644 index 00000000..18e4e885 --- /dev/null +++ b/include/jlsrtp.hpp @@ -0,0 +1,1193 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA + * + * Author: Jeannot Langlois (jeannot.langlois@gmail.com) -- 2016-2020 + */ + +#ifndef __JLSRTP__ +#define __JLSRTP__ + +#ifdef USE_OPENSSL + +#include +#include +#include +#include +#include +#include + +#define JLSRTP_VERSION 0.5 +#define JLSRTP_ENCRYPTION_KEY_LENGTH 16 // bytes +#define JLSRTP_SALTING_KEY_LENGTH 14 // bytes +#define JLSRTP_AUTHENTICATION_KEY_LENGTH 20 // bytes + +#define JLSRTP_MAX_SEQUENCE_NUMBERS 65536 + +#define JLSRTP_PSEUDORANDOM_BITS 128 +#define JLSRTP_KEY_ENCRYPTION_LABEL 0x00 +#define JLSRTP_KEY_AUTHENTICATION_LABEL 0x01 +#define JLSRTP_KEY_SALTING_LABEL 0x02 + +#define JLSRTP_SHA1_HASH_LENGTH 20 + +#define JLSRTP_SRTP_DEFAULT_HEADER_SIZE 12 // bytes + +#define JLSRTP_AUTHENTICATION_TAG_SIZE_SHA1_80 10 // bytes +#define JLSRTP_AUTHENTICATION_TAG_SIZE_SHA1_32 4 // bytes + +static const std::string base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +typedef struct _CryptoContextID +{ + unsigned int ssrc; // SSRC + std::string address; // IP address + unsigned short port; // port +} CryptoContextID; + +typedef struct _AESState +{ + unsigned char ivec[AES_BLOCK_SIZE]; // ivec[0..13] (high-order bytes): 'IV' / ivec[14..15] (low-order bytes): 'counter' + unsigned int num; // block byte offset + unsigned char ecount[AES_BLOCK_SIZE]; // encrypted ivec + EVP_CIPHER_CTX* cipher; // Cipher context +} AESState; + +typedef union _Conversion32 +{ + unsigned long i; + unsigned char c[4]; +} Conversion32; + +typedef union _Conversion64 +{ + unsigned long long i; + unsigned char c[8]; +} Conversion64; + +typedef enum _CipherType +{ + AES_CM_128, + NULL_CIPHER, + INVALID_CIPHER +} CipherType; + +typedef enum _HashType +{ + HMAC_SHA1_80, + HMAC_SHA1_32, + NULL_HASH, + INVALID_HASH +} HashType; + +typedef struct _CryptoAttribute +{ + CipherType cipher_algorithm; + HashType hmac_algorithm; + bool MKI; + unsigned int MKI_length; + unsigned long active_MKI; + std::vector master_key; + unsigned long master_key_counter; + unsigned short n_e; + unsigned short n_a; + std::vector master_salt; + unsigned long master_key_derivation_rate; + unsigned long master_mki_value; + unsigned short n_s; + unsigned int tag; +} CryptoAttribute; + +typedef enum _ActiveCrypto +{ + PRIMARY_CRYPTO, + SECONDARY_CRYPTO, + ACTIVE_CRYPTO, + INVALID_CRYPTO +} ActiveCrypto; + +class JLSRTP +{ + private: + CryptoContextID _id; + unsigned long _ROC; + unsigned short _s_l; + CryptoAttribute _primary_crypto; + CryptoAttribute _secondary_crypto; + ActiveCrypto _active_crypto; + std::vector _session_enc_key; + std::vector _session_salt_key; + std::vector _session_auth_key; + std::vector _packetIV; + AESState _pseudorandomstate; + AESState _cipherstate; + unsigned int _srtp_header_size; + unsigned int _srtp_payload_size; + + /** + * isBase64 + * + * Checks whether the given character satisfies base64 criterias (true) or not (false) + * + * @param[in] c Unsigned character to examine + * + * @return TRUE Given character satisfies base64 criterias + * @return FALSE Given character DOES NOT satisfy base64 criterias + */ + bool isBase64(unsigned char c); + + /** + * resetPseudoRandomState + * + * Resets the state of the AES counter mode pseudo random function + * + * @param[in] iv Input vector to use + * + * @return 0 SUCCESS + * @return -1 FAILURE + */ + int resetPseudoRandomState(std::vector iv); + + /** + * pseudorandomFunction + * + * Generates the given number of key stream bits from the given master key and input vector + * + * @param[in] iv Input vector to use + * @param[in] n Number of keystream bits to generate + * @param[out] output Generated keystream bits + * + * @return 0 SUCCESS + * @return -1 FAILURE -- Incorrect salting key length + * @return -2 FAILURE -- Incorrect encryption key length + * @return -3 FAILURE -- Could not set encryption key + * @return -4 FAILURE -- Invalid crypto attribute specified + */ + int pseudorandomFunction(std::vector iv, int n, std::vector &output); + + /** + * shiftVectorLeft + * + * Shifts a given vector to the left by a predetermined number of bytes + * + * @param[out] shifted_vec Shifted vector + * @param[in] original_vec Original vector to shift + * @param[in] shift_value Number of bytes to shift original vector by + * + * @return 0 SUCCESS + * @return -1 FAILURE + */ + int shiftVectorLeft(std::vector &shifted_vec, std::vector &original_vec, int shift_value); + + /** + * shiftVectorRight + * + * Shifts a given vector to the right by a predetermined number of bytes + * + * @param[out] shifted_vec Shifted vector + * @param[in] original_vec Original vector to shift + * @param[in] shift_value Number of bytes to shift original vector by + * + * @return 0 SUCCESS + * @return -1 FAILURE + */ + int shiftVectorRight(std::vector &shifted_vec, std::vector &original_vec, int shift_value); + + /** + * xorVector + * + * Performs bitwise exclusive-OR operation between the two given vectors + * + * @param[in] a First vector to use for exclusive-OR operation + * @param[in] b Second vector to use for exclusive-OR operation + * @param[out] result Result of exclusive-OR operation + * + * @return 0 SUCCESS + * @return -1 FAILURE -- Input vector sizes do not match + */ + int xorVector(std::vector &a, std::vector &b, std::vector &result); + + /** + * isBigEndian + * + * Checks whether the current machine uses BIG ENDIAN byte ordering or not + * + * @return 1 Current machine uses BIG ENDIAN byte ordering + * @return 0 Current machine does NOT use BIG ENDIAN byte ordering + */ + int isBigEndian(); + + /** + * isLittleEndian + * + * Checks whether the current machine uses LITTLE ENDIAN byte ordering or not + * + * @return 1 Current machine uses LITTLE ENDIAN byte ordering + * @return 0 Current machine does NOT use LITTLE ENDIAN byte ordering + */ + int isLittleEndian(); + + /** + * convertSsrc + * + * Converts the given numeric 32-bit ssrc to its vector version + * + * @param[in] ssrc Numerical SSRC to convert + * @param[out] result Vector-based SSRC + * + * @return 0 SUCCESS + * @return -1 FAILURE + */ + int convertSsrc(unsigned long ssrc, std::vector &result); + + /** + * convertPacketIndex + * + * Converts the given numeric 48-bit packet index to its vector version + * + * @param[in] ssrc Numerical packet index to convert + * @param[out] result Vector-based packet index + * + * @return 0 SUCCESS + * @return -1 FAILURE + */ + int convertPacketIndex(unsigned long long i, std::vector &result); + + /** + * convertROC + * + * Converts the given numeric 32-bit roll-over-counter to its vector version + * + * @param[in] roc Numerical roll-over-counter to convert + * @param[out] result Vector-based roll-over-counter + * + * @return 0 SUCCESS + * @return -1 FAILURE + */ + int convertROC(unsigned long ROC, std::vector &result); + + /** + * determineV + * + * Determines new ROC from existing ROC / s_l / SEQ values + * + * @param[in] SEQ Packet sequence number + * + * @return Updated ROC based on existing ROC / s_l / SEQ values + */ + unsigned long determineV(unsigned short SEQ); + + /** + * updateRollOverCounter + * + * Updates ROC with given value v + * + * @param[in] v Value to update ROC with + * + * @return TRUE SUCCESS + * @return FALSE FAILURE + */ + bool updateRollOverCounter(unsigned long v); + + /** + * fetchRollOverCounter + * + * Fetches current ROC value + * + * @return + */ + unsigned long fetchRollOverCounter(); + + /** + * updateSL + * + * Updates s_l with given value s + * + * @param[in] s Value to update s_l with + * + * @return TRUE SUCCESS + * @return FALSE FAILURE + */ + bool updateSL(unsigned short s); + + /** + * fetchSL + * + * Fetches current s_l value + * + * @return + */ + unsigned short fetchSL(); + + /** + * determinePacketIndex + * + * Determine index of packet from ROC and SEQ + * + * @param[in] ROC RollOverCounter + * @param[in] SEQ Packet sequence number + * + * @return Packet index based on ROC and SEQ + */ + unsigned long long determinePacketIndex(unsigned long ROC, unsigned short SEQ); + + /** + * setPacketIV + * + * Sets the current computed packet IV into the cipher state prior to encryption/decryption of a packet + * + * @return 0 SUCCESS + * @return -1 FAILURE + */ + int setPacketIV(); + + /** + * computePacketIV + * + * Computes the Input Vector for the given session salting key / ssrc / packet index + * + * @param[in] i Packet index to use + * + * @return 0 SUCCESS + * @return -1 FAILURE -- Incorrect salting key length + */ + int computePacketIV(unsigned long long i); + + /** + * displayPacketIV + * + * Displays the current computed packet Input Vector + */ + void displayPacketIV(); + + /** + * encryptVector + * + * Encrypts the given plaintext input vector into the ciphertext output one using selected session encryption key + * + * @param[in] invdata Input plaintext vector + * @param[out] ciphertext_output Output ciphertext vector + * + * @return 0 SUCCESS + * @return -1 FAILURE -- Empty input data vector + * @return -3 FAILURE -- Invalid cipher type specified + * @return -4 FAILURE -- Invalid crypto attribute specified + */ + int encryptVector(std::vector &invdata, std::vector &ciphertext_output); + + /** + * decryptVector + * + * Decrypts the given ciphertext input vector into the plaintext output one using selected session decryption key + * + * @param[in] ciphertext_input Input ciphertext vector + * @param[out] outvdata Output plaintext vector + * + * @return 0 SUCCESS + * @return -1 FAILURE -- Empty input data vector + * @return -3 FAILURE -- Invalid cipher type specified + * @return -4 FAILURE -- Invalid crypto attribute specified + */ + int decryptVector(std::vector &ciphertext_input, std::vector &outvdata); + + /** + * issueAuthenticationTag + * + * Issues a SHA1 hash of a given bit length from the provided data using the given authentication key + * + * @param[in] data Data to hash + * @param[out] hash Hash + * + * @return 0 SUCCESS + * @return -1 FAILURE -- Empty session authentication key + * @return -2 FAILURE -- Internal error generating digest + * @return -3 FAILURE -- Invalid HMAC algorithm specified + * @return -4 FAILURE -- Internal error converting ROC + * @return -5 FAILURE -- Invalid crypto attribute specified + */ + int issueAuthenticationTag(std::vector &data, std::vector &hash); + + /** + * extractAuthenticationTag + * + * Extracts SHA1 hash of a given bit length from the provided SRTP packet + * + * @param[in] srtp_packet SRTP packet to extract SHA1 hash from + * @param[out] hash Hash + * + * @return 0 SUCCESS + * @return -1 FAILURE -- Empty session authentication key + * @return -2 FAILURE -- Given SRTP packet smaller than authentication tag size + * @return -3 FAILURE -- Invalid HMAC algorithm specified + * @return -4 FAILURE -- Invalid crypto attribute specified + */ + int extractAuthenticationTag(std::vector srtp_packet, std::vector &hash); + + /** + * extractSRTPHeader + * + * Extracts the SRTP header from the provided SRTP packet + * + * @param[in] srtp_packet SRTP packet to extract SRTP header from + * @param[out] header SRTP header + * + * @return 0 SUCCESS + * @return -1 FAILURE -- SRTP header size is ZERO + * @return -2 FAILURE -- Given SRTP packet smaller than SRTP header size + */ + int extractSRTPHeader(std::vector srtp_packet, std::vector &header); + + /** + * extractSRTPPayload + * + * Extracts the SRTP payload from the provided SRTP packet + * + * @param[in] srtp_packet SRTP packet to extract SRTP payload from + * @param[out] payload SRTP payload + * + * @return 0 SUCCESS + * @return -1 FAILURE -- SRTP header size is ZERO + * @return -2 FAILURE -- SRTP payload size is ZERO + * @return -3 FAILURE -- Given SRTP packet smaller than SRTP header+payload size + */ + int extractSRTPPayload(std::vector srtp_packet, std::vector &payload); + + /** + * base64Encode + * + * Encodes the given bytes to a base64 string + * + * @param[in] s Decoded bytes to encode + * + * @return Encoded base64 string + */ + std::string base64Encode(std::vector const& s); + + /** + * base64Decode + * + * Decodes the given base64 string to bytes + * + * @param[in] s Encoded base64 string to decode + * + * @return Decoded bytes + */ + std::vector base64Decode(std::string const& s); + + /** + * resetCipherBlockOffset + * + * Resets the block offset of the AES counter mode encryption/decryption cipher + * + * @return 0 SUCCESS + * @return -1 FAILURE + */ + int resetCipherBlockOffset(); + + /** + * resetCipherOutputBlock + * + * Resets the output block of the AES counter mode encryption/decryption cipher + * + * @return 0 SUCCESS + * @return -1 FAILURE + */ + int resetCipherOutputBlock(); + + /** + * resetCipherBlockCounter + * + * Resets the block counter of the AES counter mode encryption/decryption cipher + * + * @return 0 SUCCESS + * @return -1 FAILURE + */ + int resetCipherBlockCounter(); + + /** + * setAESPseudoRandomFunctionKey + * + * Sets the AES key used by the pseudorandom function + * + * @param[in] crypto_attrib Crypto attribute whose pseudo random function key is to be set (PRIMARY_CRYPTO, SECONDARY_CRYPTO or ACTIVE_CRYPTO) + * + * @return 0 SUCCESS + * @return -1 FAILURE -- Pseudorandom function EVP_CIPHER_CTX context is NULL + * @return -2 FAILURE -- Internal EVP_EncryptInit_ex() error encountered while attempting to set AES key for primary crypto pseudorandom function + * @return -3 FAILURE -- Internal EVP_EncryptInit_ex() error encountered while attempting to set AES key for secondary crypto pseudorandom function + * @return -4 FAILURE -- Invalid crypto attribute specified + */ + int setAESPseudoRandomFunctionKey(ActiveCrypto crypto_attrib = ACTIVE_CRYPTO); + + /** + * setAESSessionEncryptionKey + * + * Sets the AES key used by the session encryption function + * + * @return 0 SUCCESS + * @return -1 FAILURE -- Session encryption EVP_CIPHER_CTX context is NULL + * @return -2 FAILURE -- Internal EVP_EncryptInit_ex() error encountered while attempting to set AES key for session encryption function + */ + int setAESSessionEncryptionKey(); + + /** + * AES_ctr128_increment + * + * Increments the given AES counter + * + * @param[in] counter AES counter to increment + */ + void AES_ctr128_increment(unsigned char* counter); + + /** + * AES_ctr128_pseudorandom_EVPencrypt + * + * Encrypts given input using AES 128-bit counter mode algorithm for pseudorandom function context + * + * @param[in] in Input plaintext + * @param[out] out Output ciphertext + * @param[in] length Input/output size + * @param[in] counter Concatenated IV/counter array + * @param[in] ecount_buf Encrypted IV/counter + * @param[in] num Block byte offset + * + * @return 0 SUCCESS + * @return -1 FAILURE -- Internal EVP_EncryptInit_ex() error encountered + * @return -2 FAILURE -- Internal EVP_EncryptUpdate() error encountered + * @return -3 FAILURE -- Invalid crypto attribute specified + */ + int AES_ctr128_pseudorandom_EVPencrypt(const unsigned char* in, + unsigned char* out, + const unsigned long length, + unsigned char counter[AES_BLOCK_SIZE], + unsigned char ecount_buf[AES_BLOCK_SIZE], + unsigned int* num); + + /** + * AES_ctr128_session_EVPencrypt + * + * Encrypts given input using AES 128-bit counter mode algorithm for session encryption context + * + * @param[in] in Input plaintext + * @param[out] out Output ciphertext + * @param[in] length Input/output size + * @param[in] counter Concatenated IV/counter array + * @param[in] ecount_buf Encrypted IV/counter + * @param[in] num Block byte offset + * + * @return 0 SUCCESS + * @return -1 FAILURE -- Internal EVP_EncryptInit_ex() error encountered + * @return -2 FAILURE -- Internal EVP_EncryptUpdate() error encountered + */ + int AES_ctr128_session_EVPencrypt(const unsigned char* in, + unsigned char* out, + const unsigned long length, + unsigned char counter[AES_BLOCK_SIZE], + unsigned char ecount_buf[AES_BLOCK_SIZE], + unsigned int* num); + + public: + + /** + * resetCryptoContext + * + * Resets crypto context + * + * @param[in] sssrc SSRC ID + * @param[in] ipAddress IP address + * @param[in] port Port + */ + void resetCryptoContext(unsigned int ssrc, std::string ipAddress, unsigned short port); + + /** + * resetCipherState + * + * Resets the state of the AES counter mode encryption/decryption cipher + * + * @return 0 SUCCESS + * @return -1 FAILURE -- Incorrect salting key length + */ + int resetCipherState(); + + /** + * deriveSessionEncryptionKey + * + * Derives the session encryption key from the given master key / master salt + * + * @li Assumes the key derivation rate is ZERO + * + * @return 0 SUCCESS + * @return -1 FAILURE -- Incorrect salting key length + * @return -2 FAILURE -- Incorrect encryption key length + * @return -3 FAILURE -- Could not set encryption key + * @return -4 FAILURE -- Invalid crypto attribute specified + */ + int deriveSessionEncryptionKey(); + + /** + * deriveSessionSaltingKey + * + * Derives the session salting key from the given master key / master salt + * + * @li Assumes the key derivation rate is ZERO + * + * @return 0 SUCCESS + * @return -1 FAILURE -- Incorrect salting key length + * @return -2 FAILURE -- Incorrect encryption key length + * @return -3 FAILURE -- Could not set encryption key + * @return -4 FAILURE -- Invalid crypto attribute specified + */ + int deriveSessionSaltingKey(); + + /** + * deriveSessionAuthenticationKey + * + * Derives the session authentication key from the given master key / master salt + * + * @li Assumes the key derivation rate is ZERO + * + * @return 0 SUCCESS + * @return -1 FAILURE -- Incorrect salting key length + * @return -2 FAILURE -- Incorrect encryption key length + * @return -3 FAILURE -- Could not set encryption key + * @return -4 FAILURE -- Invalid crypto attribute specified + */ + int deriveSessionAuthenticationKey(); + + /** + * displaySessionEncryptionKey + * + * Displays the session encryption key + */ + void displaySessionEncryptionKey(); + + /** + * displaySessionSaltingKey + * + * Displays the session salting key + */ + void displaySessionSaltingKey(); + + /** + * displaySessionAuthenticationKey + * + * Displays the session authentication key + */ + void displaySessionAuthenticationKey(); + + /** + * selectEncryptionKey + * + * Selects the session key used for encryption + * + * @return 0 SUCCESS + * @return -1 FAILURE -- Empty session encryption key + * @return -2 FAILURE -- Could not set encryption key + */ + int selectEncryptionKey(); + + /** + * selectDecryptionKey + * + * Selects the session key used for decryption + * + * @return 0 SUCCESS + * @return -1 FAILURE -- Empty session encryption key + * @return -2 FAILURE -- Could not set encryption key + */ + int selectDecryptionKey(); + + /** + * getCipherAlgorithm + * + * Gets the cipher algorithm currently in use + * + * @param[in] crypto_attrib Crypto attribute whose cipher algorithm is to be obtained (PRIMARY_CRYPTO, SECONDARY_CRYPTO or ACTIVE_CRYPTO) + * + * @return Cipher algorithm currently in use (AES_CM_128 or NULL_CIPHER) + */ + CipherType getCipherAlgorithm(ActiveCrypto crypto_attrib = ACTIVE_CRYPTO); + + /** + * selectCipherAlgorithm + * + * Selects the cipher algorithm to use + * + * @param[in] cipherType Cipher algorithm to use (AES_CM_128 or NULL_CIPHER) + * @param[in] crypto_attrib Crypto attribute whose cipher algorithm is to be set (PRIMARY_CRYPTO, SECONDARY_CRYPTO or ACTIVE_CRYPTO) + * + * @return 0 SUCCESS + * @return -1 FAILURE -- Invalid cipher algorithm specified + * @return -2 FAILURE -- Invalid crypto attribute specified + */ + int selectCipherAlgorithm(CipherType cipherType, ActiveCrypto crypto_attrib = ACTIVE_CRYPTO); + + /** + * getHashAlgorithm + * + * Gets the hashing algorithm currently in use + * + * @param[in] crypto_attrib Crypto attribute whose hash algorithm is to be obtained (PRIMARY_CRYPTO, SECONDARY_CRYPTO or ACTIVE_CRYPTO) + * + * @return Hashing algorithm currently in use (HMAC_SHA1_80 or HMAC_SHA1_32) + */ + HashType getHashAlgorithm(ActiveCrypto crypto_attrib = ACTIVE_CRYPTO); + + /** + * selectHashAlgorithm + * + * Selects the hashing algorithm to use + * + * @param[in] hashType Hashing algorithm to use (HMAC_SHA1_80 or HMAC_SHA1_32) + * @param[in] crypto_attrib Crypto attribute whose hash algorithm is to be set (PRIMARY_CRYPTO, SECONDARY_CRYPTO or ACTIVE_CRYPTO) + * + * @return 0 SUCCESS + * @return -1 FAILURE -- Invalid HMAC algorithm specified + * @return -2 FAILURE -- Invalid crypto attribute specified + */ + int selectHashAlgorithm(HashType hashType, ActiveCrypto crypto_attrib = ACTIVE_CRYPTO); + + /** + * getAuthenticationTagSize + * + * Gets the authentication tag size + * + * @return >0 SUCCESS -- Authentication tag size (bytes) + * @return -1 FAILURE -- Empty session authentication key + * @return -2 FAILURE -- Invalid HMAC algorithm specified + * @return -3 FAILURE -- Invalid crypto attribute specified + */ + int getAuthenticationTagSize(); + + /** + * displayAuthenticationTag + * + * Displays the given authentication tag + * + * @param[in] authtag Authentication tag to display + */ + void displayAuthenticationTag(std::vector &authtag); + + /** + * getSSRC + * + * Gets the SSRC currently in use + * + * @return SSRC ID currently in use + */ + unsigned int getSSRC(); + + /** + * getIPAddress + * + * Gets the IP address currently in use + * + * @return IP address currently in use + */ + std::string getIPAddress(); + + /** + * getPort + * + * Gets the port currently in use + * + * @return Port currently in use + */ + unsigned short getPort(); + + /** + * setSSRC + * + * Sets the SSRC currently in use + * + * @param[in] ssrc SSRC ID currently in use + */ + void setSSRC(unsigned int ssrc); + + /** + * setIPAddress + * + * Sets the IP address currently in use + * + * @param[in] ipAddress IP address currently in use + */ + void setIPAddress(std::string ipAddress); + + /** + * setPort + * + * Sets the port currently in use + * + * @param[in] port Port currently in use + */ + void setPort(unsigned short port); + + /** + * setID + * + * Sets the cryptographic context ID () to use + * + * @param[in] id Cryptograhic context ID () to use + */ + void setID(CryptoContextID id); + + /** + * getSrtpHeaderSize + * + * Gets the current SRTP header size + * + * @return Current SRTP header size in use + */ + unsigned int getSrtpHeaderSize(); + + /** + * setSrtpHeaderSize + * + * Sets the current SRTP header size + * + * @param[in] size Current SRTP header size to use + */ + void setSrtpHeaderSize(unsigned int size); + + /** + * getSrtpPayloadSize + * + * Gets the current SRTP payload size + * + * @return Current SRTP payload size in use + */ + unsigned int getSrtpPayloadSize(); + + /** + * setSrtpPayloadSize + * + * Sets the current SRTP payload size + * + * @param[in] size Current SRTP payload size to use + */ + void setSrtpPayloadSize(unsigned int size); + + /** + * processOutgoingPacket + * + * Processes an outgoing RTP packet (encrypt+authenticate) to become an SRTP packet + * + * @param[in] SEQ_s Input RTP packet sequence number + * @param[in] rtp_header Input RTP header + * @param[in] rtp_payload Input RTP payload + * @param[out] srtp_packet Output SRTP packet + * + * @return 0 SUCCESS + * @return -1 ENCRYPTION_FAILURE + * @return -2 Error issuing authentication tag + * @return -3 Error encountered while computing packet IV + * @return -4 Error encountered while setting packet IV + * @return -5 Error updating rollover counter + * @return -6 Error updating SL + */ + int processOutgoingPacket(unsigned short SEQ_s, + std::vector &rtp_header, + std::vector &rtp_payload, + std::vector &srtp_packet); + + /** + * processIncomingPacket + * + * Processes an incoming SRTP packet (authenticate+decrypt) to become an RTP packet + * + * @param[in] SEQ_r Input SRTP packet sequence number + * @param[in] srtp_packet Input SRTP packet + * @param[out] rtp_header Output RTP header + * @param[out] rtp_payload Output RTP payload + * + * @return 0 SUCCESS + * @return -1 AUTHENTICATION_FAILURE + * @return -2 DECRYPTION_FAILURE + * @return -3 Error extracting authentication tag + * @return -4 Error extracting SRTP header + * @return -5 Error extracting SRTP payload + * @return -6 Error issuing authentication tag + * @return -7 Error encountered while computing packet IV + * @return -8 Error encoutnered while setting packet IV + * @return -9 Error updating rollover counter + * @return -10 Error updating SL + */ + int processIncomingPacket(unsigned short SEQ_r, + std::vector &srtp_packet, + std::vector &rtp_header, + std::vector &rtp_payload); + + /** + * setCryptoTag + * + * Sets the crypto tag parameter value + * + * @param[in] tag Crypto tag value to use + * @param[in] crypto_attrib Crypto attribute whose tag is to be set (PRIMARY_CRYPTO, SECONDARY_CRYPTO or ACTIVE_CRYPTO) + * + * @return 0 SUCCESS + * @return -1 FAILURE + */ + int setCryptoTag(unsigned int tag, ActiveCrypto crypto_attrib = ACTIVE_CRYPTO); + + /** + * getCryptoTag + * + * Gets the crypto tag parameter value + * + * @param[in] crypto_attrib Crypto attribute whose tag is to be obtained (PRIMARY_CRYPTO, SECONDARY_CRYPTO or ACTIVE_CRYPTO) + * + * @return Crypto tag value currently in use + */ + unsigned int getCryptoTag(ActiveCrypto crypto_attrib = ACTIVE_CRYPTO); + + /** + * getCryptoSuite + * + * Fetches the string description of the crypto suite currently in use (e.g. "AES_CM_128_HMAC_SHA1_80" or "AES_CM_128_HMAC_SHA1_32") + * + * @return String description of the crypto suite currently in use + */ + std::string getCryptoSuite(); + + /** + * encodeMasterKeySalt + * + * Encodes the current unencoded master key/salt of the context for use in a RFC4568-compliant crypto attribute + * + * @param[out] mks Encoded master key/salt string (for use in an RFC-4568-compliant crypto attribute) + * @param[in] crypto_attrib Crypto attribute whose master key/salt is to be encoded (PRIMARY_CRYPTO, SECONDARY_CRYPTO or ACTIVE_CRYPTO) + * + * @return 0 SUCCESS + * @return -1 FAILURE + */ + int encodeMasterKeySalt(std::string &mks, ActiveCrypto crypto_attrib = ACTIVE_CRYPTO); + + /** + * decodeMasterKeySalt + * + * Decodes the given encoded master key/salt string from an RFC4568-compliant crypto attribute for use in the context + * + * @param[in] mks Encoded RFC4568-compliant master key/salt value (for use in the context) + * @param[in] crypto_attrib Crypto attribute whose master key/salt is to be decoded (PRIMARY_CRYPTO, SECONDARY_CRYPTO or ACTIVE_CRYPTO) + * + * @return 0 SUCCESS + * @return -1 FAILURE + */ + int decodeMasterKeySalt(std::string &mks, ActiveCrypto crypto_attrib = ACTIVE_CRYPTO); + + /** + * displayCryptoContext + * + * Displays current CryptoContext + */ + void displayCryptoContext(); + + /** + * dumpCryptoContext + */ + std::string dumpCryptoContext(); + + /** + * generateMasterKey + * + * Generates a master key + * + * @param[in] crypto_attrib Crypto attribute whose master key is to be generated (PRIMARY_CRYPTO, SECONDARY_CRYPTO or ACTIVE_CRYPTO) + * + * @return 0 SUCCESS + * @return -1 FAILURE + */ + int generateMasterKey(ActiveCrypto crypto_attrib = ACTIVE_CRYPTO); + + /** + * generateMasterSalt + * + * Generates a master salt + * + * @param[in] crypto_attrib Crypto attribute whose master salt is to be generated (PRIMARY_CRYPTO, SECONDARY_CRYPTO or ACTIVE_CRYPTO) + * + * @return 0 SUCCESS + * @return -1 FAILURE + */ + int generateMasterSalt(ActiveCrypto crypto_attrib = ACTIVE_CRYPTO); + + /** + * getMasterKey + * + * Gets the MASTER KEY + * + * @param[in] crypto_attrib Crypto attribute whose master key is to be fetched (PRIMARY_CRYPTO, SECONDARY_CRYPTO or ACTIVE_CRYPTO) + * + * @return Master key + */ + std::vector getMasterKey(ActiveCrypto crypto_attrib = ACTIVE_CRYPTO); + + /** + * getMasterSalt + * + * Gets the MASTER SALT + * + * @param[in] crypto_attrib Crypto attribute whose master salt is to be fetched (PRIMARY_CRYPTO, SECONDARY_CRYPTO or ACTIVE_CRYPTO) + * + * @return Master salt + */ + std::vector getMasterSalt(ActiveCrypto crypto_attrib = ACTIVE_CRYPTO); + + /** + * setMasterKey + * + * Sets the MASTER KEY + * + * @param[in] key Master key to use + * @param[in] crypto_attrib Crypto attribute whose master key is to be set (PRIMARY_CRYPTO, SECONDARY_CRYPTO or ACTIVE_CRYPTO) + * + * @return 0 SUCCESS + * @return -1 FAILURE + */ + int setMasterKey(std::vector &key, ActiveCrypto crypto_attrib = ACTIVE_CRYPTO); + + /** + * setMasterSalt + * + * Sets the MASTER SALT + * + * @param[in] salt Master salt to use + * @param[in] crypto_attrib Crypto attribute whose master salt is to be set (PRIMARY_CRYPTO, SECONDARY_CRYPTO or ACTIVE_CRYPTO) + * + * @return 0 SUCCESS + * @return -1 FAILURE + */ + int setMasterSalt(std::vector &salt, ActiveCrypto crypto_attrib = ACTIVE_CRYPTO); + + /** + * swapCrypto + * + * Swaps the PRIMARY and SECONDARY crypto attributes + * + * @return 0 SUCCESS + * @return -1 FAILURE + */ + int swapCrypto(); + + /** + * selectActiveCrypto + * + * Selects the crypto attribute to use (PRIMARY or SECONDARY) + * + * @param[in] activeCrypto Crypto attribute to use (PRIMARY_CRYPTO or SECONDARY_CRYPTO) + * + * @return 0 SUCCESS + * @return -1 FAILURE + */ + int selectActiveCrypto(ActiveCrypto activeCrypto); + + /** + * getActiveCrypto + * + * Gets the crypto attribute currently in use (PRIMARY or SECONDARY) + * + * @return PRIMARY_CRYPTO Primary crypto attribute is currently in use + * @return SECONDARY_CRYPTO Secondary crypto attribute is currently in use + * @return INVALID_CRYPTO Internal error occurred + */ + ActiveCrypto getActiveCrypto(); + + /** + * operator= + * + * Assigns a given JLSRTP object to the implicit one + * + * @param[in] that JLSRTP object to assign to the implicit one + * + * @return Reference to the implicit JLSRTP object + */ + JLSRTP& operator=(const JLSRTP& that); + + /** + * operator== + * + * Compares a given JLSRTP object to the implicit one for equality + * + * @param[in] that JLSRTP object to compare to the implicit one for equality + * + * @return TRUE Given JLSRTP object is equal to the implicit one + * @return FALSE Given JLSRTP object is NOT equal to the implicit one + */ + bool operator==(const JLSRTP& that); + + /** + * operator!= + * + * Compares a given JLSRTP object to the implicit one for inequality + * + * @param[in] that JLSRTP object to compare to the implicit one for inequality + * + * @return TRUE Given JLSRTP object is inequal to the implicit one + * @return FALSE Given JLSRTP object is NOT inequal to the implicit one + */ + bool operator!=(const JLSRTP& that); + + /** + * JLSTRP + * + * Default constructor + */ + JLSRTP(); + + /** + * JLSRTP + * + * Custom constructor + * + * @param[in] sssrc SSRC ID + * @param[in] ipAddress IP address + * @param[in] port Port + */ + JLSRTP(unsigned int ssrc, std::string ipAddress, unsigned short port); + + /** + * ~JLSRTP + * + * Default destructor + */ + ~JLSRTP(); + +}; + +#else // !USE_OPENSSL + +class JLSRTP +{ + public: + + /** + * JLSTRP + * + * Default constructor + */ + JLSRTP(); + + /** + * ~JLSRTP + * + * Default destructor + */ + ~JLSRTP(); +}; + +#endif // USE_OPENSSL + +#endif // __JLSRTP__ + diff --git a/include/message.hpp b/include/message.hpp index 3d1a21b2..3236c5a3 100644 --- a/include/message.hpp +++ b/include/message.hpp @@ -90,8 +90,42 @@ typedef enum { #ifdef RTP_STREAM , E_Message_RTPStream_Audio_Port, - E_Message_RTPStream_Video_Port -#endif + E_Message_RTPStream_Video_Port, +#ifdef USE_OPENSSL + E_Message_CryptoTag1Audio, + E_Message_CryptoTag2Audio, + E_Message_CryptoSuiteAesCm128Sha1801Audio, + E_Message_CryptoSuiteAesCm128Sha1802Audio, + E_Message_CryptoSuiteAesCm128Sha1321Audio, + E_Message_CryptoSuiteAesCm128Sha1322Audio, + E_Message_CryptoKeyParams1Audio, + E_Message_CryptoKeyParams2Audio, + E_Message_CryptoTag1Video, + E_Message_CryptoTag2Video, + E_Message_CryptoSuiteAesCm128Sha1801Video, + E_Message_CryptoSuiteAesCm128Sha1802Video, + E_Message_CryptoSuiteAesCm128Sha1321Video, + E_Message_CryptoSuiteAesCm128Sha1322Video, + E_Message_CryptoKeyParams1Video, + E_Message_CryptoKeyParams2Video, + E_Message_CryptoSuiteNullSha1801Audio, + E_Message_CryptoSuiteNullSha1802Audio, + E_Message_CryptoSuiteNullSha1321Audio, + E_Message_CryptoSuiteNullSha1322Audio, + E_Message_CryptoSuiteNullSha1801Video, + E_Message_CryptoSuiteNullSha1802Video, + E_Message_CryptoSuiteNullSha1321Video, + E_Message_CryptoSuiteNullSha1322Video, + E_Message_UEAesCm128Sha1801Audio, + E_Message_UEAesCm128Sha1802Audio, + E_Message_UEAesCm128Sha1321Audio, + E_Message_UEAesCm128Sha1322Audio, + E_Message_UEAesCm128Sha1801Video, + E_Message_UEAesCm128Sha1802Video, + E_Message_UEAesCm128Sha1321Video, + E_Message_UEAesCm128Sha1322Video, +#endif // USE_OPENSSL +#endif // RTP_STREAM } MessageCompType; class SendingMessage diff --git a/include/rtpstream.hpp b/include/rtpstream.hpp index 6835033e..ea054dc7 100644 --- a/include/rtpstream.hpp +++ b/include/rtpstream.hpp @@ -19,40 +19,230 @@ #ifndef __RTPSTREAM__ #define __RTPSTREAM__ +#include "jlsrtp.hpp" + +#include + #define RTPSTREAM_MAX_FILENAMELEN 256 +#define RTPSTREAM_MAX_PAYLOADNAME 256 +#define RTPECHO_MAX_FILENAMELEN 256 +#define RTPECHO_MAX_PAYLOADNAME 256 + +#ifdef USE_OPENSSL +typedef struct _SrtpAudioInfoParams +{ + bool audio_found; + int primary_audio_cryptotag; + char primary_audio_cryptosuite[24]; + char primary_audio_cryptokeyparams[42]; + int secondary_audio_cryptotag; + char secondary_audio_cryptosuite[24]; + char secondary_audio_cryptokeyparams[42]; + bool primary_unencrypted_audio_srtp; + bool secondary_unencrypted_audio_srtp; +} SrtpAudioInfoParams; + +typedef struct _SrtpVideoInfoParams +{ + bool video_found; + int primary_video_cryptotag; + char primary_video_cryptosuite[24]; + char primary_video_cryptokeyparams[42]; + int secondary_video_cryptotag; + char secondary_video_cryptosuite[24]; + char secondary_video_cryptokeyparams[42]; + bool primary_unencrypted_video_srtp; + bool secondary_unencrypted_video_srtp; +} SrtpVideoInfoParams; +#endif // USE_OPENSSL struct threaddata_t; struct taskentry_t; +struct taskentry_t +{ + threaddata_t *parent_thread; + unsigned long nextwake_ms; + volatile int flags; + + /* rtp stream information */ + unsigned long long last_audio_timestamp; + unsigned long long last_video_timestamp; + unsigned short audio_seq_out; + unsigned short video_seq_out; + char audio_payload_type; + char video_payload_type; + unsigned int audio_ssrc_id; + unsigned int video_ssrc_id; + + /* current playback information */ + int audio_pattern_id; // FILE: -1 (UNUSED) -- PATTERN: + int video_pattern_id; // FILE: -1 (UNUSED) -- PATTERN: + int audio_loop_count; // FILE: -- PATTERN: -1 (UNUSED) + int video_loop_count; // FILE: -- PATTERN: -1 (UNUSED) + char *audio_file_bytes_start; + char *video_file_bytes_start; + char *audio_current_file_bytes; + char *video_current_file_bytes; + int audio_file_num_bytes; + int video_file_num_bytes; + int audio_file_bytes_left; + int video_file_bytes_left; + + /* playback timing information */ + int audio_ms_per_packet; + int video_ms_per_packet; + int audio_bytes_per_packet; + int video_bytes_per_packet; + int audio_timeticks_per_packet; + int video_timeticks_per_packet; + int audio_timeticks_per_ms; + int video_timeticks_per_ms; + + /* new file playback information */ + int new_audio_pattern_id; // FILE: -1 (UNUSED) -- PATTERN: + int new_video_pattern_id; // FILE: -1 (UNUSED) -- PATTERN: + char new_audio_payload_type; + char new_video_payload_type; + int new_audio_loop_count; // FILE: -- PATTERN: -1 (UNUSED) + int new_video_loop_count; // FILE: -- PATTERN: -1 (UNUSED) + int new_audio_file_size; + int new_video_file_size; + char *new_audio_file_bytes; + char *new_video_file_bytes; + int new_audio_ms_per_packet; + int new_video_ms_per_packet; + int new_audio_bytes_per_packet; + int new_video_bytes_per_packet; + int new_audio_timeticks_per_packet; + int new_video_timeticks_per_packet; + + /* sockets for audio/video rtp_rtcp */ + int audio_rtp_socket; + int audio_rtcp_socket; + int video_rtp_socket; + int video_rtcp_socket; + +#ifdef USE_OPENSSL + /* audio/video SRTP echo activity indicators */ + int audio_srtp_echo_active; + int video_srtp_echo_active; +#endif // USE_OPENSSL + + /* rtp peer address structures */ + struct sockaddr_storage remote_audio_rtp_addr; + struct sockaddr_storage remote_audio_rtcp_addr; + struct sockaddr_storage remote_video_rtp_addr; + struct sockaddr_storage remote_video_rtcp_addr; + + /* we will have a mutex per call. should we consider refactoring to */ + /* share mutexes across calls? makes the per-call code more complex */ + + /* thread mananagment structures */ + pthread_mutex_t mutex; + + unsigned long audio_comparison_errors; + unsigned long video_comparison_errors; + + int audio_active; + int video_active; + +#ifdef USE_OPENSSL + SrtpAudioInfoParams local_srtp_audio_params; + SrtpAudioInfoParams remote_srtp_audio_params; + SrtpVideoInfoParams local_srtp_video_params; + SrtpVideoInfoParams remote_srtp_video_params; +#endif // USE_OPENSSL +}; + struct rtpstream_callinfo_t { - taskentry_t* taskinfo; - int audioport; - int videoport; + taskentry_t *taskinfo; + int local_audioport; + int local_videoport; + int remote_audioport; + int remote_videoport; + pthread_t threadID; }; struct rtpstream_actinfo_t { - char filename[RTPSTREAM_MAX_FILENAMELEN]; - int loop_count; + char filename[RTPSTREAM_MAX_FILENAMELEN]; // FILE: "" -- PATTERN: "pattern" + int pattern_id; // FILE: -1 -- PATTERN: + int loop_count; // FILE: count -- PATTERN: -1 (UNUSED) int bytes_per_packet; int ms_per_packet; int ticks_per_packet; /* need rework for 11.025 sample rate */ int payload_type; + char payload_name[RTPSTREAM_MAX_PAYLOADNAME]; // FILE/PATTERN: (e.g. "PCMU/8000", "PCMA/8000", "G729/8000", "H264/90000") + int audio_active; + int video_active; +}; + +struct rtpecho_actinfo_t +{ + int payload_type; + char payload_name[RTPECHO_MAX_PAYLOADNAME]; // e.g. "PCMU/8000", "PCMA/8000", "G729/8000", "H264/90000" + int bytes_per_packet; + int audio_active; + int video_active; +}; + +union ParamPass +{ + int i; + void* p; +}; + +union ResultCheck +{ + int i; + void* p; }; int rtpstream_new_call(rtpstream_callinfo_t *callinfo); void rtpstream_end_call(rtpstream_callinfo_t *callinfo); -void rtpstream_shutdown(void); +int rtpstream_shutdown(std::unordered_map& threadIDs); -int rtpstream_get_audioport(rtpstream_callinfo_t *callinfo); -int rtpstream_get_videoport(rtpstream_callinfo_t *callinfo); +int rtpstream_get_local_audioport(rtpstream_callinfo_t *callinfo); +int rtpstream_get_local_videoport(rtpstream_callinfo_t *callinfo); void rtpstream_set_remote(rtpstream_callinfo_t* callinfo, int ip_ver, const char* ip_addr, int audio_port, int video_port); -int rtpstream_cache_file(char *filename); +#ifdef USE_OPENSSL +int rtpstream_set_srtp_audio_local(rtpstream_callinfo_t *callinfo, SrtpAudioInfoParams &p); +int rtpstream_set_srtp_audio_remote(rtpstream_callinfo_t *callinfo, SrtpAudioInfoParams &p); +int rtpstream_set_srtp_video_local(rtpstream_callinfo_t *callinfo, SrtpVideoInfoParams &p); +int rtpstream_set_srtp_video_remote(rtpstream_callinfo_t *callinfo, SrtpVideoInfoParams &p); +#endif // USE_OPENSSL + +int rtpstream_cache_file(char *filename, + int mode /* 0: FILE - 1: PATTERN */, + int id, + int bytes_per_packet, + int stream_type /* 0: AUDIO - 1: VIDEO */); void rtpstream_play(rtpstream_callinfo_t *callinfo, rtpstream_actinfo_t *actioninfo); void rtpstream_pause(rtpstream_callinfo_t *callinfo); void rtpstream_resume(rtpstream_callinfo_t *callinfo); +void rtpstream_playapattern(rtpstream_callinfo_t *callinfo, rtpstream_actinfo_t *actioninfo, JLSRTP& txUACAudio, JLSRTP& rxUACAudio); +void rtpstream_pauseapattern(rtpstream_callinfo_t *callinfo); +void rtpstream_resumeapattern(rtpstream_callinfo_t *callinfo); + +void rtpstream_playvpattern(rtpstream_callinfo_t *callinfo, rtpstream_actinfo_t *actioninfo, JLSRTP& txUACVideo, JLSRTP& rxUACVideo); +void rtpstream_pausevpattern(rtpstream_callinfo_t *callinfo); +void rtpstream_resumevpattern(rtpstream_callinfo_t *callinfo); + +void rtpstream_audioecho_thread(void * param); +void rtpstream_videoecho_thread(void * param); + +int rtpstream_rtpecho_startaudio(rtpstream_callinfo_t *callinfo, JLSRTP& rxUASAudio, JLSRTP& txUASAudio); +int rtpstream_rtpecho_updateaudio(rtpstream_callinfo_t *callinfo, JLSRTP& rxUASAudio, JLSRTP& txUASAudio); +int rtpstream_rtpecho_stopaudio(rtpstream_callinfo_t *callinfo); + +int rtpstream_rtpecho_startvideo(rtpstream_callinfo_t *callinfo, JLSRTP& rxUASVideo, JLSRTP& txUASVideo); +int rtpstream_rtpecho_updatevideo(rtpstream_callinfo_t *callinfo, JLSRTP& rxUASVideo, JLSRTP& txUASVideo); +int rtpstream_rtpecho_stopvideo(rtpstream_callinfo_t *callinfo); + + #endif diff --git a/include/scenario.hpp b/include/scenario.hpp index dcffe112..00b5bceb 100644 --- a/include/scenario.hpp +++ b/include/scenario.hpp @@ -25,6 +25,11 @@ #define __SCENARIO__ #include + +#ifdef RTP_STREAM +#include +#endif // RTP_STREAM + #include #include "actions.hpp" #include "variables.hpp" @@ -189,6 +194,12 @@ class scenario int get_rtd(const char *ptr, bool start); int find_var(const char *varName); +#ifdef RTP_STREAM + void addRtpTaskThreadID(pthread_t id); + void removeRtpTaskThreadID(pthread_t id); + std::unordered_map& fetchRtpTaskThreadIDs(); +#endif // RTP_STREAM + CStat *stats; AllocVariableTable *allocVars; @@ -220,6 +231,10 @@ class scenario bool hidedefault; bool last_recv_optional; + +#ifdef RTP_STREAM + std::unordered_map threadIDs; +#endif // RTP_STREAM }; /* There are external variable containing the current scenario */ diff --git a/include/sipp.hpp b/include/sipp.hpp index 878c99f2..7daac557 100644 --- a/include/sipp.hpp +++ b/include/sipp.hpp @@ -141,6 +141,10 @@ #define MAX_PEER_SIZE 4096 /* 3pcc extended mode: max size of peer names */ #define MAX_LOCAL_TWIN_SOCKETS 10 /*3pcc extended mode:max number of peers from which cmd messages are received */ +#ifdef USE_OPENSSL +#define DEFAULT_PREFERRED_AUDIO_CRYPTOSUITE ((char*)"AES_CM_128_HMAC_SHA1_80") +#define DEFAULT_PREFERRED_VIDEO_CRYPTOSUITE ((char*)"AES_CM_128_HMAC_SHA1_80") +#endif // USE_OPENSSL /******************** Default parameters ***********************/ @@ -166,8 +170,9 @@ cmd messages are received */ #define DEFAULT_BEHAVIOR_BYE 1 #define DEFAULT_BEHAVIOR_ABORTUNEXP 2 #define DEFAULT_BEHAVIOR_PINGREPLY 4 +#define DEFAULT_BEHAVIOR_BADCSEQ 8 -#define DEFAULT_BEHAVIOR_ALL (DEFAULT_BEHAVIOR_BYE | DEFAULT_BEHAVIOR_ABORTUNEXP | DEFAULT_BEHAVIOR_PINGREPLY) +#define DEFAULT_BEHAVIOR_ALL (DEFAULT_BEHAVIOR_BYE | DEFAULT_BEHAVIOR_ABORTUNEXP | DEFAULT_BEHAVIOR_PINGREPLY | DEFAULT_BEHAVIOR_BADCSEQ) #ifdef RTP_STREAM #define DEFAULT_MIN_RTP_PORT 8192 @@ -252,10 +257,18 @@ MAYBE_EXTERN int tcp_readsize DEFVAL(65535); MAYBE_EXTERN int hasMedia DEFVAL(0); #endif #ifdef RTP_STREAM +MAYBE_EXTERN int min_rtp_port DEFVAL(DEFAULT_MIN_RTP_PORT); +MAYBE_EXTERN int max_rtp_port DEFVAL(DEFAULT_MAX_RTP_PORT); MAYBE_EXTERN int rtp_default_payload DEFVAL(DEFAULT_RTP_PAYLOAD); MAYBE_EXTERN int rtp_tasks_per_thread DEFVAL(DEFAULT_RTP_THREADTASKS); MAYBE_EXTERN int rtp_buffsize DEFVAL(65535); -#endif +MAYBE_EXTERN bool rtpcheck_debug DEFVAL(0); +#ifdef USE_OPENSSL +MAYBE_EXTERN bool srtpcheck_debug DEFVAL(0); +#endif // USE_OPENSSL +MAYBE_EXTERN double audiotolerance DEFVAL(1.0); +MAYBE_EXTERN double videotolerance DEFVAL(1.0); +#endif // RTP_STREAM MAYBE_EXTERN bool rtp_echo_enabled DEFVAL(0); MAYBE_EXTERN char media_ip[127]; /* also used for hostnames */ @@ -369,9 +382,12 @@ MAYBE_EXTERN unsigned long rtp2_pckts_pcap DEFVAL(0); MAYBE_EXTERN unsigned long rtp2_bytes_pcap DEFVAL(0); #ifdef RTP_STREAM MAYBE_EXTERN volatile unsigned long rtpstream_numthreads DEFVAL(0); -MAYBE_EXTERN volatile unsigned long rtpstream_bytes_in DEFVAL(0); -MAYBE_EXTERN volatile unsigned long rtpstream_bytes_out DEFVAL(0); -MAYBE_EXTERN volatile unsigned long rtpstream_pckts DEFVAL(0); +MAYBE_EXTERN volatile unsigned long rtpstream_abytes_in DEFVAL(0); +MAYBE_EXTERN volatile unsigned long rtpstream_vbytes_in DEFVAL(0); +MAYBE_EXTERN volatile unsigned long rtpstream_abytes_out DEFVAL(0); +MAYBE_EXTERN volatile unsigned long rtpstream_vbytes_out DEFVAL(0); +MAYBE_EXTERN volatile unsigned long rtpstream_apckts DEFVAL(0); +MAYBE_EXTERN volatile unsigned long rtpstream_vpckts DEFVAL(0); #endif @@ -470,7 +486,7 @@ enum E_Alter_YesNo { #include "strings.hpp" -void sipp_exit(int rc); +void sipp_exit(int rc, int rtp_errors, int echo_errors); char *get_peer_addr(char *); diff --git a/include/stat.hpp b/include/stat.hpp index 3cf5a5d7..5f29e8e3 100644 --- a/include/stat.hpp +++ b/include/stat.hpp @@ -305,6 +305,9 @@ class CStat */ void close (); + void setRtpEchoErrors(int value); + int getRtpEchoErrors(); + /** * ComputeStat Methods are used to modify counter value * It's the main interface to update counter @@ -427,7 +430,8 @@ class CStat int nRtds(); private: - unsigned long long M_counters[E_NB_COUNTER]; + unsigned int M_rtpEchoErrors; + unsigned long long M_counters[E_NB_COUNTER]; static unsigned long long M_G_counters[E_NB_G_COUNTER - E_NB_COUNTER]; #define GENERIC_C 0 diff --git a/regress/github-#0192/uac.xml b/regress/github-#0192/uac.xml index 7c80c09c..5a941783 100644 --- a/regress/github-#0192/uac.xml +++ b/regress/github-#0192/uac.xml @@ -54,7 +54,7 @@ - + diff --git a/regress/github-#0196/uac.xml b/regress/github-#0196/uac.xml index 4640494b..5e522355 100644 --- a/regress/github-#0196/uac.xml +++ b/regress/github-#0196/uac.xml @@ -54,7 +54,7 @@ - + diff --git a/regress/github-#0259/uac.xml b/regress/github-#0259/uac.xml index 9825fe76..02f0e900 100644 --- a/regress/github-#0259/uac.xml +++ b/regress/github-#0259/uac.xml @@ -54,7 +54,7 @@ - + diff --git a/sipp.dtd b/sipp.dtd index 91d17caa..a0323c7f 100644 --- a/sipp.dtd +++ b/sipp.dtd @@ -92,6 +92,7 @@ + @@ -107,6 +108,10 @@ + + + + diff --git a/sipp_scenarios/mcd_register.xml b/sipp_scenarios/mcd_register.xml new file mode 100644 index 00000000..c1b5a3aa --- /dev/null +++ b/sipp_scenarios/mcd_register.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac.xml b/sipp_scenarios/pfca_uac.xml new file mode 100644 index 00000000..b8f0a99e --- /dev/null +++ b/sipp_scenarios/pfca_uac.xml @@ -0,0 +1,136 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [media_port] RTP/AVP 0 8 9 103 101 + a=rtcp:[media_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern.xml b/sipp_scenarios/pfca_uac_apattern.xml new file mode 100644 index 00000000..3a1a5529 --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern.xml @@ -0,0 +1,194 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [media_port] RTP/AVP 0 18 9 103 8 101 + a=rtcp:[media_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_crypto_simple.xml b/sipp_scenarios/pfca_uac_apattern_crypto_simple.xml new file mode 100644 index 00000000..e58d024e --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_crypto_simple.xml @@ -0,0 +1,142 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_crypto_simple_aescm128sha132.xml b/sipp_scenarios/pfca_uac_apattern_crypto_simple_aescm128sha132.xml new file mode 100644 index 00000000..5911cd0e --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_crypto_simple_aescm128sha132.xml @@ -0,0 +1,142 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1321audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1802audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_crypto_simple_aescm128sha132_ue.xml b/sipp_scenarios/pfca_uac_apattern_crypto_simple_aescm128sha132_ue.xml new file mode 100644 index 00000000..36036dc7 --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_crypto_simple_aescm128sha132_ue.xml @@ -0,0 +1,142 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1321audio] inline:[cryptokeyparams1audio] [ueaescm128sha1321audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1802audio] inline:[cryptokeyparams2audio] [ueaescm128sha1802audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_crypto_simple_aescm128sha180.xml b/sipp_scenarios/pfca_uac_apattern_crypto_simple_aescm128sha180.xml new file mode 100644 index 00000000..e58d024e --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_crypto_simple_aescm128sha180.xml @@ -0,0 +1,142 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_crypto_simple_aescm128sha180_ue.xml b/sipp_scenarios/pfca_uac_apattern_crypto_simple_aescm128sha180_ue.xml new file mode 100644 index 00000000..62e8307a --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_crypto_simple_aescm128sha180_ue.xml @@ -0,0 +1,142 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] [ueaescm128sha1801audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio] [ueaescm128sha1322audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_crypto_simple_g711a.xml b/sipp_scenarios/pfca_uac_apattern_crypto_simple_g711a.xml new file mode 100644 index 00000000..819f3b56 --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_crypto_simple_g711a.xml @@ -0,0 +1,142 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 8 0 18 9 103 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:8 PCMA/8000 + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_crypto_simple_g711u.xml b/sipp_scenarios/pfca_uac_apattern_crypto_simple_g711u.xml new file mode 100644 index 00000000..e58d024e --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_crypto_simple_g711u.xml @@ -0,0 +1,142 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_crypto_simple_g722.xml b/sipp_scenarios/pfca_uac_apattern_crypto_simple_g722.xml new file mode 100644 index 00000000..47e7408a --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_crypto_simple_g722.xml @@ -0,0 +1,142 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 9 0 18 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:9 G722/8000 + a=fmtp:9 bitrate=64000 + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_crypto_simple_g729.xml b/sipp_scenarios/pfca_uac_apattern_crypto_simple_g729.xml new file mode 100644 index 00000000..b027ed55 --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_crypto_simple_g729.xml @@ -0,0 +1,142 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 18 0 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:18 G729/8000 + a=rtpmap:0 PCMU/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_crypto_simple_nullsha132.xml b/sipp_scenarios/pfca_uac_apattern_crypto_simple_nullsha132.xml new file mode 100644 index 00000000..ed4ba16d --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_crypto_simple_nullsha132.xml @@ -0,0 +1,142 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1321audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuitenullsha1802audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_crypto_simple_nullsha180.xml b/sipp_scenarios/pfca_uac_apattern_crypto_simple_nullsha180.xml new file mode 100644 index 00000000..bbdeba7f --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_crypto_simple_nullsha180.xml @@ -0,0 +1,142 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuitenullsha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation.xml b/sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation.xml new file mode 100644 index 00000000..8c9ec85d --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation.xml @@ -0,0 +1,216 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 13 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation_aescm128sha132.xml b/sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation_aescm128sha132.xml new file mode 100644 index 00000000..ce1681ec --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation_aescm128sha132.xml @@ -0,0 +1,216 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1321audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1802audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1321audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1802audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 13 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation_aescm128sha180.xml b/sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation_aescm128sha180.xml new file mode 100644 index 00000000..8c9ec85d --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation_aescm128sha180.xml @@ -0,0 +1,216 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 13 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation_nullsha132.xml b/sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation_nullsha132.xml new file mode 100644 index 00000000..f8881120 --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation_nullsha132.xml @@ -0,0 +1,216 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1321audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuitenullsha1802audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1321audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuitenullsha1802audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 13 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation_nullsha180.xml b/sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation_nullsha180.xml new file mode 100644 index 00000000..8d09a84d --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation_nullsha180.xml @@ -0,0 +1,216 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuitenullsha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuitenullsha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 13 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation_reuse.xml b/sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation_reuse.xml new file mode 100644 index 00000000..2a7c98aa --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_crypto_simple_renegotiation_reuse.xml @@ -0,0 +1,216 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio-9] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio-9] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 13 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_g711a.xml b/sipp_scenarios/pfca_uac_apattern_g711a.xml new file mode 100644 index 00000000..80abe770 --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_g711a.xml @@ -0,0 +1,194 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [media_port] RTP/AVP 8 0 18 9 103 101 + a=rtcp:[media_port+1] + a=sendrecv + a=rtpmap:8 PCMA/8000 + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_g711u.xml b/sipp_scenarios/pfca_uac_apattern_g711u.xml new file mode 100644 index 00000000..3a1a5529 --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_g711u.xml @@ -0,0 +1,194 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [media_port] RTP/AVP 0 18 9 103 8 101 + a=rtcp:[media_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_g722.xml b/sipp_scenarios/pfca_uac_apattern_g722.xml new file mode 100644 index 00000000..c961a688 --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_g722.xml @@ -0,0 +1,194 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [media_port] RTP/AVP 9 0 18 103 8 101 + a=rtcp:[media_port+1] + a=sendrecv + a=rtpmap:9 G722/8000 + a=fmtp:9 bitrate=64000 + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_apattern_g729.xml b/sipp_scenarios/pfca_uac_apattern_g729.xml new file mode 100644 index 00000000..97497d9f --- /dev/null +++ b/sipp_scenarios/pfca_uac_apattern_g729.xml @@ -0,0 +1,194 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [media_port] RTP/AVP 18 0 9 103 8 101 + a=rtcp:[media_port+1] + a=sendrecv + a=rtpmap:18 G729/8000 + a=rtpmap:0 PCMU/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_avpattern.xml b/sipp_scenarios/pfca_uac_avpattern.xml new file mode 100644 index 00000000..05a1fbc9 --- /dev/null +++ b/sipp_scenarios/pfca_uac_avpattern.xml @@ -0,0 +1,216 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [media_port] RTP/AVP 0 18 9 103 8 101 + a=rtcp:[media_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [media_port+2] RTP/AVP 99 98 96 97 + b=TIAS:1536000 + b=AS:1597 + a=rtcp:[media_port+3] + a=maxprate:192.0 + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_bpattern_crypto_simple.xml b/sipp_scenarios/pfca_uac_bpattern_crypto_simple.xml new file mode 100644 index 00000000..49b2e1e2 --- /dev/null +++ b/sipp_scenarios/pfca_uac_bpattern_crypto_simple.xml @@ -0,0 +1,159 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1322video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_bpattern_crypto_simple_aescm128sha132.xml b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_aescm128sha132.xml new file mode 100644 index 00000000..c2f9965d --- /dev/null +++ b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_aescm128sha132.xml @@ -0,0 +1,159 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1321audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1802audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1321video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1802video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_bpattern_crypto_simple_aescm128sha132_ue.xml b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_aescm128sha132_ue.xml new file mode 100644 index 00000000..9448b48b --- /dev/null +++ b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_aescm128sha132_ue.xml @@ -0,0 +1,159 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1321audio] inline:[cryptokeyparams1audio] [ueaescm128sha1321audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1802audio] inline:[cryptokeyparams2audio] [ueaescm128sha1802audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1321video] inline:[cryptokeyparams1video] [ueaescm128sha1321video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1802video] inline:[cryptokeyparams2video] [ueaescm128sha1802video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_bpattern_crypto_simple_aescm128sha180.xml b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_aescm128sha180.xml new file mode 100644 index 00000000..49b2e1e2 --- /dev/null +++ b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_aescm128sha180.xml @@ -0,0 +1,159 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1322video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_bpattern_crypto_simple_aescm128sha180_ue.xml b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_aescm128sha180_ue.xml new file mode 100644 index 00000000..f2199862 --- /dev/null +++ b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_aescm128sha180_ue.xml @@ -0,0 +1,159 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] [ueaescm128sha1801audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio] [ueaescm128sha1322audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] [ueaescm128sha1801video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1322video] inline:[cryptokeyparams2video] [ueaescm128sha1322video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_bpattern_crypto_simple_nullsha132.xml b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_nullsha132.xml new file mode 100644 index 00000000..ead94b89 --- /dev/null +++ b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_nullsha132.xml @@ -0,0 +1,159 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1321audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuitenullsha1802audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1321video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuitenullsha1802video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_bpattern_crypto_simple_nullsha180.xml b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_nullsha180.xml new file mode 100644 index 00000000..32e49e2b --- /dev/null +++ b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_nullsha180.xml @@ -0,0 +1,159 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuitenullsha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1801video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuitenullsha1322video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation.xml b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation.xml new file mode 100644 index 00000000..53831716 --- /dev/null +++ b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation.xml @@ -0,0 +1,250 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1322video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1322video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 13 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation_aescm128sha132.xml b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation_aescm128sha132.xml new file mode 100644 index 00000000..3c405804 --- /dev/null +++ b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation_aescm128sha132.xml @@ -0,0 +1,250 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1321audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1802audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1321video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1802video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1321audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1802audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1321video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1802video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 13 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation_aescm128sha180.xml b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation_aescm128sha180.xml new file mode 100644 index 00000000..53831716 --- /dev/null +++ b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation_aescm128sha180.xml @@ -0,0 +1,250 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1322video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1322video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 13 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation_nullsha132.xml b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation_nullsha132.xml new file mode 100644 index 00000000..425902f3 --- /dev/null +++ b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation_nullsha132.xml @@ -0,0 +1,250 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1321audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuitenullsha1802audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1321video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuitenullsha1802video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1321audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuitenullsha1802audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1321video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuitenullsha1802video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 13 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation_nullsha180.xml b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation_nullsha180.xml new file mode 100644 index 00000000..36862420 --- /dev/null +++ b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation_nullsha180.xml @@ -0,0 +1,250 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuitenullsha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1801video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuitenullsha1322video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuitenullsha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1801video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuitenullsha1322video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 13 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation_reuse.xml b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation_reuse.xml new file mode 100644 index 00000000..129e1bae --- /dev/null +++ b/sipp_scenarios/pfca_uac_bpattern_crypto_simple_renegotiation_reuse.xml @@ -0,0 +1,250 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1322video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio-9] + a=crypto:[cryptotag2audio] [cryptosuiteaescm128sha1322audio] inline:[cryptokeyparams2audio-9] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video-9] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1322video] inline:[cryptokeyparams2video-9] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 13 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_vpattern.xml b/sipp_scenarios/pfca_uac_vpattern.xml new file mode 100644 index 00000000..c0450690 --- /dev/null +++ b/sipp_scenarios/pfca_uac_vpattern.xml @@ -0,0 +1,196 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [media_port] RTP/AVP 99 98 96 97 + b=TIAS:1536000 + b=AS:1597 + a=rtcp:[media_port+1] + a=maxprate:192.0 + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_vpattern_crypto_simple.xml b/sipp_scenarios/pfca_uac_vpattern_crypto_simple.xml new file mode 100644 index 00000000..46a9ca0a --- /dev/null +++ b/sipp_scenarios/pfca_uac_vpattern_crypto_simple.xml @@ -0,0 +1,144 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1322video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_vpattern_crypto_simple_aescm128sha132.xml b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_aescm128sha132.xml new file mode 100644 index 00000000..24ca6a03 --- /dev/null +++ b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_aescm128sha132.xml @@ -0,0 +1,144 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1321video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1802video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_vpattern_crypto_simple_aescm128sha132_ue.xml b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_aescm128sha132_ue.xml new file mode 100644 index 00000000..5f939e3e --- /dev/null +++ b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_aescm128sha132_ue.xml @@ -0,0 +1,144 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1321video] inline:[cryptokeyparams1video] [ueaescm128sha1321video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1802video] inline:[cryptokeyparams2video] [ueaescm128sha1802video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_vpattern_crypto_simple_aescm128sha180.xml b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_aescm128sha180.xml new file mode 100644 index 00000000..46a9ca0a --- /dev/null +++ b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_aescm128sha180.xml @@ -0,0 +1,144 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1322video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_vpattern_crypto_simple_aescm128sha180_ue.xml b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_aescm128sha180_ue.xml new file mode 100644 index 00000000..57ecf173 --- /dev/null +++ b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_aescm128sha180_ue.xml @@ -0,0 +1,144 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] [ueaescm128sha1801video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1322video] inline:[cryptokeyparams2video] [ueaescm128sha1322video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_vpattern_crypto_simple_nullsha132.xml b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_nullsha132.xml new file mode 100644 index 00000000..57cdcee6 --- /dev/null +++ b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_nullsha132.xml @@ -0,0 +1,144 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1321video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuitenullsha1802video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_vpattern_crypto_simple_nullsha180.xml b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_nullsha180.xml new file mode 100644 index 00000000..89eddac4 --- /dev/null +++ b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_nullsha180.xml @@ -0,0 +1,144 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1801video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuitenullsha1322video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation.xml b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation.xml new file mode 100644 index 00000000..563af2b1 --- /dev/null +++ b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation.xml @@ -0,0 +1,220 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1322video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1322video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 13 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation_aescm128sha132.xml b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation_aescm128sha132.xml new file mode 100644 index 00000000..a29361cd --- /dev/null +++ b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation_aescm128sha132.xml @@ -0,0 +1,220 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1321video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1802video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1321video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1802video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 13 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation_aescm128sha180.xml b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation_aescm128sha180.xml new file mode 100644 index 00000000..563af2b1 --- /dev/null +++ b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation_aescm128sha180.xml @@ -0,0 +1,220 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1322video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1322video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 13 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation_nullsha132.xml b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation_nullsha132.xml new file mode 100644 index 00000000..1003ec15 --- /dev/null +++ b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation_nullsha132.xml @@ -0,0 +1,220 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1321video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuitenullsha1802video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1321video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuitenullsha1802video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 13 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation_nullsha180.xml b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation_nullsha180.xml new file mode 100644 index 00000000..8cc449ed --- /dev/null +++ b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation_nullsha180.xml @@ -0,0 +1,220 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1801video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuitenullsha1322video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1801video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuitenullsha1322video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 13 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation_reuse.xml b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation_reuse.xml new file mode 100644 index 00000000..40fe4963 --- /dev/null +++ b/sipp_scenarios/pfca_uac_vpattern_crypto_simple_renegotiation_reuse.xml @@ -0,0 +1,220 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 10 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1322video] inline:[cryptokeyparams2video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 11 PRACK + RAck: [$2][$1] + Contact: + Max-Forwards: 70 + Subject: Conference + Content-Length: 0 + + ]]> + + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 10 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 INVITE + Contact: + Content-Type: application/sdp + Max-Forwards: 70 + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Subject: Conference + Session-Expires: 3600;refresher=uas + Min-SE: 90 + Supported: 100rel + Require: 100rel + Content-Length: [len] + + v=0 + o=16001 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video-9] + a=crypto:[cryptotag2video] [cryptosuiteaescm128sha1322video] inline:[cryptokeyparams2video-9] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=sendrecv + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 12 ACK + Content-Length: 0 + + ]]> + + + + + + + + + + + + ;tag=[call_number] + To: [peer_tag_param] + Call-ID: [call_id] + CSeq: 13 BYE + Contact: + Max-Forwards: 70 + Subject: Conference + User-Agent: VIRTUAL Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas.xml b/sipp_scenarios/pfca_uas.xml new file mode 100644 index 00000000..7eba0628 --- /dev/null +++ b/sipp_scenarios/pfca_uas.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [media_port] RTP/AVP 0 18 9 103 8 101 + a=rtcp:[media_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio.xml b/sipp_scenarios/pfca_uas_audio.xml new file mode 100644 index 00000000..7eba0628 --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [media_port] RTP/AVP 0 18 9 103 8 101 + a=rtcp:[media_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_crypto_simple.xml b/sipp_scenarios/pfca_uas_audio_crypto_simple.xml new file mode 100644 index 00000000..b4c3231c --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_crypto_simple.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_crypto_simple_aescm128sha132.xml b/sipp_scenarios/pfca_uas_audio_crypto_simple_aescm128sha132.xml new file mode 100644 index 00000000..242c4d90 --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_crypto_simple_aescm128sha132.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1321audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_crypto_simple_aescm128sha132_ue.xml b/sipp_scenarios/pfca_uas_audio_crypto_simple_aescm128sha132_ue.xml new file mode 100644 index 00000000..23340e34 --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_crypto_simple_aescm128sha132_ue.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1321audio] inline:[cryptokeyparams1audio] [ueaescm128sha1321audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_crypto_simple_aescm128sha180.xml b/sipp_scenarios/pfca_uas_audio_crypto_simple_aescm128sha180.xml new file mode 100644 index 00000000..90811aa4 --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_crypto_simple_aescm128sha180.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_crypto_simple_aescm128sha180_ue.xml b/sipp_scenarios/pfca_uas_audio_crypto_simple_aescm128sha180_ue.xml new file mode 100644 index 00000000..b4f619e6 --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_crypto_simple_aescm128sha180_ue.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] [ueaescm128sha1801audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_crypto_simple_g711a.xml b/sipp_scenarios/pfca_uas_audio_crypto_simple_g711a.xml new file mode 100644 index 00000000..b26ed8a2 --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_crypto_simple_g711a.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 8 0 18 9 103 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:8 PCMA/8000 + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_crypto_simple_g711u.xml b/sipp_scenarios/pfca_uas_audio_crypto_simple_g711u.xml new file mode 100644 index 00000000..90811aa4 --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_crypto_simple_g711u.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_crypto_simple_g722.xml b/sipp_scenarios/pfca_uas_audio_crypto_simple_g722.xml new file mode 100644 index 00000000..8540f6dc --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_crypto_simple_g722.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 9 0 18 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:9 G722/8000 + a=fmtp:9 bitrate=64000 + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_crypto_simple_g729.xml b/sipp_scenarios/pfca_uas_audio_crypto_simple_g729.xml new file mode 100644 index 00000000..6c88749a --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_crypto_simple_g729.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 18 0 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:18 G729/8000 + a=rtpmap:0 PCMU/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_crypto_simple_nullsha132.xml b/sipp_scenarios/pfca_uas_audio_crypto_simple_nullsha132.xml new file mode 100644 index 00000000..4a30225b --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_crypto_simple_nullsha132.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1321audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_crypto_simple_nullsha180.xml b/sipp_scenarios/pfca_uas_audio_crypto_simple_nullsha180.xml new file mode 100644 index 00000000..4aa1bb56 --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_crypto_simple_nullsha180.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation.xml b/sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation.xml new file mode 100644 index 00000000..1b88dbba --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation_aescm128sha132.xml b/sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation_aescm128sha132.xml new file mode 100644 index 00000000..915f1059 --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation_aescm128sha132.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1321audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1321audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation_aescm128sha180.xml b/sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation_aescm128sha180.xml new file mode 100644 index 00000000..1b88dbba --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation_aescm128sha180.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation_nullsha132.xml b/sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation_nullsha132.xml new file mode 100644 index 00000000..2f6ca598 --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation_nullsha132.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1321audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1321audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation_nullsha180.xml b/sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation_nullsha180.xml new file mode 100644 index 00000000..0c430050 --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation_nullsha180.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation_reuse.xml b/sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation_reuse.xml new file mode 100644 index 00000000..a696b9c7 --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_crypto_simple_renegotiation_reuse.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio-5] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_g711a.xml b/sipp_scenarios/pfca_uas_audio_g711a.xml new file mode 100644 index 00000000..4bcd65aa --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_g711a.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [media_port] RTP/AVP 8 0 18 9 103 101 + a=rtcp:[media_port+1] + a=sendrecv + a=rtpmap:8 PCMA/8000 + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_g711u.xml b/sipp_scenarios/pfca_uas_audio_g711u.xml new file mode 100644 index 00000000..7eba0628 --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_g711u.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [media_port] RTP/AVP 0 18 9 103 8 101 + a=rtcp:[media_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_g722.xml b/sipp_scenarios/pfca_uas_audio_g722.xml new file mode 100644 index 00000000..d2139d33 --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_g722.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [media_port] RTP/AVP 9 0 18 103 8 101 + a=rtcp:[media_port+1] + a=sendrecv + a=rtpmap:9 G722/8000 + a=fmtp:9 bitrate=64000 + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audio_g729.xml b/sipp_scenarios/pfca_uas_audio_g729.xml new file mode 100644 index 00000000..65356172 --- /dev/null +++ b/sipp_scenarios/pfca_uas_audio_g729.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [media_port] RTP/AVP 18 0 9 103 8 101 + a=rtcp:[media_port+1] + a=sendrecv + a=rtpmap:18 G729/8000 + a=rtpmap:0 PCMU/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + + ]]> + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_audiovideo.xml b/sipp_scenarios/pfca_uas_audiovideo.xml new file mode 100644 index 00000000..a715f6bd --- /dev/null +++ b/sipp_scenarios/pfca_uas_audiovideo.xml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [media_port] RTP/AVP 0 18 9 103 8 101 + a=rtcp:[media_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [media_port+2] RTP/AVP 99 98 96 97 + b=TIAS:1536000 + b=AS:1597 + a=rtcp:[media_port+3] + a=maxprate:192.0 + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_both_crypto_simple.xml b/sipp_scenarios/pfca_uas_both_crypto_simple.xml new file mode 100644 index 00000000..5efb5ead --- /dev/null +++ b/sipp_scenarios/pfca_uas_both_crypto_simple.xml @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_both_crypto_simple_aescm128sha132.xml b/sipp_scenarios/pfca_uas_both_crypto_simple_aescm128sha132.xml new file mode 100644 index 00000000..85df4374 --- /dev/null +++ b/sipp_scenarios/pfca_uas_both_crypto_simple_aescm128sha132.xml @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1321audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1321video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_both_crypto_simple_aescm128sha132_ue.xml b/sipp_scenarios/pfca_uas_both_crypto_simple_aescm128sha132_ue.xml new file mode 100644 index 00000000..1d3edd04 --- /dev/null +++ b/sipp_scenarios/pfca_uas_both_crypto_simple_aescm128sha132_ue.xml @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1321audio] inline:[cryptokeyparams1audio] [ueaescm128sha1321audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1321video] inline:[cryptokeyparams1video] [ueaescm128sha1321video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_both_crypto_simple_aescm128sha180.xml b/sipp_scenarios/pfca_uas_both_crypto_simple_aescm128sha180.xml new file mode 100644 index 00000000..e63af167 --- /dev/null +++ b/sipp_scenarios/pfca_uas_both_crypto_simple_aescm128sha180.xml @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_both_crypto_simple_aescm128sha180_ue.xml b/sipp_scenarios/pfca_uas_both_crypto_simple_aescm128sha180_ue.xml new file mode 100644 index 00000000..acdd5a24 --- /dev/null +++ b/sipp_scenarios/pfca_uas_both_crypto_simple_aescm128sha180_ue.xml @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] [ueaescm128sha1801audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] [ueaescm128sha1801video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_both_crypto_simple_nullsha132.xml b/sipp_scenarios/pfca_uas_both_crypto_simple_nullsha132.xml new file mode 100644 index 00000000..51fef922 --- /dev/null +++ b/sipp_scenarios/pfca_uas_both_crypto_simple_nullsha132.xml @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1321audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1321video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_both_crypto_simple_nullsha180.xml b/sipp_scenarios/pfca_uas_both_crypto_simple_nullsha180.xml new file mode 100644 index 00000000..3b3ee383 --- /dev/null +++ b/sipp_scenarios/pfca_uas_both_crypto_simple_nullsha180.xml @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1801video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation.xml b/sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation.xml new file mode 100644 index 00000000..4b134a85 --- /dev/null +++ b/sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation.xml @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation_aescm128sha132.xml b/sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation_aescm128sha132.xml new file mode 100644 index 00000000..7d683386 --- /dev/null +++ b/sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation_aescm128sha132.xml @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1321audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1321video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1321audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1321video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation_aescm128sha180.xml b/sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation_aescm128sha180.xml new file mode 100644 index 00000000..4b134a85 --- /dev/null +++ b/sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation_aescm128sha180.xml @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation_nullsha132.xml b/sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation_nullsha132.xml new file mode 100644 index 00000000..f4d6cc2e --- /dev/null +++ b/sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation_nullsha132.xml @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1321audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1321video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1321audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1321video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation_nullsha180.xml b/sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation_nullsha180.xml new file mode 100644 index 00000000..54cc1f85 --- /dev/null +++ b/sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation_nullsha180.xml @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1801video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuitenullsha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1801video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation_reuse.xml b/sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation_reuse.xml new file mode 100644 index 00000000..634170ee --- /dev/null +++ b/sipp_scenarios/pfca_uas_both_crypto_simple_renegotiation_reuse.xml @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [rtpstream_audio_port] RTP/AVP 0 18 9 103 8 101 + a=crypto:[cryptotag1audio] [cryptosuiteaescm128sha1801audio] inline:[cryptokeyparams1audio-5] + a=rtcp:[rtpstream_audio_port+1] + a=sendrecv + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=rtpmap:9 G722/16000 + a=fmtp:9 bitrate=64000 + a=rtpmap:103 G7221/16000 + a=fmtp:103 bitrate=32000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video-5] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_video.xml b/sipp_scenarios/pfca_uas_video.xml new file mode 100644 index 00000000..9273b110 --- /dev/null +++ b/sipp_scenarios/pfca_uas_video.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [media_port] RTP/AVP 99 98 96 97 + b=TIAS:1536000 + b=AS:1597 + a=rtcp:[media_port+1] + a=maxprate:192.0 + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_video_crypto_simple.xml b/sipp_scenarios/pfca_uas_video_crypto_simple.xml new file mode 100644 index 00000000..84a11bdc --- /dev/null +++ b/sipp_scenarios/pfca_uas_video_crypto_simple.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_video_crypto_simple_aescm128sha132.xml b/sipp_scenarios/pfca_uas_video_crypto_simple_aescm128sha132.xml new file mode 100644 index 00000000..4d2bc460 --- /dev/null +++ b/sipp_scenarios/pfca_uas_video_crypto_simple_aescm128sha132.xml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1321video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_video_crypto_simple_aescm128sha132_ue.xml b/sipp_scenarios/pfca_uas_video_crypto_simple_aescm128sha132_ue.xml new file mode 100644 index 00000000..db3be87e --- /dev/null +++ b/sipp_scenarios/pfca_uas_video_crypto_simple_aescm128sha132_ue.xml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1321video] inline:[cryptokeyparams1video] [ueaescm128sha1321video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_video_crypto_simple_aescm128sha180.xml b/sipp_scenarios/pfca_uas_video_crypto_simple_aescm128sha180.xml new file mode 100644 index 00000000..443d00e1 --- /dev/null +++ b/sipp_scenarios/pfca_uas_video_crypto_simple_aescm128sha180.xml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_video_crypto_simple_aescm128sha180_ue.xml b/sipp_scenarios/pfca_uas_video_crypto_simple_aescm128sha180_ue.xml new file mode 100644 index 00000000..dd85f554 --- /dev/null +++ b/sipp_scenarios/pfca_uas_video_crypto_simple_aescm128sha180_ue.xml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] [ueaescm128sha1801video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_video_crypto_simple_nullsha132.xml b/sipp_scenarios/pfca_uas_video_crypto_simple_nullsha132.xml new file mode 100644 index 00000000..4d5ab863 --- /dev/null +++ b/sipp_scenarios/pfca_uas_video_crypto_simple_nullsha132.xml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1321video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_video_crypto_simple_nullsha180.xml b/sipp_scenarios/pfca_uas_video_crypto_simple_nullsha180.xml new file mode 100644 index 00000000..e9d249f5 --- /dev/null +++ b/sipp_scenarios/pfca_uas_video_crypto_simple_nullsha180.xml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1801video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation.xml b/sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation.xml new file mode 100644 index 00000000..99edd75f --- /dev/null +++ b/sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation_aescm128sha132.xml b/sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation_aescm128sha132.xml new file mode 100644 index 00000000..fe112571 --- /dev/null +++ b/sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation_aescm128sha132.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1321video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1321video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation_aescm128sha180.xml b/sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation_aescm128sha180.xml new file mode 100644 index 00000000..99edd75f --- /dev/null +++ b/sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation_aescm128sha180.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation_nullsha132.xml b/sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation_nullsha132.xml new file mode 100644 index 00000000..b0c8e213 --- /dev/null +++ b/sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation_nullsha132.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1321video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1321video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation_nullsha180.xml b/sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation_nullsha180.xml new file mode 100644 index 00000000..fbb3be54 --- /dev/null +++ b/sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation_nullsha180.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1801video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuitenullsha1801video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation_reuse.xml b/sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation_reuse.xml new file mode 100644 index 00000000..f5088b1b --- /dev/null +++ b/sipp_scenarios/pfca_uas_video_crypto_simple_renegotiation_reuse.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + Content-Length: 0 + + ]]> + + + + + + + + Server: VIRTUAL Mitel-3300-ICP-12.0.1.99 + Content-Length: 0 + + ]]> + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 0 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + Server: VIRTUAL Mitel-3300-ICP 12.0.1.99 + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=16002 0 1 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=video [rtpstream_video_port] RTP/AVP 99 98 96 97 + a=crypto:[cryptotag1video] [cryptosuiteaescm128sha1801video] inline:[cryptokeyparams1video-5] + b=TIAS:1536000 + b=AS:1597 + a=maxprate:192.0 + a=rtcp:[rtpstream_video_port+1] + a=rtpmap:99 H264/90000 + a=fmtp:99 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + a=rtpmap:98 H264/90000 + a=fmtp:98 profile-level-id=64000d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:96 H264/90000 + a=fmtp:96 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=0 + a=rtpmap:97 H264/90000 + a=fmtp:97 profile-level-id=42800d; max-mbps=108000; max-fs=3600; max-br=1280; packetization-mode=1 + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/uc360_register.xml b/sipp_scenarios/uc360_register.xml new file mode 100644 index 00000000..6e297eee --- /dev/null +++ b/sipp_scenarios/uc360_register.xml @@ -0,0 +1,64 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 1 REGISTER + Contact: + Allow: INVITE, ACK, BYE, OPTIONS, CANCEL, UPDATE, SUBSCRIBE, NOTIFY, INFO, MESSAGE + Max-Forwards: 70 + User-Agent: Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Expires: 3600 + Supported: path + Content-Length: 0 + + ]]> + + + + + + + + + + + + + + + diff --git a/sipp_scenarios/uc360_register_challenge.xml b/sipp_scenarios/uc360_register_challenge.xml new file mode 100644 index 00000000..2a92c748 --- /dev/null +++ b/sipp_scenarios/uc360_register_challenge.xml @@ -0,0 +1,62 @@ + + + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 1 REGISTER + Contact: + Allow: INVITE, ACK, BYE, OPTIONS, CANCEL, UPDATE, SUBSCRIBE, NOTIFY, INFO, MESSAGE + Max-Forwards: 70 + User-Agent: Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Expires: 3600 + Supported: path + Content-Length: 0 + + ]]> + + + + + + + ;tag=[call_number] + To: + Call-ID: [call_id] + CSeq: 2 REGISTER + Contact: + [authentication username=16001 password=asdfzxcvqwer] + Allow: INVITE, ACK, BYE, OPTIONS, CANCEL, UPDATE, SUBSCRIBE, NOTIFY, INFO, MESSAGE + Max-Forwards: 70 + User-Agent: Mitel-UC-Endpoint (Mitel UC360 Collaboration Point/2.1.0.99; 08:00:0F:74:80:E1) + Expires: 3600 + Supported: path + Content-Length: 0 + + ]]> + + + + + + + + + + + + + diff --git a/src/actions.cpp b/src/actions.cpp index 3195dd30..123d6038 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -154,19 +154,101 @@ void CAction::printInfo(char* buf, int len) snprintf(buf, len, "Type[%d] - play DTMF digits [%s]", M_action, M_message_str[0]); #endif + } #ifdef RTP_STREAM - } else if (M_action == E_AT_RTP_STREAM_PLAY) { - snprintf(buf, len, "Type[%d] - rtp_stream playfile file %s loop=%d payload %d bytes per packet=%d ms per packet=%d ticks per packet=%d", - M_action, M_rtpstream_actinfo.filename, M_rtpstream_actinfo.loop_count, - M_rtpstream_actinfo.payload_type, M_rtpstream_actinfo.bytes_per_packet, - M_rtpstream_actinfo.ms_per_packet, M_rtpstream_actinfo.ticks_per_packet); - } else if (M_action == E_AT_RTP_STREAM_PAUSE) { + else if (M_action == E_AT_RTP_STREAM_PLAY) + { + snprintf(buf, + len, + "Type[%d] - rtp_stream playfile file %s pattern_id %d loop=%d payload %d bytes per packet=%d ms per packet=%d ticks per packet=%d", + M_action, + M_rtpstream_actinfo.filename, + M_rtpstream_actinfo.pattern_id, + M_rtpstream_actinfo.loop_count, + M_rtpstream_actinfo.payload_type, + M_rtpstream_actinfo.bytes_per_packet, + M_rtpstream_actinfo.ms_per_packet, + M_rtpstream_actinfo.ticks_per_packet); + } + else if (M_action == E_AT_RTP_STREAM_PAUSE) + { snprintf(buf, len, "Type[%d] - rtp_stream pause", M_action); - } else if (M_action == E_AT_RTP_STREAM_RESUME) { + } + else if (M_action == E_AT_RTP_STREAM_RESUME) + { snprintf(buf, len, "Type[%d] - rtp_stream resume", M_action); + } + else if (M_action == E_AT_RTP_STREAM_PLAYAPATTERN) + { + snprintf(buf, + len, + "Type[%d] - rtp_stream playapattern file %s pattern_id %d loop=%d payload %d bytes per packet=%d ms per packet=%d ticks per packet=%d", + M_action, + M_rtpstream_actinfo.filename, + M_rtpstream_actinfo.pattern_id, + M_rtpstream_actinfo.loop_count, + M_rtpstream_actinfo.payload_type, + M_rtpstream_actinfo.bytes_per_packet, + M_rtpstream_actinfo.ms_per_packet, + M_rtpstream_actinfo.ticks_per_packet); + } + else if (M_action == E_AT_RTP_STREAM_PAUSEAPATTERN) + { + snprintf(buf, len, "Type[%d] - rtp_stream pauseapattern", M_action); + } + else if (M_action == E_AT_RTP_STREAM_RESUMEAPATTERN) + { + snprintf(buf, len, "Type[%d] - rtp_stream resumeapattern", M_action); + } + else if (M_action == E_AT_RTP_STREAM_PLAYVPATTERN) + { + snprintf(buf, + len, + "Type[%d] - rtp_stream playvpattern file %s pattern_id %d loop=%d payload %d bytes per packet=%d ms per packet=%d ticks per packet=%d", + M_action, + M_rtpstream_actinfo.filename, + M_rtpstream_actinfo.pattern_id, + M_rtpstream_actinfo.loop_count, + M_rtpstream_actinfo.payload_type, + M_rtpstream_actinfo.bytes_per_packet, + M_rtpstream_actinfo.ms_per_packet, + M_rtpstream_actinfo.ticks_per_packet); + } + else if (M_action == E_AT_RTP_STREAM_PAUSEVPATTERN) + { + snprintf(buf, len, "Type[%d] - rtp_stream pausevpattern", M_action); + } + else if (M_action == E_AT_RTP_STREAM_RESUMEVPATTERN) + { + snprintf(buf, len, "Type[%d] - rtp_stream resumevpattern", M_action); + } + else if (M_action == E_AT_RTP_STREAM_RTPECHO_STARTAUDIO) + { + snprintf(buf, len, "Type[%d] - rtp_stream rtpecho startaudio", M_action); + } + else if (M_action == E_AT_RTP_STREAM_RTPECHO_UPDATEAUDIO) + { + snprintf(buf, len, "Type[%d] - rtp_stream rtpecho updateaudio", M_action); + } + else if (M_action == E_AT_RTP_STREAM_RTPECHO_STOPAUDIO) + { + snprintf(buf, len, "Type[%d] - rtp_stream rtpecho stopaudio", M_action); + } + else if (M_action == E_AT_RTP_STREAM_RTPECHO_STARTVIDEO) + { + snprintf(buf, len, "Type[%d] - rtp_stream rtpecho startvideo", M_action); + } + else if (M_action == E_AT_RTP_STREAM_RTPECHO_UPDATEVIDEO) + { + snprintf(buf, len, "Type[%d] - rtp_stream rtpecho updatevideo", M_action); + } + else if (M_action == E_AT_RTP_STREAM_RTPECHO_STOPVIDEO) + { + snprintf(buf, len, "Type[%d] - rtp_stream rtpecho stopvideo", M_action); + } #endif - - } else { + else + { snprintf(buf, len, "Type[%d] - unknown action type ... ", M_action); } } @@ -248,7 +330,15 @@ pcap_pkts * CAction::getPcapPkts() } #endif #ifdef RTP_STREAM -rtpstream_actinfo_t *CAction::getRTPStreamActInfo() { return (&M_rtpstream_actinfo); } +rtpecho_actinfo_t* CAction::getRTPEchoActInfo() +{ + return &M_rtpecho_actinfo; +} + +rtpstream_actinfo_t* CAction::getRTPStreamActInfo() +{ + return &M_rtpstream_actinfo; +} #endif void CAction::setActionType (CAction::T_ActionType P_value) @@ -493,80 +583,354 @@ void CAction::setPcapArgs(const char* P_value) #endif #ifdef RTP_STREAM -void CAction::setRTPStreamActInfo(const char* P_value) +void CAction::setRTPEchoActInfo(const char* P_value) +{ + char* param_str; + char* next_comma; + char actionstring[RTPECHO_MAX_FILENAMELEN]; + + if (strlen(P_value)>=512) + { + ERROR("RTPEcho keyword %s is too long -- maximum supported length %u\n", P_value, 512); + } + + memset(actionstring, 0, sizeof(actionstring)); + + // Initialize M_rtpecho_actinfo struct members + M_rtpecho_actinfo.payload_type = rtp_default_payload; + memset(M_rtpecho_actinfo.payload_name, 0, sizeof(M_rtpecho_actinfo.payload_name)); + M_rtpecho_actinfo.bytes_per_packet = 0; + M_rtpecho_actinfo.audio_active = 0; + M_rtpecho_actinfo.video_active = 0; + + strcpy (actionstring,P_value); + param_str= strchr(actionstring,','); + next_comma= NULL; + + // Comma found for payload_type parameter + if (param_str) + { + *(param_str++)= 0; // skip comma + + /* we have a payload type parameter */ + next_comma= strchr (param_str,','); + if (next_comma) + { + *(next_comma++)= 0; + } + M_rtpecho_actinfo.payload_type= atoi(param_str); + param_str= next_comma; + } + + // Comma found for payload_name parameter + if (param_str) + { + /* we have a payload_name parameter */ + next_comma= strchr (param_str,','); + if (next_comma) + { + *(next_comma++)= 0; + } + strcpy(M_rtpecho_actinfo.payload_name, param_str); + param_str= next_comma; + } + + if (!strcmp(M_rtpecho_actinfo.payload_name, "")) + { + ERROR("Missing mandatory payload_name parameter in rtp_echo action"); + } + + /* Setup based on what we know of payload types */ + switch (M_rtpecho_actinfo.payload_type) + { + case 0: + if (!strcmp(M_rtpecho_actinfo.payload_name, "PCMU/8000")) + { + M_rtpecho_actinfo.bytes_per_packet= 160; + M_rtpecho_actinfo.audio_active = 1; + } + break; + + case 8: + if (!strcmp(M_rtpecho_actinfo.payload_name, "PCMA/8000")) + { + M_rtpecho_actinfo.bytes_per_packet= 160; + M_rtpecho_actinfo.audio_active = 1; + } + break; + + case 9: + if (!strcmp(M_rtpecho_actinfo.payload_name, "G722/8000")) + { + M_rtpecho_actinfo.bytes_per_packet= 160; + M_rtpecho_actinfo.audio_active = 1; + } + break; + + case 18: + if (!strcmp(M_rtpecho_actinfo.payload_name, "G729/8000")) + { + M_rtpecho_actinfo.bytes_per_packet= 20; + M_rtpecho_actinfo.audio_active = 1; + } + break; + + default: + if ((M_rtpecho_actinfo.payload_type >= 0) && + (M_rtpecho_actinfo.payload_type <= 95)) + { + M_rtpecho_actinfo.bytes_per_packet= -1; + M_rtpecho_actinfo.audio_active = 0; + M_rtpecho_actinfo.video_active = 0; + ERROR("Unknown static rtp payload type %d - cannot set playback parameters\n",M_rtpecho_actinfo.payload_type); + } + else if ((M_rtpecho_actinfo.payload_type >= 96) && + (M_rtpecho_actinfo.payload_type <= 127)) + { + if (!strcmp(M_rtpecho_actinfo.payload_name, "H264/90000")) + { + M_rtpecho_actinfo.bytes_per_packet = 1280; // ARBITRARY H264 PACKET SIZE + M_rtpecho_actinfo.video_active = 1; + } + else if (!strcmp(M_rtpstream_actinfo.payload_name, "iLBC/8000")) + { + M_rtpstream_actinfo.ms_per_packet = 30; + M_rtpstream_actinfo.bytes_per_packet = 50; + M_rtpstream_actinfo.ticks_per_packet = 240; + M_rtpstream_actinfo.audio_active = 1; + } + else + { + M_rtpecho_actinfo.bytes_per_packet= -1; + M_rtpecho_actinfo.audio_active = 0; + M_rtpecho_actinfo.video_active = 0; + ERROR("Unknown dynamic rtp payload type %d - cannot set playback parameters\n",M_rtpecho_actinfo.payload_type); + } + } + else + { + ERROR("Invalid rtp payload type %d - cannot set playback parameters\n",M_rtpecho_actinfo.payload_type); + } + break; + } +} + +void CAction::setRTPEchoActInfo(rtpecho_actinfo_t *P_value) +{ + /* At this stage the entire rtpecho action info structure can simply be */ + /* copied. No members need to be individually duplicated/processed. */ + memcpy (&M_rtpecho_actinfo, P_value, sizeof(M_rtpecho_actinfo)); +} + +void CAction::setRTPStreamActInfo(const char *P_value) { char* param_str; char* next_comma; + int pattern_mode = 0; + int stream_type = 0; /* 0: AUDIO / 1: VIDEO */ + + if (strlen(P_value)>=sizeof (M_rtpstream_actinfo.filename)) + { + ERROR("Filename/Pattern keyword %s is too long -- maximum supported length %zu", P_value, sizeof (M_rtpstream_actinfo.filename)-1); + } + + // Initialize M_rtpstream_actinfo struct members + memset(M_rtpstream_actinfo.filename, 0, sizeof(M_rtpstream_actinfo.filename)); + M_rtpstream_actinfo.pattern_id = -1; + M_rtpstream_actinfo.loop_count = -1; + M_rtpstream_actinfo.bytes_per_packet = 0; + M_rtpstream_actinfo.ms_per_packet = 0; + M_rtpstream_actinfo.ticks_per_packet = 0; + M_rtpstream_actinfo.payload_type = 0; + memset(M_rtpstream_actinfo.payload_name, 0, sizeof(M_rtpstream_actinfo.payload_name)); + M_rtpstream_actinfo.audio_active = 0; + M_rtpstream_actinfo.video_active = 0; + + if ((!strncmp(P_value, "apattern", 8)) || + (!strncmp(P_value, "vpattern", 8))) + { + pattern_mode = 1; + } + + strcpy (M_rtpstream_actinfo.filename,P_value); + param_str= strchr(M_rtpstream_actinfo.filename,','); + next_comma= NULL; - if (strlen(P_value) >= sizeof(M_rtpstream_actinfo.filename)) { - ERROR("Filename %s is too long, maximum supported length %zu", P_value, - sizeof(M_rtpstream_actinfo.filename) - 1); - } - strcpy(M_rtpstream_actinfo.filename, P_value); - param_str = strchr(M_rtpstream_actinfo.filename, ','); - next_comma = NULL; - - M_rtpstream_actinfo.loop_count = 1; - if (param_str) { - /* we have a loop count parameter */ - *(param_str++) = 0; - next_comma= strchr(param_str, ','); - if (next_comma) { - *(next_comma++) = 0; + // Set default values of pattern_id/loop_count depending on whether we are in PATTERN or FILE mode + if (pattern_mode) + { + M_rtpstream_actinfo.pattern_id = 1; + M_rtpstream_actinfo.loop_count = -1; + } + else + { + M_rtpstream_actinfo.pattern_id = -1; + M_rtpstream_actinfo.loop_count= 1; + } + + // Comma found for loop_count (FILE MODE) or pattern_id (PATTERN MODE) + if (param_str) + { + /* we have a loop count parameter (FILE MODE) or pattern id parameter (PATTERN MODE) */ + *(param_str++)= 0; + next_comma= strchr (param_str,','); + if (next_comma) + { + *(next_comma++)= 0; } - M_rtpstream_actinfo.loop_count = atoi(param_str); - param_str = next_comma; + + if (pattern_mode) + { + M_rtpstream_actinfo.pattern_id= atoi(param_str); + } + else + { + M_rtpstream_actinfo.loop_count= atoi(param_str); + } + + param_str= next_comma; } + // Set default RTP payload type value M_rtpstream_actinfo.payload_type= rtp_default_payload; - if (param_str) { + + // Comma found for payload_type parameter + if (param_str) + { /* we have a payload type parameter */ next_comma= strchr (param_str,','); - if (next_comma) { + if (next_comma) + { *(next_comma++)= 0; } M_rtpstream_actinfo.payload_type= atoi(param_str); + param_str= next_comma; } + // Comma found for payload_name parameter + if (param_str) + { + /* we have a payload_name parameter */ + next_comma= strchr (param_str,','); + if (next_comma) + { + *(next_comma++)= 0; + } + strcpy(M_rtpstream_actinfo.payload_name, param_str); + param_str= next_comma; + } + + if (!strcmp(M_rtpstream_actinfo.payload_name, "")) + { + ERROR("Missing mandatory payload_name parameter in rtp_stream action"); + } + + // JLTAG NOTE: + // Reworked code from commit "f3b6fe8cd60dd3d1dcca0ab373dc9d289f123f43" which violated the RFC standards for payload_type IDs by using dynamic payload + // type 98 incorrectly as a static one for the iLBC audio codec which rather uses dynamic payload types and should rather be determined by payload_name + // (0-95 is the payload_type range reserved for static codecs, 96-127 is the payload_type range is reserved for dynamic codecs) + /* Setup based on what we know of payload types */ - switch (M_rtpstream_actinfo.payload_type) { - case 0: - M_rtpstream_actinfo.ms_per_packet = 20; - M_rtpstream_actinfo.bytes_per_packet = 160; - M_rtpstream_actinfo.ticks_per_packet = 160; - break; - case 8: - M_rtpstream_actinfo.ms_per_packet = 20; - M_rtpstream_actinfo.bytes_per_packet = 160; - M_rtpstream_actinfo.ticks_per_packet = 160; - break; - case 9: - M_rtpstream_actinfo.ms_per_packet = 20; - M_rtpstream_actinfo.bytes_per_packet = 160; - M_rtpstream_actinfo.ticks_per_packet = 160; - break; - case 18: - M_rtpstream_actinfo.ms_per_packet = 20; - M_rtpstream_actinfo.bytes_per_packet = 20; - M_rtpstream_actinfo.ticks_per_packet = 160; - break; - case 98: - M_rtpstream_actinfo.ms_per_packet = 30; - M_rtpstream_actinfo.bytes_per_packet = 50; - M_rtpstream_actinfo.ticks_per_packet = 240; - break; - default: - M_rtpstream_actinfo.ms_per_packet= -1; - M_rtpstream_actinfo.bytes_per_packet= -1; - M_rtpstream_actinfo.ticks_per_packet= -1; - ERROR("Unknown rtp payload type %d - cannot set playback parameters", - M_rtpstream_actinfo.payload_type); - break; + switch (M_rtpstream_actinfo.payload_type) + { + case 0: + if (!strcmp(M_rtpstream_actinfo.payload_name, "PCMU/8000")) + { + M_rtpstream_actinfo.ms_per_packet= 20; + M_rtpstream_actinfo.bytes_per_packet= 160; + M_rtpstream_actinfo.ticks_per_packet= 160; + M_rtpstream_actinfo.audio_active = 1; + stream_type = 0; + } + break; + + case 8: + if (!strcmp(M_rtpstream_actinfo.payload_name, "PCMA/8000")) + { + M_rtpstream_actinfo.ms_per_packet= 20; + M_rtpstream_actinfo.bytes_per_packet= 160; + M_rtpstream_actinfo.ticks_per_packet= 160; + M_rtpstream_actinfo.audio_active = 1; + stream_type = 0; + } + break; + + case 9: + if (!strcmp(M_rtpstream_actinfo.payload_name, "G722/8000")) + { + M_rtpstream_actinfo.ms_per_packet= 20; + M_rtpstream_actinfo.bytes_per_packet= 160; + M_rtpstream_actinfo.ticks_per_packet= 160; + M_rtpstream_actinfo.audio_active = 1; + stream_type = 0; + } + break; + + case 18: + if (!strcmp(M_rtpstream_actinfo.payload_name, "G729/8000")) + { + M_rtpstream_actinfo.ms_per_packet= 20; + M_rtpstream_actinfo.bytes_per_packet= 20; + M_rtpstream_actinfo.ticks_per_packet= 160; + M_rtpstream_actinfo.audio_active = 1; + stream_type = 0; + } + break; + + default: + if ((M_rtpstream_actinfo.payload_type >= 0) && + (M_rtpstream_actinfo.payload_type <= 95)) + { + M_rtpstream_actinfo.ms_per_packet= -1; + M_rtpstream_actinfo.bytes_per_packet= -1; + M_rtpstream_actinfo.ticks_per_packet= -1; + M_rtpstream_actinfo.audio_active = 0; + M_rtpstream_actinfo.video_active = 0; + ERROR("Unknown static rtp payload type %d - cannot set playback parameters\n",M_rtpstream_actinfo.payload_type); + } + else if ((M_rtpstream_actinfo.payload_type >= 96) && + (M_rtpstream_actinfo.payload_type <= 127)) + { + if (!strcmp(M_rtpstream_actinfo.payload_name, "H264/90000")) + { + M_rtpstream_actinfo.ms_per_packet = 160; // ARBITRARY H264 PACKET TIME + M_rtpstream_actinfo.bytes_per_packet = 1280; // ARBITRARY H264 PACKET SIZE + M_rtpstream_actinfo.ticks_per_packet = 1280; // ARBITRARY H264 PACKET TICKS + M_rtpstream_actinfo.video_active = 1; + stream_type = 1; + } + else if (!strcmp(M_rtpstream_actinfo.payload_name, "iLBC/8000")) + { + M_rtpstream_actinfo.ms_per_packet = 30; + M_rtpstream_actinfo.bytes_per_packet = 50; + M_rtpstream_actinfo.ticks_per_packet = 240; + M_rtpstream_actinfo.audio_active = 1; + stream_type = 0; + } + else + { + M_rtpstream_actinfo.ms_per_packet= -1; + M_rtpstream_actinfo.bytes_per_packet= -1; + M_rtpstream_actinfo.ticks_per_packet= -1; + M_rtpstream_actinfo.audio_active = 0; + M_rtpstream_actinfo.video_active = 0; + ERROR("Unknown dynamic rtp payload type %d - cannot set playback parameters\n",M_rtpstream_actinfo.payload_type); + } + } + else + { + ERROR("Invalid rtp payload type %d - cannot set playback parameters\n",M_rtpstream_actinfo.payload_type); + } + break; } - if (rtpstream_cache_file(M_rtpstream_actinfo.filename) < 0) { - ERROR("Cannot read/cache rtpstream file %s", - M_rtpstream_actinfo.filename); + if (rtpstream_cache_file(M_rtpstream_actinfo.filename, + pattern_mode /* 0: FILE - 1: PATTERN */, + M_rtpstream_actinfo.pattern_id, + M_rtpstream_actinfo.bytes_per_packet, + stream_type) < 0) + { + ERROR("Cannot read/cache rtpstream file %s",M_rtpstream_actinfo.filename); } } @@ -574,7 +938,7 @@ void CAction::setRTPStreamActInfo(rtpstream_actinfo_t *P_value) { /* At this stage the entire rtpstream action info structure can simply be */ /* copied. No members need to be individually duplicated/processed. */ - memcpy(&M_rtpstream_actinfo,P_value, sizeof(M_rtpstream_actinfo)); + memcpy(&M_rtpstream_actinfo, P_value, sizeof(M_rtpstream_actinfo)); } #endif @@ -617,6 +981,7 @@ void CAction::setAction(CAction P_action) setPcapArgs ( P_action.M_pcapArgs ); #endif #ifdef RTP_STREAM + setRTPEchoActInfo(&(P_action.M_rtpecho_actinfo)); setRTPStreamActInfo(&(P_action.M_rtpstream_actinfo)); #endif } @@ -652,6 +1017,7 @@ CAction::CAction(scenario *scenario) #endif #ifdef RTP_STREAM + memset(&M_rtpecho_actinfo, 0, sizeof(M_rtpecho_actinfo)); memset(&M_rtpstream_actinfo, 0, sizeof(M_rtpstream_actinfo)); #endif diff --git a/src/call.cpp b/src/call.cpp index 548cd3c5..24f2cfea 100644 --- a/src/call.cpp +++ b/src/call.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #ifdef PCAPPLAY #include "send_packets.h" @@ -217,14 +218,32 @@ void call::get_remote_media_addr(std::string const &msg) /******* Extract RTP remote media infomartion from SDP *******/ /***** Similar to the routines used by the PCAP play code *****/ -void call::extract_rtp_remote_addr(const char* msg) +#define SDP_AUDIOPORT_PREFIX "\nm=audio" +#define SDP_IMAGEPORT_PREFIX "\nm=image" +#define SDP_VIDEOPORT_PREFIX "\nm=video" +std::string call::extract_rtp_remote_addr(const char* msg, int &ip_ver, int &audio_port, int &video_port) { - int ip_ver; - int audio_port = 0; + const char* search; int image_port = 0; - int video_port = 0; + std::size_t pos1 = 0; + std::size_t pos2 = 0; + std::string msgstr; + std::string sub; + std::string host; + + if (msg) { + msgstr = msg; + } - std::string host = find_in_sdp("c=IN IP4 ", msg); + /* Look for start of message body */ + search = strstr(msg, "\r\n\r\n"); + if (!search) { + ERROR("extract_rtp_remote_addr: SDP message body not found"); + } + msg = search + 2; /* skip past header. point to blank line before body */ + + /* Now search for IP address field */ + host = find_in_sdp("c=IN IP4 ", msg); if (host.empty()) { host = find_in_sdp("c=IN IP6 ", msg); if (host.empty()) { @@ -235,31 +254,491 @@ void call::extract_rtp_remote_addr(const char* msg) ip_ver = 4; } - std::string port = find_in_sdp("m=audio ", msg); - if (!port.empty()) { - audio_port = ::atoi(port.c_str()); + /* Find the port number for the image stream */ + pos1 = msgstr.find(SDP_IMAGEPORT_PREFIX, 0, 8); + if (pos1 != std::string::npos) + { + pos1 += 8; /* skip SDP_IMAGEPORT_PREFIX */ + pos1 += 1; /* skip first whitespace */ + pos2 = msgstr.find(" ", pos1); /* find second whitespace AFTER port */ + if (pos2 != std::string::npos) + { + sub = msgstr.substr(pos1, pos2-pos1); /* extract port substring */ + sscanf(sub.c_str(), "%d", &image_port); /* parse port substring as integer */ + } } - port = find_in_sdp("m=image ", msg); - if (!port.empty()) { - image_port = ::atoi(port.c_str()); + /* Now try to find the port number for the audio stream */ + pos1 = msgstr.find(SDP_AUDIOPORT_PREFIX, 0, 8); + if (pos1 != std::string::npos) + { + pos1 += 8; /* skip SDP_AUDIOPORT_PREFIX */ + pos1 += 1; /* skip first whitespace */ + pos2 = msgstr.find(" ", pos1); /* find second whitespace AFTER port */ + if (pos2 != std::string::npos) + { + sub = msgstr.substr(pos1, pos2-pos1); /* extract port substring */ + sscanf(sub.c_str(), "%d", &audio_port); /* parse port substring as integer */ + } } - port = find_in_sdp("m=video ", msg); - if (!port.empty()) { - video_port = ::atoi(port.c_str()); + /* first audio m-line had port of ZERO -- look for second audio m-line */ + if (audio_port == 0) + { + pos1 = msgstr.find(SDP_AUDIOPORT_PREFIX, pos2, 8); + if (pos1 != std::string::npos) + { + pos1 += 8; /* skip SDP_AUDIOPORT_PREFIX */ + pos1 += 1; /* skip first whitespace */ + pos2 = msgstr.find(" ", pos1); /* find second whitespace AFTER port */ + if (pos2 != std::string::npos) + { + sub = msgstr.substr(pos1, pos2-pos1); /* extract port substring */ + sscanf(sub.c_str(), "%d", &audio_port); + } + } } - if (audio_port == 0 && image_port == 0 && video_port == 0) { - ERROR("extract_rtp_remote_addr: no m=audio, m=image or m=video line found in SDP message body"); + /* And find the port number for the video stream */ + pos1 = msgstr.find(SDP_VIDEOPORT_PREFIX, 0, 8); + if (pos1 != std::string::npos) + { + pos1 += 8; /* skip SDP_VIDEOPORT_PREFIX */ + pos1 += 1; /* skip first whitespace */ + pos2 = msgstr.find(" ", pos1); /* find second whitespace AFTER port */ + if (pos2 != std::string::npos) + { + sub = msgstr.substr(pos1, pos2-pos1); /* extract port substring */ + sscanf(sub.c_str(), "%d", &video_port); /* parse port substring as integer */ + } } - /* If we get an image_port only, we won't set anything useful. - * We cannot use rtpstream for udptl/t38 data because it has - * non-linear timing and data size. */ - rtpstream_set_remote(&rtpstream_callinfo, ip_ver, host.c_str(), audio_port, video_port); + /* first video m-line had port of ZERO -- look for second video m-line */ + if (video_port == 0) + { + pos1 = msgstr.find(SDP_VIDEOPORT_PREFIX, pos2, 8); + if (pos1 != std::string::npos) + { + pos1 += 8; /* skip SDP_VIDEOPORT_PREFIX */ + pos1 += 1; /* skip first whitespace */ + pos2 = msgstr.find(" ", pos1); /* find second whitespace AFTER port */ + if (pos2 != std::string::npos) + { + sub = msgstr.substr(pos1, pos2-pos1); /* extract port substring */ + sscanf(sub.c_str(), "%d", &video_port); + } + } + } + + if ((audio_port==0)&&(video_port==0)&&(image_port==0)) { + ERROR("extract_rtp_remote_addr: no m=audio or m=video or m=image line found in SDP message body"); + } + + return host; } -#endif + +#ifdef USE_OPENSSL +int call::check_audio_ciphersuite_match(SrtpAudioInfoParams &pA) +{ + int audio_cs_len = 0; + int audio_ciphersuite_match = 0; + + logSrtpInfo("call::check_audio_ciphersuite_match(): Preferred AUDIO cryptosuite: [%s]\n", _pref_audio_cs_out); + + if (pA.audio_found) + { + audio_cs_len = strlen(_pref_audio_cs_out); + if (!strncmp(_pref_audio_cs_out, "AES_CM_128_HMAC_SHA1_80", audio_cs_len) || + !strncmp(_pref_audio_cs_out, "AES_CM_128_HMAC_SHA1_32", audio_cs_len) || + !strncmp(_pref_audio_cs_out, "NULL_HMAC_SHA1_80", audio_cs_len) || + !strncmp(_pref_audio_cs_out, "NULL_HMAC_SHA1_32", audio_cs_len)) + { + if (!strncmp(pA.primary_audio_cryptosuite, _pref_audio_cs_out, audio_cs_len)) + { + // PRIMARY AUDIO cryptosuite matches preferred AUDIO cryptosuite + logSrtpInfo("call::check_audio_ciphersuite_match(): PRIMARY AUDIO cryptosuite matches preferred AUDIO cryptosuite...\n"); + audio_ciphersuite_match = 1; + } + else + { + // PRIMARY AUDIO cryptosuite does NOT match preferred AUDIO cryptosuite + logSrtpInfo("call::check_audio_ciphersuite_match(): PRIMARY AUDIO cryptosuite [%s] does NOT match preferred AUDIO cryptosuite [%s]...\n", pA.primary_audio_cryptosuite, _pref_audio_cs_out); + audio_ciphersuite_match = 0; + } + } + } + + return audio_ciphersuite_match; +} + +int call::check_video_ciphersuite_match(SrtpVideoInfoParams &pV) +{ + int video_cs_len = 0; + int video_ciphersuite_match = 0; + + logSrtpInfo("call::check_video_ciphersuite_match(): Preferred VIDEO cryptosuite: [%s]\n", _pref_video_cs_out); + + if (pV.video_found) + { + video_cs_len = strlen(_pref_video_cs_out); + if (!strncmp(_pref_video_cs_out, "AES_CM_128_HMAC_SHA1_80", video_cs_len) || + !strncmp(_pref_video_cs_out, "AES_CM_128_HMAC_SHA1_32", video_cs_len) || + !strncmp(_pref_video_cs_out, "NULL_HMAC_SHA1_80", video_cs_len) || + !strncmp(_pref_video_cs_out, "NULL_HMAC_SHA1_32", video_cs_len)) + { + if (!strncmp(pV.primary_video_cryptosuite, _pref_video_cs_out, video_cs_len)) + { + // PRIMARY VIDEO cryptosuite matches preferred VIDEO cryptosuite + logSrtpInfo("call::check_video_ciphersuite_match(): PRIMARY VIDEO cryptosuite matches preferred VIDEO cryptosuite...\n"); + video_ciphersuite_match = 1; + } + else + { + // PRIMARY VIDEO cryptosuite does NOT match preferred VIDEO cryptosuite + logSrtpInfo("call::check_video_ciphersuite_match(): PRIMARY VIDEO cryptosuite [%s] does NOT match preferred VIDEO cryptosuite [%s]...\n", pV.primary_video_cryptosuite, _pref_video_cs_out); + video_ciphersuite_match = 0; + } + } + } + + return video_ciphersuite_match; +} + +/******* Extract SRTP remote media infomartion from SDP *******/ + +#define SDP_AUDIOCRYPTO_PREFIX "\na=crypto:" +#define SDP_VIDEOCRYPTO_PREFIX "\na=crypto:" +int call::extract_srtp_remote_info(const char * msg, SrtpAudioInfoParams &pA, SrtpVideoInfoParams &pV) +{ + const char* ro_search = NULL; + const char* alt_search = NULL; + + pA.audio_found = false; + pV.video_found = false; + + pA.primary_audio_cryptotag = 0; + pV.primary_video_cryptotag = 0; + memset(pA.primary_audio_cryptosuite, 0, sizeof(pA.primary_audio_cryptosuite)); + memset(pV.primary_video_cryptosuite, 0, sizeof(pV.primary_video_cryptosuite)); + memset(pA.primary_audio_cryptokeyparams, 0, sizeof(pA.primary_audio_cryptokeyparams)); + memset(pV.primary_video_cryptokeyparams, 0, sizeof(pV.primary_video_cryptokeyparams)); + pA.primary_unencrypted_audio_srtp = false; + pV.primary_unencrypted_video_srtp = false; + + pA.secondary_audio_cryptotag = 0; + pV.secondary_video_cryptotag = 0; + memset(pA.secondary_audio_cryptosuite, 0, sizeof(pA.secondary_audio_cryptosuite)); + memset(pV.secondary_video_cryptosuite, 0, sizeof(pV.secondary_video_cryptosuite)); + memset(pA.secondary_audio_cryptokeyparams, 0, sizeof(pA.secondary_audio_cryptokeyparams)); + memset(pV.secondary_video_cryptokeyparams, 0, sizeof(pV.secondary_video_cryptokeyparams)); + pA.secondary_unencrypted_audio_srtp = false; + pV.secondary_unencrypted_video_srtp = false; + + char* sdp_body = NULL; + char* sdp_body_remember = NULL; + + std::size_t mline_sol = 0; /* Start of m-line line */ + std::size_t mline_eol = 0; /* End of m-line line */ + std::string mline_contents = ""; /* Actual m-line contents */ + std::size_t msection_limit = 0; /* m-line media section limit */ + std::string msgstr; /* std::string representation of SDP body */ + + char crypto_audio_sessionparams[64]; + char crypto_video_sessionparams[64]; + + char* checkUESRTP = NULL; + bool audioExists = false; + bool videoExists = false; + std::size_t cur_pos = 0; + int audio_port = 0; + int video_port = 0; + std::size_t pos1 = 0; + std::size_t pos2 = 0; + std::string sub; + std::size_t amsection_limit = 0; + std::size_t vmsection_limit = 0; + + /* Look for start of message body */ + ro_search= strstr(msg,"\n\n"); // UNIX line endings (LFLF) between header/body sections + alt_search= strstr(msg, "\r\n\r\n"); // DOS line endings (CRLFCRLF) between header/body sections + + if (ro_search) { + sdp_body = strdup(ro_search); + } else if (alt_search) { + sdp_body = strdup(alt_search); + } + + if (sdp_body) { + msgstr = sdp_body; + sdp_body_remember = sdp_body; + + if (ro_search) { + sdp_body += 2; /* skip past header - point to blank line before body */ + } else if (alt_search) { + sdp_body += 4; /* skip past header - point to blank line before body */ + } + + /* -------------------------------------------------------------- + * Try to find an AUDIO MLINE + * -------------------------------------------------------------- */ + pos1 = msgstr.find(SDP_AUDIOPORT_PREFIX, 0, 8); + if (pos1 != std::string::npos) + { + pos1 += 8; /* skip SDP_AUDIOPORT_PREFIX */ + pos1 += 1; /* skip first whitespace */ + pos2 = msgstr.find(" ", pos1); /* find second whitespace AFTER port */ + if (pos2 != std::string::npos) + { + sub = msgstr.substr(pos1, pos2-pos1); /* extract port substring */ + sscanf(sub.c_str(), "%d", &audio_port); /* parse port substring as integer */ + if (audio_port != 0) + { + logSrtpInfo("found first ACTIVE audio m-line with NON-ZERO port [%d]...\n", audio_port); + audioExists = true; + } + else + { + logSrtpInfo("found first INACTIVE audio m-line (e.g. with ZERO port)...\n"); + + pos1 = msgstr.find(SDP_AUDIOPORT_PREFIX, pos2, 8); + if (pos1 != std::string::npos) + { + pos1 += 8; /* skip SDP_AUDIOPORT_PREFIX */ + pos1 += 1; /* skip first whitespace */ + pos2 = msgstr.find(" ", pos1); /* find second whitespace AFTER port */ + if (pos2 != std::string::npos) + { + sub = msgstr.substr(pos1, pos2-pos1); /* extract port substring */ + sscanf(sub.c_str(), "%d", &audio_port); + if (audio_port != 0) + { + logSrtpInfo("found second ACTIVE audio m-line with NON-ZERO port [%d]...\n", audio_port); + audioExists = true; + } + else + { + logSrtpInfo("found second INACTIVE audio m-line (e.g. with ZERO port)...\n"); + audioExists = false; + } + } + else + { + logSrtpInfo("invalid formatting encountered: missing whitespace after second audio m-line port...\n"); + audioExists = false; + } + } + else + { + logSrtpInfo("NO second audio m-line found...\n"); + audioExists = false; + } + } + } + else + { + logSrtpInfo("invalid formatting encountered: missing whitespace after first audio m-line port...\n"); + audioExists = false; + } + } + else + { + logSrtpInfo("NO first audio m-line found...\n"); + audioExists = false; + } + + cur_pos = pos2; + amsection_limit = msgstr.find("\nm=audio", cur_pos, 8); + vmsection_limit = msgstr.find("\nm=video", cur_pos, 8); + + if (audioExists && + (((amsection_limit != std::string::npos) && (cur_pos != std::string::npos) && (cur_pos < amsection_limit)) || + ((amsection_limit == std::string::npos) && (vmsection_limit == std::string::npos) && (cur_pos != std::string::npos)))) + { + // AUDIO "m=audio" prefix found... + pA.audio_found = true; + + mline_sol = msgstr.find(SDP_AUDIOCRYPTO_PREFIX, cur_pos/*0*/, 10); + if (mline_sol != std::string::npos) { + // PRIMARY AUDIO "a:crypto:" crypto prefix found + mline_eol = msgstr.find("\n", mline_sol, 1); + if (mline_eol != std::string::npos) { + mline_contents = msgstr.substr(mline_sol, mline_eol); + sscanf(mline_contents.c_str(), "\na=crypto:%d %s inline:%s %s", &pA.primary_audio_cryptotag, + pA.primary_audio_cryptosuite, + pA.primary_audio_cryptokeyparams, + crypto_audio_sessionparams); + checkUESRTP = strstr(crypto_audio_sessionparams, "UNENCRYPTED_SRTP"); + if (checkUESRTP) { + logSrtpInfo("call::extract_srtp_remote_info(): Detected UNENCRYPTED_SRTP token for PRIMARY AUDIO\n"); + pA.primary_unencrypted_audio_srtp = true; + } else { + logSrtpInfo("call::extract_srtp_remote_info(): No UNENCRYPTED_SRTP token detected for PRIMARY AUDIO\n"); + pA.primary_unencrypted_audio_srtp = false; + } + } + } + + // Look for end-of-audio-media section + msection_limit = msgstr.find("\nm=", mline_eol+1, 3); + + mline_sol = msgstr.find(SDP_AUDIOCRYPTO_PREFIX, mline_eol+1, 10); + if (((msection_limit != std::string::npos) && (mline_sol != std::string::npos) && (mline_sol < msection_limit)) || + ((msection_limit == std::string::npos) && (mline_sol != std::string::npos))) { + // SECONDARY AUDIO "a:crypto:" crypto prefix found + mline_eol = msgstr.find("\n", mline_sol, 1); + if (mline_eol != std::string::npos) { + mline_contents = msgstr.substr(mline_sol, mline_eol); + sscanf(mline_contents.c_str(), "\na=crypto:%d %s inline:%s %s", &pA.secondary_audio_cryptotag, + pA.secondary_audio_cryptosuite, + pA.secondary_audio_cryptokeyparams, + crypto_audio_sessionparams); + checkUESRTP = strstr(crypto_audio_sessionparams, "UNENCRYPTED_SRTP"); + if (checkUESRTP) { + logSrtpInfo("call::extract_srtp_remote_info(): Detected UNENCRYPTED_SRTP token for SECONDARY AUDIO\n"); + pA.secondary_unencrypted_audio_srtp = true; + } else { + logSrtpInfo("call::extract_srtp_remote_info(): No UNENCRYPTED_SRTP token detected for SECONDARY AUDIO\n"); + pA.secondary_unencrypted_audio_srtp = false; + } + } + } + } + + /* -------------------------------------------------------------- + * Try to find a VIDEO MLINE + * -------------------------------------------------------------- */ + pos1 = msgstr.find(SDP_VIDEOPORT_PREFIX, 0, 8); + if (pos1 != std::string::npos) + { + pos1 += 8; /* skip SDP_VIDEOPORT_PREFIX */ + pos1 += 1; /* skip first whitespace */ + pos2 = msgstr.find(" ", pos1); /* find second whitespace AFTER port */ + if (pos2 != std::string::npos) + { + sub = msgstr.substr(pos1, pos2-pos1); /* extract port substring */ + sscanf(sub.c_str(), "%d", &video_port); /* parse port substring as integer */ + if (video_port != 0) + { + logSrtpInfo("found first ACTIVE video m-line with NON-ZERO port [%d]...\n", video_port); + videoExists = true; + } + else + { + logSrtpInfo("found first INACTIVE video m-line (e.g. with ZERO port)...\n"); + + pos1 = msgstr.find(SDP_VIDEOPORT_PREFIX, pos2, 8); + if (pos1 != std::string::npos) + { + pos1 += 8; /* skip SDP_VIDEOPORT_PREFIX */ + pos1 += 1; /* skip first whitespace */ + pos2 = msgstr.find(" ", pos1); /* find second whitespace AFTER port */ + if (pos2 != std::string::npos) + { + sub = msgstr.substr(pos1, pos2-pos1); /* extract port substring */ + sscanf(sub.c_str(), "%d", &video_port); + if (video_port != 0) + { + logSrtpInfo("found second ACTIVE video m-line with NON-ZERO port [%d]...\n", video_port); + videoExists = true; + } + else + { + logSrtpInfo("found second INACTIVE video m-line (e.g. with ZERO port)...\n"); + videoExists = false; + } + } + else + { + logSrtpInfo("invalid formatting encountered: missing whitespace after second video m-line port...\n"); + videoExists = false; + } + } + else + { + logSrtpInfo("NO second video m-line found...\n"); + videoExists = false; + } + } + } + else + { + logSrtpInfo("invalid formatting encountered: missing whitespace after first video m-line port...\n"); + videoExists = false; + } + } + else + { + logSrtpInfo("NO first video m-line found...\n"); + videoExists = false; + } + + cur_pos = pos2; + vmsection_limit = msgstr.find("\nm=video", cur_pos, 8); + amsection_limit = msgstr.find("\nm=audio", cur_pos, 8); + + if (videoExists && + (((vmsection_limit != std::string::npos) && (cur_pos != std::string::npos) && (cur_pos < vmsection_limit)) || + ((vmsection_limit == std::string::npos) && (amsection_limit == std::string::npos) && (cur_pos != std::string::npos)))) + { + // VIDEO "m=video" prefix found... + pV.video_found = true; + + mline_sol = msgstr.find(SDP_VIDEOCRYPTO_PREFIX, cur_pos/*mline_eol+1*/, 10); + if (mline_sol != std::string::npos) { + // PRIMARY VIDEO "a:crypto:" crypto prefix found + mline_eol = msgstr.find("\n", mline_sol, 1); + if (mline_eol != std::string::npos) { + mline_contents = msgstr.substr(mline_sol, mline_eol); + sscanf(mline_contents.c_str(), "\na=crypto:%d %s inline:%s %s", &pV.primary_video_cryptotag, + pV.primary_video_cryptosuite, + pV.primary_video_cryptokeyparams, + crypto_video_sessionparams); + checkUESRTP = strstr(crypto_video_sessionparams, "UNENCRYPTED_SRTP"); + if (checkUESRTP) { + logSrtpInfo("call::extract_srtp_remote_info(): Detected UNENCRYPTED_SRTP token for PRIMARY VIDEO\n"); + pV.primary_unencrypted_video_srtp = true; + } else { + logSrtpInfo("call::extract_srtp_remote_info(): No UNENCRYPTED_SRTP token detected for PRIMARY VIDEO\n"); + pV.primary_unencrypted_video_srtp = false; + } + } + } + + // Look for end-of-video-media section + msection_limit = msgstr.find("\nm=", mline_eol+1, 3); + + mline_sol = msgstr.find(SDP_VIDEOCRYPTO_PREFIX, mline_eol+1, 10); + if (((msection_limit != std::string::npos) && (mline_sol != std::string::npos) && (mline_sol < msection_limit)) || + ((msection_limit == std::string::npos) && (mline_sol != std::string::npos))) { + // SECONDARY VIDEO "a:crypto:" crypto prefix found + mline_eol = msgstr.find("\n", mline_sol, 1); + if (mline_eol != std::string::npos) { + mline_contents = msgstr.substr(mline_sol, mline_eol); + sscanf(mline_contents.c_str(), "\na=crypto:%d %s inline:%s %s", &pV.secondary_video_cryptotag, + pV.secondary_video_cryptosuite, + pV.secondary_video_cryptokeyparams, + crypto_video_sessionparams); + checkUESRTP = strstr(crypto_video_sessionparams, "UNENCRYPTED_SRTP"); + if (checkUESRTP) { + logSrtpInfo("call::extract_srtp_remote_info(): Detected UNENCRYPTED_SRTP token for SECONDARY VIDEO\n"); + pV.secondary_unencrypted_video_srtp = true; + } else { + logSrtpInfo("call::extract_srtp_remote_info(): No UNENCRYPTED_SRTP token detected for SECONDARY VIDEO\n"); + pV.secondary_unencrypted_video_srtp = false; + } + } + } + } + + free(sdp_body_remember); + + return 0; /* SUCCESS -- parsed SDP SRTP INFO */ + } else { + return -1; /* FAILURE -- No SDP body found */ + } +} +#endif // USE_OPENSSL +#endif // RTP_STREAM /******* Very simple hash for retransmission detection *******/ @@ -364,6 +843,31 @@ call *call::add_call(int userId, bool ipv6, struct sockaddr_storage *dest) void call::init(scenario * call_scenario, SIPpSocket *socket, struct sockaddr_storage *dest, const char * p_id, int userId, bool ipv6, bool isAutomatic, bool isInitCall) { +#ifdef USE_OPENSSL + _srtpctxdebugfile = NULL; + + if (srtpcheck_debug) + { + if (sendMode == MODE_CLIENT) + { + _srtpctxdebugfile = fopen("srtpctxdebugfile_uac", "w"); + } + else if (sendMode == MODE_SERVER) + { + _srtpctxdebugfile = fopen("srtpctxdebugfile_uas", "w"); + } + + if (_srtpctxdebugfile == NULL) + { + /* error encountered opening srtp ctx debug file */ + WARNING("Error encountered opening srtp ctx debug file"); + } + } +#endif // USE_OPENSSL + + _sessionStateCurrent = eNoSession; + _sessionStateOld = eNoSession; + this->call_scenario = call_scenario; zombie = false; @@ -379,6 +883,8 @@ void call::init(scenario * call_scenario, SIPpSocket *socket, struct sockaddr_st last_recv_index = -1; last_recv_msg = NULL; + last_recv_invite_cseq = 0; + recv_retrans_hash = 0; recv_retrans_recv_index = -1; recv_retrans_send_index = -1; @@ -412,9 +918,49 @@ void call::init(scenario * call_scenario, SIPpSocket *socket, struct sockaddr_st next_nonce_count = 1; #ifdef RTP_STREAM +#ifdef USE_OPENSSL + // + // JLSRTP CLIENT context constants + // + if (srtpcheck_debug) + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::init(): (a) TX-UAC-AUDIO SRTP context - CLIENT setting SRTP header size to 12\n"); + _txUACAudio.setSrtpHeaderSize(12); + logSrtpInfo("call::init(): (a) TX-UAC-VIDEO SRTP context - CLIENT setting SRTP header size to 12\n"); + _txUACVideo.setSrtpHeaderSize(12); + logSrtpInfo("call::init(): (b) RX-UAC-AUDIO SRTP context - CLIENT setting SRTP header size to 12\n"); + _rxUACAudio.setSrtpHeaderSize(12); + logSrtpInfo("call::init(): (b) RX-UAC-VIDEO SRTP context - CLIENT setting SRTP header size to 12\n"); + _rxUACVideo.setSrtpHeaderSize(12); + } + } + + // + // JLSRTP SERVER context constants + // + if (srtpcheck_debug) + { + if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::init(): (c) RX-UAS-AUDIO SRTP context - SERVER setting SRTP header size to 12\n"); + _rxUASAudio.setSrtpHeaderSize(12); + logSrtpInfo("call::init(): (c) RX-UAS-VIDEO SRTP context - SERVER setting SRTP header size to 12\n"); + _rxUASVideo.setSrtpHeaderSize(12); + logSrtpInfo("call::init(): (d) TX-UAS-AUDIO SRTP context - SERVER setting SRTP header size to 12\n"); + _txUASAudio.setSrtpHeaderSize(12); + logSrtpInfo("call::init(): (d) TX-UAS-VIDEO SRTP context - SERVER setting SRTP header size to 12\n"); + _txUASVideo.setSrtpHeaderSize(12); + } + } + + memset(_pref_audio_cs_out, 0, sizeof(_pref_audio_cs_out)); + memset(_pref_video_cs_out, 0, sizeof(_pref_video_cs_out)); +#endif // USE_OPENSSL /* check and warn on rtpstream_new_call result? -> error alloc'ing mem */ rtpstream_new_call(&rtpstream_callinfo); -#endif +#endif // RTP_STREAM #ifdef PCAPPLAY hasMediaInformation = 0; @@ -550,6 +1096,43 @@ void call::init(scenario * call_scenario, SIPpSocket *socket, struct sockaddr_st setRunning(); } +bool call::checkAckCSeq(const char* msg) +{ + static char request[65]; + unsigned long int rcseq = 0; + const char* ptr = NULL; + + rcseq = get_cseq_value(msg); + memset(request, 0, sizeof(request)); + + if ((msg[0] == 'S') && + (msg[1] == 'I') && + (msg[2] == 'P') && + (msg[3] == '/') && + (msg[4] == '2') && + (msg[5] == '.') && + (msg[6] == '0')) { + request[0]=0; + } else if (ptr = strchr(msg, ' ')) { + if ((ptr - msg) < 64) { + memcpy(request, msg, ptr - msg); + request[ptr - msg] = 0; + } else { + ERROR("SIP method too long in received message '%s'", msg); + } + } else { + ERROR("Invalid SIP message received '%s'", msg); + } + + if ((default_behaviors & DEFAULT_BEHAVIOR_BADCSEQ) && + !strncmp(request, "ACK", 3) && + (rcseq != last_recv_invite_cseq)) { + return false; + } else { + return true; + } +} + int call::_callDebug(const char *fmt, ...) { va_list ap; @@ -650,6 +1233,34 @@ call::~call() free(start_time_rtd); free(rtd_done); free(debugBuffer); + +#ifdef USE_OPENSSL + if (srtpcheck_debug) + { + fclose(_srtpctxdebugfile); + _srtpctxdebugfile = NULL; + } +#endif // USE_OPENSSL +} + +void call::setRtpEchoErrors(int value) +{ + if (!initCall) + { + call_scenario->stats->setRtpEchoErrors(value); + } +} + +int call::getRtpEchoErrors() +{ + if (!initCall) + { + return call_scenario->stats->getRtpEchoErrors(); + } + else + { + return 0; + } } void call::computeStat (CStat::E_Action P_action) @@ -1140,6 +1751,14 @@ void call::terminate(CStat::E_Action reason) new deadcall(id, reason_str); } break; + case E_AR_RTPECHO_ERROR: + computeStat(CStat::E_CALL_FAILED); + setRtpEchoErrors(1); + if (deadcall_wait && !initCall) { + sprintf(reason_str, "rtp echo error %d", msg_index); + new deadcall(id, reason_str); + } + break; case call::E_AR_NO_ERROR: case call::E_AR_STOP_CALL: /* Do nothing. */ @@ -1231,6 +1850,8 @@ bool call::next() bool call::executeMessage(message *curmsg) { + T_ActionResult actionResult = E_AR_NO_ERROR; + if (curmsg->pause_distribution || curmsg->pause_variable != -1) { unsigned int pause; if (curmsg->pause_distribution) { @@ -1285,8 +1906,17 @@ bool call::executeMessage(message *curmsg) } else if(curmsg -> M_type == MSG_TYPE_NOP) { callDebug("Executing NOP at index %d.\n", curmsg->index); do_bookkeeping(curmsg); - executeAction(NULL, curmsg); - return(next()); + actionResult = executeAction(NULL, curmsg); + last_action_result = actionResult; + if (actionResult == E_AR_RTPECHO_ERROR) + { + terminate(CStat::E_CALL_FAILED); + return false; + } + else + { + return next(); + } } else if(curmsg -> send_scheme) { @@ -1955,6 +2585,37 @@ char* call::createSendingMessage(SendingMessage *src, int P_index, char *msg_buf char *dest = msg_buffer; bool suppresscrlf = false; +#ifdef RTP_STREAM +#ifdef USE_OPENSSL + bool srtp_audio_updated = false; + bool srtp_video_updated = false; + + // OUTGOING SRTP PARAM CONTEXT + SrtpAudioInfoParams pA; + SrtpVideoInfoParams pV; + + pA.audio_found = false; + pA.primary_audio_cryptotag = 0; + memset(pA.primary_audio_cryptosuite, 0, sizeof(pA.primary_audio_cryptosuite)); + memset(pA.primary_audio_cryptokeyparams, 0, sizeof(pA.primary_audio_cryptokeyparams)); + pA.secondary_audio_cryptotag = 0; + memset(pA.secondary_audio_cryptosuite, 0, sizeof(pA.secondary_audio_cryptosuite)); + memset(pA.secondary_audio_cryptokeyparams, 0, sizeof(pA.secondary_audio_cryptokeyparams)); + pA.primary_unencrypted_audio_srtp = false; + pA.secondary_unencrypted_audio_srtp = false; + + pV.video_found = false; + pV.primary_video_cryptotag = 0; + memset(pV.primary_video_cryptosuite, 0, sizeof(pV.primary_video_cryptosuite)); + memset(pV.primary_video_cryptokeyparams, 0, sizeof(pV.primary_video_cryptokeyparams)); + pV.secondary_video_cryptotag = 0; + memset(pV.secondary_video_cryptosuite, 0, sizeof(pV.secondary_video_cryptosuite)); + memset(pV.secondary_video_cryptokeyparams, 0, sizeof(pV.secondary_video_cryptokeyparams)); + pV.primary_unencrypted_video_srtp = false; + pV.secondary_unencrypted_video_srtp = false; +#endif // USE_OPENSSL +#endif // RTP_STREAM + *dest = '\0'; for (int i = 0; i < src->numComponents(); i++) { @@ -1992,77 +2653,1151 @@ char* call::createSendingMessage(SendingMessage *src, int P_index, char *msg_buf } else { port = local_port; } - dest += snprintf(dest, left, "%d", port + comp->offset); - break; - case E_Message_Transport: - dest += snprintf(dest, left, "%s", TRANSPORT_TO_STRING(transport)); - break; - case E_Message_Local_IP_Type: - dest += snprintf(dest, left, "%s", (local_ip_is_ipv6 ? "6" : "4")); - break; - case E_Message_Server_IP: { - /* We should do this conversion once per socket creation, rather than - * repeating it every single time. */ - struct sockaddr_storage server_sockaddr; + dest += snprintf(dest, left, "%d", port + comp->offset); + break; + case E_Message_Transport: + dest += snprintf(dest, left, "%s", TRANSPORT_TO_STRING(transport)); + break; + case E_Message_Local_IP_Type: + dest += snprintf(dest, left, "%s", (local_ip_is_ipv6 ? "6" : "4")); + break; + case E_Message_Server_IP: { + /* We should do this conversion once per socket creation, rather than + * repeating it every single time. */ + struct sockaddr_storage server_sockaddr; + + sipp_socklen_t len = sizeof(server_sockaddr); + getsockname(call_socket->ss_fd, + (sockaddr *)(void *)&server_sockaddr, &len); + + char address[INET6_ADDRSTRLEN]; + if (getnameinfo(_RCAST(sockaddr*, &server_sockaddr), len, address, sizeof(address), + NULL, 0, NI_NUMERICHOST) < 0) { + ERROR_NO("Unable to get socket name information"); + } + + dest += snprintf(dest, left, "%s", address); + } + break; + case E_Message_Media_IP: + dest += snprintf(dest, left, "%s", media_ip); + break; + case E_Message_Media_Port: + { + int port = media_port + comp->offset; +#ifdef PCAPPLAY + char *begin = dest; + while (begin > msg_buffer) { + if (*begin == '\n') { + break; + } + begin--; + } + if (begin == msg_buffer) { + ERROR("Can not find beginning of a line for the media port!\n"); + } + if (strstr(begin, "audio")) { + if (media_ip_is_ipv6) { + (_RCAST(struct sockaddr_in6 *, &(play_args_a.from)))->sin6_port = port; + } else { + (_RCAST(struct sockaddr_in *, &(play_args_a.from)))->sin_port = port; + } + } else if (strstr(begin, "video")) { + if (media_ip_is_ipv6) { + (_RCAST(struct sockaddr_in6 *, &(play_args_v.from)))->sin6_port = port; + } else { + (_RCAST(struct sockaddr_in *, &(play_args_v.from)))->sin_port = port; + } + } else { + ERROR("media_port keyword with no audio or video on the current line (%s)", begin); + } +#endif + dest += sprintf(dest, "%u", port); + break; + } + case E_Message_Auto_Media_Port: + { + int port = port = media_port + (4 * (number - 1)) % 10000 + comp->offset; +#ifdef PCAPPLAY + char *begin = dest; + while (begin > msg_buffer) { + if (*begin == '\n') { + break; + } + begin--; + } + if (begin == msg_buffer) { + ERROR("Can not find beginning of a line for the media port!"); + } + play_args_t* play_args = NULL; + if (strstr(begin, "audio")) { + play_args = &play_args_a; + } else if (strstr(begin, "image")) { + play_args = &play_args_i; + } else if (strstr(begin, "video")) { + play_args = &play_args_v; + } else { + ERROR("media_port keyword with no audio or video on the current line (%s)", begin); + } + if (media_ip_is_ipv6) { + (_RCAST(struct sockaddr_in6 *, &(play_args->from)))->sin6_port = htons(port); + } else { + (_RCAST(struct sockaddr_in *, &(play_args->from)))->sin_port = htons(port); + } +#endif + dest += sprintf(dest, "%u", port); + break; + } +#ifdef RTP_STREAM + case E_Message_RTPStream_Audio_Port: + { + int temp_audio_port= 0; + // Only obtain port for RTP ([rtpstream_audio_port+0]) *BUT NOT* RTCP ([rtpstream_audio_port+1]) + if (comp->offset == 0) { + temp_audio_port = rtpstream_get_local_audioport (&rtpstream_callinfo); + if (!temp_audio_port) { + /* Make this a warning instead? */ + ERROR("cannot assign a free audio port to this call - using 0 for [rtpstream_audio_port]"); + } + } else if (comp->offset >= 1) { + temp_audio_port = rtpstream_callinfo.local_audioport + comp->offset; + } +#ifdef USE_OPENSSL + logSrtpInfo("call::createSendingMessage(): E_Message_RTPStream_Audio_Port: %d\n", temp_audio_port); +#endif // USE_OPENSSL + dest += snprintf(dest, left, "%d",temp_audio_port); + } + break; + case E_Message_RTPStream_Video_Port: + { + int temp_video_port= 0; + // Only obtain port for RTP ([rtpstream_video_port+0]) *BUT NOT* RTCP ([rtpstream_video_port+1]) + if (comp->offset == 0) { + temp_video_port = rtpstream_get_local_videoport (&rtpstream_callinfo); + if (!temp_video_port) { + /* Make this a warning instead? */ + ERROR("cannot assign a free video port to this call - using 0 for [rtpstream_video_port]"); + } + } else if (comp->offset >= 1) { + temp_video_port = rtpstream_callinfo.local_videoport + comp->offset; + } +#ifdef USE_OPENSSL + logSrtpInfo("call::createSendingMessage(): E_Message_RTPStream_Video_Port: %d\n", temp_video_port); +#endif // USE_OPENSSL + dest += snprintf(dest, left, "%d",temp_video_port); + } + break; +#ifdef USE_OPENSSL + case E_Message_CryptoTag1Audio: + { + pA.audio_found = true; + pA.primary_audio_cryptotag = 1; + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoTag1Audio() - PRIMARY - CLIENT: %d\n", pA.primary_audio_cryptotag); + _txUACAudio.setCryptoTag(pA.primary_audio_cryptotag, PRIMARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoTag1Audio() - PRIMARY - SERVER: %d\n", pA.primary_audio_cryptotag); + _txUASAudio.setCryptoTag(pA.primary_audio_cryptotag, PRIMARY_CRYPTO); + } + dest += snprintf(dest, left, "%d", pA.primary_audio_cryptotag); + srtp_audio_updated = true; + } + break; + case E_Message_CryptoTag2Audio: + { + pA.audio_found = true; + pA.secondary_audio_cryptotag = 2; + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoTag2Audio() - SECONDARY - CLIENT: %d\n", pA.secondary_audio_cryptotag); + _txUACAudio.setCryptoTag(pA.secondary_audio_cryptotag, SECONDARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoTag2Audio() - SECONDARY - SERVER: %d\n", pA.secondary_audio_cryptotag); + _txUASAudio.setCryptoTag(pA.secondary_audio_cryptotag, SECONDARY_CRYPTO); + } + dest += snprintf(dest, left, "%d", pA.secondary_audio_cryptotag); + srtp_audio_updated = true; + } + break; + case E_Message_CryptoSuiteAesCm128Sha1801Audio: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteAesCm128Sha1801Audio() - PRIMARY - CLIENT\n"); + _txUACAudio.selectCipherAlgorithm(AES_CM_128, PRIMARY_CRYPTO); + _txUACAudio.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteAesCm128Sha1801Audio() - PRIMARY - SERVER\n"); + _txUASAudio.selectCipherAlgorithm(AES_CM_128, PRIMARY_CRYPTO); + _txUASAudio.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + + if ((getSessionStateCurrent() == eNoSession) || (getSessionStateCurrent() == eCompleted)) + { + logSrtpInfo("call::createSendingMessage(): Marking preferred OFFER cryptosuite...\n"); + memset(_pref_audio_cs_out, 0, sizeof(_pref_audio_cs_out)); + strncpy(_pref_audio_cs_out, "AES_CM_128_HMAC_SHA1_80", 23); + } + else if (getSessionStateCurrent() == eOfferReceived) + { + if (sendMode == MODE_CLIENT) + { + if (!strncmp(_rxUACAudio.getCryptoSuite().c_str(), "AES_CM_128_HMAC_SHA1_80", 23)) + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite match -- CLIENT -- NO-OP...\n"); + } + else + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite mismatch -- CLIENT -- SWAPPING...\n"); + _rxUACAudio.swapCrypto(); + } + } + else if (sendMode == MODE_SERVER) + { + if (!strncmp(_rxUASAudio.getCryptoSuite().c_str(), "AES_CM_128_HMAC_SHA1_80", 23)) + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite match -- SERVER -- NO-OP...\n"); + } + else + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite mismatch -- SERVER -- SWAPPING...\n"); + _rxUASAudio.swapCrypto(); + } + } + } + + pA.audio_found = true; + strncpy(pA.primary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_80", 23); + dest += snprintf(dest, left, "%s", "AES_CM_128_HMAC_SHA1_80"); + srtp_audio_updated = true; + } + break; + case E_Message_CryptoSuiteAesCm128Sha1802Audio: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteAesCm128Sha1802Audio() - SECONDARY - CLIENT\n"); + _txUACAudio.selectCipherAlgorithm(AES_CM_128, SECONDARY_CRYPTO); + _txUACAudio.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteAesCm128Sha1802Audio() - SECONDARY - SERVER\n"); + _txUASAudio.selectCipherAlgorithm(AES_CM_128, SECONDARY_CRYPTO); + _txUASAudio.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + pA.audio_found = true; + strncpy(pA.secondary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_80", 23); + dest += snprintf(dest, left, "%s", "AES_CM_128_HMAC_SHA1_80"); + srtp_audio_updated = true; + } + break; + case E_Message_CryptoSuiteAesCm128Sha1321Audio: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteAesCm128Sha1321Audio() - PRIMARY - CLIENT\n"); + _txUACAudio.selectCipherAlgorithm(AES_CM_128, PRIMARY_CRYPTO); + _txUACAudio.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteAesCm128Sha1321Audio() - PRIMARY - SERVER\n"); + _txUASAudio.selectCipherAlgorithm(AES_CM_128, PRIMARY_CRYPTO); + _txUASAudio.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + + if ((getSessionStateCurrent() == eNoSession) || (getSessionStateCurrent() == eCompleted)) + { + logSrtpInfo("call::createSendingMessage(): Marking preferred OFFER cryptosuite...\n"); + memset(_pref_audio_cs_out, 0, sizeof(_pref_audio_cs_out)); + strncpy(_pref_audio_cs_out, "AES_CM_128_HMAC_SHA1_32", 23); + } + else if (getSessionStateCurrent() == eOfferReceived) + { + if (sendMode == MODE_CLIENT) + { + if (!strncmp(_rxUACAudio.getCryptoSuite().c_str(), "AES_CM_128_HMAC_SHA1_32", 23)) + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite match -- CLIENT -- NO-OP...\n"); + } + else + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite mismatch -- CLIENT -- SWAPPING...\n"); + _rxUACAudio.swapCrypto(); + } + } + else if (sendMode == MODE_SERVER) + { + if (!strncmp(_rxUASAudio.getCryptoSuite().c_str(), "AES_CM_128_HMAC_SHA1_32", 23)) + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite match -- SERVER -- NO-OP...\n"); + } + else + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite mismatch -- SERVER -- SWAPPING...\n"); + _rxUASAudio.swapCrypto(); + } + } + } + + pA.audio_found = true; + strncpy(pA.primary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_32", 23); + dest += snprintf(dest, left, "%s", "AES_CM_128_HMAC_SHA1_32"); + srtp_audio_updated = true; + } + break; + case E_Message_CryptoSuiteAesCm128Sha1322Audio: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteAesCm128Sha1322Audio() - SECONDARY - CLIENT\n"); + _txUACAudio.selectCipherAlgorithm(AES_CM_128, SECONDARY_CRYPTO); + _txUACAudio.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteAesCm128Sha1322Audio() - SECONDARY - SERVER\n"); + _txUASAudio.selectCipherAlgorithm(AES_CM_128, SECONDARY_CRYPTO); + _txUASAudio.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + pA.audio_found = true; + strncpy(pA.secondary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_32", 23); + dest += snprintf(dest, left, "%s", "AES_CM_128_HMAC_SHA1_32"); + srtp_audio_updated = true; + } + break; + case E_Message_CryptoSuiteNullSha1801Audio: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteNullSha1801Audio() - PRIMARY - CLIENT\n"); + _txUACAudio.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); + _txUACAudio.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteNullSha1801Audio() - PRIMARY - SERVER\n"); + _txUASAudio.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); + _txUASAudio.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + + if ((getSessionStateCurrent() == eNoSession) || (getSessionStateCurrent() == eCompleted)) + { + logSrtpInfo("call::createSendingMessage(): Marking preferred OFFER cryptosuite...\n"); + memset(_pref_audio_cs_out, 0, sizeof(_pref_audio_cs_out)); + strncpy(_pref_audio_cs_out, "NULL_HMAC_SHA1_80", 17); + } + else if (getSessionStateCurrent() == eOfferReceived) + { + if (sendMode == MODE_CLIENT) + { + if (!strncmp(_rxUACAudio.getCryptoSuite().c_str(), "NULL_HMAC_SHA1_80", 17)) + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite match -- CLIENT -- NO-OP...\n"); + } + else + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite mismatch -- CLIENT -- SWAPPING...\n"); + _rxUACAudio.swapCrypto(); + } + } + else if (sendMode == MODE_SERVER) + { + if (!strncmp(_rxUASAudio.getCryptoSuite().c_str(), "NULL_HMAC_SHA1_80", 17)) + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite match -- SERVER -- NO-OP...\n"); + } + else + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite mismatch -- SERVER -- SWAPPING...\n"); + _rxUASAudio.swapCrypto(); + } + } + } + + pA.audio_found = true; + strncpy(pA.primary_audio_cryptosuite, "NULL_HMAC_SHA1_80", 17); + dest += snprintf(dest, left, "%s", "NULL_HMAC_SHA1_80"); + srtp_audio_updated = true; + } + break; + case E_Message_CryptoSuiteNullSha1802Audio: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteNullSha1802Audio() - SECONDARY - CLIENT\n"); + _txUACAudio.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); + _txUACAudio.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteNullSha1802Audio() - SECONDARY - SERVER\n"); + _txUASAudio.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); + _txUASAudio.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + pA.audio_found = true; + strncpy(pA.secondary_audio_cryptosuite, "NULL_HMAC_SHA1_80", 17); + dest += snprintf(dest, left, "%s", "NULL_HMAC_SHA1_80"); + srtp_audio_updated = true; + } + break; + case E_Message_CryptoSuiteNullSha1321Audio: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteNullSha1321Audio() - PRIMARY - CLIENT\n"); + _txUACAudio.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); + _txUACAudio.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteNullSha1321Audio() - PRIMARY - SERVER\n"); + _txUASAudio.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); + _txUASAudio.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + + if ((getSessionStateCurrent() == eNoSession) || (getSessionStateCurrent() == eCompleted)) + { + logSrtpInfo("call::createSendingMessage(): Marking preferred OFFER cryptosuite...\n"); + memset(_pref_audio_cs_out, 0, sizeof(_pref_audio_cs_out)); + strncpy(_pref_audio_cs_out, "NULL_HMAC_SHA1_32", 17); + } + else if (getSessionStateCurrent() == eOfferReceived) + { + if (sendMode == MODE_CLIENT) + { + if (!strncmp(_rxUACAudio.getCryptoSuite().c_str(), "NULL_HMAC_SHA1_32", 17)) + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite match -- CLIENT -- NO-OP...\n"); + } + else + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite mismatch -- CLIENT -- SWAPPING...\n"); + _rxUACAudio.swapCrypto(); + } + } + else if (sendMode == MODE_SERVER) + { + if (!strncmp(_rxUASAudio.getCryptoSuite().c_str(), "NULL_HMAC_SHA1_32", 17)) + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite match -- SERVER -- NO-OP...\n"); + } + else + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite mismatch -- SERVER -- SWAPPING...\n"); + _rxUASAudio.swapCrypto(); + } + } + } + + pA.audio_found = true; + strncpy(pA.primary_audio_cryptosuite, "NULL_HMAC_SHA1_32", 17); + dest += snprintf(dest, left, "%s", "NULL_HMAC_SHA1_32"); + srtp_audio_updated = true; + } + break; + case E_Message_CryptoSuiteNullSha1322Audio: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteNullSha1322Audio() - SECONDARY - CLIENT\n"); + _txUACAudio.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); + _txUACAudio.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteNullSha1322Audio() - SECONDARY - SERVER\n"); + _txUASAudio.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); + _txUASAudio.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + pA.audio_found = true; + strncpy(pA.secondary_audio_cryptosuite, "NULL_HMAC_SHA1_32", 17); + dest += snprintf(dest, left, "%s", "NULL_HMAC_SHA1_32"); + srtp_audio_updated = true; + } + break; + case E_Message_CryptoKeyParams1Audio: + { + std::string mks; + + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams1Audio() - PRIMARY - CLIENT - component offset:%d\n", comp->offset); + if (comp->offset >= 0) + { + _txUACAudio.generateMasterKey(PRIMARY_CRYPTO); + _txUACAudio.generateMasterSalt(PRIMARY_CRYPTO); + _txUACAudio.encodeMasterKeySalt(mks, PRIMARY_CRYPTO); + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams1Audio() - PRIMARY - CLIENT - generating new concatenated base64-encoded master key/salt:%s\n", mks.c_str()); + } + else + { + _txUACAudio.encodeMasterKeySalt(mks, PRIMARY_CRYPTO); + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams1Audio() - PRIMARY - CLIENT - reusing old concatenated base64-encoded master key/salt:%s\n", mks.c_str()); + } + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams1Audio() - PRIMARY - SERVER - component offset:%d\n", comp->offset); + if (comp->offset >= 0) + { + _txUASAudio.generateMasterKey(PRIMARY_CRYPTO); + _txUASAudio.generateMasterSalt(PRIMARY_CRYPTO); + _txUASAudio.encodeMasterKeySalt(mks, PRIMARY_CRYPTO); + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams1Audio() - PRIMARY - SERVER - generating new concatenated base64-encoded master key/salt:%s\n", mks.c_str()); + } + else + { + _txUASAudio.encodeMasterKeySalt(mks, PRIMARY_CRYPTO); + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams1Audio() - PRIMARY - SERVER - reusing old concatenated base64-encoded master key/salt:%s\n", mks.c_str()); + } + } + pA.audio_found = true; + strncpy(pA.primary_audio_cryptokeyparams, mks.c_str(), 40); + dest += snprintf(dest, left, "%s", pA.primary_audio_cryptokeyparams); + srtp_audio_updated = true; + } + break; + case E_Message_CryptoKeyParams2Audio: + { + std::string mks; + + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams2Audio() - SECONDARY - CLIENT - component offset:%d\n", comp->offset); + if (comp->offset >= 0) + { + _txUACAudio.generateMasterKey(SECONDARY_CRYPTO); + _txUACAudio.generateMasterSalt(SECONDARY_CRYPTO); + _txUACAudio.encodeMasterKeySalt(mks, SECONDARY_CRYPTO); + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams2Audio() - SECONDARY - CLIENT - generating new concatenated base64-encoded master key/salt:%s\n", mks.c_str()); + } + else + { + _txUACAudio.encodeMasterKeySalt(mks, SECONDARY_CRYPTO); + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams2Audio() - SECONDARY - CLIENT - reusing old concatenated base64-encoded master key/salt:%s\n", mks.c_str()); + } + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams2Audio() - SECONDARY - SERVER - component offset:%d\n", comp->offset); + if (comp->offset >= 0) + { + _txUASAudio.generateMasterKey(SECONDARY_CRYPTO); + _txUASAudio.generateMasterSalt(SECONDARY_CRYPTO); + _txUASAudio.encodeMasterKeySalt(mks, SECONDARY_CRYPTO); + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams2Audio() - SECONDARY - SERVER - generating new concatenated base64-encoded master key/salt:%s\n", mks.c_str()); + } + else + { + _txUASAudio.encodeMasterKeySalt(mks, SECONDARY_CRYPTO); + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams2Audio() - SECONDARY - SERVER - reusing old concatenated base64-encoded master key/salt:%s\n", mks.c_str()); + } + } + pA.audio_found = true; + strncpy(pA.secondary_audio_cryptokeyparams, mks.c_str(), 40); + dest += snprintf(dest, left, "%s", pA.secondary_audio_cryptokeyparams); + srtp_audio_updated = true; + } + break; + case E_Message_UEAesCm128Sha1801Audio: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_UEAesCm128Sha1801Audio() - PRIMARY - CLIENT\n"); + _txUACAudio.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); /* Request JLSRTP NOT to encrypt */ + _txUACAudio.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_UEAesCm128Sha1801Audio() - PRIMARY - SERVER\n"); + _txUASAudio.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); /* Request JLSRTP NOT to encrypt */ + _txUASAudio.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + pA.audio_found = true; + pA.primary_unencrypted_audio_srtp = true; + strncpy(pA.primary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_80", 23); + dest += snprintf(dest, left, "%s", "UNENCRYPTED_SRTP"); + srtp_audio_updated = true; + } + break; + case E_Message_UEAesCm128Sha1802Audio: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_UEAesCm128Sha1802Audio() - SECONDARY - CLIENT\n"); + _txUACAudio.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); /* Request JLSRTP NOT to encrypt */ + _txUACAudio.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_UEAesCm128Sha1802Audio() - SECONDARY - SERVER\n"); + _txUASAudio.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); /* Request JLSRTP NOT to encrypt */ + _txUASAudio.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + pA.audio_found = true; + pA.secondary_unencrypted_audio_srtp = true; + strncpy(pA.secondary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_80", 23); + dest += snprintf(dest, left, "%s", "UNENCRYPTED_SRTP"); + srtp_audio_updated = true; + } + break; + case E_Message_UEAesCm128Sha1321Audio: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_UEAesCm128Sha1321Audio() - PRIMARY - CLIENT\n"); + _txUACAudio.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); /* Request JLSRTP NOT to encrypt */ + _txUACAudio.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_UEAesCm128Sha1321Audio() - PRIMARY - SERVER\n"); + _txUASAudio.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); /* Request JLSRTP NOT to encrypt */ + _txUASAudio.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + pA.audio_found = true; + pA.primary_unencrypted_audio_srtp = true; + strncpy(pA.primary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_32", 23); + dest += snprintf(dest, left, "%s", "UNENCRYPTED_SRTP"); + srtp_audio_updated = true; + } + break; + case E_Message_UEAesCm128Sha1322Audio: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_UEAesCm128Sha1322Audio() - SECONDARY - CLIENT\n"); + _txUACAudio.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); /* Request JLSRTP NOT to encrypt */ + _txUACAudio.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_UEAesCm128Sha1322Audio() - SECONDARY - SERVER\n"); + _txUASAudio.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); /* Request JLSRTP NOT to encrypt */ + _txUASAudio.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + pA.audio_found = true; + pA.secondary_unencrypted_audio_srtp = true; + strncpy(pA.secondary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_32", 23); + dest += snprintf(dest, left, "%s", "UNENCRYPTED_SRTP"); + srtp_audio_updated = true; + } + break; + case E_Message_CryptoTag1Video: + { + pV.video_found = true; + pV.primary_video_cryptotag = 1; + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoTag1Video() - PRIMARY - CLIENT: %d\n", pV.primary_video_cryptotag); + _txUACVideo.setCryptoTag(pV.primary_video_cryptotag, PRIMARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoTag1Video() - PRIMARY - SERVER: %d\n", pV.primary_video_cryptotag); + _txUASVideo.setCryptoTag(pV.primary_video_cryptotag, PRIMARY_CRYPTO); + } + dest += snprintf(dest, left, "%d", pV.primary_video_cryptotag); + srtp_video_updated = true; + } + break; + case E_Message_CryptoTag2Video: + { + pV.video_found = true; + pV.secondary_video_cryptotag = 2; + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoTag2Video() - SECONDARY - CLIENT: %d\n", pV.secondary_video_cryptotag); + _txUACVideo.setCryptoTag(pV.secondary_video_cryptotag, SECONDARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoTag2Video() - SECONDARY - SERVER: %d\n", pV.secondary_video_cryptotag); + _txUASVideo.setCryptoTag(pV.secondary_video_cryptotag, SECONDARY_CRYPTO); + } + dest += snprintf(dest, left, "%d", pV.secondary_video_cryptotag); + srtp_video_updated = true; + } + break; + case E_Message_CryptoSuiteAesCm128Sha1801Video: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteAesCm128Sha1801Video() - PRIMARY - CLIENT\n"); + _txUACVideo.selectCipherAlgorithm(AES_CM_128, PRIMARY_CRYPTO); + _txUACVideo.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteAesCm128Sha1801Video() - PRIMARY - SERVER\n"); + _txUASVideo.selectCipherAlgorithm(AES_CM_128, PRIMARY_CRYPTO); + _txUASVideo.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + + if ((getSessionStateCurrent() == eNoSession) || (getSessionStateCurrent() == eCompleted)) + { + logSrtpInfo("call::createSendingMessage(): Marking preferred OFFER cryptosuite...\n"); + memset(_pref_video_cs_out, 0, sizeof(_pref_video_cs_out)); + strncpy(_pref_video_cs_out, "AES_CM_128_HMAC_SHA1_80", 23); + } + else if (getSessionStateCurrent() == eOfferReceived) + { + if (sendMode == MODE_CLIENT) + { + if (!strncmp(_rxUACVideo.getCryptoSuite().c_str(), "AES_CM_128_HMAC_SHA1_80", 23)) + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite match -- CLIENT -- NO-OP...\n"); + } + else + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite mismatch -- CLIENT -- SWAPPING...\n"); + _rxUACVideo.swapCrypto(); + } + } + else if (sendMode == MODE_SERVER) + { + if (!strncmp(_rxUASVideo.getCryptoSuite().c_str(), "AES_CM_128_HMAC_SHA1_80", 23)) + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite match -- SERVER -- NO-OP...\n"); + } + else + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite mismatch -- SERVER -- SWAPPING...\n"); + _rxUASVideo.swapCrypto(); + } + } + } + + pV.video_found = true; + strncpy(pV.primary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_80", 23); + dest += snprintf(dest, left, "%s", "AES_CM_128_HMAC_SHA1_80"); + srtp_video_updated = true; + } + break; + case E_Message_CryptoSuiteAesCm128Sha1802Video: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteAesCm128Sha1802Video() - SECONDARY - CLIENT\n"); + _txUACVideo.selectCipherAlgorithm(AES_CM_128, SECONDARY_CRYPTO); + _txUACVideo.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteAesCm128Sha1802Video() - SECONDARY - SERVER\n"); + _txUASVideo.selectCipherAlgorithm(AES_CM_128, SECONDARY_CRYPTO); + _txUASVideo.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + pV.video_found = true; + strncpy(pV.secondary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_80", 23); + dest += snprintf(dest, left, "%s", "AES_CM_128_HMAC_SHA1_80"); + srtp_video_updated = true; + } + break; + case E_Message_CryptoSuiteAesCm128Sha1321Video: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteAesCm128Sha1321Video() - PRIMARY - CLIENT\n"); + _txUACVideo.selectCipherAlgorithm(AES_CM_128, PRIMARY_CRYPTO); + _txUACVideo.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteAesCm128Sha1321Video() - PRIMARY - SERVER\n"); + _txUASVideo.selectCipherAlgorithm(AES_CM_128, PRIMARY_CRYPTO); + _txUASVideo.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + + if ((getSessionStateCurrent() == eNoSession) || (getSessionStateCurrent() == eCompleted)) + { + logSrtpInfo("call::createSendingMessage(): Marking preferred OFFER cryptosuite...\n"); + memset(_pref_video_cs_out, 0, sizeof(_pref_video_cs_out)); + strncpy(_pref_video_cs_out, "AES_CM_128_HMAC_SHA1_32", 23); + } + else if (getSessionStateCurrent() == eOfferReceived) + { + if (sendMode == MODE_CLIENT) + { + if (!strncmp(_rxUACVideo.getCryptoSuite().c_str(), "AES_CM_128_HMAC_SHA1_32", 23)) + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite match -- CLIENT -- NO-OP...\n"); + } + else + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite mismatch -- CLIENT -- SWAPPING...\n"); + _rxUACVideo.swapCrypto(); + } + } + else if (sendMode == MODE_SERVER) + { + if (!strncmp(_rxUASVideo.getCryptoSuite().c_str(), "AES_CM_128_HMAC_SHA1_32", 23)) + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite match -- SERVER -- NO-OP...\n"); + } + else + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite mismatch -- SERVER -- SWAPPING...\n"); + _rxUASVideo.swapCrypto(); + } + } + } + + pV.video_found = true; + strncpy(pV.primary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_32", 23); + dest += snprintf(dest, left, "%s", "AES_CM_128_HMAC_SHA1_32"); + srtp_video_updated = true; + } + break; + case E_Message_CryptoSuiteAesCm128Sha1322Video: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteAesCm128Sha1322Video() - SECONDARY - CLIENT\n"); + _txUACVideo.selectCipherAlgorithm(AES_CM_128, SECONDARY_CRYPTO); + _txUACVideo.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteAesCm128Sha1322Video() - SECONDARY - SERVER\n"); + _txUASVideo.selectCipherAlgorithm(AES_CM_128, SECONDARY_CRYPTO); + _txUASVideo.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + pV.video_found = true; + strncpy(pV.secondary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_32", 23); + dest += snprintf(dest, left, "%s", "AES_CM_128_HMAC_SHA1_32"); + srtp_video_updated = true; + } + break; + case E_Message_CryptoSuiteNullSha1801Video: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteNullSha1801Video() - PRIMARY - CLIENT\n"); + _txUACVideo.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); + _txUACVideo.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteNullSha1801Video() - PRIMARY - SERVER\n"); + _txUASVideo.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); + _txUASVideo.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + + if ((getSessionStateCurrent() == eNoSession) || (getSessionStateCurrent() == eCompleted)) + { + logSrtpInfo("call::createSendingMessage(): Marking preferred OFFER cryptosuite...\n"); + memset(_pref_video_cs_out, 0, sizeof(_pref_video_cs_out)); + strncpy(_pref_video_cs_out, "NULL_HMAC_SHA1_80", 17); + } + else if (getSessionStateCurrent() == eOfferReceived) + { + if (sendMode == MODE_CLIENT) + { + if (!strncmp(_rxUACVideo.getCryptoSuite().c_str(), "NULL_HMAC_SHA1_80", 17)) + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite match -- CLIENT -- NO-OP...\n"); + } + else + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite mismatch -- CLIENT -- SWAPPING...\n"); + _rxUACVideo.swapCrypto(); + } + } + else if (sendMode == MODE_SERVER) + { + if (!strncmp(_rxUASVideo.getCryptoSuite().c_str(), "NULL_HMAC_SHA1_80", 17)) + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite match -- SERVER -- NO-OP...\n"); + } + else + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite mismatch -- SERVER -- SWAPPING...\n"); + _rxUASVideo.swapCrypto(); + } + } + } - sipp_socklen_t len = sizeof(server_sockaddr); - getsockname(call_socket->ss_fd, - (sockaddr *)(void *)&server_sockaddr, &len); + pV.video_found = true; + strncpy(pV.primary_video_cryptosuite, "NULL_HMAC_SHA1_80", 17); + dest += snprintf(dest, left, "%s", "NULL_HMAC_SHA1_80"); + srtp_video_updated = true; + } + break; + case E_Message_CryptoSuiteNullSha1802Video: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteNullSha1802Video() - SECONDARY - CLIENT\n"); + _txUACVideo.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); + _txUACVideo.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteNullSha1802Video() - SECONDARY - SERVER\n"); + _txUASVideo.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); + _txUASVideo.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + pV.video_found = true; + strncpy(pV.secondary_video_cryptosuite, "NULL_HMAC_SHA1_80", 17); + dest += snprintf(dest, left, "%s", "NULL_HMAC_SHA1_80"); + srtp_video_updated = true; + } + break; + case E_Message_CryptoSuiteNullSha1321Video: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteNullSha1321Video() - PRIMARY - CLIENT\n"); + _txUACVideo.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); + _txUACVideo.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteNullSha1321Video() - PRIMARY - SERVER\n"); + _txUASVideo.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); + _txUASVideo.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } - char address[INET6_ADDRSTRLEN]; - if (getnameinfo(_RCAST(sockaddr*, &server_sockaddr), len, address, sizeof(address), - NULL, 0, NI_NUMERICHOST) < 0) { - ERROR_NO("Unable to get socket name information"); + if ((getSessionStateCurrent() == eNoSession) || (getSessionStateCurrent() == eCompleted)) + { + logSrtpInfo("call::createSendingMessage(): Marking preferred OFFER cryptosuite...\n"); + memset(_pref_video_cs_out, 0, sizeof(_pref_video_cs_out)); + strncpy(_pref_video_cs_out, "NULL_HMAC_SHA1_32", 17); + } + else if (getSessionStateCurrent() == eOfferReceived) + { + if (sendMode == MODE_CLIENT) + { + if (!strncmp(_rxUACVideo.getCryptoSuite().c_str(), "NULL_HMAC_SHA1_32", 17)) + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite match -- CLIENT -- NO-OP...\n"); + } + else + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite mismatch -- CLIENT -- SWAPPING...\n"); + _rxUACVideo.swapCrypto(); + } + } + else if (sendMode == MODE_SERVER) + { + if (!strncmp(_rxUASVideo.getCryptoSuite().c_str(), "NULL_HMAC_SHA1_32", 17)) + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite match -- SERVER -- NO-OP...\n"); + } + else + { + logSrtpInfo("call::createSendingMessage(): Preferred ANSWER cryptosuite mismatch -- SERVER -- SWAPPING...\n"); + _rxUASVideo.swapCrypto(); + } + } } - dest += snprintf(dest, left, "%s", address); + pV.video_found = true; + strncpy(pV.primary_video_cryptosuite, "NULL_HMAC_SHA1_32", 17); + dest += snprintf(dest, left, "%s", "NULL_HMAC_SHA1_32"); + srtp_video_updated = true; } break; - case E_Message_Media_IP: - dest += snprintf(dest, left, "%s", media_ip); - break; - case E_Message_Media_Port: - case E_Message_Auto_Media_Port: { - int port = media_port + comp->offset; - if (comp->type == E_Message_Auto_Media_Port) { - port = media_port + (4 * (number - 1)) % 10000 + comp->offset; + case E_Message_CryptoSuiteNullSha1322Video: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteNullSha1322Video() - SECONDARY - CLIENT\n"); + _txUACVideo.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); + _txUACVideo.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); } -#ifdef PCAPPLAY - char *begin = dest; - while (begin > msg_buffer) { - if (*begin == '\n') { - break; + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoSuiteNullSha1322Video() - SECONDARY - SERVER\n"); + _txUASVideo.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); + _txUASVideo.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + pV.video_found = true; + strncpy(pV.secondary_video_cryptosuite, "NULL_HMAC_SHA1_32", 17); + dest += snprintf(dest, left, "%s", "NULL_HMAC_SHA1_32"); + srtp_video_updated = true; + } + break; + case E_Message_CryptoKeyParams1Video: + { + std::string mks; + + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams1Video() - PRIMARY - CLIENT - component offset:%d\n", comp->offset); + if (comp->offset >= 0) + { + _txUACVideo.generateMasterKey(PRIMARY_CRYPTO); + _txUACVideo.generateMasterSalt(PRIMARY_CRYPTO); + _txUACVideo.encodeMasterKeySalt(mks, PRIMARY_CRYPTO); + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams1Video() - PRIMARY - CLIENT - generating new concatenated base64-encoded master key/salt:%s\n", mks.c_str()); + } + else + { + _txUACVideo.encodeMasterKeySalt(mks, PRIMARY_CRYPTO); + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams1Video() - PRIMARY - CLIENT - reusing old concatenated base64-encoded master key/salt:%s\n", mks.c_str()); } - begin--; } - if (begin == msg_buffer) { - ERROR("Can not find beginning of a line for the media port!"); + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams1Video() - PRIMARY - SERVER - component offset:\n", comp->offset); + if (comp->offset >= 0) + { + _txUASVideo.generateMasterKey(PRIMARY_CRYPTO); + _txUASVideo.generateMasterSalt(PRIMARY_CRYPTO); + _txUASVideo.encodeMasterKeySalt(mks, PRIMARY_CRYPTO); + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams1Video() - PRIMARY - SERVER - generating new concatenated base64-encoded master key/salt:%s\n", mks.c_str()); + } + else + { + _txUASVideo.encodeMasterKeySalt(mks, PRIMARY_CRYPTO); + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams1Video() - PRIMARY - SERVER - reusing old concatenated base64-encoded master key/salt:%s\n", mks.c_str()); + } } - play_args_t* play_args = NULL; - if (strstr(begin, "audio")) { - play_args = &play_args_a; - } else if (strstr(begin, "image")) { - play_args = &play_args_i; - } else if (strstr(begin, "video")) { - play_args = &play_args_v; - } else { - ERROR("media_port keyword with no audio or video on the current line (%s)", begin); + pV.video_found = true; + strncpy(pV.primary_video_cryptokeyparams, mks.c_str(), 40); + dest += snprintf(dest, left, "%s", pV.primary_video_cryptokeyparams); + srtp_video_updated = true; + } + break; + case E_Message_CryptoKeyParams2Video: + { + std::string mks; + + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams2Video() - SECONDARY - CLIENT - component offset:%d\n", comp->offset); + if (comp->offset >= 0) + { + _txUACVideo.generateMasterKey(SECONDARY_CRYPTO); + _txUACVideo.generateMasterSalt(SECONDARY_CRYPTO); + _txUACVideo.encodeMasterKeySalt(mks, SECONDARY_CRYPTO); + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams2Video() - SECONDARY - CLIENT - generating new concatenated base64-encoded master key/salt:%s\n", mks.c_str()); + } + else + { + _txUACVideo.encodeMasterKeySalt(mks, SECONDARY_CRYPTO); + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams2Video() - SECONDARY - CLIENT - reusing old concatenated base64-encoded master key/salt:%s\n", mks.c_str()); + } } - if (media_ip_is_ipv6) { - (_RCAST(struct sockaddr_in6 *, &(play_args->from)))->sin6_port = htons(port); - } else { - (_RCAST(struct sockaddr_in *, &(play_args->from)))->sin_port = htons(port); + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams2Video() - SECONDARY - SERVER - component offset:%d\n", comp->offset); + if (comp->offset >= 0) + { + _txUASVideo.generateMasterKey(SECONDARY_CRYPTO); + _txUASVideo.generateMasterSalt(SECONDARY_CRYPTO); + _txUASVideo.encodeMasterKeySalt(mks, SECONDARY_CRYPTO); + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams2Video() - SECONDARY - SERVER - generating new concatenated base64-encoded master key/salt:%s\n", mks.c_str()); + } + else + { + _txUASVideo.encodeMasterKeySalt(mks, SECONDARY_CRYPTO); + logSrtpInfo("call::createSendingMessage(): E_Message_CryptoKeyParams2Video() - SECONDARY - SERVER - reusing old concatenated base64-encoded master key/salt:%s\n", mks.c_str()); + } } -#endif - dest += sprintf(dest, "%u", port); - break; + pV.video_found = true; + strncpy(pV.secondary_video_cryptokeyparams, mks.c_str(), 40); + dest += snprintf(dest, left, "%s", pV.secondary_video_cryptokeyparams); + srtp_video_updated = true; } -#ifdef RTP_STREAM - case E_Message_RTPStream_Audio_Port: /* DEPRECATED */ - case E_Message_RTPStream_Video_Port: /* DEPRECATED */ - dest += sprintf(dest, "%u", media_port); - break; -#endif + break; + case E_Message_UEAesCm128Sha1801Video: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_UEAesCm128Sha1801Video() - PRIMARY - CLIENT\n"); + _txUACVideo.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); /* Request JLSRTP NOT to encrypt */ + _txUACVideo.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_UEAesCm128Sha1801Video() - PRIMARY - SERVER\n"); + _txUASVideo.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); /* Request JLSRTP NOT to encrypt */ + _txUASVideo.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + pV.video_found = true; + pV.primary_unencrypted_video_srtp = true; + strncpy(pV.primary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_80", 23); + dest += snprintf(dest, left, "%s", "UNENCRYPTED_SRTP"); + srtp_video_updated = true; + } + break; + case E_Message_UEAesCm128Sha1802Video: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_UEAesCm128Sha1802Video() - SECONDARY - CLIENT\n"); + _txUACVideo.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); /* Request JLSRTP NOT to encrypt */ + _txUACVideo.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_UEAesCm128Sha1802Video() - SECONDARY - SERVER\n"); + _txUASVideo.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); /* Request JLSRTP NOT to encrypt */ + _txUASVideo.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + pV.video_found = true; + pV.secondary_unencrypted_video_srtp = true; + strncpy(pV.secondary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_80", 23); + dest += snprintf(dest, left, "%s", "UNENCRYPTED_SRTP"); + srtp_video_updated = true; + } + break; + case E_Message_UEAesCm128Sha1321Video: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_UEAesCm128Sha1321Video() - PRIMARY - CLIENT\n"); + _txUACVideo.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); /* Request JLSRTP NOT to encrypt */ + _txUACVideo.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_UEAesCm128Sha1321Video() - PRIMARY - SERVER\n"); + _txUASVideo.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); /* Request JLSRTP NOT to encrypt */ + _txUASVideo.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + pV.video_found = true; + pV.primary_unencrypted_video_srtp = true; + strncpy(pV.primary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_32", 23); + dest += snprintf(dest, left, "%s", "UNENCRYPTED_SRTP"); + srtp_video_updated = true; + } + break; + case E_Message_UEAesCm128Sha1322Video: + { + if (sendMode == MODE_CLIENT) + { + logSrtpInfo("call::createSendingMessage(): E_Message_UEAesCm128Sha1322Video() - SECONDARY - CLIENT\n"); + _txUACVideo.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); /* Request JLSRTP NOT to encrypt */ + _txUACVideo.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + else if (sendMode == MODE_SERVER) + { + logSrtpInfo("call::createSendingMessage(): E_Message_UEAesCm128Sha1322Video() - SECONDARY - SERVER\n"); + _txUASVideo.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); /* Request JLSRTP NOT to encrypt */ + _txUASVideo.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + pV.video_found = true; + pV.secondary_unencrypted_video_srtp = true; + strncpy(pV.secondary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_32", 23); + dest += snprintf(dest, left, "%s", "UNENCRYPTED_SRTP"); + srtp_video_updated = true; + } + break; +#endif // USE_OPENSSL +#endif // RTP_STREAM case E_Message_Media_IP_Type: dest += snprintf(dest, left, "%s", (media_ip_is_ipv6 ? "6" : "4")); break; @@ -2385,6 +4120,74 @@ char* call::createSendingMessage(SendingMessage *src, int P_index, char *msg_buf SendingMessage::freeMessageComponent(auth_comp); } +#ifdef RTP_STREAM +#ifdef USE_OPENSSL + // PASS OUTGOING SRTP PARAMETERS... + if (srtp_audio_updated && (pA.primary_audio_cryptotag != 0)) + { + rtpstream_set_srtp_audio_local(&rtpstream_callinfo, pA); + if (sendMode == MODE_CLIENT) + { + // + // RX-UAC-AUDIO SRTP context (b) -- SSRC/IPADDRESS/PORT + // + CryptoContextID rxUACA; + rxUACA.ssrc = rtpstream_callinfo.taskinfo->audio_ssrc_id; + rxUACA.address = media_ip; + rxUACA.port = rtpstream_callinfo.local_audioport; + logSrtpInfo("call::createSendingMessage(): (b) RX-UAC-AUDIO SRTP context - ssrc:0x%08x address:%s port:%d\n", rxUACA.ssrc, rxUACA.address.c_str(), rxUACA.port); + _rxUACAudio.setID(rxUACA); + } + } + if (srtp_video_updated && (pV.primary_video_cryptotag != 0)) + { + rtpstream_set_srtp_video_local(&rtpstream_callinfo, pV); + if (sendMode == MODE_CLIENT) + { + // + // RX-UAC-VIDEO SRTP context (b) -- SSRC/IPADDRESS/PORT + // + CryptoContextID rxUACV; + rxUACV.ssrc = rtpstream_callinfo.taskinfo->video_ssrc_id; + rxUACV.address = media_ip; + rxUACV.port = rtpstream_callinfo.local_videoport; + logSrtpInfo("call::createSendingMessage(): (b) RX-UAC-VIDEO SRTP context - ssrc:0x%08x address:%s port:%d\n", rxUACV.ssrc, rxUACV.address.c_str(), rxUACV.port); + _rxUACVideo.setID(rxUACV); + } + } +#endif // USE_OPENSSL + + if (body && + !strcmp(get_header_content(msg_buffer, (char*)"Content-Type:"), "application/sdp")) + { + if (getSessionStateCurrent() == eNoSession) + { +#ifdef USE_OPENSSL + logSrtpInfo("call::createSendingMessage(): Switching session state: eNoSession --> eOfferSent\n"); +#endif // USE_OPENSSL + setSessionState(eOfferSent); + } + else if (getSessionStateCurrent() == eCompleted) + { +#ifdef USE_OPENSSL + logSrtpInfo("call::createSendingMessage(): Switching session state: eCompleted --> eOfferSent\n"); +#endif // USE_OPENSSL + setSessionState(eOfferSent); + } + else if (getSessionStateCurrent() == eOfferReceived) + { +#ifdef USE_OPENSSL + logSrtpInfo("call::createSendingMessage(): Switching session state: eOfferReceived --> eAnswerSent\n"); +#endif // USE_OPENSSL + setSessionState(eAnswerSent); +#ifdef USE_OPENSSL + logSrtpInfo("call::createSendingMessage(): Switching session state: eAnswerSent --> eCompleted\n"); +#endif // USE_OPENSSL + setSessionState(eCompleted); + } + } +#endif // RTP_STREAM + return msg_buffer; } @@ -2733,6 +4536,7 @@ bool call::process_incoming(const char* msg, const struct sockaddr_storage* src) int search_index; bool found = false; T_ActionResult actionResult; + unsigned long int invite_cseq = 0; getmilliseconds(); callDebug("Processing %zu byte incoming message for call-ID %s (hash %lu):\n%s\n\n", @@ -2760,6 +4564,13 @@ bool call::process_incoming(const char* msg, const struct sockaddr_storage* src) responsecseqmethod[0] = '\0'; txn[0] = '\0'; + if (!checkAckCSeq(msg)) { + WARNING("ACK CSeq value does NOT match value of related INVITE CSeq -- aborting call\n"); + computeStat(CStat::E_CALL_FAILED); + delete this; + return false; + } + /* Check that we have a To:-header */ if (!get_header(msg, "To:", false)[0] && !process_unexpected(msg)) { return false; @@ -2821,13 +4632,588 @@ bool call::process_incoming(const char* msg, const struct sockaddr_storage* src) #ifdef RTP_STREAM /* Check if message has a SDP in it; and extract media information. */ if (!strcmp(get_header_content(msg, "Content-Type:"), "application/sdp") && - hasMedia == 1 && !curmsg->ignoresdp) { - const char* ptr = get_header_content(msg, "Content-Length:"); - if (ptr && atoll(ptr) > 0) { - extract_rtp_remote_addr(msg); - } - } -#endif + (hasMedia == 1) && + (!curmsg->ignoresdp)) + { + const char* ptr = 0; + int ip_ver = 0; + int audio_port = 0; + int video_port = 0; + std::string host; + +#ifdef USE_OPENSSL + int audio_offer_ciphersuite_swap = 0; + int video_offer_ciphersuite_swap = 0; + int audio_answer_ciphersuite_match = -1; + int video_answer_ciphersuite_match = -1; +#endif // USE_OPENSSL + + ptr = get_header_content(msg, "Content-Length:"); + + if (ptr && atoll(ptr) > 0) + { + if (getSessionStateCurrent() == eNoSession) + { +#ifdef USE_OPENSSL + logSrtpInfo("call::process_incoming(): Switching session state: eNoSession --> eOfferReceived\n"); +#endif // USE_OPENSSL + setSessionState(eOfferReceived); + } + else if (getSessionStateCurrent() == eCompleted) + { +#ifdef USE_OPENSSL + logSrtpInfo("call::process_incoming(): Switching session state: eCompleted --> eOfferReceived\n"); +#endif // USE_OPENSSL + setSessionState(eOfferReceived); + } + else if (getSessionStateCurrent() == eOfferSent) + { +#ifdef USE_OPENSSL + logSrtpInfo("call::process_incoming(): Switching session state: eOfferSent --> eAnswerReceived\n"); +#endif // USE_OPENSSL + setSessionState(eAnswerReceived); +#ifdef USE_OPENSSL + logSrtpInfo("call::process_incoming(); Switching session state: eAnswerReceived --> eCompleted\n"); +#endif // USE_OPENSSL + setSessionState(eCompleted); + } + +#ifdef USE_OPENSSL + // INCOMING SRTP PARAM CONTEXT + SrtpAudioInfoParams pA; + SrtpVideoInfoParams pV; + + pA.audio_found = false; + pA.primary_audio_cryptotag = 0; + memset(pA.primary_audio_cryptosuite, 0, sizeof(pA.primary_audio_cryptosuite)); + memset(pA.primary_audio_cryptokeyparams, 0, sizeof(pA.primary_audio_cryptokeyparams)); + pA.secondary_audio_cryptotag = 0; + memset(pA.secondary_audio_cryptosuite, 0, sizeof(pA.secondary_audio_cryptosuite)); + memset(pA.secondary_audio_cryptokeyparams, 0, sizeof(pA.secondary_audio_cryptokeyparams)); + pA.primary_unencrypted_audio_srtp = false; + pA.secondary_unencrypted_audio_srtp = false; + + pV.video_found = false; + pV.primary_video_cryptotag = 0; + memset(pV.primary_video_cryptosuite, 0, sizeof(pV.primary_video_cryptosuite)); + memset(pV.primary_video_cryptokeyparams, 0, sizeof(pV.primary_video_cryptokeyparams)); + pV.secondary_video_cryptotag = 0; + memset(pV.secondary_video_cryptosuite, 0, sizeof(pV.secondary_video_cryptosuite)); + memset(pV.secondary_video_cryptokeyparams, 0, sizeof(pV.secondary_video_cryptokeyparams)); + pV.primary_unencrypted_video_srtp = false; + pV.secondary_unencrypted_video_srtp = false; +#endif // USE_OPENSSL + + host = extract_rtp_remote_addr(msg, ip_ver, audio_port, video_port); +#ifdef USE_OPENSSL + extract_srtp_remote_info(msg, pA, pV); +#endif // USE_OPENSSL + rtpstream_set_remote (&rtpstream_callinfo,ip_ver,host.c_str(),audio_port,video_port); + +#ifdef USE_OPENSSL + // PASS INCOMING SRTP PARAMETERS... + if (pA.audio_found && (pA.primary_audio_cryptotag != 0)) + { + // + // INCOMING OFFER -- PERFORM PRIMARY/SECONDARY AUDIO SWAPS IF NEEDED/APPLICABLE + // + if ((getSessionStateCurrent() == eOfferReceived) && ((getSessionStateOld() == eNoSession || getSessionStateOld() == eCompleted))) + { + // NO-OP... + } + // + // INCOMING ANSWER -- PERFORM PRIMARY/SECONDARY AUDIO SWAPS IF NEEDED/APPLICABLE + // + else if ((getSessionStateCurrent() == eCompleted) && (getSessionStateOld() == eAnswerReceived)) + { + audio_answer_ciphersuite_match = check_audio_ciphersuite_match(pA); + } + + rtpstream_set_srtp_audio_remote(&rtpstream_callinfo, pA); + if (sendMode == MODE_CLIENT) + { + // + // TX-UAC-AUDIO SRTP context (a) -- SSRC/IPADDRESS/PORT + // + CryptoContextID txUACA; + txUACA.ssrc = rtpstream_callinfo.taskinfo->audio_ssrc_id; + txUACA.address = host; + txUACA.port = audio_port; + logSrtpInfo("call::process_incoming(): (a) TX-UAC-AUDIO SRTP context - ssrc:0x%08x address:%s port:%d\n", txUACA.ssrc, txUACA.address.c_str(), txUACA.port); + _txUACAudio.setID(txUACA); + + if (audio_answer_ciphersuite_match == 0) + { + logSrtpInfo("call::process_incoming(): (a) TX-UAC_AUDIO SRTP context -- CLIENT -- CIPHERSUITE SWAP...\n"); + _txUACAudio.swapCrypto(); + } + + // + // RX-UAC-AUDIO SRTP context (b) -- MASTER KEY/SALT PARSE + CRYPTO TAG + CRYPTOSUITE + // + std::string mks1; + mks1 = pA.primary_audio_cryptokeyparams; + if (!mks1.empty()) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-AUDIO SRTP context -- primary master key/salt: %s\n", mks1.c_str()); + logSrtpInfo("call::process_incoming(): (b) RX-UAC-AUDIO SRTP context -- primary crypto tag: %d\n", pA.primary_audio_cryptotag); + _rxUACAudio.decodeMasterKeySalt(mks1, PRIMARY_CRYPTO); + _rxUACAudio.setCryptoTag(pA.primary_audio_cryptotag, PRIMARY_CRYPTO); + + if (!strcmp(pA.primary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_80") && !pA.primary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-AUDIO SRTP context -- ENCRYPTION -- primary cryptosuite: [%s]\n", pA.primary_audio_cryptosuite); + _rxUACAudio.selectCipherAlgorithm(AES_CM_128, PRIMARY_CRYPTO); + _rxUACAudio.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + else if (!strcmp(pA.primary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_32") && !pA.primary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-AUDIO SRTP context -- ENCRYPTION -- primary cryptosuite: [%s]\n", pA.primary_audio_cryptosuite); + _rxUACAudio.selectCipherAlgorithm(AES_CM_128, PRIMARY_CRYPTO); + _rxUACAudio.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + else if (!strcmp(pA.primary_audio_cryptosuite, "NULL_HMAC_SHA1_80") && !pA.primary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-AUDIO SRTP context -- ENCRYPTION -- primary cryptosuite: [%s]\n", pA.primary_audio_cryptosuite); + _rxUACAudio.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); + _rxUACAudio.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + else if (!strcmp(pA.primary_audio_cryptosuite, "NULL_HMAC_SHA1_32") && !pA.primary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-AUDIO SRTP context -- ENCRYPTION -- primary cryptosuite: [%s]\n", pA.primary_audio_cryptosuite); + _rxUACAudio.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); + _rxUACAudio.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + else if (!strcmp(pA.primary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_80") && pA.primary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-AUDIO SRTP context -- NOENCRYPTION -- primary cryptosuite: [%s]\n", pA.primary_audio_cryptosuite); + _rxUACAudio.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); /* Request JLSRTP NOT to decrypt */ + _rxUACAudio.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + else if (!strcmp(pA.primary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_32") && pA.primary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-AUDIO SRTP context -- NOENCRYPTION -- primary cryptosuite: [%s]\n", pA.primary_audio_cryptosuite); + _rxUACAudio.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); /* Request JLSRTP NOT to decrypt */ + _rxUACAudio.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + } + + std::string mks2; + mks2 = pA.secondary_audio_cryptokeyparams; + if (!mks2.empty()) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-AUDIO SRTP context -- secondary master key/salt: %s\n", mks2.c_str()); + logSrtpInfo("call::process_incoming(): (b) RX-UAC-AUDIO SRTP context -- secondary crypto tag: %d\n", pA.secondary_audio_cryptotag); + _rxUACAudio.decodeMasterKeySalt(mks2, SECONDARY_CRYPTO); + _rxUACAudio.setCryptoTag(pA.secondary_audio_cryptotag, SECONDARY_CRYPTO); + + if (!strcmp(pA.secondary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_80") && !pA.secondary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-AUDIO SRTP context -- ENCRYPTION -- secondary cryptosuite: [%s]\n", pA.secondary_audio_cryptosuite); + _rxUACAudio.selectCipherAlgorithm(AES_CM_128, SECONDARY_CRYPTO); + _rxUACAudio.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + else if (!strcmp(pA.secondary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_32") && !pA.secondary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-AUDIO SRTP context -- ENCRYPTION -- secondary cryptosuite: [%s]\n", pA.secondary_audio_cryptosuite); + _rxUACAudio.selectCipherAlgorithm(AES_CM_128, SECONDARY_CRYPTO); + _rxUACAudio.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + else if (!strcmp(pA.secondary_audio_cryptosuite, "NULL_HMAC_SHA1_80") && !pA.secondary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-AUDIO SRTP context -- ENCRYPTION -- secondary cryptosuite: [%s]\n", pA.secondary_audio_cryptosuite); + _rxUACAudio.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); + _rxUACAudio.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + else if (!strcmp(pA.secondary_audio_cryptosuite, "NULL_HMAC_SHA1_32") && !pA.secondary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-AUDIO SRTP context -- ENCRYPTION -- secondary cryptosuite: [%s]\n", pA.secondary_audio_cryptosuite); + _rxUACAudio.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); + _rxUACAudio.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + else if (!strcmp(pA.secondary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_80") && pA.secondary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-AUDIO SRTP context -- NOENCRYPTION -- secondary cryptosuite: [%s]\n", pA.secondary_audio_cryptosuite); + _rxUACAudio.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); /* Request JLSRTP NOT to decrypt */ + _rxUACAudio.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + else if (!strcmp(pA.secondary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_32") && pA.secondary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-AUDIO SRTP context -- NOENCRYPTION -- secondary cryptosuite: [%s]\n", pA.secondary_audio_cryptosuite); + _rxUACAudio.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); /* Request JLSRTP NOT to decrypt */ + _rxUACAudio.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + } + } + if (sendMode == MODE_SERVER) + { + // + // TX-UAS-AUDIO SRTP context (d) -- SSRC/IPADDRESS/PORT + // + CryptoContextID txUASA; + txUASA.ssrc = rtpstream_callinfo.taskinfo->audio_ssrc_id; + txUASA.address = host; + txUASA.port = audio_port; + logSrtpInfo("call::process_incoming(): (d) TX-UAS-AUDIO SRTP context - ssrc:0x%08x address:%s port:%d\n", txUASA.ssrc, txUASA.address.c_str(), txUASA.port); + _txUASAudio.setID(txUASA); + + if (audio_answer_ciphersuite_match == 0) + { + logSrtpInfo("call::process_incoming(): (d) TX-UAS_AUDIO SRTP context -- SERVER -- CIPHERSUITE SWAP...\n"); + _txUASAudio.swapCrypto(); + } + + // + // RX-UAS-AUDIO SRTP context (c) -- MASTER KEY/SALT PARSE + CRYPTO TAG + CRYPTOSUITE + // + std::string mks1; + mks1 = pA.primary_audio_cryptokeyparams; + if (!mks1.empty()) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-AUDIO SRTP context -- primary master key/salt: %s\n", mks1.c_str()); + logSrtpInfo("call::process_incoming(): (c) RX-UAS-AUDIO SRTP context -- primary crypto tag: %d\n", pA.primary_audio_cryptotag); + _rxUASAudio.decodeMasterKeySalt(mks1, PRIMARY_CRYPTO); + _rxUASAudio.setCryptoTag(pA.primary_audio_cryptotag, PRIMARY_CRYPTO); + + if (!strcmp(pA.primary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_80") && !pA.primary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-AUDIO SRTP context -- ENCRYPTION -- primary cryptosuite: [%s]\n", pA.primary_audio_cryptosuite); + _rxUASAudio.selectCipherAlgorithm(AES_CM_128, PRIMARY_CRYPTO); + _rxUASAudio.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + else if (!strcmp(pA.primary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_32") && !pA.primary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-AUDIO SRTP context -- ENCRYPTION -- primary cryptosuite: [%s]\n", pA.primary_audio_cryptosuite); + _rxUASAudio.selectCipherAlgorithm(AES_CM_128, PRIMARY_CRYPTO); + _rxUASAudio.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + else if (!strcmp(pA.primary_audio_cryptosuite, "NULL_HMAC_SHA1_80") && !pA.primary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-AUDIO SRTP context -- ENCRYPTION -- primary cryptosuite: [%s]\n", pA.primary_audio_cryptosuite); + _rxUASAudio.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); + _rxUASAudio.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + else if (!strcmp(pA.primary_audio_cryptosuite, "NULL_HMAC_SHA1_32") && !pA.primary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-AUDIO SRTP context -- ENCRYPTION -- primary cryptosuite: [%s]\n", pA.primary_audio_cryptosuite); + _rxUASAudio.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); + _rxUASAudio.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + else if (!strcmp(pA.primary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_80") && pA.primary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-AUDIO SRTP context -- NOENCRYPTION -- primary cryptosuite: [%s]\n", pA.primary_audio_cryptosuite); + _rxUASAudio.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); /* Request JLSRTP NOT to decrypt */ + _rxUASAudio.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + else if (!strcmp(pA.primary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_32") && pA.primary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-AUDIO SRTP context -- NOENCRYPTION -- primary cryptosuite: [%s]\n", pA.primary_audio_cryptosuite); + _rxUASAudio.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); /* Request JLSRTP NOT to decrypt */ + _rxUASAudio.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + } + + std::string mks2; + mks2 = pA.secondary_audio_cryptokeyparams; + if (!mks2.empty()) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-AUDIO SRTP context -- secondary master key/salt: %s\n", mks2.c_str()); + logSrtpInfo("call::process_incoming(): (c) RX-UAS-AUDIO SRTP context -- secondary crypto tag: %d\n", pA.secondary_audio_cryptotag); + _rxUASAudio.decodeMasterKeySalt(mks2, SECONDARY_CRYPTO); + _rxUASAudio.setCryptoTag(pA.secondary_audio_cryptotag, SECONDARY_CRYPTO); + + if (!strcmp(pA.secondary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_80") && !pA.secondary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-AUDIO SRTP context -- ENCRYPTION -- secondary cryptosuite: [%s]\n", pA.secondary_audio_cryptosuite); + _rxUASAudio.selectCipherAlgorithm(AES_CM_128, SECONDARY_CRYPTO); + _rxUASAudio.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + else if (!strcmp(pA.secondary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_32") && !pA.secondary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-AUDIO SRTP context -- ENCRYPTION -- secondary cryptosuite: [%s]\n", pA.secondary_audio_cryptosuite); + _rxUASAudio.selectCipherAlgorithm(AES_CM_128, SECONDARY_CRYPTO); + _rxUASAudio.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + else if (!strcmp(pA.secondary_audio_cryptosuite, "NULL_HMAC_SHA1_80") && !pA.secondary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-AUDIO SRTP context -- ENCRYPTION -- secondary cryptosuite: [%s]\n", pA.secondary_audio_cryptosuite); + _rxUASAudio.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); + _rxUASAudio.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + else if (!strcmp(pA.secondary_audio_cryptosuite, "NULL_HMAC_SHA1_32") && !pA.secondary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-AUDIO SRTP context -- ENCRYPTION -- secondary cryptosuite: [%s]\n", pA.secondary_audio_cryptosuite); + _rxUASAudio.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); + _rxUASAudio.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + else if (!strcmp(pA.secondary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_80") && pA.secondary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-AUDIO SRTP context -- NOENCRYPTION -- secondary cryptosuite: [%s]\n", pA.secondary_audio_cryptosuite); + _rxUASAudio.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); /* Request JLSRTP NOT to decrypt */ + _rxUASAudio.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + else if (!strcmp(pA.secondary_audio_cryptosuite, "AES_CM_128_HMAC_SHA1_32") && pA.secondary_unencrypted_audio_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-AUDIO SRTP context -- NOENCRYPTION -- secondary cryptosuite: [%s]\n", pA.secondary_audio_cryptosuite); + _rxUASAudio.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); /* Request JLSRTP NOT to decrypt */ + _rxUASAudio.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + } + } + } + if (pV.video_found && (pV.primary_video_cryptotag != 0)) + { + // + // INCOMING OFFER -- PERFORM PRIMARY/SECONDARY VIDEO SWAPS IF NEEDED/APPLICABLE + // + if ((getSessionStateCurrent() == eOfferReceived) && ((getSessionStateOld() == eNoSession || getSessionStateOld() == eCompleted))) + { + // NO-OP... + } + // + // INCOMING ANSWER -- PERFORM PRIMARY/SECONDARY VIDEO SWAPS IF NEEDED/APPLICABLE + // + else if ((getSessionStateCurrent() == eCompleted) && (getSessionStateOld() == eAnswerReceived)) + { + video_answer_ciphersuite_match = check_video_ciphersuite_match(pV); + } + + rtpstream_set_srtp_video_remote(&rtpstream_callinfo, pV); + if (sendMode == MODE_CLIENT) + { + // + // TX-UAC-VIDEO SRTP context (a) -- SSRC/IPADDRESS/PORT + // + CryptoContextID txUACV; + txUACV.ssrc = rtpstream_callinfo.taskinfo->video_ssrc_id; + txUACV.address = host; + txUACV.port = video_port; + logSrtpInfo("call::process_incoming(): (a) TX-UAC-VIDEO SRTP context - ssrc:0x%08x address:%s port:%d\n", txUACV.ssrc, txUACV.address.c_str(), txUACV.port); + _txUACVideo.setID(txUACV); + + if (video_answer_ciphersuite_match == 0) + { + logSrtpInfo("call::process_incoming(): (a) TX-UAC_VIDEO SRTP context -- CLIENT -- CIPHERSUITE SWAP...\n"); + _txUACVideo.swapCrypto(); + } + + // + // RX-UAC-VIDEO SRTP context (b) -- MASTER KEY/SALT PARSE + CRYPTO TAG + CRYPTOSUITE + // + std::string mks1; + mks1 = pV.primary_video_cryptokeyparams; + if (!mks1.empty()) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-VIDEO SRTP context -- primary master key/salt: %s\n", mks1.c_str()); + logSrtpInfo("call::process_incoming(): (b) RX-UAC-VIDEO SRTP context -- primary crypto tag: %d\n", pV.primary_video_cryptotag); + _rxUACVideo.decodeMasterKeySalt(mks1, PRIMARY_CRYPTO); + _rxUACVideo.setCryptoTag(pV.primary_video_cryptotag, PRIMARY_CRYPTO); + + if (!strcmp(pV.primary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_80") && !pV.primary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-VIDEO SRTP context -- ENCRYPTION -- primary cryptosuite: [%s]\n", pV.primary_video_cryptosuite); + _rxUACVideo.selectCipherAlgorithm(AES_CM_128, PRIMARY_CRYPTO); + _rxUACVideo.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + else if (!strcmp(pV.primary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_32") && !pV.primary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-VIDEO SRTP context -- ENCRYPTION -- primary cryptosuite: [%s]\n", pV.primary_video_cryptosuite); + _rxUACVideo.selectCipherAlgorithm(AES_CM_128, PRIMARY_CRYPTO); + _rxUACVideo.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + else if (!strcmp(pV.primary_video_cryptosuite, "NULL_HMAC_SHA1_80") && !pV.primary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-VIDEO SRTP context -- ENCRYPTION -- primary cryptosuite: [%s]\n", pV.primary_video_cryptosuite); + _rxUACVideo.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); + _rxUACVideo.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + else if (!strcmp(pV.primary_video_cryptosuite, "NULL_HMAC_SHA1_32") && !pV.primary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-VIDEO SRTP context -- ENCRYPTION -- primary cryptosuite: [%s]\n", pV.primary_video_cryptosuite); + _rxUACVideo.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); + _rxUACVideo.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + else if (!strcmp(pV.primary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_80") && pV.primary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-VIDEO SRTP context -- NOENCRYPTION -- primary cryptosuite: [%s]\n", pV.primary_video_cryptosuite); + _rxUACVideo.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); /* Request JLSRTP NOT to decrypt */ + _rxUACVideo.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + else if (!strcmp(pV.primary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_32") && pV.primary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-VIDEO SRTP context -- NOENCRYPTION -- primary cryptosuite: [%s]\n", pV.primary_video_cryptosuite); + _rxUACVideo.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); /* Request JLSRTP NOT to decrypt */ + _rxUACVideo.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + } + + std::string mks2; + mks2 = pV.secondary_video_cryptokeyparams; + if (!mks2.empty()) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-VIDEO SRTP context -- secondary master key/salt: %s\n", mks2.c_str()); + logSrtpInfo("call::process_incoming(): (b) RX-UAC-VIDEO SRTP context -- secondary crypto tag: %d\n", pV.secondary_video_cryptotag); + _rxUACVideo.decodeMasterKeySalt(mks2, SECONDARY_CRYPTO); + _rxUACVideo.setCryptoTag(pV.secondary_video_cryptotag, SECONDARY_CRYPTO); + + if (!strcmp(pV.secondary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_80") && !pV.secondary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-VIDEO SRTP context -- ENCRYPTION -- secondary cryptosuite: [%s]\n", pV.secondary_video_cryptosuite); + _rxUACVideo.selectCipherAlgorithm(AES_CM_128, SECONDARY_CRYPTO); + _rxUACVideo.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + else if (!strcmp(pV.secondary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_32") && !pV.secondary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-VIDEO SRTP context -- ENCRYPTION -- secondary cryptosuite: [%s]\n", pV.secondary_video_cryptosuite); + _rxUACVideo.selectCipherAlgorithm(AES_CM_128, SECONDARY_CRYPTO); + _rxUACVideo.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + else if (!strcmp(pV.secondary_video_cryptosuite, "NULL_HMAC_SHA1_80") && !pV.secondary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-VIDEO SRTP context -- ENCRYPTION -- secondary cryptosuite: [%s]\n", pV.secondary_video_cryptosuite); + _rxUACVideo.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); + _rxUACVideo.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + else if (!strcmp(pV.secondary_video_cryptosuite, "NULL_HMAC_SHA1_32") && !pV.secondary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-VIDEO SRTP context -- ENCRYPTION -- secondary cryptosuite: [%s]\n", pV.secondary_video_cryptosuite); + _rxUACVideo.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); + _rxUACVideo.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + else if (!strcmp(pV.secondary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_80") && pV.secondary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-VIDEO SRTP context -- NOENCRYPTION -- secondary cryptosuite: [%s]\n", pV.secondary_video_cryptosuite); + _rxUACVideo.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); /* Request JLSRTP NOT to decrypt */ + _rxUACVideo.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + else if (!strcmp(pV.secondary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_32") && pV.secondary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (b) RX-UAC-VIDEO SRTP context -- NOENCRYPTION -- secondary cryptosuite: [%s]\n", pV.secondary_video_cryptosuite); + _rxUACVideo.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); /* Request JLSRTP NOT to decrypt */ + _rxUACVideo.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + } + } + if (sendMode == MODE_SERVER) + { + // + // TX-UAS-VIDEO SRTP context (d) -- SSRC/IPADDRESS/PORT + // + CryptoContextID txUASV; + txUASV.ssrc = rtpstream_callinfo.taskinfo->video_ssrc_id; + txUASV.address = host; + txUASV.port = video_port; + logSrtpInfo("call::process_incoming(): (d) TX-UAS-VIDEO SRTP context - ssrc:0x%08x address:%s port:%d\n", txUASV.ssrc, txUASV.address.c_str(), txUASV.port); + _txUASVideo.setID(txUASV); + + if (video_answer_ciphersuite_match == 0) + { + logSrtpInfo("call::process_incoming(): (d) TX-UAS_VIDEO SRTP context -- SERVER -- CIPHERSUITE SWAP...\n"); + _txUASVideo.swapCrypto(); + } + + // + // RX-UAS-VIDEO SRTP context (c) -- MASTER KEY/SALT PARSE + CRYPTO TAG + CRYPTOSUITE + // + std::string mks1; + mks1 = pV.primary_video_cryptokeyparams; + if (!mks1.empty()) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-VIDEO SRTP context -- primary master key/salt: %s\n", mks1.c_str()); + logSrtpInfo("call::process_incoming(): (c) RX-UAS-VIDEO SRTP context -- primary crypto tag: %d\n", pV.primary_video_cryptotag); + _rxUASVideo.decodeMasterKeySalt(mks1, PRIMARY_CRYPTO); + _rxUASVideo.setCryptoTag(pV.primary_video_cryptotag, PRIMARY_CRYPTO); + + if (!strcmp(pV.primary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_80") && !pV.primary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-VIDEO SRTP context -- ENCRYPTION -- primary cryptosuite: [%s]\n", pV.primary_video_cryptosuite); + _rxUASVideo.selectCipherAlgorithm(AES_CM_128, PRIMARY_CRYPTO); + _rxUASVideo.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + else if (!strcmp(pV.primary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_32") && !pV.primary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-VIDEO SRTP context -- ENCRYPTION -- primary cryptosuite: [%s]\n", pV.primary_video_cryptosuite); + _rxUASVideo.selectCipherAlgorithm(AES_CM_128, PRIMARY_CRYPTO); + _rxUASVideo.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + else if (!strcmp(pV.primary_video_cryptosuite, "NULL_HMAC_SHA1_80") && !pV.primary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-VIDEO SRTP context -- ENCRYPTION -- primary cryptosuite: [%s]\n", pV.primary_video_cryptosuite); + _rxUASVideo.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); + _rxUASVideo.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + else if (!strcmp(pV.primary_video_cryptosuite, "NULL_HMAC_SHA1_32") && !pV.primary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-VIDEO SRTP context -- ENCRYPTION -- primary cryptosuite: [%s]\n", pV.primary_video_cryptosuite); + _rxUASVideo.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); + _rxUASVideo.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + else if (!strcmp(pV.primary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_80") && pV.primary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-VIDEO SRTP context -- NOENCRYPTION -- primary cryptosuite: [%s]\n", pV.primary_video_cryptosuite); + _rxUASVideo.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); /* Request JLSRTP NOT to decrypt */ + _rxUASVideo.selectHashAlgorithm(HMAC_SHA1_80, PRIMARY_CRYPTO); + } + else if (!strcmp(pV.primary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_32") && pV.primary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-VIDEO SRTP context -- NOENCRYPTION -- primary cryptosuite: [%s]\n", pV.primary_video_cryptosuite); + _rxUASVideo.selectCipherAlgorithm(NULL_CIPHER, PRIMARY_CRYPTO); /* Request JLSRTP NOT to decrypt */ + _rxUASVideo.selectHashAlgorithm(HMAC_SHA1_32, PRIMARY_CRYPTO); + } + } + + std::string mks2; + mks2 = pV.secondary_video_cryptokeyparams; + if (!mks2.empty()) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-VIDEO SRTP context -- secondary master key/salt: %s\n", mks2.c_str()); + logSrtpInfo("call::process_incoming(): (c) RX-UAS-VIDEO SRTP context -- secondary crypto tag: %d\n", pV.secondary_video_cryptotag); + _rxUASVideo.decodeMasterKeySalt(mks2, SECONDARY_CRYPTO); + _rxUASVideo.setCryptoTag(pV.secondary_video_cryptotag, SECONDARY_CRYPTO); + + if (!strcmp(pV.secondary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_80") && !pV.secondary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-VIDEO SRTP context -- ENCRYPTION -- secondary cryptosuite: [%s]\n", pV.secondary_video_cryptosuite); + _rxUASVideo.selectCipherAlgorithm(AES_CM_128, SECONDARY_CRYPTO); + _rxUASVideo.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + else if (!strcmp(pV.secondary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_32") && !pV.secondary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-VIDEO SRTP context -- ENCRYPTION -- secondary cryptosuite: [%s]\n", pV.secondary_video_cryptosuite); + _rxUASVideo.selectCipherAlgorithm(AES_CM_128, SECONDARY_CRYPTO); + _rxUASVideo.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + else if (!strcmp(pV.secondary_video_cryptosuite, "NULL_HMAC_SHA1_80") && !pV.secondary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-VIDEO SRTP context -- ENCRYPTION -- secondary cryptosuite: [%s]\n", pV.secondary_video_cryptosuite); + _rxUASVideo.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); + _rxUASVideo.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + else if (!strcmp(pV.secondary_video_cryptosuite, "NULL_HMAC_SHA1_32") && !pV.secondary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-VIDEO SRTP context -- ENCRYPTION -- secondary cryptosuite: [%s]\n", pV.secondary_video_cryptosuite); + _rxUASVideo.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); + _rxUASVideo.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + else if (!strcmp(pV.secondary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_80") && pV.secondary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-VIDEO SRTP context -- NOENCRYPTION -- secondary cryptosuite: [%s]\n", pV.secondary_video_cryptosuite); + _rxUASVideo.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); /* Request JLSRTP NOT to decrypt */ + _rxUASVideo.selectHashAlgorithm(HMAC_SHA1_80, SECONDARY_CRYPTO); + } + else if (!strcmp(pV.secondary_video_cryptosuite, "AES_CM_128_HMAC_SHA1_32") && pV.secondary_unencrypted_video_srtp) + { + logSrtpInfo("call::process_incoming(): (c) RX-UAS-VIDEO SRTP context -- NOENCRYPTION -- secondary cryptosuite: [%s]\n", pV.secondary_video_cryptosuite); + _rxUASVideo.selectCipherAlgorithm(NULL_CIPHER, SECONDARY_CRYPTO); /* Request JLSRTP NOT to decrypt */ + _rxUASVideo.selectHashAlgorithm(HMAC_SHA1_32, SECONDARY_CRYPTO); + } + } + } + } +#endif // USE_OPENSSL + } // ptr + } // Content-Type +#endif // RTP_STREAM /* Is it a response ? */ if ((msg[0] == 'S') && @@ -2886,7 +5272,10 @@ bool call::process_incoming(const char* msg, const struct sockaddr_storage* src) get_remote_media_addr(msg); } #endif - + if (!strncmp(request, "INVITE", 6)) { + invite_cseq = get_cseq_value(msg); + last_recv_invite_cseq = invite_cseq; + } reply_code = 0; } else { ERROR("SIP method too long in received message '%s'", @@ -3243,6 +5632,7 @@ call::T_ActionResult call::executeAction(const char* msg, message* curmsg) { CActions* actions; CAction* currentAction; + int rc = 0; actions = curmsg->M_actions; // looking for action to do on this message @@ -3709,7 +6099,7 @@ call::T_ActionResult call::executeAction(const char* msg, message* curmsg) quitting = 1; break; case CAction::E_INTCMD_STOP_NOW: - sipp_exit(EXIT_TEST_RES_INTERNAL); + sipp_exit(EXIT_TEST_RES_INTERNAL, 0, 0); break; case CAction::E_INTCMD_STOPCALL: default: @@ -3773,18 +6163,376 @@ call::T_ActionResult call::executeAction(const char* msg, message* curmsg) } pthread_attr_destroy(&attr); #endif + } #ifdef RTP_STREAM - } else if (currentAction->getActionType() == CAction::E_AT_RTP_ECHO) { + else if (currentAction->getActionType() == CAction::E_AT_RTP_ECHO) + { rtp_echo_state = (currentAction->getDoubleValue() != 0); - } else if (currentAction->getActionType() == CAction::E_AT_RTP_STREAM_PAUSE) { + } + else if (currentAction->getActionType() == CAction::E_AT_RTP_STREAM_PAUSE) + { rtpstream_pause(&rtpstream_callinfo); - } else if (currentAction->getActionType() == CAction::E_AT_RTP_STREAM_RESUME) { + } + else if (currentAction->getActionType() == CAction::E_AT_RTP_STREAM_RESUME) + { rtpstream_resume(&rtpstream_callinfo); - } else if (currentAction->getActionType() == CAction::E_AT_RTP_STREAM_PLAY) { - rtpstream_play(&rtpstream_callinfo, currentAction->getRTPStreamActInfo()); -#endif - } else { + } + else if (currentAction->getActionType() == CAction::E_AT_RTP_STREAM_PLAY) + { + rtpstream_play(&rtpstream_callinfo,currentAction->getRTPStreamActInfo()); + // Obtain ID of parent thread used for the related RTP task + call_scenario->addRtpTaskThreadID(rtpstream_callinfo.threadID); + } + else if (currentAction->getActionType() == CAction::E_AT_RTP_STREAM_PAUSEAPATTERN) + { + rtpstream_pauseapattern(&rtpstream_callinfo); + } + else if (currentAction->getActionType() == CAction::E_AT_RTP_STREAM_RESUMEAPATTERN) + { + rtpstream_resumeapattern(&rtpstream_callinfo); + } + else if (currentAction->getActionType() == CAction::E_AT_RTP_STREAM_PLAYAPATTERN) + { +#ifdef USE_OPENSSL + // + // TX/RX-UAC-AUDIO SRTP context (a)(b) -- SRTP PAYLOAD SIZE + DERIVE SESSION ENCRYPTION/SALTING/AUTHENTICATION KEYS + SELECT ENCRYPTION KEY + RESET CIPHER STATE + // WE ASSUME THE SAME CODEC PAYLOAD SIZE WILL BE USED IN BOTH DIRECTIONS + // + if (sendMode == MODE_CLIENT) + { + rtpstream_actinfo_t* actinfo = currentAction->getRTPStreamActInfo(); + logSrtpInfo("call::executeAction(): (a) TX-UAC-AUDIO SRTP context - CLIENT setting SRTP payload size to %d\n", actinfo->bytes_per_packet); + _txUACAudio.setSrtpPayloadSize(actinfo->bytes_per_packet); + logSrtpInfo("call::executeAction(): (b) RX-UAC-AUDIO SRTP context - CLIENT setting SRTP payload size to %d\n", actinfo->bytes_per_packet); + _rxUACAudio.setSrtpPayloadSize(actinfo->bytes_per_packet); + + logSrtpInfo("call::executeAction(): (a) TX-UAC-AUDIO SRTP context - CLIENT deriving session encryption/salting/authentication keys\n"); + _txUACAudio.deriveSessionEncryptionKey(); + _txUACAudio.deriveSessionSaltingKey(); + _txUACAudio.deriveSessionAuthenticationKey(); + logSrtpInfo("call::executeAction(): (a) TX-UAC-AUDIO SRTP context - CLIENT selecting encryption key\n"); + _txUACAudio.selectEncryptionKey(); + logSrtpInfo("call::executeAction(): (a) TX-UAC-AUDIO SRTP context - CLIENT resetting cipher state\n"); + _txUACAudio.resetCipherState(); + logSrtpInfo("call::executeAction(): (b) RX-UAC-AUDIO SRTP context - CLIENT deriving session encryption/salting/authentication keys\n"); + _rxUACAudio.deriveSessionEncryptionKey(); + _rxUACAudio.deriveSessionSaltingKey(); + _rxUACAudio.deriveSessionAuthenticationKey(); + logSrtpInfo("call::executeAction(): (b) RX-UAC-AUDIO SRTP context - CLIENT selecting decryption key\n"); + _rxUACAudio.selectDecryptionKey(); + logSrtpInfo("call::executeAction(): (b) RX-UAC-AUDIO SRTP context - CLIENT resetting cipher state\n"); + _rxUACAudio.resetCipherState(); + //logSrtpInfo("call::executeAction(): ******** (a) TX-UAC-AUDIO SRTP context dump ********\n"); + //logSrtpInfo("%s", _txUACAudio.dumpCryptoContext().c_str()); + //logSrtpInfo("call::executeAction(): ****************************************************\n"); + //logSrtpInfo("call::executeAction(): ******** (b) RX-UAC-AUDIO SRTP context dump ********\n"); + //logSrtpInfo("%s", _rxUACAudio.dumpCryptoContext().c_str()); + //logSrtpInfo("call::executeAction(): ****************************************************\n"); + } + + logSrtpInfo("call::executeAction(): rtpstream_playapattern\n"); +#endif // USE_OPENSSL + rtpstream_playapattern(&rtpstream_callinfo,currentAction->getRTPStreamActInfo(), _txUACAudio, _rxUACAudio); + // Obtain ID of parent thread used for the related RTP task + call_scenario->addRtpTaskThreadID(rtpstream_callinfo.threadID); + } + else if (currentAction->getActionType() == CAction::E_AT_RTP_STREAM_PAUSEVPATTERN) + { + rtpstream_pausevpattern(&rtpstream_callinfo); + } + else if (currentAction->getActionType() == CAction::E_AT_RTP_STREAM_RESUMEVPATTERN) + { + rtpstream_resumevpattern(&rtpstream_callinfo); + } + else if (currentAction->getActionType() == CAction::E_AT_RTP_STREAM_PLAYVPATTERN) + { +#ifdef USE_OPENSSL + // + // TX/RX-UAC-VIDEO SRTP context (a)(b) -- SRTP PAYLOAD SIZE + DERIVE SESSION ENCRYPTION/SALTING/AUTHENTICATION KEYS + SELECT ENCRYPTION KEY + RESET CIPHER STATE + // WE ASSUME THE SAME CODEC PAYLOAD SIZE WILL BE USED IN BOTH DIRECTIONS + // + if (sendMode == MODE_CLIENT) + { + rtpstream_actinfo_t* actinfo = currentAction->getRTPStreamActInfo(); + logSrtpInfo("call::executeAction(): (a) TX-UAC-VIDEO SRTP context - CLIENT setting SRTP payload size to %d\n", actinfo->bytes_per_packet); + _txUACVideo.setSrtpPayloadSize(actinfo->bytes_per_packet); + logSrtpInfo("call::executeAction(): (b) RX-UAC-VIDEO SRTP context - CLIENT setting SRTP payload size to %d\n", actinfo->bytes_per_packet); + _rxUACVideo.setSrtpPayloadSize(actinfo->bytes_per_packet); + + logSrtpInfo("call::executeAction(): (a) TX-UAC-VIDEO SRTP context - CLIENT deriving session encryption/salting/authentication keys\n"); + _txUACVideo.deriveSessionEncryptionKey(); + _txUACVideo.deriveSessionSaltingKey(); + _txUACVideo.deriveSessionAuthenticationKey(); + logSrtpInfo("call::executeAction(): (a) TX-UAC-VIDEO SRTP context - CLIENT selecting encryption key\n"); + _txUACVideo.selectEncryptionKey(); + logSrtpInfo("call::executeAction(): (a) TX-UAC-VIDEO SRTP context - CLIENT resetting cipher state\n"); + _txUACVideo.resetCipherState(); + logSrtpInfo("call::executeAction(): (b) RX-UAC-VIDEO SRTP context - CLIENT deriving session encryption/salting/authentication keys\n"); + _rxUACVideo.deriveSessionEncryptionKey(); + _rxUACVideo.deriveSessionSaltingKey(); + _rxUACVideo.deriveSessionAuthenticationKey(); + logSrtpInfo("call::executeAction(): (b) RX-UAC-VIDEO SRTP context - CLIENT selecting decryption key\n"); + _rxUACVideo.selectDecryptionKey(); + logSrtpInfo("call::executeAction(): (b) RX-UAC-VIDEO SRTP context - CLIENT resetting cipher state\n"); + _rxUACVideo.resetCipherState(); + //logSrtpInfo("call::executeAction(): ******** (a) TX-UAC-VIDEO SRTP context dump ********\n"); + //logSrtpInfo("%s", _txUACVideo.dumpCryptoContext().c_str()); + //logSrtpInfo("call::executeAction(): ****************************************************\n"); + //logSrtpInfo("call::executeAction(): ******** (b) RX-UAC-VIDEO SRTP context dump ********\n"); + //logSrtpInfo("%s", _rxUACVideo.dumpCryptoContext().c_str()); + //logSrtpInfo("call::executeAction(): ****************************************************\n"); + } + + logSrtpInfo("call::executeAction(): rtpstream_playvpattern\n"); +#endif // USE_OPENSSL + rtpstream_playvpattern(&rtpstream_callinfo,currentAction->getRTPStreamActInfo(), _txUACVideo, _rxUACVideo); + // Obtain ID of parent thread used for the related RTP task + call_scenario->addRtpTaskThreadID(rtpstream_callinfo.threadID); + } + else if (currentAction->getActionType() == CAction::E_AT_RTP_STREAM_RTPECHO_STARTAUDIO) + { +#ifdef USE_OPENSSL + if (sendMode == MODE_SERVER) + { + // + // RX-UAS-AUDIO SRTP context (c) -- SSRC/IPADDRESS/PORT + // + CryptoContextID rxUASA; + rxUASA.ssrc = rtpstream_callinfo.taskinfo->audio_ssrc_id; + rxUASA.address = media_ip; + rxUASA.port = rtpstream_callinfo.local_audioport; + logSrtpInfo("call::executeAction() [STARTAUDIO]: (c) RX-UAS-AUDIO SRTP context - ssrc:0x%08x address:%s port:%d\n", rxUASA.ssrc, rxUASA.address.c_str(), rxUASA.port); + _rxUASAudio.setID(rxUASA); + + // + // RX/TX-UAS-AUDIO SRTP context (c)(d) -- SRTP PAYLOAD SIZE + DERIVE SESSION ENCRYPTION/SALTING/AUTHENTICATION KEYS + SELECT ENCRYPTION KEY + RESET CIPHER STATE + // WE ASSUME THE SAME CODEC PAYLOAD SIZE WILL BE USED IN BOTH DIRECTIONS + // + rtpecho_actinfo_t* actinfo = currentAction->getRTPEchoActInfo(); + logSrtpInfo("call::executeAction() [STARTAUDIO]: (c) RX-UAS-AUDIO SRTP context - SERVER setting SRTP payload size to %d\n", actinfo->bytes_per_packet); + _rxUASAudio.setSrtpPayloadSize(actinfo->bytes_per_packet); + logSrtpInfo("call::executeAction() [STARTAUDIO]: (d) TX-UAS-AUDIO SRTP context - SERVER setting SRTP payload size to %d\n", actinfo->bytes_per_packet); + _txUASAudio.setSrtpPayloadSize(actinfo->bytes_per_packet); + + logSrtpInfo("call::executeAction() [STARTAUDIO]: (c) RX-UAS-AUDIO SRTP context - SERVER deriving session encryption/salting/authentication keys\n"); + _rxUASAudio.deriveSessionEncryptionKey(); + _rxUASAudio.deriveSessionSaltingKey(); + _rxUASAudio.deriveSessionAuthenticationKey(); + logSrtpInfo("call::executeAction() [STARTAUDIO]: (c) RX-UAS-AUDIO SRTP context - SERVER selecting decryption key\n"); + _rxUASAudio.selectDecryptionKey(); + logSrtpInfo("call::executeAction() [STARTAUDIO]: (c) RX-UAS-AUDIO SRTP context - SERVER resetting cipher state\n"); + _rxUASAudio.resetCipherState(); + logSrtpInfo("call::executeAction() [STARTAUDIO]: (d) TX-UAS-AUDIO SRTP context - SERVER deriving session encryption/salting/authentication keys\n"); + _txUASAudio.deriveSessionEncryptionKey(); + _txUASAudio.deriveSessionSaltingKey(); + _txUASAudio.deriveSessionAuthenticationKey(); + logSrtpInfo("call::executeAction() [STARTAUDIO]: (d) TX-UAS-AUDIO SRTP context - SERVER selecting encryption key\n"); + _txUASAudio.selectEncryptionKey(); + logSrtpInfo("call::executeAction() [STARTAUDIO]: (d) TX-UAS-AUDIO SRTP context - SERVER resetting cipher state\n"); + _txUASAudio.resetCipherState(); + //logSrtpInfo("call::executeAction() [STARTAUDIO]: ******** (c) RX-UAS-AUDIO SRTP context dump ********\n"); + //logSrtpInfo("%s", _rxUASAudio.dumpCryptoContext().c_str()); + //logSrtpInfo("call::executeAction() [STARTAUDIO]: ****************************************************\n"); + //logSrtpInfo("call::executeAction() [STARTAUDIO]: ******** (d) TX-UAS-AUDIO SRTP context dump ********\n"); + //logSrtpInfo("%s", _txUASAudio.dumpCryptoContext().c_str()); + //logSrtpInfo("call::executeAction() [STARTAUDIO]: ****************************************************\n"); + } + + logSrtpInfo("call::executeAction() [STARTAUDIO]: rtpstream_rtpecho_startaudio\n"); +#endif // USE_OPENSSL + rtpstream_rtpecho_startaudio(&rtpstream_callinfo, _rxUASAudio, _txUASAudio); + } + else if (currentAction->getActionType() == CAction::E_AT_RTP_STREAM_RTPECHO_UPDATEAUDIO) + { +#ifdef USE_OPENSSL + if (sendMode == MODE_SERVER) + { + // + // RX-UAS-AUDIO SRTP context (c) -- SSRC/IPADDRESS/PORT + // + CryptoContextID rxUASA; + rxUASA.ssrc = rtpstream_callinfo.taskinfo->audio_ssrc_id; + rxUASA.address = media_ip; + rxUASA.port = rtpstream_callinfo.local_audioport; + logSrtpInfo("call::executeAction() [UPDATEAUDIO]: (c) RX-UAS-AUDIO SRTP context - ssrc:0x%08x address:%s port:%d\n", rxUASA.ssrc, rxUASA.address.c_str(), rxUASA.port); + _rxUASAudio.setID(rxUASA); + + // + // RX/TX-UAS-AUDIO SRTP context (c)(d) -- SRTP PAYLOAD SIZE + DERIVE SESSION ENCRYPTION/SALTING/AUTHENTICATION KEYS + SELECT ENCRYPTION KEY + RESET CIPHER STATE + // WE ASSUME THE SAME CODEC PAYLOAD SIZE WILL BE USED IN BOTH DIRECTIONS + // + rtpecho_actinfo_t* actinfo = currentAction->getRTPEchoActInfo(); + logSrtpInfo("call::executeAction() [UPDATEAUDIO]: (c) RX-UAS-AUDIO SRTP context - SERVER setting SRTP payload size to %d\n", actinfo->bytes_per_packet); + _rxUASAudio.setSrtpPayloadSize(actinfo->bytes_per_packet); + logSrtpInfo("call::executeAction() [UPDATEAUDIO]: (d) TX-UAS-AUDIO SRTP context - SERVER setting SRTP payload size to %d\n", actinfo->bytes_per_packet); + _txUASAudio.setSrtpPayloadSize(actinfo->bytes_per_packet); + + logSrtpInfo("call::executeAction() [UPDATEAUDIO]: (c) RX-UAS-AUDIO SRTP context - SERVER deriving session encryption/salting/authentication keys\n"); + _rxUASAudio.deriveSessionEncryptionKey(); + _rxUASAudio.deriveSessionSaltingKey(); + _rxUASAudio.deriveSessionAuthenticationKey(); + logSrtpInfo("call::executeAction() [UPDATEAUDIO]: (c) RX-UAS-AUDIO SRTP context - SERVER selecting decryption key\n"); + _rxUASAudio.selectDecryptionKey(); + logSrtpInfo("call::executeAction() [UPDATEAUDIO]: (c) RX-UAS-AUDIO SRTP context - SERVER resetting cipher state\n"); + _rxUASAudio.resetCipherState(); + logSrtpInfo("call::executeAction() [UPDATEAUDIO]: (d) TX-UAS-AUDIO SRTP context - SERVER deriving session encryption/salting/authentication keys\n"); + _txUASAudio.deriveSessionEncryptionKey(); + _txUASAudio.deriveSessionSaltingKey(); + _txUASAudio.deriveSessionAuthenticationKey(); + logSrtpInfo("call::executeAction() [UPDATEAUDIO]: (d) TX-UAS-AUDIO SRTP context - SERVER selecting encryption key\n"); + _txUASAudio.selectEncryptionKey(); + logSrtpInfo("call::executeAction() [UPDATEAUDIO]: (d) TX-UAS-AUDIO SRTP context - SERVER resetting cipher state\n"); + _txUASAudio.resetCipherState(); + //logSrtpInfo("call::executeAction() [UPDATEAUDIO]: ******** (c) RX-UAS-AUDIO SRTP context dump ********\n"); + //logSrtpInfo("%s", _rxUASAudio.dumpCryptoContext().c_str()); + //logSrtpInfo("call::executeAction() [UPDATEAUDIO]: ****************************************************\n"); + //logSrtpInfo("call::executeAction() [UPDATEAUDIO]: ******** (d) TX-UAS-AUDIO SRTP context dump ********\n"); + //logSrtpInfo("%s", _txUASAudio.dumpCryptoContext().c_str()); + //logSrtpInfo("call::executeAction() [UPDATEAUDIO]: ****************************************************\n"); + } + + logSrtpInfo("call::executeAction() [UPDATEAUDIO]: rtpstream_rtpecho_updateaudio\n"); +#endif // USE_OPENSSL + rtpstream_rtpecho_updateaudio(&rtpstream_callinfo, _rxUASAudio, _txUASAudio); + } + else if (currentAction->getActionType() == CAction::E_AT_RTP_STREAM_RTPECHO_STOPAUDIO) + { +#ifdef USE_OPENSSL + logSrtpInfo("call::executeAction() [STOPAUDIO]: rtpstream_rtpecho_stopaudio\n"); +#endif // USE_OPENSSL + rc = rtpstream_rtpecho_stopaudio(&rtpstream_callinfo); + if (rc < 0) + { +#ifdef USE_OPENSSL + logSrtpInfo("call::executeAction() [STOPAUDIO]: rtpstream_rtpecho_stopaudio() rc==%d\n", rc); +#endif // USE_OPENSSL + return call::E_AR_RTPECHO_ERROR; + } + } + else if (currentAction->getActionType() == CAction::E_AT_RTP_STREAM_RTPECHO_STARTVIDEO) + { +#ifdef USE_OPENSSL + if (sendMode == MODE_SERVER) + { + // + // RX-UAS-VIDEO SRTP context (c) -- SSRC/IPADDRESS/PORT + // + CryptoContextID rxUASV; + rxUASV.ssrc = rtpstream_callinfo.taskinfo->video_ssrc_id; + rxUASV.address = media_ip; + rxUASV.port = rtpstream_callinfo.local_videoport; + logSrtpInfo("call::executeAction() [STARTVIDEO]: (c) RX-UAS-VIDEO SRTP context - ssrc:0x%08x address:%s port:%d\n", rxUASV.ssrc, rxUASV.address.c_str(), rxUASV.port); + _rxUASVideo.setID(rxUASV); + + // + // RX/TX-UAS-VIDEO SRTP context (c)(d) -- SRTP PAYLOAD SIZE + DERIVE SESSION ENCRYPTION/SALTING/AUTHENTICATION KEYS + SELECT ENCRYPTION KEY + RESET CIPHER STATE + // WE ASSUME THE SAME CODEC PAYLOAD SIZE WILL BE USED IN BOTH DIRECTIONS + // + rtpecho_actinfo_t* actinfo = currentAction->getRTPEchoActInfo(); + logSrtpInfo("call::executeAction() [STARTVIDEO]: (c) RX-UAS-VIDEO SRTP context - SERVER setting SRTP payload size to %d\n", actinfo->bytes_per_packet); + _rxUASVideo.setSrtpPayloadSize(actinfo->bytes_per_packet); + logSrtpInfo("call::executeAction() [STARTVIDEO]: (d) TX-UAS-VIDEO SRTP context - SERVER setting SRTP payload size to %d\n", actinfo->bytes_per_packet); + _txUASVideo.setSrtpPayloadSize(actinfo->bytes_per_packet); + + logSrtpInfo("call::executeAction() [STARTVIDEO]: (c) RX-UAS-VIDEO SRTP context - SERVER deriving session encryption/salting/authentication keys\n"); + _rxUASVideo.deriveSessionEncryptionKey(); + _rxUASVideo.deriveSessionSaltingKey(); + _rxUASVideo.deriveSessionAuthenticationKey(); + logSrtpInfo("call::executeAction() [STARTVIDEO]: (c) RX-UAS-VIDEO SRTP context - SERVER selecting decryption key\n"); + _rxUASVideo.selectDecryptionKey(); + logSrtpInfo("call::executeAction() [STARTVIDEO]: (c) RX-UAS-VIDEO SRTP context - SERVER resetting cipher state\n"); + _rxUASVideo.resetCipherState(); + logSrtpInfo("call::executeAction() [STARTVIDEO]: (d) TX-UAS-VIDEO SRTP context - SERVER deriving session encryption/salting/authentication keys\n"); + _txUASVideo.deriveSessionEncryptionKey(); + _txUASVideo.deriveSessionSaltingKey(); + _txUASVideo.deriveSessionAuthenticationKey(); + logSrtpInfo("call::executeAction() [STARTVIDEO]: (d) TX-UAS-VIDEO SRTP context - SERVER selecting encryption key\n"); + _txUASVideo.selectEncryptionKey(); + logSrtpInfo("call::executeAction() [STARTVIDEO]: (d) TX-UAS-VIDEO SRTP context - SERVER resetting cipher state\n"); + _txUASVideo.resetCipherState(); + //logSrtpInfo("call::executeAction() [STARTVIDEO]: ******** (c) RX-UAS-VIDEO SRTP context dump ********\n"); + //logSrtpInfo("%s", _rxUASVideo.dumpCryptoContext().c_str()); + //logSrtpInfo("call::executeAction() [STARTVIDEO]: ****************************************************\n"); + //logSrtpInfo("call::executeAction() [STARTVIDEO]: ******** (d) TX-UAS-VIDEO SRTP context dump ********\n"); + //logSrtpInfo("%s", _txUASVideo.dumpCryptoContext().c_str()); + //logSrtpInfo("call::executeAction() [STARTVIDEO]: ****************************************************\n"); + } + + logSrtpInfo("call::executeAction() [STARTVIDEO]: rtpstream_rtpecho_startvideo\n"); +#endif // USE_OPENSSL + rtpstream_rtpecho_startvideo(&rtpstream_callinfo, _rxUASVideo, _txUASVideo); + } + else if (currentAction->getActionType() == CAction::E_AT_RTP_STREAM_RTPECHO_UPDATEVIDEO) + { +#ifdef USE_OPENSSL + if (sendMode == MODE_SERVER) + { + // + // RX-UAS-VIDEO SRTP context (c) -- SSRC/IPADDRESS/PORT + // + CryptoContextID rxUASV; + rxUASV.ssrc = rtpstream_callinfo.taskinfo->video_ssrc_id; + rxUASV.address = media_ip; + rxUASV.port = rtpstream_callinfo.local_videoport; + logSrtpInfo("call::executeAction() [UPDATEVIDEO]: (c) RX-UAS-VIDEO SRTP context - ssrc:0x%08x address:%s port:%d\n", rxUASV.ssrc, rxUASV.address.c_str(), rxUASV.port); + _rxUASVideo.setID(rxUASV); + + // + // RX/TX-UAS-VIDEO SRTP context (c)(d) -- SRTP PAYLOAD SIZE + DERIVE SESSION ENCRYPTION/SALTING/AUTHENTICATION KEYS + SELECT ENCRYPTION KEY + RESET CIPHER STATE + // WE ASSUME THE SAME CODEC PAYLOAD SIZE WILL BE USED IN BOTH DIRECTIONS + // + rtpecho_actinfo_t* actinfo = currentAction->getRTPEchoActInfo(); + logSrtpInfo("call::executeAction() [UPDATEVIDEO]: (c) RX-UAS-VIDEO SRTP context - SERVER setting SRTP payload size to %d\n", actinfo->bytes_per_packet); + _rxUASVideo.setSrtpPayloadSize(actinfo->bytes_per_packet); + logSrtpInfo("call::executeAction() [UPDATEVIDEO]: (d) TX-UAS-VIDEO SRTP context - SERVER setting SRTP payload size to %d\n", actinfo->bytes_per_packet); + _txUASVideo.setSrtpPayloadSize(actinfo->bytes_per_packet); + + logSrtpInfo("call::executeAction() [UPDATEVIDEO]: (c) RX-UAS-VIDEO SRTP context - SERVER deriving session encryption/salting/authentication keys\n"); + _rxUASVideo.deriveSessionEncryptionKey(); + _rxUASVideo.deriveSessionSaltingKey(); + _rxUASVideo.deriveSessionAuthenticationKey(); + logSrtpInfo("call::executeAction() [UPDATEVIDEO]: (c) RX-UAS-VIDEO SRTP context - SERVER selecting decryption key\n"); + _rxUASVideo.selectDecryptionKey(); + logSrtpInfo("call::executeAction() [UPDATEVIDEO]: (c) RX-UAS-VIDEO SRTP context - SERVER resetting cipher state\n"); + _rxUASVideo.resetCipherState(); + logSrtpInfo("call::executeAction() [UPDATEVIDEO]: (d) TX-UAS-VIDEO SRTP context - SERVER deriving session encryption/salting/authentication keys\n"); + _txUASVideo.deriveSessionEncryptionKey(); + _txUASVideo.deriveSessionSaltingKey(); + _txUASVideo.deriveSessionAuthenticationKey(); + logSrtpInfo("call::executeAction() [UPDATEVIDEO]: (d) TX-UAS-VIDEO SRTP context - SERVER selecting encryption key\n"); + _txUASVideo.selectEncryptionKey(); + logSrtpInfo("call::executeAction() [UPDATEVIDEO]: (d) TX-UAS-VIDEO SRTP context - SERVER resetting cipher state\n"); + _txUASVideo.resetCipherState(); + //logSrtpInfo("call::executeAction() [UPDATEVIDEO]: ******** (c) RX-UAS-VIDEO SRTP context dump ********\n"); + //logSrtpInfo("%s", _rxUASVideo.dumpCryptoContext().c_str()); + //logSrtpInfo("call::executeAction() [UPDATEVIDEO]: ****************************************************\n"); + //logSrtpInfo("call::executeAction() [UPDATEVIDEO]: ******** (d) TX-UAS-VIDEO SRTP context dump ********\n"); + //logSrtpInfo("%s", _txUASVideo.dumpCryptoContext().c_str()); + //logSrtpInfo("call::executeAction() [UPDATEVIDEO]: ****************************************************\n"); + } + + logSrtpInfo("call::executeAction() [UPDATEVIDEO]: rtpstream_rtpecho_updatevideo\n"); +#endif // USE_OPENSSL + rtpstream_rtpecho_updatevideo(&rtpstream_callinfo, _rxUASVideo, _txUASVideo); + } + else if (currentAction->getActionType() == CAction::E_AT_RTP_STREAM_RTPECHO_STOPVIDEO) + { +#ifdef USE_OPENSSL + logSrtpInfo("call::executeAction() [STOPVIDEO]: rtpstream_rtpecho_stopvideo\n"); +#endif // USE_OPENSSL + rc = rtpstream_rtpecho_stopvideo(&rtpstream_callinfo); + if (rc < 0) + { +#ifdef USE_OPENSSL + logSrtpInfo("call::executeAction() [STOPVIDEO]: rtpstream_rtpecho_stopvideo() rc==%d\n", rc); +#endif // USE_OPENSSL + return call::E_AR_RTPECHO_ERROR; + } + } +#endif // RTP_STREAM + else + { ERROR("call::executeAction unknown action"); } } // end for @@ -4090,6 +6838,38 @@ bool call::automaticResponseMode(T_AutoMode P_case, const char* P_recv) return false; } +#ifdef USE_OPENSSL +int call::logSrtpInfo(const char *fmt, ...) +{ + va_list args; + + if (_srtpctxdebugfile != NULL) + { + va_start(args, fmt); + vfprintf(_srtpctxdebugfile, fmt, args); + va_end(args); + } + + return 0; +} +#endif // USE_OPENSSL + +void call::setSessionState(SessionState state) +{ + _sessionStateOld = _sessionStateCurrent; + _sessionStateCurrent = state; +} + +SessionState call::getSessionStateCurrent() +{ + return _sessionStateCurrent; +} + +SessionState call::getSessionStateOld() +{ + return _sessionStateOld; +} + #ifdef PCAPPLAY void *send_wrapper(void *arg) { diff --git a/src/jlsrtp.cpp b/src/jlsrtp.cpp new file mode 100644 index 00000000..f40cb7a4 --- /dev/null +++ b/src/jlsrtp.cpp @@ -0,0 +1,3580 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA + * + * Author: Jeannot Langlois (jeannot.langlois@gmail.com) -- 2016-2020 + */ + +#ifdef USE_OPENSSL + +#include "jlsrtp.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include // std::ostringstream + +// --------------- PRIVATE METHODS ---------------- + +bool JLSRTP::isBase64(unsigned char c) +{ + return (isalnum(c) || + (c == '+') || + (c == '/')); +} + +int JLSRTP::resetPseudoRandomState(std::vector iv) +{ + int ivSize = 0; + + ivSize = iv.size(); + assert(ivSize == JLSRTP_SALTING_KEY_LENGTH); + if (ivSize == JLSRTP_SALTING_KEY_LENGTH) + { + // aes_ctr128_encrypt() requires 'num' and 'ecount' to be set to zero on the first call + _pseudorandomstate.num = 0; + memset(_pseudorandomstate.ecount, 0, sizeof(_pseudorandomstate.ecount)); + + // Clear BOTH high-order bytes [0..13] for 'IV' AND low-order bytes [14..15] for 'counter' + memset(_pseudorandomstate.ivec, 0, AES_BLOCK_SIZE); + // Copy 'IV' into high-order bytes [0..13] -- low-order bytes [14..15] remain zero + memcpy(_pseudorandomstate.ivec, iv.data(), iv.size()); + + return 0; + } + else + { + return -1; + } +} + +int JLSRTP::pseudorandomFunction(std::vector iv, int n, std::vector &output) +{ + int rc = 0; + int num_loops = 0; + AES_KEY aes_key; + std::vector block; + std::vector input; + int ivSize = 0; + int keySize = 0; + int retVal = 0; + + switch (_active_crypto) + { + case PRIMARY_CRYPTO: + { + ivSize = iv.size(); + keySize = _primary_crypto.master_key.size(); + + assert(ivSize == JLSRTP_SALTING_KEY_LENGTH); + assert(keySize == JLSRTP_ENCRYPTION_KEY_LENGTH); + if (ivSize == JLSRTP_SALTING_KEY_LENGTH) + { + if (keySize == JLSRTP_ENCRYPTION_KEY_LENGTH) + { + input.resize(AES_BLOCK_SIZE, 0); + output.clear(); + + // Determine how many AES_BLOCK_SIZE-byte encryption loops will be necessary to achieve at least n/8 bytes of pseudorandom ciphertext + num_loops = (n % JLSRTP_PSEUDORANDOM_BITS) ? ((n / JLSRTP_PSEUDORANDOM_BITS) + 1) : (n / JLSRTP_PSEUDORANDOM_BITS); + + // Set encryption key + rc = setAESPseudoRandomFunctionKey(_active_crypto); + if (rc == 0) + { + // Reset IV/counter state + resetPseudoRandomState(iv); + + for (int i = 0; i < num_loops; i++) + { + // Encrypt given _pseudorandomstate.ivec input using aes_key to block + block.clear(); + block.resize(AES_BLOCK_SIZE, 0); + AES_ctr128_pseudorandom_EVPencrypt(input.data(), block.data(), AES_BLOCK_SIZE, _pseudorandomstate.ivec, _pseudorandomstate.ecount, &_pseudorandomstate.num); + output.insert(output.end(), block.begin(), block.end()); + } + + // Truncate output to n/8 bytes + output.resize(n / 8); + + retVal = 0; + } + else + { + retVal = -3; + } + } + else + { + retVal = -2; + } + } + else + { + retVal = -1; + } + } + break; + + case SECONDARY_CRYPTO: + { + ivSize = iv.size(); + keySize = _secondary_crypto.master_key.size(); + + assert(ivSize == JLSRTP_SALTING_KEY_LENGTH); + assert(keySize == JLSRTP_ENCRYPTION_KEY_LENGTH); + if (ivSize == JLSRTP_SALTING_KEY_LENGTH) + { + if (keySize == JLSRTP_ENCRYPTION_KEY_LENGTH) + { + input.resize(AES_BLOCK_SIZE, 0); + output.clear(); + + // Determine how many AES_BLOCK_SIZE-byte encryption loops will be necessary to achieve at least n/8 bytes of pseudorandom ciphertext + num_loops = (n % JLSRTP_PSEUDORANDOM_BITS) ? ((n / JLSRTP_PSEUDORANDOM_BITS) + 1) : (n / JLSRTP_PSEUDORANDOM_BITS); + + // Set encryption key + rc = setAESPseudoRandomFunctionKey(_active_crypto); + if (rc == 0) + { + // Reset IV/counter state + resetPseudoRandomState(iv); + + for (int i = 0; i < num_loops; i++) + { + // Encrypt given _pseudorandomstate.ivec input using aes_key to block + block.clear(); + block.resize(AES_BLOCK_SIZE, 0); + AES_ctr128_pseudorandom_EVPencrypt(input.data(), block.data(), AES_BLOCK_SIZE, _pseudorandomstate.ivec, _pseudorandomstate.ecount, &_pseudorandomstate.num); + output.insert(output.end(), block.begin(), block.end()); + } + + // Truncate output to n/8 bytes + output.resize(n / 8); + + retVal = 0; + } + else + { + retVal = -3; + } + } + else + { + retVal = -2; + } + } + else + { + retVal = -1; + } + } + break; + + default: + { + retVal = -4; + } + break; + } + + return retVal; +} + +int JLSRTP::shiftVectorLeft(std::vector &shifted_vec, std::vector &original_vec, int shift_value) +{ + int i = 0; + int j = 0; + + shifted_vec.clear(); + shifted_vec.resize(original_vec.size(), 0); + + for (i = shift_value, j = 0; i < original_vec.size(); i++, j++) { + shifted_vec[j] = original_vec[i]; + } + + return 0; +} + +int JLSRTP::shiftVectorRight(std::vector &shifted_vec, std::vector &original_vec, int shift_value) +{ + int i = 0; + int j = 0; + + shifted_vec.clear(); + shifted_vec.resize(original_vec.size(), 0); + + for (i = shift_value, j = 0; i < shifted_vec.size(); i++, j++) { + shifted_vec[i] = original_vec[j]; + } + + return 0; +} + +int JLSRTP::xorVector(std::vector &a, std::vector &b, std::vector &result) +{ + int retVal = -1; + + if (a.size() == b.size()) + { + result.clear(); + result.resize(a.size(), 0); + std::transform(a.begin(), a.end(), b.begin(), result.begin(), std::bit_xor()); + retVal = 0; + } + else + { + retVal = -1; + } + + return retVal; +} + +int JLSRTP::isBigEndian() +{ + Conversion32 bint = {0x01020304}; + + return (bint.c[0] == 0x01); +} + +int JLSRTP::isLittleEndian() +{ + Conversion32 bint = {0x01020304}; + + return (bint.c[0] == 0x04); +} + +int JLSRTP::convertSsrc(unsigned long ssrc, std::vector &result) +{ + Conversion32 exchange_ssrc = {ssrc}; + + result.clear(); + result.resize(16, 0); + + if (isLittleEndian()) + { + result[12] = exchange_ssrc.c[3]; + result[13] = exchange_ssrc.c[2]; + result[14] = exchange_ssrc.c[1]; + result[15] = exchange_ssrc.c[0]; + } + else + { + result[12] = exchange_ssrc.c[0]; + result[13] = exchange_ssrc.c[1]; + result[14] = exchange_ssrc.c[2]; + result[15] = exchange_ssrc.c[3]; + } + + return 0; +} + +int JLSRTP::convertPacketIndex(unsigned long long i, std::vector &result) +{ + Conversion64 exchange_i = {i}; + + result.clear(); + result.resize(16, 0); + + if (isLittleEndian()) + { + result[8] = exchange_i.c[7]; + result[9] = exchange_i.c[6]; + result[10] = exchange_i.c[5]; + result[11] = exchange_i.c[4]; + result[12] = exchange_i.c[3]; + result[13] = exchange_i.c[2]; + result[14] = exchange_i.c[1]; + result[15] = exchange_i.c[0]; + } + else + { + result[8] = exchange_i.c[0]; + result[9] = exchange_i.c[1]; + result[10] = exchange_i.c[2]; + result[11] = exchange_i.c[3]; + result[12] = exchange_i.c[4]; + result[13] = exchange_i.c[5]; + result[14] = exchange_i.c[6]; + result[15] = exchange_i.c[7]; + } + + return 0; +} + +int JLSRTP::convertROC(unsigned long ROC, std::vector &result) +{ + Conversion32 exchange_roc = {ROC}; + + result.clear(); + result.resize(4, 0); + + if (isLittleEndian()) + { + result[0] = exchange_roc.c[3]; + result[1] = exchange_roc.c[2]; + result[2] = exchange_roc.c[1]; + result[3] = exchange_roc.c[0]; + } + else + { + result[0] = exchange_roc.c[0]; + result[1] = exchange_roc.c[1]; + result[2] = exchange_roc.c[2]; + result[3] = exchange_roc.c[3]; + } + + return 0; + + return 0; +} + +unsigned long JLSRTP::determineV(unsigned short SEQ) +{ + unsigned long v = 0; + + if (_s_l < 32768) + { + if ((SEQ - _s_l) > 32768) + { + v = _ROC-1; + } + else + { + v = _ROC; + } + } + else + { + if ((SEQ - _s_l) < -32768) + { + v = _ROC+1; + } + else + { + v = _ROC; + } + } + + return v; +} + +bool JLSRTP::updateRollOverCounter(unsigned long v) +{ + _ROC = v; + + return true; +} + +unsigned long JLSRTP::fetchRollOverCounter() +{ + return _ROC; +} + +bool JLSRTP::updateSL(unsigned short s) +{ + _s_l = s; + + return true; +} + +unsigned short JLSRTP::fetchSL() +{ + return _s_l; +} + +unsigned long long JLSRTP::determinePacketIndex(unsigned long ROC, unsigned short SEQ) +{ + return ((JLSRTP_MAX_SEQUENCE_NUMBERS * ROC) + SEQ); +} + +int JLSRTP::setPacketIV() +{ + int ivSize = 0; + + ivSize = _packetIV.size(); + assert(ivSize == JLSRTP_SALTING_KEY_LENGTH); + if (ivSize == JLSRTP_SALTING_KEY_LENGTH) + { + // Copy 'IV' into high-order bytes [0..13] -- low-order bytes [14..15] remain zero + memcpy(_cipherstate.ivec, _packetIV.data(), _packetIV.size()); + + return 0; + } + else + { + return -1; + } +} + +int JLSRTP::computePacketIV(unsigned long long i) +{ + std::vector padded_salt; + std::vector ssrc_vec; + std::vector i_vec; + std::vector shifted_ssrc; + std::vector shifted_i; + std::vector intermediate; + unsigned long ssrc = _id.ssrc; // SSRC + int saltSize = 0; + + _packetIV.clear(); + + saltSize = _session_salt_key.size(); + assert(saltSize == JLSRTP_SALTING_KEY_LENGTH); + if (saltSize == JLSRTP_SALTING_KEY_LENGTH) + { + padded_salt = _session_salt_key; + padded_salt.push_back(0x00); // 1-byte PAD + padded_salt.push_back(0x00); // 1-byte PAD + + convertSsrc(ssrc, ssrc_vec); + convertPacketIndex(i, i_vec); + + shiftVectorLeft(shifted_ssrc, ssrc_vec, 8); + shiftVectorLeft(shifted_i, i_vec, 2); + + xorVector(padded_salt, shifted_ssrc, intermediate); + xorVector(intermediate, shifted_i, _packetIV); + + // Truncate output IV to 14 bytes + _packetIV.resize(14); + + return 0; + } + else + { + return -1; + } +} + +void JLSRTP::displayPacketIV() +{ + printf("packet_iv : ["); + for (int i = 0; i < _packetIV.size(); i++) + { + printf("%02x", _packetIV[i]); + } + printf("]\n"); +} + +int JLSRTP::encryptVector(std::vector &invdata, std::vector &ciphertext_output) +{ + int retVal = 0; + + assert(!invdata.empty()); + if (!invdata.empty()) + { + switch (_active_crypto) + { + case PRIMARY_CRYPTO: + { + switch (_primary_crypto.cipher_algorithm) + { + case AES_CM_128: + { + ciphertext_output.resize(invdata.size(), 0); + resetCipherBlockOffset(); + resetCipherOutputBlock(); + resetCipherBlockCounter(); + AES_ctr128_session_EVPencrypt(invdata.data(), ciphertext_output.data(), invdata.size(), _cipherstate.ivec, _cipherstate.ecount, &_cipherstate.num); + retVal = 0; + } + break; + + case NULL_CIPHER: + { + ciphertext_output = invdata; + retVal = 0; + } + break; + + default: + { + retVal = -3; + } + break; + } + } + break; + + case SECONDARY_CRYPTO: + { + switch (_secondary_crypto.cipher_algorithm) + { + case AES_CM_128: + { + ciphertext_output.resize(invdata.size(), 0); + resetCipherBlockOffset(); + resetCipherOutputBlock(); + resetCipherBlockCounter(); + AES_ctr128_session_EVPencrypt(invdata.data(), ciphertext_output.data(), invdata.size(), _cipherstate.ivec, _cipherstate.ecount, &_cipherstate.num); + retVal = 0; + } + break; + + case NULL_CIPHER: + { + ciphertext_output = invdata; + retVal = 0; + } + break; + + default: + { + retVal = -3; + } + break; + } + } + break; + + default: + { + retVal = -4; + } + break; + } + } + else + { + retVal = -1; + } + + return retVal; +} + +int JLSRTP::decryptVector(std::vector &ciphertext_input, std::vector &outvdata) +{ + int retVal = 0; + + assert(!ciphertext_input.empty()); + if (!ciphertext_input.empty()) + { + switch (_active_crypto) + { + case PRIMARY_CRYPTO: + { + switch (_primary_crypto.cipher_algorithm) + { + case AES_CM_128: + { + outvdata.resize(ciphertext_input.size(), 0); + resetCipherBlockOffset(); + resetCipherOutputBlock(); + resetCipherBlockCounter(); + AES_ctr128_session_EVPencrypt(ciphertext_input.data(), outvdata.data(), ciphertext_input.size(), _cipherstate.ivec, _cipherstate.ecount, &_cipherstate.num); + retVal = 0; + } + break; + + case NULL_CIPHER: + { + outvdata = ciphertext_input; + retVal = 0; + } + break; + + default: + { + retVal = -3; + } + break; + } + } + break; + + case SECONDARY_CRYPTO: + { + switch (_secondary_crypto.cipher_algorithm) + { + case AES_CM_128: + { + outvdata.resize(ciphertext_input.size(), 0); + resetCipherBlockOffset(); + resetCipherOutputBlock(); + resetCipherBlockCounter(); + AES_ctr128_session_EVPencrypt(ciphertext_input.data(), outvdata.data(), ciphertext_input.size(), _cipherstate.ivec, _cipherstate.ecount, &_cipherstate.num); + retVal = 0; + } + break; + + case NULL_CIPHER: + { + outvdata = ciphertext_input; + retVal = 0; + } + break; + + default: + { + retVal = -3; + } + break; + } + } + break; + + default: + { + retVal = -4; + } + break; + } + } + else + { + retVal = -1; + } + + return retVal; +} + +int JLSRTP::issueAuthenticationTag(std::vector &data, std::vector &hash) +{ + unsigned char* digest = NULL; + int retVal = -1; + std::vector auth_portion; + std::vector rocVec; + int rc = -1; + + assert(!_session_auth_key.empty()); + if (!_session_auth_key.empty()) + { + rc = convertROC(_ROC, rocVec); + if (rc == 0) + { + auth_portion.clear(); + auth_portion.insert(auth_portion.end(), data.begin(), data.end()); + auth_portion.insert(auth_portion.end(), rocVec.begin(), rocVec.end()); + + hash.clear(); + digest = HMAC(EVP_sha1(), _session_auth_key.data(), _session_auth_key.size(), /*data.data()*/ auth_portion.data(), /*data.size()*/ auth_portion.size(), NULL, NULL); + + if (digest != NULL) + { + hash.assign(digest, digest+JLSRTP_SHA1_HASH_LENGTH); + + switch (_active_crypto) + { + case PRIMARY_CRYPTO: + { + switch (_primary_crypto.hmac_algorithm) + { + case HMAC_SHA1_80: + hash.resize(JLSRTP_AUTHENTICATION_TAG_SIZE_SHA1_80); // Truncate to 10 bytes (80 bits / 8 bits/byte = 10 bytes) + retVal = 0; + break; + + case HMAC_SHA1_32: + hash.resize(JLSRTP_AUTHENTICATION_TAG_SIZE_SHA1_32); // Truncate to 4 bytes (32 bits / 8 bits/byte = 4 bytes) + retVal = 0; + break; + + default: + // Unrecognized input value -- NO-OP... + retVal = -3; + break; + } + } + break; + + case SECONDARY_CRYPTO: + { + switch (_secondary_crypto.hmac_algorithm) + { + case HMAC_SHA1_80: + hash.resize(JLSRTP_AUTHENTICATION_TAG_SIZE_SHA1_80); // Truncate to 10 bytes (80 bits / 8 bits/byte = 10 bytes) + retVal = 0; + break; + + case HMAC_SHA1_32: + hash.resize(JLSRTP_AUTHENTICATION_TAG_SIZE_SHA1_32); // Truncate to 4 bytes (32 bits / 8 bits/byte = 4 bytes) + retVal = 0; + break; + + default: + // Unrecognized input value -- NO-OP... + retVal = -3; + break; + } + } + break; + + default: + { + retVal = -5; + } + break; + } + } + else + { + retVal = -2; + } + } + else + { + retVal = -4; + } + } + else + { + retVal = -1; + } + + return retVal; +} + +int JLSRTP::extractAuthenticationTag(std::vector srtp_packet, std::vector &hash) +{ + int retVal = -1; + std::vector::iterator it = srtp_packet.begin(); + int authtag_pos = 0; + + assert(!_session_auth_key.empty()); + if (!_session_auth_key.empty()) + { + switch (_active_crypto) + { + case PRIMARY_CRYPTO: + { + switch (_primary_crypto.hmac_algorithm) + { + case HMAC_SHA1_80: + if (srtp_packet.size() >= JLSRTP_AUTHENTICATION_TAG_SIZE_SHA1_80) + { + authtag_pos = srtp_packet.size() - 10; + std::advance(it, authtag_pos); + hash.assign(it, srtp_packet.end()); // Fetch trailing 10 bytes (80 bits / 8 bits/byte = 10 bytes) + retVal = 0; + } + else + { + retVal = -2; + } + break; + + case HMAC_SHA1_32: + if (srtp_packet.size() >= JLSRTP_AUTHENTICATION_TAG_SIZE_SHA1_32) + { + authtag_pos = srtp_packet.size() - 4; + std::advance(it, authtag_pos); + hash.assign(it, srtp_packet.end()); // Fetch trailing 4 bytes (32 bits / 8 bits/byte = 4 bytes) + retVal = 0; + } + else + { + retVal = -2; + } + break; + + default: + // Unrecognized input value -- NO-OP... + retVal = -3; + break; + } + } + break; + + case SECONDARY_CRYPTO: + { + switch (_secondary_crypto.hmac_algorithm) + { + case HMAC_SHA1_80: + if (srtp_packet.size() >= JLSRTP_AUTHENTICATION_TAG_SIZE_SHA1_80) + { + authtag_pos = srtp_packet.size() - 10; + std::advance(it, authtag_pos); + hash.assign(it, srtp_packet.end()); // Fetch trailing 10 bytes (80 bits / 8 bits/byte = 10 bytes) + retVal = 0; + } + else + { + retVal = -2; + } + break; + + case HMAC_SHA1_32: + if (srtp_packet.size() >= JLSRTP_AUTHENTICATION_TAG_SIZE_SHA1_32) + { + authtag_pos = srtp_packet.size() - 4; + std::advance(it, authtag_pos); + hash.assign(it, srtp_packet.end()); // Fetch trailing 4 bytes (32 bits / 8 bits/byte = 4 bytes) + retVal = 0; + } + else + { + retVal = -2; + } + break; + + default: + // Unrecognized input value -- NO-OP... + retVal = -3; + break; + } + } + break; + + default: + { + retVal = -4; + } + break; + } + } + else + { + retVal = -1; + } + + return retVal; +} + +int JLSRTP::extractSRTPHeader(std::vector srtp_packet, std::vector &header) +{ + int retVal = -1; + std::vector::iterator it = srtp_packet.begin(); + + if (_srtp_header_size > 0) + { + if (srtp_packet.size() >= _srtp_header_size) + { + header.clear(); + std::advance(it, _srtp_header_size); + header.assign(srtp_packet.begin(), it); // Fetch leading 12 bytes + retVal = 0; + } + else + { + retVal = -2; + } + } + else + { + retVal = -1; + } + + return retVal; +} + +int JLSRTP::extractSRTPPayload(std::vector srtp_packet, std::vector &payload) +{ + int retVal = -1; + std::vector::iterator it_payload_begin = srtp_packet.begin(); + std::vector::iterator it_payload_end = srtp_packet.begin(); + int header_payload_size = 0; + + header_payload_size = _srtp_header_size + _srtp_payload_size; + + if (_srtp_header_size > 0) + { + if (_srtp_payload_size > 0) + { + if (srtp_packet.size() >= header_payload_size) + { + payload.clear(); + std::advance(it_payload_begin, _srtp_header_size); + std::advance(it_payload_end, header_payload_size); + payload.assign(it_payload_begin, it_payload_end); // Fetch payload bytes + retVal = 0; + } + else + { + retVal = -3; + } + } + else + { + retVal = -2; + } + } + else + { + retVal = -1; + } + + return retVal; +} + +std::string JLSRTP::base64Encode(std::vector const& s) +{ + int i = 0; + int j = 0; + unsigned char char_array_3[3]; + unsigned char char_array_4[4]; + unsigned char const* bytes_to_encode = &s.front(); + unsigned int in_len = s.size(); + std::string ret; + + while (in_len--) + { + char_array_3[i++] = *(bytes_to_encode++); + if (i == 3) + { + char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; + char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); + char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); + char_array_4[3] = char_array_3[2] & 0x3f; + + for(i = 0; (i <4) ; i++) + { + ret += base64Chars[char_array_4[i]]; + } + i = 0; + } + } + + if (i) + { + for(j = i; j < 3; j++) + { + char_array_3[j] = '\0'; + } + + char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; + char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); + char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); + char_array_4[3] = char_array_3[2] & 0x3f; + + for (j = 0; (j < i + 1); j++) + { + ret += base64Chars[char_array_4[j]]; + } + + while((i++ < 3)) + { + ret += '='; + } + } + + return ret; +} + +std::vector JLSRTP::base64Decode(std::string const& encoded_string) +{ + int i = 0; + int j = 0; + unsigned char char_array_4[4]; + unsigned char char_array_3[3]; + int in_ = 0; + int in_len = encoded_string.size(); + std::vector ret; + + while (in_len-- && ( encoded_string[in_] != '=') && isBase64(encoded_string[in_])) + { + char_array_4[i++] = encoded_string[in_]; + in_++; + if (i ==4) + { + for (i = 0; i <4; i++) + { + char_array_4[i] = base64Chars.find(char_array_4[i]); + } + + char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); + char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); + char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; + + for (i = 0; (i < 3); i++) + { + ret.push_back(char_array_3[i]); + } + i = 0; + } + } + + if (i) + { + for (j = i; j <4; j++) + { + char_array_4[j] = 0; + } + + for (j = 0; j <4; j++) + { + char_array_4[j] = base64Chars.find(char_array_4[j]); + } + + char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); + char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); + char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; + + for (j = 0; (j < i - 1); j++) + { + ret.push_back(char_array_3[j]); + } + } + + return ret; +} + +int JLSRTP::resetCipherBlockOffset() +{ + _cipherstate.num = 0; + + return 0; +} + +int JLSRTP::resetCipherOutputBlock() +{ + memset(_cipherstate.ecount, 0, sizeof(_cipherstate.ecount)); + + return 0; +} + +int JLSRTP::resetCipherBlockCounter() +{ + // Clear low-order bytes [14..15] for 'counter' + memset(_cipherstate.ivec+14, 0, 2); + + return 0; +} + +int JLSRTP::setAESPseudoRandomFunctionKey(ActiveCrypto crypto_attrib /*= ACTIVE_CRYPTO*/) +{ + ActiveCrypto active_crypto = INVALID_CRYPTO; + int rc = 0; + int retVal = 0; + + if (_pseudorandomstate.cipher != NULL) + { + if (crypto_attrib == ACTIVE_CRYPTO) + { + active_crypto = _active_crypto; + } + else + { + active_crypto = crypto_attrib; + } + + switch (active_crypto) + { + case PRIMARY_CRYPTO: + { + rc = EVP_EncryptInit_ex(_pseudorandomstate.cipher, NULL, NULL, _primary_crypto.master_key.data(), NULL); + if (rc == 1) + { + retVal = 0; + } + else + { + retVal = -2; + } + } + break; + + case SECONDARY_CRYPTO: + { + rc = EVP_EncryptInit_ex(_pseudorandomstate.cipher, NULL, NULL, _secondary_crypto.master_key.data(), NULL); + if (rc == 1) + { + retVal = 0; + } + else + { + retVal = -3; + } + } + break; + + default: + { + retVal = -4; + } + break; + } + } + else + { + retVal = -1; + } + + return retVal; +} + +int JLSRTP::setAESSessionEncryptionKey() +{ + int rc = 0; + int retVal = 0; + + if (_cipherstate.cipher != NULL) + { + rc = EVP_EncryptInit_ex(_cipherstate.cipher, NULL, NULL, _session_enc_key.data(), NULL); + if (rc == 1) + { + retVal = 0; + } + else + { + retVal = -2; + } + } + else + { + retVal = -1; + } + + return retVal; +} + +void JLSRTP::AES_ctr128_increment(unsigned char* counter) +{ + unsigned char* cur_pos = NULL; + + for (cur_pos = counter + 15; cur_pos >= counter; cur_pos--) + { + (*cur_pos)++; + if (*cur_pos != 0) + { + break; + } + } +} + +int JLSRTP::AES_ctr128_pseudorandom_EVPencrypt(const unsigned char* in, + unsigned char* out, + const unsigned long length, + unsigned char counter[AES_BLOCK_SIZE], + unsigned char ecount_buf[AES_BLOCK_SIZE], + unsigned int* num) +{ + int nb; + unsigned int n; + unsigned long l=length; + int rc = 0; + int retVal = 0; + + switch (_active_crypto) + { + case PRIMARY_CRYPTO: + { + n = *num; + + while (l--) + { + if (n == 0) + { + // IMPORTANT: Key MUST be set every single time EVP_EncryptUpdate() is to be called... + rc = EVP_EncryptInit_ex(_pseudorandomstate.cipher, NULL, NULL, _primary_crypto.master_key.data(), NULL); + if (rc == 1) + { + rc = EVP_EncryptUpdate(_pseudorandomstate.cipher, ecount_buf, &nb, counter, AES_BLOCK_SIZE); + if (rc == 1) + { + retVal = 0; + AES_ctr128_increment(counter); + } + else + { + retVal = -2; + break; + } + } + else + { + retVal = -1; + break; + } + } + *(out++) = *(in++) ^ ecount_buf[n]; + n = (n+1) % AES_BLOCK_SIZE; + } + + *num=n; + } + break; + + case SECONDARY_CRYPTO: + { + n = *num; + + while (l--) + { + if (n == 0) + { + // IMPORTANT: Key MUST be set every single time EVP_EncryptUpdate() is to be called... + rc = EVP_EncryptInit_ex(_pseudorandomstate.cipher, NULL, NULL, _secondary_crypto.master_key.data(), NULL); + if (rc == 1) + { + rc = EVP_EncryptUpdate(_pseudorandomstate.cipher, ecount_buf, &nb, counter, AES_BLOCK_SIZE); + if (rc == 1) + { + retVal = 0; + AES_ctr128_increment(counter); + } + else + { + retVal = -2; + break; + } + } + else + { + retVal = -1; + break; + } + } + *(out++) = *(in++) ^ ecount_buf[n]; + n = (n+1) % AES_BLOCK_SIZE; + } + + *num=n; + } + break; + + default: + { + retVal = -3; + } + break; + } + + return retVal; +} + +int JLSRTP::AES_ctr128_session_EVPencrypt(const unsigned char* in, + unsigned char* out, + const unsigned long length, + unsigned char counter[AES_BLOCK_SIZE], + unsigned char ecount_buf[AES_BLOCK_SIZE], + unsigned int* num) +{ + int nb; + unsigned int n; + unsigned long l=length; + int rc = 0; + int retVal = 0; + + n = *num; + + while (l--) + { + if (n == 0) + { + // IMPORTANT: Key MUST be set every single time EVP_EncryptUpdate() is to be called... + rc = EVP_EncryptInit_ex(_cipherstate.cipher, NULL, NULL, _session_enc_key.data(), NULL); + if (rc == 1) + { + rc = EVP_EncryptUpdate(_cipherstate.cipher, ecount_buf, &nb, counter, AES_BLOCK_SIZE); + if (rc == 1) + { + retVal = 0; + AES_ctr128_increment(counter); + } + else + { + retVal = -2; + break; + } + } + else + { + retVal = -1; + break; + } + } + *(out++) = *(in++) ^ ecount_buf[n]; + n = (n+1) % AES_BLOCK_SIZE; + } + + *num=n; + + return retVal; +} + + +// --------------- PUBLIC METHODS ---------------- + +void JLSRTP::resetCryptoContext(unsigned int ssrc, std::string ipAddress, unsigned short port) +{ + _id.ssrc = ssrc; + _id.address = ipAddress; + _id.port = port; + _ROC = 0; + _s_l = 0; + _primary_crypto.cipher_algorithm = AES_CM_128; + _primary_crypto.hmac_algorithm = HMAC_SHA1_80; + _primary_crypto.MKI = 0; + _primary_crypto.MKI_length = 0; + _primary_crypto.active_MKI = 0; + _primary_crypto.master_key.resize(JLSRTP_ENCRYPTION_KEY_LENGTH, 0); + _primary_crypto.master_key_counter = 0; + _primary_crypto.n_e = _primary_crypto.master_key.size(); + _primary_crypto.n_a = JLSRTP_AUTHENTICATION_KEY_LENGTH; + _primary_crypto.master_salt.resize(JLSRTP_SALTING_KEY_LENGTH, 0); + _primary_crypto.master_key_derivation_rate = 0; + _primary_crypto.master_mki_value = 0; + _primary_crypto.n_s = _primary_crypto.master_salt.size(); + _primary_crypto.tag = 0; + _secondary_crypto.cipher_algorithm = AES_CM_128; + _secondary_crypto.hmac_algorithm = HMAC_SHA1_80; + _secondary_crypto.MKI = 0; + _secondary_crypto.MKI_length = 0; + _secondary_crypto.active_MKI = 0; + _secondary_crypto.master_key.resize(JLSRTP_ENCRYPTION_KEY_LENGTH, 0); + _secondary_crypto.master_key_counter = 0; + _secondary_crypto.n_e = _secondary_crypto.master_key.size(); + _secondary_crypto.n_a = JLSRTP_AUTHENTICATION_KEY_LENGTH; + _secondary_crypto.master_salt.resize(JLSRTP_SALTING_KEY_LENGTH, 0); + _secondary_crypto.master_key_derivation_rate = 0; + _secondary_crypto.master_mki_value = 0; + _secondary_crypto.n_s = _secondary_crypto.master_salt.size(); + _secondary_crypto.tag = 0; + _session_enc_key.resize(JLSRTP_ENCRYPTION_KEY_LENGTH, 0); + _session_salt_key.resize(JLSRTP_SALTING_KEY_LENGTH, 0); + _session_auth_key.resize(JLSRTP_AUTHENTICATION_KEY_LENGTH, 0); + _packetIV.resize(JLSRTP_SALTING_KEY_LENGTH, 0); + memset(_pseudorandomstate.ivec, 0, sizeof(_pseudorandomstate.ivec)); + _pseudorandomstate.num = 0; + memset(_pseudorandomstate.ecount, 0, sizeof(_pseudorandomstate.ecount)); + memset(_cipherstate.ivec, 0, sizeof(_cipherstate.ivec)); + _cipherstate.num = 0; + memset(_cipherstate.ecount, 0, sizeof(_cipherstate.ecount)); + _srtp_header_size = JLSRTP_SRTP_DEFAULT_HEADER_SIZE; + _srtp_payload_size = 0; + _active_crypto = PRIMARY_CRYPTO; +} + +int JLSRTP::resetCipherState() +{ + int ivSize = 0; + + ivSize = _packetIV.size(); + assert(ivSize == JLSRTP_SALTING_KEY_LENGTH); + if (ivSize == JLSRTP_SALTING_KEY_LENGTH) + { + // aes_ctr128_encrypt() requires 'num' and 'ecount' to be set to zero on the first call + resetCipherBlockOffset(); + resetCipherOutputBlock(); + + // Clear BOTH high-order bytes [0..13] for 'IV' AND low-order bytes [14..15] for 'counter' + memset(_cipherstate.ivec, 0, AES_BLOCK_SIZE); + // Copy 'IV' into high-order bytes [0..13] -- low-order bytes [14..15] remain zero + memcpy(_cipherstate.ivec, _packetIV.data(), _packetIV.size()); + + return 0; + } + else + { + return -1; + } +} + +int JLSRTP::deriveSessionEncryptionKey() +{ + std::vector input_vector; // Input vector (built from applicable keyid_XXXs) + std::vector keyid_encryption; + int saltSize = 0; + int retVal = -1; + + switch (_active_crypto) + { + case PRIMARY_CRYPTO: + { + saltSize = _primary_crypto.master_salt.size(); + assert(saltSize == JLSRTP_SALTING_KEY_LENGTH); + if (saltSize == JLSRTP_SALTING_KEY_LENGTH) + { + input_vector.clear(); + + keyid_encryption.clear(); + keyid_encryption.resize(7, 0); + keyid_encryption.push_back(JLSRTP_KEY_ENCRYPTION_LABEL); + keyid_encryption.push_back(0x00); + keyid_encryption.push_back(0x00); + keyid_encryption.push_back(0x00); + keyid_encryption.push_back(0x00); + keyid_encryption.push_back(0x00); + keyid_encryption.push_back(0x00); + + xorVector(keyid_encryption, _primary_crypto.master_salt, input_vector); + + retVal = pseudorandomFunction(input_vector, 128, _session_enc_key); + } + else + { + retVal = -1; + } + } + break; + + case SECONDARY_CRYPTO: + { + saltSize = _secondary_crypto.master_salt.size(); + assert(saltSize == JLSRTP_SALTING_KEY_LENGTH); + if (saltSize == JLSRTP_SALTING_KEY_LENGTH) + { + input_vector.clear(); + + keyid_encryption.clear(); + keyid_encryption.resize(7, 0); + keyid_encryption.push_back(JLSRTP_KEY_ENCRYPTION_LABEL); + keyid_encryption.push_back(0x00); + keyid_encryption.push_back(0x00); + keyid_encryption.push_back(0x00); + keyid_encryption.push_back(0x00); + keyid_encryption.push_back(0x00); + keyid_encryption.push_back(0x00); + + xorVector(keyid_encryption, _secondary_crypto.master_salt, input_vector); + + retVal = pseudorandomFunction(input_vector, 128, _session_enc_key); + } + else + { + retVal = -1; + } + } + break; + + default: + { + retVal = -4; + } + break; + } + + return retVal; +} + +int JLSRTP::deriveSessionSaltingKey() +{ + std::vector input_vector; // Input vector (built from applicable keyid_XXXs) + std::vector keyid_salting; + int saltSize = 0; + int retVal = -1; + + switch (_active_crypto) + { + case PRIMARY_CRYPTO: + { + saltSize = _primary_crypto.master_salt.size(); + assert(saltSize == JLSRTP_SALTING_KEY_LENGTH); + if (saltSize == JLSRTP_SALTING_KEY_LENGTH) + { + input_vector.clear(); + + keyid_salting.clear(); + keyid_salting.resize(7, 0); + keyid_salting.push_back(JLSRTP_KEY_SALTING_LABEL); + keyid_salting.push_back(0x00); + keyid_salting.push_back(0x00); + keyid_salting.push_back(0x00); + keyid_salting.push_back(0x00); + keyid_salting.push_back(0x00); + keyid_salting.push_back(0x00); + + xorVector(keyid_salting, _primary_crypto.master_salt, input_vector); + + retVal = pseudorandomFunction(input_vector, 112, _session_salt_key); + } + else + { + retVal = -1; + } + } + break; + + case SECONDARY_CRYPTO: + { + saltSize = _secondary_crypto.master_salt.size(); + assert(saltSize == JLSRTP_SALTING_KEY_LENGTH); + if (saltSize == JLSRTP_SALTING_KEY_LENGTH) + { + input_vector.clear(); + + keyid_salting.clear(); + keyid_salting.resize(7, 0); + keyid_salting.push_back(JLSRTP_KEY_SALTING_LABEL); + keyid_salting.push_back(0x00); + keyid_salting.push_back(0x00); + keyid_salting.push_back(0x00); + keyid_salting.push_back(0x00); + keyid_salting.push_back(0x00); + keyid_salting.push_back(0x00); + + xorVector(keyid_salting, _secondary_crypto.master_salt, input_vector); + + retVal = pseudorandomFunction(input_vector, 112, _session_salt_key); + } + else + { + retVal = -1; + } + } + break; + + default: + { + retVal = -4; + } + break; + } + + return retVal; +} + +int JLSRTP::deriveSessionAuthenticationKey() +{ + std::vector input_vector; // Input vector (built from applicable keyid_XXXs) + std::vector keyid_authentication; + int saltSize = 0; + int retVal = -1; + + switch (_active_crypto) + { + case PRIMARY_CRYPTO: + { + saltSize = _primary_crypto.master_salt.size(); + assert(saltSize == JLSRTP_SALTING_KEY_LENGTH); + if (saltSize == JLSRTP_SALTING_KEY_LENGTH) + { + input_vector.clear(); + + keyid_authentication.clear(); + keyid_authentication.resize(7, 0); + keyid_authentication.push_back(JLSRTP_KEY_AUTHENTICATION_LABEL); + keyid_authentication.push_back(0x00); + keyid_authentication.push_back(0x00); + keyid_authentication.push_back(0x00); + keyid_authentication.push_back(0x00); + keyid_authentication.push_back(0x00); + keyid_authentication.push_back(0x00); + + xorVector(keyid_authentication, _primary_crypto.master_salt, input_vector); + + retVal = pseudorandomFunction(input_vector, 160, _session_auth_key); + } + else + { + retVal = -1; + } + } + break; + + case SECONDARY_CRYPTO: + { + saltSize = _secondary_crypto.master_salt.size(); + assert(saltSize == JLSRTP_SALTING_KEY_LENGTH); + if (saltSize == JLSRTP_SALTING_KEY_LENGTH) + { + input_vector.clear(); + + keyid_authentication.clear(); + keyid_authentication.resize(7, 0); + keyid_authentication.push_back(JLSRTP_KEY_AUTHENTICATION_LABEL); + keyid_authentication.push_back(0x00); + keyid_authentication.push_back(0x00); + keyid_authentication.push_back(0x00); + keyid_authentication.push_back(0x00); + keyid_authentication.push_back(0x00); + keyid_authentication.push_back(0x00); + + xorVector(keyid_authentication, _secondary_crypto.master_salt, input_vector); + + retVal = pseudorandomFunction(input_vector, 160, _session_auth_key); + } + else + { + retVal = -1; + } + } + break; + + default: + { + retVal = -4; + } + break; + } + + return retVal; +} + +void JLSRTP::displaySessionEncryptionKey() +{ + //printf("session_encryption_key[] size: %d\n", _session_enc_key.size()); + + printf("_session_enc_key : ["); + for (int i = 0; i < _session_enc_key.size(); i++) + { + printf("%02x", _session_enc_key[i]); + } + printf("]\n"); +} + +void JLSRTP::displaySessionSaltingKey() +{ + //printf("session_salting_key[] size: %d\n", _session_salt_key.size()); + + printf("_session_salt_key : ["); + for (int i = 0; i < _session_salt_key.size(); i++) + { + printf("%02x", _session_salt_key[i]); + } + printf("]\n"); +} + +void JLSRTP::displaySessionAuthenticationKey() +{ + //printf("session_authentication_key[] size: %d\n", _session_auth_key.size()); + + printf("_session_auth_key : ["); + for (int i = 0; i < _session_auth_key.size(); i++) + { + printf("%02x", _session_auth_key[i]); + } + printf("]\n"); +} + +int JLSRTP::selectEncryptionKey() +{ + int rc = 0; + + assert(!_session_enc_key.empty()); + if (!_session_enc_key.empty()) + { + rc = setAESSessionEncryptionKey(); + if (rc == 0) + { + return 0; + } + + return -2; + } + else + { + return -1; + } +} + +int JLSRTP::selectDecryptionKey() +{ + int rc = 0; + + assert(!_session_enc_key.empty()); + if (!_session_enc_key.empty()) + { + rc = setAESSessionEncryptionKey(); + if (rc == 0) + { + return 0; + } + + return -2; + } + else + { + return -1; + } +} + +CipherType JLSRTP::getCipherAlgorithm(ActiveCrypto crypto_attrib /*= ACTIVE_CRYPTO*/) +{ + CipherType retVal = INVALID_CIPHER; + ActiveCrypto active_crypto = INVALID_CRYPTO; + + if (crypto_attrib == ACTIVE_CRYPTO) + { + active_crypto = _active_crypto; + } + else + { + active_crypto = crypto_attrib; + } + + switch (active_crypto) + { + case PRIMARY_CRYPTO: + { + retVal = _primary_crypto.cipher_algorithm; + } + break; + + case SECONDARY_CRYPTO: + { + retVal = _secondary_crypto.cipher_algorithm; + } + break; + + default: + { + retVal = INVALID_CIPHER; + } + break; + } + + return retVal; +} + +int JLSRTP::selectCipherAlgorithm(CipherType cipherType, ActiveCrypto crypto_attrib /*= ACTIVE_CRYPTO*/) +{ + int retVal = -1; + ActiveCrypto active_crypto = INVALID_CRYPTO; + + if (crypto_attrib == ACTIVE_CRYPTO) + { + active_crypto = _active_crypto; + } + else + { + active_crypto = crypto_attrib; + } + + switch (active_crypto) + { + case PRIMARY_CRYPTO: + { + switch (cipherType) + { + case AES_CM_128: + { + _primary_crypto.cipher_algorithm = AES_CM_128; + retVal = 0; + } + break; + + case NULL_CIPHER: + { + _primary_crypto.cipher_algorithm = NULL_CIPHER; + retVal = 0; + } + break; + + default: + { + retVal = -1; + } + break; + } + } + break; + + case SECONDARY_CRYPTO: + { + switch (cipherType) + { + case AES_CM_128: + { + _secondary_crypto.cipher_algorithm = AES_CM_128; + retVal = 0; + } + break; + + case NULL_CIPHER: + { + _secondary_crypto.cipher_algorithm = NULL_CIPHER; + retVal = 0; + } + break; + + default: + { + retVal = -1; + } + break; + } + } + break; + + default: + { + retVal = -2; + } + break; + } + + return retVal; +} + +HashType JLSRTP::getHashAlgorithm(ActiveCrypto crypto_attrib /*= ACTIVE_CRYPTO*/) +{ + HashType retVal = INVALID_HASH; + ActiveCrypto active_crypto = INVALID_CRYPTO; + + if (crypto_attrib == ACTIVE_CRYPTO) + { + active_crypto = _active_crypto; + } + else + { + active_crypto = crypto_attrib; + } + + switch (active_crypto) + { + case PRIMARY_CRYPTO: + { + retVal = _primary_crypto.hmac_algorithm; + } + break; + + case SECONDARY_CRYPTO: + { + retVal = _secondary_crypto.hmac_algorithm; + } + break; + + default: + { + retVal = INVALID_HASH; + } + break; + } + + return retVal; +} + +int JLSRTP::selectHashAlgorithm(HashType hashType, ActiveCrypto crypto_attrib /*= ACTIVE_CRYPTO*/) +{ + int retVal = -1; + ActiveCrypto active_crypto = INVALID_CRYPTO; + + if (crypto_attrib == ACTIVE_CRYPTO) + { + active_crypto = _active_crypto; + } + else + { + active_crypto = crypto_attrib; + } + + switch (active_crypto) + { + + case PRIMARY_CRYPTO: + { + switch (hashType) + { + case HMAC_SHA1_80: + { + _primary_crypto.hmac_algorithm = HMAC_SHA1_80; + retVal = 0; + } + break; + + case HMAC_SHA1_32: + { + _primary_crypto.hmac_algorithm = HMAC_SHA1_32; + retVal = 0; + } + break; + + default: + { + retVal = -1; + } + break; + } + } + break; + + case SECONDARY_CRYPTO: + { + switch (hashType) + { + case HMAC_SHA1_80: + { + _secondary_crypto.hmac_algorithm = HMAC_SHA1_80; + retVal = 0; + } + break; + + case HMAC_SHA1_32: + { + _secondary_crypto.hmac_algorithm = HMAC_SHA1_32; + retVal = 0; + } + break; + + default: + { + retVal = -1; + } + break; + } + } + break; + + default: + { + retVal = -2; + } + break; + } + + return retVal; +} + +int JLSRTP::getAuthenticationTagSize() +{ + int retVal = -1; + + assert(!_session_auth_key.empty()); + if (!_session_auth_key.empty()) + { + switch (_active_crypto) + { + case PRIMARY_CRYPTO: + { + switch (_primary_crypto.hmac_algorithm) + { + case HMAC_SHA1_80: + retVal = JLSRTP_AUTHENTICATION_TAG_SIZE_SHA1_80; + break; + + case HMAC_SHA1_32: + retVal = JLSRTP_AUTHENTICATION_TAG_SIZE_SHA1_32; + break; + + default: + // Unrecognized input value -- NO-OP... + retVal = -2; + break; + } + } + break; + + case SECONDARY_CRYPTO: + { + switch (_secondary_crypto.hmac_algorithm) + { + case HMAC_SHA1_80: + retVal = JLSRTP_AUTHENTICATION_TAG_SIZE_SHA1_80; + break; + + case HMAC_SHA1_32: + retVal = JLSRTP_AUTHENTICATION_TAG_SIZE_SHA1_32; + break; + + default: + // Unrecognized input value -- NO-OP... + retVal = -2; + break; + } + } + break; + + default: + { + retVal = -3; + } + break; + } + } + else + { + retVal = -1; + } + + return retVal; +} + +void JLSRTP::displayAuthenticationTag(std::vector &authtag) +{ + printf("authentication tag : ["); + for (int i = 0; i < authtag.size(); i++) + { + printf("%02x", authtag[i]); + } + printf("]\n"); +} + +unsigned int JLSRTP::getSSRC() +{ + return _id.ssrc; +} + +std::string JLSRTP::getIPAddress() +{ + return _id.address; +} + +unsigned short JLSRTP::getPort() +{ + return _id.port; +} + +void JLSRTP::setSSRC(unsigned int ssrc) +{ + _id.ssrc = ssrc; +} + +void JLSRTP::setIPAddress(std::string ipAddress) +{ + _id.address = ipAddress; +} + +void JLSRTP::setPort(unsigned short port) +{ + _id.port = port; +} + +void JLSRTP::setID(CryptoContextID id) +{ + _id.ssrc = id.ssrc; + _id.address = id.address; + _id.port = id.port; +} + +unsigned int JLSRTP::getSrtpHeaderSize() +{ + return _srtp_header_size; +} + +void JLSRTP::setSrtpHeaderSize(unsigned int size) +{ + _srtp_header_size = size; +} + +unsigned int JLSRTP::getSrtpPayloadSize() +{ + return _srtp_payload_size; +} + +void JLSRTP::setSrtpPayloadSize(unsigned int size) +{ + _srtp_payload_size = size; +} + +int JLSRTP::processOutgoingPacket(unsigned short SEQ_s, + std::vector &rtp_header, + std::vector &rtp_payload, + std::vector &srtp_packet) +{ + int rc = 0; + bool check = false; + unsigned long v_s = 0; + unsigned long long i_s = 0LL; /* TEST PACKET INDEX */ + std::vector srtp_payload; /* ENCRYPTED PAYLOAD */ + std::vector auth_tag; + std::vector auth_portion; + int retVal = -1; + + // 1. Determine crypto context to use + // NO-OP (IMPLICIT) + + // 2. Determine packet index (i) using RoC + _s_l + SEQ (section 3.3.1) + //std::cout << "[processOutgoingPacket] SEQ_s: " << SEQ_s << " current ROC_s: " << _ROC << " current s_l_s: " << _s_l << " "; + v_s = determineV(SEQ_s); + //std::cout << "v_s: " << v_s << " "; + i_s = determinePacketIndex(v_s, SEQ_s); + //std::cout << "i_s: " << i_s << std::endl; + + // 3. Determine master key / master salt using packet index (i) OR MKI (section 8.1) + // NO-OP -- MASTER KEY / MASTER SALT ASSUMED TO BE UNIQUE WITHIN CONTEXT + + // 4. Determine session key / session salt (section 4.3) using master key + master salt + key_derivation_rate + session key-lengths + packet index (i) + // NO-OP -- SESSION KEY / SESSION SALT ALREADY DETERMINED AT THIS POINT + + // 5. Encrypt PAYLOAD to produce encrypted portion (section 4.1) using encryption algorithm + session encryption key + session salting key + packet index (i) + rc = computePacketIV(i_s); + if (rc == 0) + { + rc = setPacketIV(); + if (rc == 0) + { + rc = encryptVector(rtp_payload, srtp_payload); + if (rc == 0) + { + //printf("[processOutgoingPacket] CIPHERTEXT: ["); + //for (int i = 0; i < srtp_payload.size(); i++) { + // printf("%02x", srtp_payload[i]); + //} + //printf("]\n"); + + auth_portion.insert(auth_portion.end(), rtp_header.begin(), rtp_header.end()); + auth_portion.insert(auth_portion.end(), srtp_payload.begin(), srtp_payload.end()); + + // 6. If MKI is 1 then append MKI to packet + // NO-OP -- MKI NOT USED + + // 7A. Compute authentication tag from authenticated portion of the packet (section 4.2) using RoC + authentication algorithm + session authentication key + rc = issueAuthenticationTag(auth_portion, auth_tag); + if (rc == 0) + { + // 7B. Append authentication tag to the packet to produce encrypted+authenticated portion + srtp_packet.clear(); + srtp_packet.insert(srtp_packet.end(), auth_portion.begin(), auth_portion.end()); + srtp_packet.insert(srtp_packet.end(), auth_tag.begin(), auth_tag.end()); + + // 8. If necessary update RoC (section 3.3.1) using packet index (i) + check = updateRollOverCounter(v_s); + if (check) + { + check = updateSL(SEQ_s); + if (check) + { + retVal = 0; + } + else + { + retVal = -6; + } + } + else + { + retVal = -5; + } + } + else + { + retVal = -2; + } + } + else + { + retVal = -1; // ENCRYPTION FAILURE + } + } + else + { + retVal = -4; + } + } + else + { + retVal = -3; + } + + return retVal; +} + +int JLSRTP::processIncomingPacket(unsigned short SEQ_r, + std::vector &srtp_packet, + std::vector &rtp_header, + std::vector &rtp_payload) +{ + int rc = 0; + bool check = false; + unsigned long v_r = 0; + unsigned long long i_r = 0LL; /* TEST PACKET INDEX */ + std::vector auth_tag_generated; + std::vector auth_portion; + std::vector auth_tag_received; + std::vector srtp_payload; /* ENCRYPTED PAYLOAD */ + int retVal = -1; + + rtp_header.clear(); + rtp_payload.clear(); + + // 1. Determine crypto context to use + // NO-OP (IMPLICIT) + + // 2. Determine packet index (i) using RoC + _s_l (section 3.3.1) + //std::cout << "[processIncomingPacket] SEQ_r: " << SEQ_r << " current ROC_r: " << _ROC << " current s_l_r: " << _s_l << " "; + v_r = determineV(SEQ_r); + //std::cout << "v_r: " << v_r << " "; + i_r = determinePacketIndex(v_r, SEQ_r); + //std::cout << "i_r: " << i_r << " " << std::endl; + + // 3. Determine master key / master salt -- if MKI is 1 then use MKI in packet otherwise use packet index (i) (section 8.1) + // NO-OP -- MASTER KEY / MASTER SALT ASSUMED TO BE UNIQUE WITHIN CONTEXT + + // 4. Determine session key / session salt (section 4.3) using master key + master salt + key_derivation_rate + session key-lengths + packet index (i) + // NO-OP -- SESSION KEY / SESSION SALT ALREADY DETERMINED AT THIS POINT + + // 5A. Check if packet has been replayed (section 3.3.2) using replay list + packet index (i) -- discard packet if replayed + // NO-OP -- REPLAY LIST NOT USED + + // 5B. Verify authentication tag using RoC + authentication algorithm + session authentication key -- if authentication failure (section 4.2) discard packet + + rc = extractAuthenticationTag(srtp_packet, auth_tag_received); + if (rc == 0) + { + rc = extractSRTPHeader(srtp_packet, rtp_header); + if (rc == 0) + { + rc = extractSRTPPayload(srtp_packet, srtp_payload); + if (rc == 0) + { + auth_portion.insert(auth_portion.end(), rtp_header.begin(), rtp_header.end()); + auth_portion.insert(auth_portion.end(), srtp_payload.begin(), srtp_payload.end()); + + rc = issueAuthenticationTag(auth_portion, auth_tag_generated); + if (rc == 0) + { + if (auth_tag_received == auth_tag_generated) + { + // 6. Decrypt PAYLOAD (section 4.1) using decryption algorithm + session encryption key + session salting key + //printf("[processIncomingPacket] CIPHERTEXT: ["); + //for (int i = 0; i < srtp_payload.size(); i++) { + // printf("%02x", srtp_payload[i]); + //} + //printf("]\n"); + + rc = computePacketIV(i_r); + if (rc == 0) + { + rc = setPacketIV(); + if (rc == 0) + { + rc = decryptVector(srtp_payload, rtp_payload); + if (rc == 0) + { + // 7A. Update RoC / _s_l (section 3.3.1) using estimated packet index (i) + check = updateRollOverCounter(v_r); + if (check) + { + check = updateSL(SEQ_r); + if (check) + { + // 7B. Update replay list if applicable (section 3.3.2) + // NO-OP -- REPLAY LIST NOT USED + + // 8. Remove MKI + authentication tag fields from packet if present + // NO-OP -- AUTOMATICALLY DONE BY PREVIOUS RTP HEADER+PAYLOAD EXTRACTION + + retVal = 0; + } + else + { + retVal = -10; + } + } + else + { + retVal = -9; + } + } + else + { + retVal = -2; // DECRYPTION FAILURE + } + } + else + { + retVal = -8; + } + } + else + { + retVal = -7; + } + } + else + { + retVal = -1; // AUTHENTICATION FAILURE + } + } + else + { + retVal = -6; + } + } + else + { + retVal = -5; + } + } + else + { + retVal = -4; + } + } + else + { + retVal = -3; + } + + return retVal; +} + +int JLSRTP::setCryptoTag(unsigned int tag, ActiveCrypto crypto_attrib /*= ACTIVE_CRYPTO*/) +{ + int retVal = -1; + ActiveCrypto active_crypto = INVALID_CRYPTO; + + if (crypto_attrib == ACTIVE_CRYPTO) + { + active_crypto = _active_crypto; + } + else + { + active_crypto = crypto_attrib; + } + + switch (active_crypto) + { + case PRIMARY_CRYPTO: + { + _primary_crypto.tag = tag; + retVal = 0; + } + break; + + case SECONDARY_CRYPTO: + { + _secondary_crypto.tag = tag; + retVal = 0; + } + break; + + default: + { + retVal = -1; + } + break; + } + + return retVal; +} + +unsigned int JLSRTP::getCryptoTag(ActiveCrypto crypto_attrib /*= ACTIVE_CRYPTO*/) +{ + int retVal = -1; + ActiveCrypto active_crypto = INVALID_CRYPTO; + + if (crypto_attrib == ACTIVE_CRYPTO) + { + active_crypto = _active_crypto; + } + else + { + active_crypto = crypto_attrib; + } + + switch (active_crypto) + { + case PRIMARY_CRYPTO: + { + return _primary_crypto.tag; + } + break; + + case SECONDARY_CRYPTO: + { + return _secondary_crypto.tag; + } + break; + + default: + { + retVal = -1; + } + break; + } + + return retVal; +} + +std::string JLSRTP::getCryptoSuite() +{ + std::string cryptosuite; + + switch (_active_crypto) + { + case PRIMARY_CRYPTO: + { + switch (_primary_crypto.cipher_algorithm) + { + case AES_CM_128: + { + switch (_primary_crypto.hmac_algorithm) + { + case HMAC_SHA1_80: + { + cryptosuite = "AES_CM_128_HMAC_SHA1_80"; + } + break; + + case HMAC_SHA1_32: + { + cryptosuite = "AES_CM_128_HMAC_SHA1_32"; + } + break; + + default: + { + cryptosuite = ""; + } + break; + } + } + break; + + case NULL_CIPHER: + { + switch (_primary_crypto.hmac_algorithm) + { + case HMAC_SHA1_80: + { + cryptosuite = "NULL_HMAC_SHA1_80"; + } + break; + + case HMAC_SHA1_32: + { + cryptosuite = "NULL_HMAC_SHA1_32"; + } + break; + + default: + { + cryptosuite = ""; + } + break; + } + } + break; + + default: + { + cryptosuite = ""; + } + break; + } + } + break; + + case SECONDARY_CRYPTO: + { + switch (_secondary_crypto.cipher_algorithm) + { + case AES_CM_128: + { + switch (_secondary_crypto.hmac_algorithm) + { + case HMAC_SHA1_80: + { + cryptosuite = "AES_CM_128_HMAC_SHA1_80"; + } + break; + + case HMAC_SHA1_32: + { + cryptosuite = "AES_CM_128_HMAC_SHA1_32"; + } + break; + + default: + { + cryptosuite = ""; + } + break; + } + } + break; + + case NULL_CIPHER: + { + switch (_secondary_crypto.hmac_algorithm) + { + case HMAC_SHA1_80: + { + cryptosuite = "NULL_HMAC_SHA1_80"; + } + break; + + case HMAC_SHA1_32: + { + cryptosuite = "NULL_HMAC_SHA1_32"; + } + break; + + default: + { + cryptosuite = ""; + } + break; + } + } + break; + + default: + { + cryptosuite = ""; + } + break; + } + } + break; + + default: + { + cryptosuite = ""; + } + break; + } + + return cryptosuite; +} + +int JLSRTP::encodeMasterKeySalt(std::string &mks, ActiveCrypto crypto_attrib /*= ACTIVE_CRYPTO*/) +{ + int retVal = -1; + std::vector concat; + mks.clear(); + ActiveCrypto active_crypto = INVALID_CRYPTO; + + if (crypto_attrib == ACTIVE_CRYPTO) + { + active_crypto = _active_crypto; + } + else + { + active_crypto = crypto_attrib; + } + + switch (active_crypto) + { + case PRIMARY_CRYPTO: + { + concat.insert(concat.end(), _primary_crypto.master_key.begin(), _primary_crypto.master_key.end()); + concat.insert(concat.end(), _primary_crypto.master_salt.begin(), _primary_crypto.master_salt.end()); + + //std::cout << "encodeMasterKeySalt(): concat:["; + //for (int i = 0; i < concat.size(); i++) + //{ + // printf("%02X", concat[i]); + //} + //std::cout << "]" << std::endl; + + mks = base64Encode(concat); + + //std::cout << "encodeMasterKeySalt(): [" << mks << "]" << std::endl; + retVal = 0; + } + break; + + case SECONDARY_CRYPTO: + { + concat.insert(concat.end(), _secondary_crypto.master_key.begin(), _secondary_crypto.master_key.end()); + concat.insert(concat.end(), _secondary_crypto.master_salt.begin(), _secondary_crypto.master_salt.end()); + + //std::cout << "encodeMasterKeySalt(): concat:["; + //for (int i = 0; i < concat.size(); i++) + //{ + // printf("%02X", concat[i]); + //} + //std::cout << "]" << std::endl; + + mks = base64Encode(concat); + + //std::cout << "encodeMasterKeySalt(): [" << mks << "]" << std::endl; + retVal = 0; + } + break; + + default: + { + retVal = -1; + } + } + + return retVal; +} + +int JLSRTP::decodeMasterKeySalt(std::string &mks, ActiveCrypto crypto_attrib /*= ACTIVE_CRYPTO*/) +{ + int retVal = -1; + std::vector concat; + int split_pos = 0; + std::vector::iterator it_begin; + std::vector::iterator it_middle; + std::vector::iterator it_end; + ActiveCrypto active_crypto = INVALID_CRYPTO; + + if (crypto_attrib == ACTIVE_CRYPTO) + { + active_crypto = _active_crypto; + } + else + { + active_crypto = crypto_attrib; + } + + switch (active_crypto) + { + case PRIMARY_CRYPTO: + { + concat = base64Decode(mks); + + //std::cout << "decodeMasterKeySalt(): concat:["; + //for (int i = 0; i < concat.size(); i++) + //{ + // printf("%02X", concat[i]); + //} + //std::cout << "]" << std::endl; + + split_pos = _primary_crypto.n_e; + it_begin = concat.begin(); + it_middle = concat.begin(); + it_end = concat.end(); + + std::advance(it_middle, split_pos); + _primary_crypto.master_key.assign(it_begin, it_middle); + _primary_crypto.master_salt.assign(it_middle, it_end); + + //std::cout << "decodeMasterKeySalt(): _masterKey:["; + //for (int i = 0; i < _primary_crypto.master_key.size(); i++) + //{ + // printf("%02X", _primary_crypto.master_key[i]); + //} + //std::cout << "] _masterSalt:["; + //for (int i = 0; i < _primary_crypto.master_salt.size(); i++) + //{ + // printf("%02X", _primary_crypto.master_salt[i]); + //} + //std::cout << "]" << std::endl; + retVal = 0; + } + break; + + case SECONDARY_CRYPTO: + { + concat = base64Decode(mks); + + //std::cout << "decodeMasterKeySalt(): concat:["; + //for (int i = 0; i < concat.size(); i++) + //{ + // printf("%02X", concat[i]); + //} + //std::cout << "]" << std::endl; + + split_pos = _secondary_crypto.n_e; + it_begin = concat.begin(); + it_middle = concat.begin(); + it_end = concat.end(); + + std::advance(it_middle, split_pos); + _secondary_crypto.master_key.assign(it_begin, it_middle); + _secondary_crypto.master_salt.assign(it_middle, it_end); + + //std::cout << "decodeMasterKeySalt(): _masterKey:["; + //for (int i = 0; i < _secondary_crypto.master_key.size(); i++) + //{ + // printf("%02X", _secondary_crypto.master_key[i]); + //} + //std::cout << "] _masterSalt:["; + //for (int i = 0; i < _secondary_crypto.master_salt.size(); i++) + //{ + // printf("%02X", _secondary_crypto.master_salt[i]); + //} + //std::cout << "]" << std::endl; + retVal = 0; + } + break; + + default: + { + retVal = -1; + } + break; + } + + return retVal; +} + +void JLSRTP::displayCryptoContext() +{ + std::cout << "_id : " << "(" << _id.ssrc << ", " << _id.address << ", " << _id.port << ")" << std::endl; + std::cout << "_ROC : " << _ROC << std::endl; + std::cout << "_s_l : " << _s_l << std::endl; + std::cout << "_primary_crypto.cipher_algorithm : " << _primary_crypto.cipher_algorithm << std::endl; + std::cout << "_primary_crypto.hmac_algorithm : " << _primary_crypto.hmac_algorithm << std::endl; + std::cout << "_primary_crypto.MKI : " << _primary_crypto.MKI << std::endl; + std::cout << "_primary_crypto.MKI_length : " << _primary_crypto.MKI_length << std::endl; + std::cout << "_primary_crypto.active_MKI : " << _primary_crypto.active_MKI << std::endl; + std::cout << "_primary_crypto.master_key : "; + std::cout.setf(std::ios::hex, std::ios::basefield); + std::cout << std::setfill('0') << std::setw(JLSRTP_ENCRYPTION_KEY_LENGTH); + for (int i = 0; i < _primary_crypto.master_key.size(); i++) + { + printf("%02x", _primary_crypto.master_key[i]); +// std::cout << std::hex << _primary_crypto.master_key[i]; + } + std::cout.unsetf(std::ios::hex); + std::cout << std::endl; + std::cout << "_primary_crypto.master_key_counter : " << _primary_crypto.master_key_counter << std::endl; + std::cout << "_primary_crypto.n_e : " << _primary_crypto.n_e << std::endl; + std::cout << "_primary_crypto.n_a : " << _primary_crypto.n_a << std::endl; + std::cout << "_primary_crypto.master_salt : "; + std::cout.setf(std::ios::hex, std::ios::basefield); + std::cout << std::setfill('0') << std::setw(JLSRTP_SALTING_KEY_LENGTH); + for (int i = 0; i < _primary_crypto.master_salt.size(); i++) + { + printf("%02x", _primary_crypto.master_salt[i]); +// std::cout << std::hex << _primary_crypto.master_salt[i]; + } + std::cout.unsetf(std::ios::hex); + std::cout << std::endl; + std::cout << "_primary_crypto.master_key_derivation_rate : " << _primary_crypto.master_key_derivation_rate << std::endl; + std::cout << "_primary_crypto.master_mki_value : " << _primary_crypto.master_mki_value << std::endl; + std::cout << "_primary_crypto.n_s : " << _primary_crypto.n_s << std::endl; + std::cout << "_primary_crypto.tag : " << _primary_crypto.tag << std::endl; + std::cout << "_secondary_crypto.cipher_algorithm : " << _secondary_crypto.cipher_algorithm << std::endl; + std::cout << "_secondary_crypto.hmac_algorithm : " << _secondary_crypto.hmac_algorithm << std::endl; + std::cout << "_secondary_crypto.MKI : " << _secondary_crypto.MKI << std::endl; + std::cout << "_secondary_crypto.MKI_length : " << _secondary_crypto.MKI_length << std::endl; + std::cout << "_secondary_crypto.active_MKI : " << _secondary_crypto.active_MKI << std::endl; + std::cout << "_secondary_crypto.master_key : "; + std::cout.setf(std::ios::hex, std::ios::basefield); + std::cout << std::setfill('0') << std::setw(JLSRTP_ENCRYPTION_KEY_LENGTH); + for (int i = 0; i < _secondary_crypto.master_key.size(); i++) + { + printf("%02x", _secondary_crypto.master_key[i]); +// std::cout << std::hex << _secondary_crypto.master_key[i]; + } + std::cout.unsetf(std::ios::hex); + std::cout << std::endl; + std::cout << "_secondary_crypto.master_key_counter : " << _secondary_crypto.master_key_counter << std::endl; + std::cout << "_secondary_crypto.n_e : " << _secondary_crypto.n_e << std::endl; + std::cout << "_secondary_crypto.n_a : " << _secondary_crypto.n_a << std::endl; + std::cout << "_secondary_crypto.master_salt : "; + std::cout.setf(std::ios::hex, std::ios::basefield); + std::cout << std::setfill('0') << std::setw(JLSRTP_SALTING_KEY_LENGTH); + for (int i = 0; i < _secondary_crypto.master_salt.size(); i++) + { + printf("%02x", _secondary_crypto.master_salt[i]); +// std::cout << std::hex << _secondary_crypto.master_salt[i]; + } + std::cout.unsetf(std::ios::hex); + std::cout << std::endl; + std::cout << "_secondary_crypto.master_key_derivation_rate : " << _secondary_crypto.master_key_derivation_rate << std::endl; + std::cout << "_secondary_crypto.master_mki_value : " << _secondary_crypto.master_mki_value << std::endl; + std::cout << "_secondary_crypto.n_s : " << _secondary_crypto.n_s << std::endl; + std::cout << "_secondary_crypto.tag : " << _secondary_crypto.tag << std::endl; + printf("_session_enc_key : ["); + for (int i = 0; i < _session_enc_key.size(); i++) + { + printf("%02x", _session_enc_key[i]); + } + printf("]\n"); + printf("_session_salt_key : ["); + for (int i = 0; i < _session_salt_key.size(); i++) + { + printf("%02x", _session_salt_key[i]); + } + printf("]\n"); + printf("_session_auth_key : ["); + for (int i = 0; i < _session_auth_key.size(); i++) + { + printf("%02x", _session_auth_key[i]); + } + printf("]\n"); + printf("_packet_iv : ["); + for (int i = 0; i < _packetIV.size(); i++) + { + printf("%02x", _packetIV[i]); + } + printf("]\n"); + + std::cout << "_pseudorandomstate.ivec : ["; + for (int i = 0; i < AES_BLOCK_SIZE; i++) + { + printf("%02x", _pseudorandomstate.ivec[i]); + } + std::cout << "]" << std::endl; + std::cout << "_pseudorandomstate.num : " << _pseudorandomstate.num << std::endl; + std::cout << "_pseudorandomstate.ecount : ["; + for (int i = 0; i < AES_BLOCK_SIZE; i++) + { + printf("%02x", _pseudorandomstate.ecount[i]); + } + std::cout << "]" << std::endl; + + std::cout << "_cipherstate.ivec : ["; + for (int i = 0; i < AES_BLOCK_SIZE; i++) + { + printf("%02x", _cipherstate.ivec[i]); + } + std::cout << "]" << std::endl; + std::cout << "_cipherstate.num : " << _cipherstate.num << std::endl; + std::cout << "_cipherstate.ecount : ["; + for (int i = 0; i < AES_BLOCK_SIZE; i++) + { + printf("%02x", _cipherstate.ecount[i]); + } + std::cout << "]" << std::endl; + std::cout << "_srtp_header_size : " << _srtp_header_size << std::endl; + std::cout << "_srtp_payload_size : " << _srtp_payload_size << std::endl; + std::cout << "_active_crypto : " << _active_crypto << std::endl; +} + +std::string JLSRTP::dumpCryptoContext() +{ + std::ostringstream oss; + + oss.str(""); + + oss << "_id : " << "(" << _id.ssrc << ", " << _id.address << ", " << _id.port << ")" << std::endl; + oss << "_ROC : " << _ROC << std::endl; + oss << "_s_l : " << _s_l << std::endl; + oss << "_primary_crypto.cipher_algorithm : " << _primary_crypto.cipher_algorithm << std::endl; + oss << "_primary_crypto.hmac_algorithm : " << _primary_crypto.hmac_algorithm << std::endl; + oss << "_primary_crypto.MKI : " << _primary_crypto.MKI << std::endl; + oss << "_primary_crypto.MKI_length : " << _primary_crypto.MKI_length << std::endl; + oss << "_primary_crypto.active_MKI : " << _primary_crypto.active_MKI << std::endl; + oss << "_primary_crypto.master_key : "; + oss.setf(std::ios::hex, std::ios::basefield); + for (int i = 0; i < _primary_crypto.master_key.size(); i++) + { + oss << std::setw(2) << std::setfill('0'); + oss << static_cast(_primary_crypto.master_key[i]); + } + oss.unsetf(std::ios::hex); + oss << std::endl; + oss << "_primary_crypto.master_key_counter : " << _primary_crypto.master_key_counter << std::endl; + oss << "_primary_crypto.n_e : " << _primary_crypto.n_e << std::endl; + oss << "_primary_crypto.n_a : " << _primary_crypto.n_a << std::endl; + oss << "_primary_crypto.master_salt : "; + oss.setf(std::ios::hex, std::ios::basefield); + for (int i = 0; i < _primary_crypto.master_salt.size(); i++) + { + oss << std::setw(2) << std::setfill('0'); + oss << static_cast(_primary_crypto.master_salt[i]); + } + oss.unsetf(std::ios::hex); + oss << std::endl; + oss << "_primary_crypto.master_key_derivation_rate : " << _primary_crypto.master_key_derivation_rate << std::endl; + oss << "_primary_crypto.master_mki_value : " << _primary_crypto.master_mki_value << std::endl; + oss << "_primary_crypto.n_s : " << _primary_crypto.n_s << std::endl; + oss << "_primary_crypto.tag : " << _primary_crypto.tag << std::endl; + oss << "_secondary_crypto.cipher_algorithm : " << _secondary_crypto.cipher_algorithm << std::endl; + oss << "_secondary_crypto.hmac_algorithm : " << _secondary_crypto.hmac_algorithm << std::endl; + oss << "_secondary_crypto.MKI : " << _secondary_crypto.MKI << std::endl; + oss << "_secondary_crypto.MKI_length : " << _secondary_crypto.MKI_length << std::endl; + oss << "_secondary_crypto.active_MKI : " << _secondary_crypto.active_MKI << std::endl; + oss << "_secondary_crypto.master_key : "; + oss.setf(std::ios::hex, std::ios::basefield); + for (int i = 0; i < _secondary_crypto.master_key.size(); i++) + { + oss << std::setw(2) << std::setfill('0'); + oss << static_cast(_secondary_crypto.master_key[i]); + } + oss.unsetf(std::ios::hex); + oss << std::endl; + oss << "_secondary_crypto.master_key_counter : " << _secondary_crypto.master_key_counter << std::endl; + oss << "_secondary_crypto.n_e : " << _secondary_crypto.n_e << std::endl; + oss << "_secondary_crypto.n_a : " << _secondary_crypto.n_a << std::endl; + oss << "_secondary_crypto.master_salt : "; + oss.setf(std::ios::hex, std::ios::basefield); + for (int i = 0; i < _secondary_crypto.master_salt.size(); i++) + { + oss << std::setw(2) << std::setfill('0'); + oss << static_cast(_secondary_crypto.master_salt[i]); + } + oss.unsetf(std::ios::hex); + oss << std::endl; + oss << "_secondary_crypto.master_key_derivation_rate : " << _secondary_crypto.master_key_derivation_rate << std::endl; + oss << "_secondary_crypto.master_mki_value : " << _secondary_crypto.master_mki_value << std::endl; + oss << "_secondary_crypto.n_s : " << _secondary_crypto.n_s << std::endl; + oss << "_secondary_crypto.tag : " << _secondary_crypto.tag << std::endl; + oss << "_session_enc_key : ["; + oss.setf(std::ios::hex, std::ios::basefield); + for (int i = 0; i < _session_enc_key.size(); i++) + { + oss << std::setw(2) << std::setfill('0'); + oss << static_cast(_session_enc_key[i]); + } + oss.unsetf(std::ios::hex); + oss << "]" << std::endl; + oss << "_session_salt_key : ["; + oss.setf(std::ios::hex, std::ios::basefield); + for (int i = 0; i < _session_salt_key.size(); i++) + { + oss << std::setw(2) << std::setfill('0'); + oss << static_cast(_session_salt_key[i]); + } + oss.unsetf(std::ios::hex); + oss << "]" << std::endl; + oss << "_session_auth_key : ["; + oss.setf(std::ios::hex, std::ios::basefield); + for (int i = 0; i < _session_auth_key.size(); i++) + { + oss << std::setw(2) << std::setfill('0'); + oss << static_cast(_session_auth_key[i]); + } + oss.unsetf(std::ios::hex); + oss << "]" << std::endl; + oss << "_packet_iv : ["; + oss.setf(std::ios::hex, std::ios::basefield); + for (int i = 0; i < _packetIV.size(); i++) + { + oss << std::setw(2) << std::setfill('0'); + oss << static_cast(_packetIV[i]); + } + oss.unsetf(std::ios::hex); + oss << "]" << std::endl; + + oss << "_pseudorandomstate.ivec : ["; + oss.setf(std::ios::hex, std::ios::basefield); + for (int i = 0; i < AES_BLOCK_SIZE; i++) + { + oss << std::setw(2) << std::setfill('0'); + oss << static_cast(_pseudorandomstate.ivec[i]); + } + oss.unsetf(std::ios::hex); + oss << "]" << std::endl; + oss << "_pseudorandomstate.num : " << _pseudorandomstate.num << std::endl; + oss << "_pseudorandomstate.ecount : ["; + oss.setf(std::ios::hex, std::ios::basefield); + for (int i = 0; i < AES_BLOCK_SIZE; i++) + { + oss << std::setw(2) << std::setfill('0'); + oss << static_cast(_pseudorandomstate.ecount[i]); + } + oss.unsetf(std::ios::hex); + oss << "]" << std::endl; + + oss << "_cipherstate.ivec : ["; + oss.setf(std::ios::hex, std::ios::basefield); + for (int i = 0; i < AES_BLOCK_SIZE; i++) + { + oss << std::setw(2) << std::setfill('0'); + oss << static_cast(_cipherstate.ivec[i]); + } + oss.unsetf(std::ios::hex); + oss << "]" << std::endl; + oss << "_cipherstate.num : " << _cipherstate.num << std::endl; + oss << "_cipherstate.ecount : ["; + oss.setf(std::ios::hex, std::ios::basefield); + for (int i = 0; i < AES_BLOCK_SIZE; i++) + { + oss << std::setw(2) << std::setfill('0'); + oss << static_cast(_cipherstate.ecount[i]); + } + oss.unsetf(std::ios::hex); + oss << "]" << std::endl; + oss << "_srtp_header_size : " << _srtp_header_size << std::endl; + oss << "_srtp_payload_size : " << _srtp_payload_size << std::endl; + oss << "_active_crypto : " << _active_crypto << std::endl; + + return oss.str(); +} + +int JLSRTP::generateMasterKey(ActiveCrypto crypto_attrib /*= ACTIVE_CRYPTO*/) +{ + int retVal = -1; + ActiveCrypto active_crypto = INVALID_CRYPTO; + + if (crypto_attrib == ACTIVE_CRYPTO) + { + active_crypto = _active_crypto; + } + else + { + active_crypto = crypto_attrib; + } + + switch (active_crypto) + { + case PRIMARY_CRYPTO: + { + if (RAND_bytes(_primary_crypto.master_key.data(), _primary_crypto.master_key.size()) == 1) + { + retVal = 0; + } + else + { + retVal = -1; + } +/* + _primary_crypto.master_key.clear(); + _primary_crypto.master_key.push_back(0xE1); + _primary_crypto.master_key.push_back(0xF9); + _primary_crypto.master_key.push_back(0x7A); + _primary_crypto.master_key.push_back(0x0D); + _primary_crypto.master_key.push_back(0x3E); + _primary_crypto.master_key.push_back(0x01); + _primary_crypto.master_key.push_back(0x8B); + _primary_crypto.master_key.push_back(0xE0); + _primary_crypto.master_key.push_back(0xD6); + _primary_crypto.master_key.push_back(0x4F); + _primary_crypto.master_key.push_back(0xA3); + _primary_crypto.master_key.push_back(0x2C); + _primary_crypto.master_key.push_back(0x06); + _primary_crypto.master_key.push_back(0xDE); + _primary_crypto.master_key.push_back(0x41); + _primary_crypto.master_key.push_back(0x39); + retVal = 0; +*/ + } + break; + + case SECONDARY_CRYPTO: + { + if (RAND_bytes(_secondary_crypto.master_key.data(), _secondary_crypto.master_key.size()) == 1) + { + retVal = 0; + } + else + { + retVal = -1; + } +/* + _secondary_crypto.master_key.clear(); + _secondary_crypto.master_key.push_back(0xE1); + _secondary_crypto.master_key.push_back(0xF9); + _secondary_crypto.master_key.push_back(0x7A); + _secondary_crypto.master_key.push_back(0x0D); + _secondary_crypto.master_key.push_back(0x3E); + _secondary_crypto.master_key.push_back(0x01); + _secondary_crypto.master_key.push_back(0x8B); + _secondary_crypto.master_key.push_back(0xE0); + _secondary_crypto.master_key.push_back(0xD6); + _secondary_crypto.master_key.push_back(0x4F); + _secondary_crypto.master_key.push_back(0xA3); + _secondary_crypto.master_key.push_back(0x2C); + _secondary_crypto.master_key.push_back(0x06); + _secondary_crypto.master_key.push_back(0xDE); + _secondary_crypto.master_key.push_back(0x41); + _secondary_crypto.master_key.push_back(0x39); + retVal = 0; +*/ + } + break; + + default: + { + retVal = -1; + } + break; + } + + return retVal; +} + +int JLSRTP::generateMasterSalt(ActiveCrypto crypto_attrib /*= ACTIVE_CRYPTO*/) +{ + int retVal = -1; + ActiveCrypto active_crypto = INVALID_CRYPTO; + + if (crypto_attrib == ACTIVE_CRYPTO) + { + active_crypto = _active_crypto; + } + else + { + active_crypto = crypto_attrib; + } + + switch (active_crypto) + { + case PRIMARY_CRYPTO: + { + if (RAND_bytes(_primary_crypto.master_salt.data(), _primary_crypto.master_salt.size()) == 1) + { + retVal = 0; + } + else + { + retVal = -1; + } +/* + _primary_crypto.master_salt.clear(); + _primary_crypto.master_salt.push_back(0x0E); + _primary_crypto.master_salt.push_back(0xC6); + _primary_crypto.master_salt.push_back(0x75); + _primary_crypto.master_salt.push_back(0xAD); + _primary_crypto.master_salt.push_back(0x49); + _primary_crypto.master_salt.push_back(0x8A); + _primary_crypto.master_salt.push_back(0xFE); + _primary_crypto.master_salt.push_back(0xEB); + _primary_crypto.master_salt.push_back(0xB6); + _primary_crypto.master_salt.push_back(0x96); + _primary_crypto.master_salt.push_back(0x0B); + _primary_crypto.master_salt.push_back(0x3A); + _primary_crypto.master_salt.push_back(0xAB); + _primary_crypto.master_salt.push_back(0xE6); + retVal = 0; +*/ + } + break; + + case SECONDARY_CRYPTO: + { + if (RAND_bytes(_secondary_crypto.master_salt.data(), _secondary_crypto.master_salt.size()) == 1) + { + retVal = 0; + } + else + { + retVal = -1; + } +/* + _secondary_crypto.master_salt.clear(); + _secondary_crypto.master_salt.push_back(0x0E); + _secondary_crypto.master_salt.push_back(0xC6); + _secondary_crypto.master_salt.push_back(0x75); + _secondary_crypto.master_salt.push_back(0xAD); + _secondary_crypto.master_salt.push_back(0x49); + _secondary_crypto.master_salt.push_back(0x8A); + _secondary_crypto.master_salt.push_back(0xFE); + _secondary_crypto.master_salt.push_back(0xEB); + _secondary_crypto.master_salt.push_back(0xB6); + _secondary_crypto.master_salt.push_back(0x96); + _secondary_crypto.master_salt.push_back(0x0B); + _secondary_crypto.master_salt.push_back(0x3A); + _secondary_crypto.master_salt.push_back(0xAB); + _secondary_crypto.master_salt.push_back(0xE6); + retVal = 0; +*/ + } + break; + + default: + { + retVal = -1; + } + break; + } + + return retVal; +} + +std::vector JLSRTP::getMasterKey(ActiveCrypto crypto_attrib /*= ACTIVE_CRYPTO*/) +{ + std::vector retVal; + ActiveCrypto active_crypto = INVALID_CRYPTO; + + if (crypto_attrib == ACTIVE_CRYPTO) + { + active_crypto = _active_crypto; + } + else + { + active_crypto = crypto_attrib; + } + + switch (active_crypto) + { + case PRIMARY_CRYPTO: + { + retVal = _primary_crypto.master_key; + } + break; + + case SECONDARY_CRYPTO: + { + retVal = _secondary_crypto.master_key; + } + break; + + default: + { + retVal.clear(); + } + break; + } + + return retVal; +} + +std::vector JLSRTP::getMasterSalt(ActiveCrypto crypto_attrib /*= ACTIVE_CRYPTO*/) +{ + std::vector retVal; + ActiveCrypto active_crypto = INVALID_CRYPTO; + + if (crypto_attrib == ACTIVE_CRYPTO) + { + active_crypto = _active_crypto; + } + else + { + active_crypto = crypto_attrib; + } + + switch (active_crypto) + { + case PRIMARY_CRYPTO: + { + retVal = _primary_crypto.master_salt; + } + break; + + case SECONDARY_CRYPTO: + { + retVal = _secondary_crypto.master_salt; + } + break; + + default: + { + retVal.clear(); + } + break; + } + + return retVal; +} + +int JLSRTP::setMasterKey(std::vector &key, ActiveCrypto crypto_attrib /*= ACTIVE_CRYPTO*/) +{ + int retVal = -1; + ActiveCrypto active_crypto = INVALID_CRYPTO; + + if (crypto_attrib == ACTIVE_CRYPTO) + { + active_crypto = _active_crypto; + } + else + { + active_crypto = crypto_attrib; + } + + switch (active_crypto) + { + case PRIMARY_CRYPTO: + { + _primary_crypto.master_key = key; + retVal = 0; + } + break; + + case SECONDARY_CRYPTO: + { + _secondary_crypto.master_key = key; + retVal = 0; + } + break; + + default: + { + retVal = -1; + } + break; + } + + return retVal; +} + +int JLSRTP::setMasterSalt(std::vector &salt, ActiveCrypto crypto_attrib /*= ACTIVE_CRYPTO*/) +{ + int retVal = -1; + ActiveCrypto active_crypto = INVALID_CRYPTO; + + if (crypto_attrib == ACTIVE_CRYPTO) + { + active_crypto = _active_crypto; + } + else + { + active_crypto = crypto_attrib; + } + + switch (active_crypto) + { + case PRIMARY_CRYPTO: + { + _primary_crypto.master_salt = salt; + retVal = 0; + } + break; + + case SECONDARY_CRYPTO: + { + _secondary_crypto.master_salt = salt; + retVal = 0; + } + break; + + default: + { + retVal = -1; + } + break; + } + + return retVal; +} + +int JLSRTP::swapCrypto() +{ + int retVal = 0; + + CipherType cipher_algorithm = INVALID_CIPHER; + HashType hmac_algorithm = INVALID_HASH; + bool MKI = false; + unsigned int MKI_length = 0; + unsigned long active_MKI = 0; + std::vector master_key; + unsigned long master_key_counter = 0; + unsigned short n_e = 0; + unsigned short n_a = 0; + std::vector master_salt; + unsigned long master_key_derivation_rate = 0; + unsigned long master_mki_value = 0; + unsigned short n_s = 0; + unsigned int tag = 0; + + cipher_algorithm = _primary_crypto.cipher_algorithm; + hmac_algorithm = _primary_crypto.hmac_algorithm; + MKI = _primary_crypto.MKI; + MKI_length = _primary_crypto.MKI_length; + active_MKI = _primary_crypto.active_MKI; + master_key = _primary_crypto.master_key; + master_key_counter = _primary_crypto.master_key_counter; + n_e = _primary_crypto.n_e; + n_a = _primary_crypto.n_a; + master_salt = _primary_crypto.master_salt; + master_key_derivation_rate = _primary_crypto.master_key_derivation_rate; + master_mki_value = _primary_crypto.master_mki_value; + n_s = _primary_crypto.n_s; + tag = _primary_crypto.tag; + + _primary_crypto.cipher_algorithm = _secondary_crypto.cipher_algorithm; + _primary_crypto.hmac_algorithm = _secondary_crypto.hmac_algorithm; + _primary_crypto.MKI = _secondary_crypto.MKI; + _primary_crypto.MKI_length = _secondary_crypto.MKI_length; + _primary_crypto.active_MKI = _secondary_crypto.active_MKI; + _primary_crypto.master_key = _secondary_crypto.master_key; + _primary_crypto.master_key_counter = _secondary_crypto.master_key_counter; + _primary_crypto.n_e = _secondary_crypto.n_e; + _primary_crypto.n_a = _secondary_crypto.n_a; + _primary_crypto.master_salt = _secondary_crypto.master_salt; + _primary_crypto.master_key_derivation_rate = _secondary_crypto.master_key_derivation_rate; + _primary_crypto.master_mki_value = _secondary_crypto.master_mki_value; + _primary_crypto.n_s = _secondary_crypto.n_s; + _primary_crypto.tag = _secondary_crypto.tag; + + _secondary_crypto.cipher_algorithm = cipher_algorithm; + _secondary_crypto.hmac_algorithm = hmac_algorithm; + _secondary_crypto.MKI = MKI; + _secondary_crypto.MKI_length = MKI_length; + _secondary_crypto.active_MKI = active_MKI; + _secondary_crypto.master_key = master_key; + _secondary_crypto.master_key_counter = master_key_counter; + _secondary_crypto.n_e = n_e; + _secondary_crypto.n_a = n_a; + _secondary_crypto.master_salt = master_salt; + _secondary_crypto.master_key_derivation_rate = master_key_derivation_rate; + _secondary_crypto.master_mki_value = master_mki_value; + _secondary_crypto.n_s = n_s; + _secondary_crypto.tag = tag; + + return retVal; +} + +int JLSRTP::selectActiveCrypto(ActiveCrypto activeCrypto) +{ + int retVal = -1; + + switch (activeCrypto) + { + case PRIMARY_CRYPTO: + { + _active_crypto = activeCrypto; + retVal = 0; + } + break; + + case SECONDARY_CRYPTO: + { + _active_crypto = activeCrypto; + retVal = 0; + } + break; + + default: + { + _active_crypto = INVALID_CRYPTO; + retVal = -1; + } + break; + } + + return retVal; +} + +ActiveCrypto JLSRTP::getActiveCrypto() +{ + return _active_crypto; +} + +JLSRTP& JLSRTP::operator=(const JLSRTP& that) +{ + _id.ssrc = that._id.ssrc; + _id.address = that._id.address; + _id.port = that._id.port; + _ROC = that._ROC; + _s_l = that._s_l; + _primary_crypto.cipher_algorithm = that._primary_crypto.cipher_algorithm; + _primary_crypto.hmac_algorithm = that._primary_crypto.hmac_algorithm; + _primary_crypto.MKI = that._primary_crypto.MKI; + _primary_crypto.MKI_length = that._primary_crypto.MKI_length; + _primary_crypto.active_MKI = that._primary_crypto.active_MKI; + _primary_crypto.master_key = that._primary_crypto.master_key; + _primary_crypto.master_key_counter = that._primary_crypto.master_key_counter; + _primary_crypto.n_e = that._primary_crypto.n_e; + _primary_crypto.n_a = that._primary_crypto.n_a; + _primary_crypto.master_salt = that._primary_crypto.master_salt; + _primary_crypto.master_key_derivation_rate = that._primary_crypto.master_key_derivation_rate; + _primary_crypto.master_mki_value = that._primary_crypto.master_mki_value; + _primary_crypto.n_s = that._primary_crypto.n_s; + _primary_crypto.tag = that._primary_crypto.tag; + _secondary_crypto.cipher_algorithm = that._secondary_crypto.cipher_algorithm; + _secondary_crypto.hmac_algorithm = that._secondary_crypto.hmac_algorithm; + _secondary_crypto.MKI = that._secondary_crypto.MKI; + _secondary_crypto.MKI_length = that._secondary_crypto.MKI_length; + _secondary_crypto.active_MKI = that._secondary_crypto.active_MKI; + _secondary_crypto.master_key = that._secondary_crypto.master_key; + _secondary_crypto.master_key_counter = that._secondary_crypto.master_key_counter; + _secondary_crypto.n_e = that._secondary_crypto.n_e; + _secondary_crypto.n_a = that._secondary_crypto.n_a; + _secondary_crypto.master_salt = that._secondary_crypto.master_salt; + _secondary_crypto.master_key_derivation_rate = that._secondary_crypto.master_key_derivation_rate; + _secondary_crypto.master_mki_value = that._secondary_crypto.master_mki_value; + _secondary_crypto.n_s = that._secondary_crypto.n_s; + _secondary_crypto.tag = that._secondary_crypto.tag; + _session_enc_key = that._session_enc_key; + _session_salt_key = that._session_salt_key; + _session_auth_key = that._session_auth_key; + _packetIV = that._packetIV; + memcpy(_pseudorandomstate.ivec, that._pseudorandomstate.ivec, sizeof(_pseudorandomstate.ivec)); + _pseudorandomstate.num = that._pseudorandomstate.num; + memcpy(_pseudorandomstate.ecount, that._pseudorandomstate.ecount, sizeof(_pseudorandomstate.ecount)); + memcpy(_cipherstate.ivec, that._cipherstate.ivec, sizeof(_cipherstate.ivec)); + _cipherstate.num = that._cipherstate.num; + memcpy(_cipherstate.ecount, that._cipherstate.ecount, sizeof(_cipherstate.ecount)); + _srtp_header_size = that._srtp_header_size; + _srtp_payload_size = that._srtp_payload_size; + _active_crypto = that._active_crypto; + + return *this; +} + +bool JLSRTP::operator==(const JLSRTP& that) +{ + if ( + (_id.ssrc == that._id.ssrc) && + (_id.address == that._id.address) && + (_id.port == that._id.port) && + (_ROC == that._ROC) && + (_s_l == that._s_l) && + (_primary_crypto.cipher_algorithm == that._primary_crypto.cipher_algorithm) && + (_primary_crypto.hmac_algorithm == that._primary_crypto.hmac_algorithm) && + (_primary_crypto.MKI == that._primary_crypto.MKI) && + (_primary_crypto.MKI_length == that._primary_crypto.MKI_length) && + (_primary_crypto.active_MKI == that._primary_crypto.active_MKI) && + (_primary_crypto.master_key == that._primary_crypto.master_key) && + (_primary_crypto.master_key_counter == that._primary_crypto.master_key_counter) && + (_primary_crypto.n_e == that._primary_crypto.n_e) && + (_primary_crypto.n_a == that._primary_crypto.n_a) && + (_primary_crypto.master_salt == that._primary_crypto.master_salt) && + (_primary_crypto.master_key_derivation_rate == that._primary_crypto.master_key_derivation_rate) && + (_primary_crypto.master_mki_value == that._primary_crypto.master_mki_value) && + (_primary_crypto.n_s == that._primary_crypto.n_s) && + (_primary_crypto.tag == that._primary_crypto.tag) && + (_secondary_crypto.cipher_algorithm == that._secondary_crypto.cipher_algorithm) && + (_secondary_crypto.hmac_algorithm == that._secondary_crypto.hmac_algorithm) && + (_secondary_crypto.MKI == that._secondary_crypto.MKI) && + (_secondary_crypto.MKI_length == that._secondary_crypto.MKI_length) && + (_secondary_crypto.active_MKI == that._secondary_crypto.active_MKI) && + (_secondary_crypto.master_key == that._secondary_crypto.master_key) && + (_secondary_crypto.master_key_counter == that._secondary_crypto.master_key_counter) && + (_secondary_crypto.n_e == that._secondary_crypto.n_e) && + (_secondary_crypto.n_a == that._secondary_crypto.n_a) && + (_secondary_crypto.master_salt == that._secondary_crypto.master_salt) && + (_secondary_crypto.master_key_derivation_rate == that._secondary_crypto.master_key_derivation_rate) && + (_secondary_crypto.master_mki_value == that._secondary_crypto.master_mki_value) && + (_secondary_crypto.n_s == that._secondary_crypto.n_s) && + (_secondary_crypto.tag == that._secondary_crypto.tag) && + (_session_enc_key == that._session_enc_key) && + (_session_salt_key == that._session_salt_key) && + (_session_auth_key == that._session_auth_key) && + (_packetIV == that._packetIV) && + (memcmp(_pseudorandomstate.ivec, that._pseudorandomstate.ivec, sizeof(_pseudorandomstate.ivec)) == 0) && + (_pseudorandomstate.num == that._pseudorandomstate.num) && + (memcmp(_pseudorandomstate.ecount, that._pseudorandomstate.ecount, sizeof(_pseudorandomstate.ecount)) == 0) && + (memcmp(_cipherstate.ivec, that._cipherstate.ivec, sizeof(_cipherstate.ivec)) == 0) && + (_cipherstate.num == that._cipherstate.num) && + (memcmp(_cipherstate.ecount, that._cipherstate.ecount, sizeof(_cipherstate.ecount)) == 0) && + (_srtp_header_size == that._srtp_header_size) && + (_srtp_payload_size == that._srtp_payload_size) && + (_active_crypto == that._active_crypto) + ) + { + return true; + } + else + { + return false; + } +} + +bool JLSRTP::operator!=(const JLSRTP& that) +{ + if (*this == that) + { + return false; + } + else + { + return true; + } +} + +JLSRTP::JLSRTP() +{ + resetCryptoContext(0xCA110000, "127.0.0.1", 0); + + _pseudorandomstate.cipher = EVP_CIPHER_CTX_new(); + if (_pseudorandomstate.cipher != NULL) + { + EVP_EncryptInit_ex(_pseudorandomstate.cipher, EVP_aes_128_ecb(), NULL, NULL /* primary/secondary master key set later */, NULL); + } + + _cipherstate.cipher = EVP_CIPHER_CTX_new(); + if (_cipherstate.cipher != NULL) + { + EVP_EncryptInit_ex(_cipherstate.cipher, EVP_aes_128_ecb(), NULL, NULL /* _session_enc_key set later */, NULL); + } +} + +JLSRTP::JLSRTP(unsigned int ssrc, std::string ipAddress, unsigned short port) +{ + resetCryptoContext(ssrc, ipAddress, port); + + _pseudorandomstate.cipher = EVP_CIPHER_CTX_new(); + if (_pseudorandomstate.cipher != NULL) + { + EVP_EncryptInit_ex(_pseudorandomstate.cipher, EVP_aes_128_ecb(), NULL, NULL /* primary/secondary master key set later */, NULL); + } + + _cipherstate.cipher = EVP_CIPHER_CTX_new(); + if (_cipherstate.cipher != NULL) + { + EVP_EncryptInit_ex(_cipherstate.cipher, EVP_aes_128_ecb(), NULL, NULL /* _session_enc_key set later */, NULL); + } +} + +JLSRTP::~JLSRTP() +{ + EVP_CIPHER_CTX_free(_cipherstate.cipher); + EVP_CIPHER_CTX_free(_pseudorandomstate.cipher); + RAND_cleanup(); +} + +#else // !USE_OPENSSL + +#include "jlsrtp.hpp" + +JLSRTP::JLSRTP() +{ +} + +JLSRTP::~JLSRTP() +{ +} + +#endif // USE_OPENSSL + diff --git a/src/logger.cpp b/src/logger.cpp index 7d031d52..abfb61fe 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -459,7 +459,7 @@ static void _screen_error(int fatal, bool use_errno, int error, const char *fmt, _advance(c, snprintf(c, bufEnd - c, "Unable to create '%s': %s.\n", screen_logfile, strerror(errno))); } - sipp_exit(EXIT_FATAL_ERROR); + sipp_exit(EXIT_FATAL_ERROR, 0, 0); } } @@ -486,9 +486,9 @@ static void _screen_error(int fatal, bool use_errno, int error, const char *fmt, if (fatal) { if (error == EADDRINUSE) { - sipp_exit(EXIT_BIND_ERROR); + sipp_exit(EXIT_BIND_ERROR, 0, 0); } else { - sipp_exit(EXIT_FATAL_ERROR); + sipp_exit(EXIT_FATAL_ERROR, 0, 0); } } } diff --git a/src/message.cpp b/src/message.cpp index f48ab3c3..e02fb616 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -62,10 +62,43 @@ struct KeywordMap SimpleKeywords[] = { {"auto_media_port", E_Message_Auto_Media_Port }, #endif #ifdef RTP_STREAM - /* Legacy since 3.6-dev. Actually uses media_port. */ {"rtpstream_audio_port", E_Message_RTPStream_Audio_Port }, {"rtpstream_video_port", E_Message_RTPStream_Video_Port }, -#endif +#ifdef USE_OPENSSL + {"cryptotag1audio", E_Message_CryptoTag1Audio }, + {"cryptotag2audio", E_Message_CryptoTag2Audio }, + {"cryptosuiteaescm128sha1801audio", E_Message_CryptoSuiteAesCm128Sha1801Audio }, + {"cryptosuiteaescm128sha1802audio", E_Message_CryptoSuiteAesCm128Sha1802Audio }, + {"cryptosuiteaescm128sha1321audio", E_Message_CryptoSuiteAesCm128Sha1321Audio }, + {"cryptosuiteaescm128sha1322audio", E_Message_CryptoSuiteAesCm128Sha1322Audio }, + {"cryptokeyparams1audio", E_Message_CryptoKeyParams1Audio }, + {"cryptokeyparams2audio", E_Message_CryptoKeyParams2Audio }, + {"cryptotag1video", E_Message_CryptoTag1Video }, + {"cryptotag2video", E_Message_CryptoTag2Video }, + {"cryptosuiteaescm128sha1801video", E_Message_CryptoSuiteAesCm128Sha1801Video }, + {"cryptosuiteaescm128sha1802video", E_Message_CryptoSuiteAesCm128Sha1802Video }, + {"cryptosuiteaescm128sha1321video", E_Message_CryptoSuiteAesCm128Sha1321Video }, + {"cryptosuiteaescm128sha1322video", E_Message_CryptoSuiteAesCm128Sha1322Video }, + {"cryptokeyparams1video", E_Message_CryptoKeyParams1Video }, + {"cryptokeyparams2video", E_Message_CryptoKeyParams2Video }, + {"cryptosuitenullsha1801audio" , E_Message_CryptoSuiteNullSha1801Audio }, + {"cryptosuitenullsha1802audio" , E_Message_CryptoSuiteNullSha1802Audio }, + {"cryptosuitenullsha1321audio" , E_Message_CryptoSuiteNullSha1321Audio }, + {"cryptosuitenullsha1322audio" , E_Message_CryptoSuiteNullSha1322Audio }, + {"cryptosuitenullsha1801video" , E_Message_CryptoSuiteNullSha1801Video }, + {"cryptosuitenullsha1802video" , E_Message_CryptoSuiteNullSha1802Video }, + {"cryptosuitenullsha1321video" , E_Message_CryptoSuiteNullSha1321Video }, + {"cryptosuitenullsha1322video" , E_Message_CryptoSuiteNullSha1322Video }, + {"ueaescm128sha1801audio" , E_Message_UEAesCm128Sha1801Audio }, + {"ueaescm128sha1802audio" , E_Message_UEAesCm128Sha1802Audio }, + {"ueaescm128sha1321audio" , E_Message_UEAesCm128Sha1321Audio }, + {"ueaescm128sha1322audio" , E_Message_UEAesCm128Sha1322Audio }, + {"ueaescm128sha1801video" , E_Message_UEAesCm128Sha1801Video }, + {"ueaescm128sha1802video" , E_Message_UEAesCm128Sha1802Video }, + {"ueaescm128sha1321video" , E_Message_UEAesCm128Sha1321Video }, + {"ueaescm128sha1322video" , E_Message_UEAesCm128Sha1322Video }, +#endif // USE_OPENSSL +#endif // RTP_STREAM {"media_port", E_Message_Media_Port }, {"media_ip_type", E_Message_Media_IP_Type }, {"call_number", E_Message_Call_Number }, diff --git a/src/rtpstream.cpp b/src/rtpstream.cpp index 64d35d3d..3c5860ed 100644 --- a/src/rtpstream.cpp +++ b/src/rtpstream.cpp @@ -28,6 +28,10 @@ #include #include "rtpstream.hpp" +#include +#include +#include + /* stub to add extra debugging/logging... */ static void debugprint(const char* format, ...) { @@ -37,14 +41,29 @@ static void debugprint(const char* format, ...) #define BIND_MAX_TRIES 100 #define RTPSTREAM_THREADBLOCKSIZE 16 #define MAX_UDP_RECV_BUFFER 8192 - -#define TI_NULL_AUDIOIP 0x01 -#define TI_NULLIP (TI_NULL_AUDIOIP) -#define TI_PAUSERTP 0x04 -#define TI_ECHORTP 0x08 /* Not currently implemented */ -#define TI_KILLTASK 0x10 -#define TI_PLAYFILE 0x40 -#define TI_CONFIGFLAGS (TI_KILLTASK|TI_PLAYFILE) +#define MAX_UDP_SEND_BUFFER 8192 + +#define TI_NULL_AUDIOIP 0x001 +#define TI_NULL_VIDEOIP 0x002 +#define TI_NULLIP (TI_NULL_AUDIOIP | TI_NULL_VIDEOIP) +#define TI_PAUSERTP 0x004 +#define TI_ECHORTP 0x008 /* Not currently implemented */ +#define TI_KILLTASK 0x010 +#define TI_RECONNECTSOCKET 0x020 +#define TI_PLAYFILE 0x040 +#define TI_PAUSERTPAPATTERN 0x080 +#define TI_PLAYAPATTERN 0x100 +#define TI_PAUSERTPVPATTERN 0x200 +#define TI_PLAYVPATTERN 0x400 +#define TI_CONFIGFLAGS (TI_KILLTASK | TI_RECONNECTSOCKET | TI_PLAYFILE | TI_PLAYAPATTERN | TI_PLAYVPATTERN) + +#define PATTERN1 0xAA +#define PATTERN2 0xBB +#define PATTERN3 0xCC +#define PATTERN4 0xDD +#define PATTERN5 0xEE +#define PATTERN6 0xFF +#define NUMPATTERNS 6 struct rtp_header_t { @@ -54,51 +73,6 @@ struct rtp_header_t uint32_t ssrc_id; }; -struct taskentry_t -{ - threaddata_t *parent_thread; - unsigned long nextwake_ms; - volatile int flags; - - /* rtp stream information */ - unsigned long long last_timestamp; - unsigned short seq; - char payload_type; - unsigned int ssrc_id; - - /* current playback information */ - int loop_count; - char *file_bytes_start; - char *current_file_bytes; - int file_num_bytes; - int file_bytes_left; - /* playback timing information */ - int ms_per_packet; - int bytes_per_packet; - int timeticks_per_packet; - int timeticks_per_ms; - - /* new file playback information */ - char new_payload_type; - int new_loop_count; - int new_file_size; - char *new_file_bytes; - int new_ms_per_packet; - int new_bytes_per_packet; - int new_timeticks_per_packet; - /* sockets for audio/video rtp_rtcp */ - int audio_rtp_socket; - - /* rtp peer address structures */ - struct sockaddr_storage remote_audio_rtp_addr; - - /* we will have a mutex per call. should we consider refactoring to */ - /* share mutexes across calls? makes the per-call code more complex */ - - /* thread mananagment structures */ - pthread_mutex_t mutex; -}; - struct threaddata_t { pthread_mutex_t tasklist_mutex; @@ -117,7 +91,15 @@ struct cached_file_t int filesize; }; +struct cached_pattern_t +{ + int id; + char *bytes; + int filesize; +}; + cached_file_t *cached_files = NULL; +cached_pattern_t *cached_patterns = NULL; int num_cached_files = 0; int next_rtp_port = 0; @@ -130,12 +112,328 @@ int ready_threads_max = 0; unsigned int global_ssrc_id = 0xCA110000; +FILE* debugafile = NULL; +FILE* debugvfile = NULL; +pthread_mutex_t debugamutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t debugvmutex = PTHREAD_MUTEX_INITIALIZER; +#ifdef USE_OPENSSL +FILE* debuglsrtpafile = NULL; +FILE* debugrsrtpafile = NULL; +pthread_mutex_t debuglsrtpamutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t debugrsrtpamutex = PTHREAD_MUTEX_INITIALIZER; +FILE* debuglsrtpvfile = NULL; +FILE* debugrsrtpvfile = NULL; +pthread_mutex_t debuglsrtpvmutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t debugrsrtpvmutex = PTHREAD_MUTEX_INITIALIZER; +#endif // USE_OPENSSL +FILE* debugrefileaudio = NULL; +FILE* debugrefilevideo = NULL; +pthread_mutex_t debugremutexaudio = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t debugremutexvideo = PTHREAD_MUTEX_INITIALIZER; + +// RTPSTREAM ECHO +pthread_t pthread_audioecho_id; +pthread_t pthread_videoecho_id; +bool quit_audioecho_thread = false; +bool quit_videoecho_thread = false; +pthread_mutex_t quit_mutexaudio = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t quit_mutexvideo = PTHREAD_MUTEX_INITIALIZER; +pthread_cond_t quit_cvaudio = PTHREAD_COND_INITIALIZER; +pthread_cond_t quit_cvvideo = PTHREAD_COND_INITIALIZER; + +// JLSRTP contexts +JLSRTP g_txUACAudio; +JLSRTP g_rxUACAudio; +JLSRTP g_txUACVideo; +JLSRTP g_rxUACVideo; +JLSRTP g_rxUASAudio; +JLSRTP g_txUASAudio; +JLSRTP g_rxUASVideo; +JLSRTP g_txUASVideo; +pthread_mutex_t uacAudioMutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t uacVideoMutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t uasAudioMutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t uasVideoMutex = PTHREAD_MUTEX_INITIALIZER; + //=================================================================================================== +static int getThreadId(pthread_t p) +{ + int retVal = -1; + +#ifdef __APPLE__ + int rc = -1; + uint64_t thread_id = 0; + rc = pthread_threadid_np(p, &thread_id); + if (rc == 0) + { + retVal = thread_id; + } + else + { + retVal = -1; + } +#else // !__APPLE__ + retVal = p; +#endif // __APPLE__ + + return retVal; +} + +void printAudioHexUS(char const* note, unsigned char const* string, int size, int extrainfo, int moreinfo) +{ + if ((debugafile != NULL) && + (note != NULL) && + (string != NULL) && + rtpcheck_debug) + { + pthread_mutex_lock(&debugamutex); + fprintf(debugafile, "TID: %lu %s %d %d %d [", pthread_self(), note, size, extrainfo, moreinfo); + for (int i = 0; i < size; i++) + { + fprintf(debugafile, "%02X", 0x000000FF & string[i]); + } + fprintf(debugafile, "]\n"); + pthread_mutex_unlock(&debugamutex); + } +} + +void printVideoHexUS(char const* note, unsigned char const* string, int size, int extrainfo, int moreinfo) +{ + if ((debugvfile != NULL) && + (note != NULL) && + (string != NULL) && + rtpcheck_debug) + { + pthread_mutex_lock(&debugvmutex); + fprintf(debugvfile, "TID: %lu %s %d %d %d [", pthread_self(), note, size, extrainfo, moreinfo); + for (int i = 0; i < size; i++) + { + fprintf(debugvfile, "%02X", 0x000000FF & string[i]); + } + fprintf(debugvfile, "]\n"); + pthread_mutex_unlock(&debugvmutex); + } +} + +void printAudioHex(char const* note, char const* string, int size, int extrainfo, int moreinfo) +{ + if ((debugafile != NULL) && + (note != NULL) && + (string != NULL) && + rtpcheck_debug) + { + pthread_mutex_lock(&debugamutex); + fprintf(debugafile, "TID: %lu %s %d %d %d [", pthread_self(), note, size, extrainfo, moreinfo); + for (int i = 0; i < size; i++) + { + fprintf(debugafile, "%02X", 0x000000FF & string[i]); + } + fprintf(debugafile, "]\n"); + pthread_mutex_unlock(&debugamutex); + } +} + +void printAudioVector(char const* note, std::vector const &v) +{ + int i = 0; + + if ((debugafile != NULL) && + (note != NULL) && + rtpcheck_debug) + { + pthread_mutex_lock(&debugamutex); + fprintf(debugafile, "TID: %lu %s\n", pthread_self(), note); + for (i = 0; i < v.size(); i++) + { + fprintf(debugafile, "%lu\n", v[i]); + } + pthread_mutex_unlock(&debugamutex); + } +} + +void printVideoHex(char const* note, char const* string, int size, int extrainfo, int moreinfo) +{ + if ((debugvfile != NULL) && + (note != NULL) && + (string != NULL) && + rtpcheck_debug) + { + pthread_mutex_lock(&debugvmutex); + fprintf(debugvfile, "TID: %lu %s %d %d %d [", pthread_self(), note, size, extrainfo, moreinfo); + for (int i = 0; i < size; i++) + { + fprintf(debugvfile, "%02X", 0x000000FF & string[i]); + } + fprintf(debugvfile, "]\n"); + pthread_mutex_unlock(&debugvmutex); + } +} + +void printVideoVector(char const* note, std::vector const &v) +{ + int i = 0; + + if ((debugvfile != NULL) && + (note != NULL) && + rtpcheck_debug) + { + pthread_mutex_lock(&debugvmutex); + fprintf(debugvfile, "TID: %lu %s\n", pthread_self(), note); + for (i = 0; i < v.size(); i++) + { + fprintf(debugvfile, "%lu\n", v[i]); + } + pthread_mutex_unlock(&debugvmutex); + } +} + +#ifdef USE_OPENSSL +void printLocalAudioSrtpStuff(SrtpAudioInfoParams &p) +{ + if (debuglsrtpafile != NULL) + { + pthread_mutex_lock(&debuglsrtpamutex); + fprintf(debuglsrtpafile, "audio_found : %d\n", p.audio_found); + fprintf(debuglsrtpafile, "primary_audio_cryptotag : %d\n", p.primary_audio_cryptotag); + fprintf(debuglsrtpafile, "secondary_audio_cryptotag : %d\n", p.secondary_audio_cryptotag); + fprintf(debuglsrtpafile, "primary_audio_cryptosuite : %s\n", p.primary_audio_cryptosuite); + fprintf(debuglsrtpafile, "secondary_audio_cryptosuite : %s\n", p.secondary_audio_cryptosuite); + fprintf(debuglsrtpafile, "primary_audio_cryptokeyparams : %s\n", p.primary_audio_cryptokeyparams); + fprintf(debuglsrtpafile, "secondary_audio_cryptokeyparams : %s\n", p.secondary_audio_cryptokeyparams); + fprintf(debuglsrtpafile, "primary_unencrypted_audio_srtp : %d\n", p.primary_unencrypted_audio_srtp); + fprintf(debuglsrtpafile, "secondary_unencrypted_audio_srtp: %d\n", p.secondary_unencrypted_audio_srtp); + pthread_mutex_unlock(&debuglsrtpamutex); + } +} + +void printRemoteAudioSrtpStuff(SrtpAudioInfoParams &p) +{ + if (debugrsrtpafile != NULL) + { + pthread_mutex_lock(&debugrsrtpamutex); + fprintf(debugrsrtpafile, "audio_found : %d\n", p.audio_found); + fprintf(debugrsrtpafile, "primary_audio_cryptotag : %d\n", p.primary_audio_cryptotag); + fprintf(debugrsrtpafile, "secondary_audio_cryptotag : %d\n", p.secondary_audio_cryptotag); + fprintf(debugrsrtpafile, "primary_audio_cryptosuite : %s\n", p.primary_audio_cryptosuite); + fprintf(debugrsrtpafile, "secondary_audio_cryptosuite : %s\n", p.secondary_audio_cryptosuite); + fprintf(debugrsrtpafile, "primary_audio_cryptokeyparams : %s\n", p.primary_audio_cryptokeyparams); + fprintf(debugrsrtpafile, "secondary_audio_cryptokeyparams : %s\n", p.secondary_audio_cryptokeyparams); + fprintf(debugrsrtpafile, "primary_unencrypted_audio_srtp : %d\n", p.primary_unencrypted_audio_srtp); + fprintf(debugrsrtpafile, "secondary_unencrypted_audio_srtp: %d\n", p.secondary_unencrypted_audio_srtp); + pthread_mutex_unlock(&debugrsrtpamutex); + } +} + +void printLocalVideoSrtpStuff(SrtpVideoInfoParams &p) +{ + if (debuglsrtpvfile != NULL) + { + pthread_mutex_lock(&debuglsrtpvmutex); + fprintf(debuglsrtpvfile, "video_found : %d\n", p.video_found); + fprintf(debuglsrtpvfile, "primary_video_cryptotag : %d\n", p.primary_video_cryptotag); + fprintf(debuglsrtpvfile, "secondary_video_cryptotag : %d\n", p.secondary_video_cryptotag); + fprintf(debuglsrtpvfile, "primary_video_cryptosuite : %s\n", p.primary_video_cryptosuite); + fprintf(debuglsrtpvfile, "secondary_video_cryptosuite : %s\n", p.secondary_video_cryptosuite); + fprintf(debuglsrtpvfile, "primary_video_cryptokeyparams : %s\n", p.primary_video_cryptokeyparams); + fprintf(debuglsrtpvfile, "secondary_video_cryptokeyparams : %s\n", p.secondary_video_cryptokeyparams); + fprintf(debuglsrtpvfile, "primary_unencrypted_video_srtp : %d\n", p.primary_unencrypted_video_srtp); + fprintf(debuglsrtpvfile, "secondary_unencrypted_video_srtp: %d\n", p.secondary_unencrypted_video_srtp); + pthread_mutex_unlock(&debuglsrtpvmutex); + } +} + +void printRemoteVideoSrtpStuff(SrtpVideoInfoParams &p) +{ + if (debugrsrtpvfile != NULL) + { + pthread_mutex_lock(&debugrsrtpvmutex); + fprintf(debugrsrtpvfile, "video_found : %d\n", p.video_found); + fprintf(debugrsrtpvfile, "primary_video_cryptotag : %d\n", p.primary_video_cryptotag); + fprintf(debugrsrtpvfile, "secondary_video_cryptotag : %d\n", p.secondary_video_cryptotag); + fprintf(debugrsrtpvfile, "primary_video_cryptosuite : %s\n", p.primary_video_cryptosuite); + fprintf(debugrsrtpvfile, "secondary_video_cryptosuite : %s\n", p.secondary_video_cryptosuite); + fprintf(debugrsrtpvfile, "primary_video_cryptokeyparams : %s\n", p.primary_video_cryptokeyparams); + fprintf(debugrsrtpvfile, "secondary_video_cryptokeyparams : %s\n", p.secondary_video_cryptokeyparams); + fprintf(debugrsrtpvfile, "primary_unencrypted_video_srtp : %d\n", p.primary_unencrypted_video_srtp); + fprintf(debugrsrtpvfile, "secondary_unencrypted_video_srtp: %d\n", p.secondary_unencrypted_video_srtp); + pthread_mutex_unlock(&debugrsrtpvmutex); + } +} +#endif // USE_OPENSSL + +int set_bit(unsigned long* context, int value) +{ + int retVal = -1; + + if (context != NULL) + { + if (value > 0) + { + *context |= (1 << (value - 1)); + retVal = value; + } + else + { + retVal = 0; + } + } + else + { + retVal = -1; + } + + return retVal; +} + +int clear_bit(unsigned long* context, int value) +{ + int retVal = -1; + + if (context != NULL) + { + if (value > 0) + { + *context &= ~(1 << (value - 1)); + retVal = value; + } + else + { + retVal = 0; + } + } + else + { + retVal = -1; + } + + return retVal; +} + /* code checked */ static void rtpstream_free_taskinfo(taskentry_t* taskinfo) { if (taskinfo) { +#ifdef USE_OPENSSL + /* audio SRTP echo activity indicators */ + taskinfo->audio_srtp_echo_active = 0; + taskinfo->video_srtp_echo_active = 0; +#endif // USE_OPENSSL + + /* close sockets associated with this call */ + if (taskinfo->audio_rtp_socket != -1) { + close(taskinfo->audio_rtp_socket); + } + if (taskinfo->audio_rtcp_socket != -1) { + close(taskinfo->audio_rtcp_socket); + } + if (taskinfo->video_rtp_socket != -1) { + close(taskinfo->video_rtp_socket); + } + if (taskinfo->video_rtcp_socket != -1) { + close(taskinfo->video_rtcp_socket); + } + /* cleanup pthread library structure */ pthread_mutex_destroy(&(taskinfo->mutex)); free(taskinfo); @@ -145,132 +443,734 @@ static void rtpstream_free_taskinfo(taskentry_t* taskinfo) /* code checked */ static void rtpstream_process_task_flags(taskentry_t* taskinfo) { + if (taskinfo->flags & TI_RECONNECTSOCKET) { + int remote_addr_len; + int rc = -1; + + remote_addr_len = media_ip_is_ipv6 ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in); + + /* enter critical section to lock address updates */ + /* may want to leave this out -- low chance of race condition */ + pthread_mutex_lock(&(taskinfo->mutex)); + + /* If we have valid ip and port numbers for audio rtp stream */ + if (!(taskinfo->flags & TI_NULL_AUDIOIP)) + { + if (taskinfo->audio_rtcp_socket != -1) { + rc = connect(taskinfo->audio_rtcp_socket, (struct sockaddr *) & (taskinfo->remote_audio_rtcp_addr), remote_addr_len); + if (rc < 0) { + debugprint("closing audio rtcp socket %d due to error %d in rtpstream_process_task_flags taskinfo = %p\n", + taskinfo->audio_rtcp_socket, errno, taskinfo); + close(taskinfo->audio_rtcp_socket); + taskinfo->audio_rtcp_socket = -1; + } + } + + if (taskinfo->audio_rtp_socket != -1) { +#ifdef USE_OPENSSL + if (!taskinfo->audio_srtp_echo_active) { +#else // !USE_OPENSSL + if (1) { +#endif // USE_OPENSSL + rc = connect(taskinfo->audio_rtp_socket, (struct sockaddr *) & (taskinfo->remote_audio_rtp_addr), remote_addr_len); + if (rc < 0) { + debugprint("closing audio rtp socket %d due to error %d in rtpstream_process_task_flags taskinfo = %p\n", + taskinfo->audio_rtp_socket, errno, taskinfo); + close(taskinfo->audio_rtp_socket); + taskinfo->audio_rtp_socket = -1; + } + } else { + /* Do NOT perform connect() when doing SRTP echo */ + } + } + } + + /* If we have valid ip and port numbers for video rtp stream */ + if (!(taskinfo->flags & TI_NULL_VIDEOIP)) + { + if (taskinfo->video_rtcp_socket != -1) { + rc = connect(taskinfo->video_rtcp_socket, (struct sockaddr *) & (taskinfo->remote_video_rtcp_addr), remote_addr_len); + if (rc < 0) { + debugprint("closing video rtcp socket %d due to error %d in rtpstream_process_task_flags taskinfo = %p\n", + taskinfo->video_rtcp_socket, errno, taskinfo); + close(taskinfo->video_rtcp_socket); + taskinfo->video_rtcp_socket = -1; + } + } + if (taskinfo->video_rtp_socket != -1) { +#ifdef USE_OPENSSL + if (!taskinfo->video_srtp_echo_active) { +#else // !USE_OPENSSL + if (1) { +#endif // USE_OPENSSL + rc = connect(taskinfo->video_rtp_socket, (struct sockaddr *) & (taskinfo->remote_video_rtp_addr), remote_addr_len); + if (rc < 0) { + debugprint("closing video rtp socket %d due to error %d in rtpstream_process_task_flags taskinfo = %p\n", + taskinfo->video_rtp_socket, errno, taskinfo); + close(taskinfo->video_rtp_socket); + taskinfo->video_rtp_socket = -1; + } + } else { + /* Do NOT perform connect() when doing SRTP echo */ + } + } + } + + taskinfo->flags &= ~TI_RECONNECTSOCKET; + pthread_mutex_unlock(&(taskinfo->mutex)); + } if (taskinfo->flags & TI_PLAYFILE) { /* copy playback information */ - taskinfo->loop_count = taskinfo->new_loop_count; - taskinfo->file_bytes_start = taskinfo->new_file_bytes; - taskinfo->current_file_bytes = taskinfo->new_file_bytes; - taskinfo->file_num_bytes = taskinfo->new_file_size; - taskinfo->file_bytes_left = taskinfo->new_file_size; - taskinfo->payload_type = taskinfo->new_payload_type; - - taskinfo->ms_per_packet = taskinfo->new_ms_per_packet; - taskinfo->bytes_per_packet = taskinfo->new_bytes_per_packet; - taskinfo->timeticks_per_packet = taskinfo->new_timeticks_per_packet; - taskinfo->timeticks_per_ms = taskinfo->timeticks_per_packet/taskinfo->ms_per_packet; - - taskinfo->last_timestamp = getmilliseconds()*taskinfo->timeticks_per_ms; + taskinfo->audio_pattern_id = taskinfo->new_audio_pattern_id; + taskinfo->audio_loop_count = taskinfo->new_audio_loop_count; + taskinfo->audio_file_bytes_start = taskinfo->new_audio_file_bytes; + taskinfo->audio_current_file_bytes = taskinfo->new_audio_file_bytes; + taskinfo->audio_file_num_bytes = taskinfo->new_audio_file_size; + taskinfo->audio_file_bytes_left = taskinfo->new_audio_file_size; + taskinfo->audio_payload_type = taskinfo->new_audio_payload_type; + + taskinfo->audio_ms_per_packet = taskinfo->new_audio_ms_per_packet; + taskinfo->audio_bytes_per_packet = taskinfo->new_audio_bytes_per_packet; + taskinfo->audio_timeticks_per_packet = taskinfo->new_audio_timeticks_per_packet; + taskinfo->audio_timeticks_per_ms = taskinfo->audio_timeticks_per_packet/taskinfo->audio_ms_per_packet; + + taskinfo->last_audio_timestamp = getmilliseconds() * taskinfo->audio_timeticks_per_ms; taskinfo->flags &= ~TI_PLAYFILE; } + + if (taskinfo->flags & TI_PLAYAPATTERN) + { + /* copy playback information */ + taskinfo->audio_pattern_id = taskinfo->new_audio_pattern_id; + taskinfo->audio_loop_count = taskinfo->new_audio_loop_count; + taskinfo->audio_file_bytes_start = taskinfo->new_audio_file_bytes; + taskinfo->audio_current_file_bytes = taskinfo->new_audio_file_bytes; + taskinfo->audio_file_num_bytes = taskinfo->new_audio_file_size; + taskinfo->audio_file_bytes_left = taskinfo->new_audio_file_size; + taskinfo->audio_payload_type = taskinfo->new_audio_payload_type; + + taskinfo->audio_ms_per_packet = taskinfo->new_audio_ms_per_packet; + taskinfo->audio_bytes_per_packet = taskinfo->new_audio_bytes_per_packet; + taskinfo->audio_timeticks_per_packet = taskinfo->new_audio_timeticks_per_packet; + taskinfo->audio_timeticks_per_ms = taskinfo->audio_timeticks_per_packet/taskinfo->audio_ms_per_packet; + + taskinfo->last_audio_timestamp = getmilliseconds() * taskinfo->audio_timeticks_per_ms; + taskinfo->flags &= ~TI_PLAYAPATTERN; + } + + if (taskinfo->flags & TI_PLAYVPATTERN) + { + /* copy playback information */ + taskinfo->video_pattern_id = taskinfo->new_video_pattern_id; + taskinfo->video_loop_count = taskinfo->new_video_loop_count; + taskinfo->video_file_bytes_start = taskinfo->new_video_file_bytes; + taskinfo->video_current_file_bytes = taskinfo->new_video_file_bytes; + taskinfo->video_file_num_bytes = taskinfo->new_video_file_size; + taskinfo->video_file_bytes_left = taskinfo->new_video_file_size; + taskinfo->video_payload_type = taskinfo->new_video_payload_type; + + taskinfo->video_ms_per_packet = taskinfo->new_video_ms_per_packet; + taskinfo->video_bytes_per_packet = taskinfo->new_video_bytes_per_packet; + taskinfo->video_timeticks_per_packet = taskinfo->new_video_timeticks_per_packet; + taskinfo->video_timeticks_per_ms = taskinfo->video_timeticks_per_packet/taskinfo->video_ms_per_packet; + + taskinfo->last_video_timestamp = getmilliseconds() * taskinfo->video_timeticks_per_ms; + taskinfo->flags &= ~TI_PLAYVPATTERN; + } } /**** todo - check code ****/ -static unsigned long rtpstream_playrtptask(taskentry_t* taskinfo, unsigned long timenow_ms) +static unsigned long rtpstream_playrtptask(taskentry_t* taskinfo, + unsigned long timenow_ms, + unsigned long* comparison_acheck, + std::vector &rs_apackets, + unsigned long* comparison_vcheck, + std::vector &rs_vpackets, + int taskindex) { - int rc; - unsigned long next_wake; - unsigned long long target_timestamp; + int rc; + unsigned long next_wake; + unsigned long long target_timestamp; + int compresult; + struct timeval tv; + fd_set readfds; + std::vector rtp_header; + std::vector payload_data; + std::vector audio_out; + std::vector audio_in; + std::vector video_out; + std::vector video_in; + unsigned short host_flags = 0; + unsigned short host_seqnum = 0; + unsigned int host_timestamp = 0; + unsigned int host_ssrc = 0; + unsigned short network_flags = 0; + unsigned short network_seqnum = 0; + unsigned int network_timestamp = 0; + unsigned int network_ssrc = 0; + unsigned short audio_seq_in = 0; + unsigned short video_seq_in = 0; + unsigned int audio_in_size = 0; + unsigned int video_in_size = 0; + + union { + rtp_header_t hdr; + char buffer[MAX_UDP_RECV_BUFFER]; + } udp_recv_temp; + + union { + rtp_header_t hdr; + char buffer[MAX_UDP_SEND_BUFFER]; + } udp_send_temp; + + union { + rtp_header_t hdr; + char buffer[MAX_UDP_RECV_BUFFER]; + } udp_recv_audio; + + union { + rtp_header_t hdr; + char buffer[MAX_UDP_SEND_BUFFER]; + } udp_send_audio; union { rtp_header_t hdr; char buffer[MAX_UDP_RECV_BUFFER]; - } udp; + } udp_recv_video; + + union { + rtp_header_t hdr; + char buffer[MAX_UDP_SEND_BUFFER]; + } udp_send_video; + + + tv.tv_sec = 0; + tv.tv_usec = 10000; /* 10ms */ + + *comparison_acheck = 0; + *comparison_vcheck = 0; + + printAudioHex("----AUDIO RTP SOCKET----", "", 0, taskindex, taskinfo->audio_rtp_socket); + printVideoHex("----VIDEO RTP SOCKET----", "", 0, taskindex, taskinfo->video_rtp_socket); /* OK, now to play - sockets are supposed to be non-blocking */ /* no support for video stream at this stage. will need some work */ next_wake = timenow_ms + 100; /* default next wakeup time */ - if (taskinfo->audio_rtp_socket != -1) { - /* if/when we include echo functionality, we'll have to read - * from the audio_rtp_socket too, and check by peer address if - * it is "our" traffic */ - - /* are we playing back an audio file? */ - if (taskinfo->loop_count) { - target_timestamp = timenow_ms * taskinfo->timeticks_per_ms; - next_wake = timenow_ms + taskinfo->ms_per_packet - timenow_ms % taskinfo->ms_per_packet; - if (taskinfo->flags & (TI_NULL_AUDIOIP | TI_PAUSERTP)) { + if ((taskinfo->audio_rtp_socket != -1) && + (taskindex >= 0) && + (taskindex <= (rs_apackets.size()-1))) + { + /* are we playing back an audio file/pattern? */ + if (taskinfo->audio_loop_count) + { + target_timestamp = timenow_ms * taskinfo->audio_timeticks_per_ms; + next_wake = timenow_ms + taskinfo->audio_ms_per_packet - timenow_ms%taskinfo->audio_ms_per_packet; + if (taskinfo->flags & (TI_NULL_AUDIOIP | TI_PAUSERTP | TI_PAUSERTPAPATTERN)) + { /* when paused, set timestamp so stream appears to be up to date */ - taskinfo->last_timestamp = target_timestamp; + taskinfo->last_audio_timestamp = target_timestamp; } - if (taskinfo->last_timestamp < target_timestamp) { + if (taskinfo->last_audio_timestamp < target_timestamp) + { /* need to send rtp payload - build rtp packet header... */ - udp.hdr.flags = htons(0x8000 | taskinfo->payload_type); - udp.hdr.seq = htons(taskinfo->seq); - udp.hdr.timestamp = htonl((uint32_t)(taskinfo->last_timestamp & 0xFFFFFFFF)); - udp.hdr.ssrc_id = htonl(taskinfo->ssrc_id); + memset(udp_send_audio.buffer, 0, sizeof(udp_send_audio)); + udp_send_audio.hdr.flags = htons(0x8000 | taskinfo->audio_payload_type); + udp_send_audio.hdr.seq = htons(taskinfo->audio_seq_out); + udp_send_audio.hdr.timestamp = htonl((uint32_t) (taskinfo->last_audio_timestamp & 0XFFFFFFFF)); + udp_send_audio.hdr.ssrc_id = htonl(taskinfo->audio_ssrc_id); /* add payload data to the packet - handle buffer wraparound */ - if (taskinfo->file_bytes_left >= taskinfo->bytes_per_packet) { + if (taskinfo->audio_file_bytes_left >= taskinfo->audio_bytes_per_packet) + { /* no need for fancy acrobatics */ - memcpy(udp.buffer + sizeof(rtp_header_t), taskinfo->current_file_bytes, taskinfo->bytes_per_packet); - } else { + memcpy(udp_send_audio.buffer + sizeof(rtp_header_t), taskinfo->audio_current_file_bytes, taskinfo->audio_bytes_per_packet); + } + else + { /* copy from end and then begining of file. does not handle the */ /* case where file is shorter than the packet length!! */ - memcpy(udp.buffer + sizeof(rtp_header_t), taskinfo->current_file_bytes, taskinfo->file_bytes_left); - memcpy(udp.buffer + sizeof(rtp_header_t) + taskinfo->file_bytes_left, - taskinfo->file_bytes_start, taskinfo->bytes_per_packet - taskinfo->file_bytes_left); + memcpy(udp_send_audio.buffer + sizeof(rtp_header_t), taskinfo->audio_current_file_bytes, taskinfo->audio_file_bytes_left); + memcpy(udp_send_audio.buffer + sizeof(rtp_header_t) + taskinfo->audio_file_bytes_left, taskinfo->audio_file_bytes_start, taskinfo->audio_bytes_per_packet - taskinfo->audio_file_bytes_left); + } + + pthread_mutex_lock(&uacAudioMutex); +#ifdef USE_OPENSSL + if (g_txUACAudio.getCryptoTag() != 0) + { + // GRAB RTP HEADER + rtp_header.resize(sizeof(rtp_header_t), 0); + memcpy(rtp_header.data(), udp_send_audio.buffer, sizeof(rtp_header_t) /*12*/); + // GRAB RTP PAYLOAD DATA + payload_data.resize(taskinfo->audio_bytes_per_packet, 0); + memcpy(payload_data.data(), udp_send_audio.buffer + sizeof(rtp_header_t), taskinfo->audio_bytes_per_packet); + + // ENCRYPT + rc = g_txUACAudio.processOutgoingPacket(taskinfo->audio_seq_out, rtp_header, payload_data, audio_out); + printAudioHex("TXUACAUDIO -- processOutgoingPacket() rc == ", "", rc, 0, 0); } + else + { +#endif // USE_OPENSSL + // NOENCRYPTION + audio_out.resize(sizeof(rtp_header_t) + taskinfo->audio_bytes_per_packet, 0); + memcpy(audio_out.data(), udp_send_audio.buffer, sizeof(rtp_header_t) + taskinfo->audio_bytes_per_packet); +#ifdef USE_OPENSSL + } +#endif // USE_OPENSSL /* now send the actual packet */ - size_t packet_len = taskinfo->bytes_per_packet + sizeof(rtp_header_t); - socklen_t remote_addr_len = (media_ip_is_ipv6 ? - sizeof(struct sockaddr_in6) : - sizeof(struct sockaddr_in)); - rc = sendto(taskinfo->audio_rtp_socket, udp.buffer, packet_len, 0, - (struct sockaddr*)&taskinfo->remote_audio_rtp_addr, remote_addr_len); + rc = send(taskinfo->audio_rtp_socket, audio_out.data(), audio_out.size(), 0); + if (rc < 0) + { + printAudioHex("SEND FAILED: ", "", rc, errno, 0); - if (rc < 0) { /* handle sending errors */ - if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { + if ((errno == EAGAIN) || (errno == EWOULDBLOCK) || (errno == EINTR)) + { next_wake = timenow_ms + 2; /* retry after short sleep */ - } else { + } + else + { /* this looks like a permanent error - should we ignore ENETUNREACH? */ - debugprint("closing rtp socket %d due to error %d in rtpstream_new_call taskinfo=%p\n", - taskinfo->audio_rtp_socket, errno, taskinfo); + debugprint("closing rtp socket %d due to error %d in rtpstream_new_call callinfo=%p\n", taskinfo->audio_rtp_socket, errno); close(taskinfo->audio_rtp_socket); taskinfo->audio_rtp_socket = -1; } - } else { + } + else + { /* statistics - only count successful sends */ - rtpstream_bytes_out += taskinfo->bytes_per_packet + sizeof(rtp_header_t); - rtpstream_pckts++; + rtpstream_abytes_out += taskinfo->audio_bytes_per_packet + sizeof(rtp_header_t); + rtpstream_apckts++; // GLOBAL RTP packet counter + rs_apackets[taskindex]++; // TASK-specific RTP packet counter + + printAudioHexUS("SIPP SUCCESS SEND LOG: ", audio_out.data(), audio_out.size(), rc, rtpstream_apckts); + + FD_ZERO(&readfds); + FD_SET(taskinfo->audio_rtp_socket, &readfds); + rc = select(taskinfo->audio_rtp_socket + 1, &readfds, NULL, NULL, &tv); + + if (FD_ISSET(taskinfo->audio_rtp_socket, &readfds)) + { + /* this is temp code - will have to reorganize if/when we include echo functionality */ + /* just keep listening on rtp socket (is this really required?) - ignore any errors */ +#ifdef USE_OPENSSL + if (g_rxUACAudio.getCryptoTag() != 0) + { + audio_in_size = sizeof(rtp_header_t) + taskinfo->audio_bytes_per_packet + g_rxUACAudio.getAuthenticationTagSize(); + } + else + { +#endif // USE_OPENSSL + // NOENCRYPTION + audio_in_size = sizeof(rtp_header_t) + taskinfo->audio_bytes_per_packet; +#ifdef USE_OPENSSL + } +#endif // USE_OPENSSL + audio_in.resize(audio_in_size, 0); + while ((rc = recv(taskinfo->audio_rtp_socket, audio_in.data(), audio_in.size(), 0)) >= 0) + { + /* for now we will just ignore any received data or receive errors */ + /* separate code path for RTP echo */ + rtpstream_abytes_in += rc; + printAudioHexUS("SIPP SUCCESS RECV LOG: ", audio_in.data(), audio_in.size(), rc, rtpstream_apckts); + } +#ifdef USE_OPENSSL + if (g_rxUACAudio.getCryptoTag() != 0) + { + // DECRYPT + rtp_header.clear(); + payload_data.clear(); + + audio_seq_in = ntohs(((rtp_header_t*)audio_in.data())->seq); + rc = g_rxUACAudio.processIncomingPacket(audio_seq_in, audio_in, rtp_header, payload_data); + printAudioHex("RXUACAUDIO -- processIncomingPacket() rc == ", "", rc, 0, 0); + + host_flags = ntohs(((rtp_header_t*)audio_in.data())->flags); + host_seqnum = ntohs(((rtp_header_t*)audio_in.data())->seq); + host_timestamp = ntohl(((rtp_header_t*)audio_in.data())->timestamp); + host_ssrc = ntohl(((rtp_header_t*)audio_in.data())->ssrc_id); + + audio_in[0] = (host_flags >> 8) & 0xFF; + audio_in[1] = host_flags & 0xFF; + audio_in[2] = (host_seqnum >> 8) & 0xFF; + audio_in[3] = host_seqnum & 0xFF; + audio_in[4] = (host_timestamp >> 24) & 0xFF; + audio_in[5] = (host_timestamp >> 16) & 0xFF; + audio_in[6] = (host_timestamp >> 8) & 0xFF; + audio_in[7] = host_timestamp & 0xFF; + audio_in[8] = (host_ssrc >> 24) & 0xFF; + audio_in[9] = (host_ssrc >> 16) & 0xFF; + audio_in[10] = (host_ssrc >> 8) & 0xFF; + audio_in[11] = host_ssrc & 0xFF; + + memset(udp_recv_audio.buffer, 0, sizeof(udp_recv_audio)); + memcpy(udp_recv_audio.buffer, rtp_header.data(), rtp_header.size()); + memcpy(udp_recv_audio.buffer + sizeof(rtp_header_t), payload_data.data(), payload_data.size()); + } + else + { +#endif // USE_OPENSSL + // NOENCRYPTION + host_flags = ntohs(((rtp_header_t*)audio_in.data())->flags); + host_seqnum = ntohs(((rtp_header_t*)audio_in.data())->seq); + host_timestamp = ntohl(((rtp_header_t*)audio_in.data())->timestamp); + host_ssrc = ntohl(((rtp_header_t*)audio_in.data())->ssrc_id); + + audio_in[0] = (host_flags >> 8) & 0xFF; + audio_in[1] = host_flags & 0xFF; + audio_in[2] = (host_seqnum >> 8) & 0xFF; + audio_in[3] = host_seqnum & 0xFF; + audio_in[4] = (host_timestamp >> 24) & 0xFF; + audio_in[5] = (host_timestamp >> 16) & 0xFF; + audio_in[6] = (host_timestamp >> 8) & 0xFF; + audio_in[7] = host_timestamp & 0xFF; + audio_in[8] = (host_ssrc >> 24) & 0xFF; + audio_in[9] = (host_ssrc >> 16) & 0xFF; + audio_in[10] = (host_ssrc >> 8) & 0xFF; + audio_in[11] = host_ssrc & 0xFF; + + memset(udp_recv_audio.buffer, 0, sizeof(udp_recv_audio)); + memcpy(udp_recv_audio.buffer, audio_in.data(), audio_in.size()); +#ifdef USE_OPENSSL + } +#endif // USE_OPENSSL + + // VALIDATION TEST + compresult = 0; + compresult = memcmp(udp_send_audio.buffer + sizeof(rtp_header_t), + udp_recv_audio.buffer + sizeof(rtp_header_t), + taskinfo->audio_bytes_per_packet /* PAYLOAD comparison ONLY -- header EXCLUDED*/); + if (compresult == 0) + { + // SUCCESS + printAudioHex("COMPARISON OK ", "", 0, taskinfo->audio_comparison_errors, rtpstream_apckts); + *comparison_acheck = 0; + } + else + { + // FAILURE + taskinfo->audio_comparison_errors++; + printAudioHex("COMPARISON FAILED", "", 0, taskinfo->audio_comparison_errors, rtpstream_apckts); + *comparison_acheck = 1; + } + } + else + { + taskinfo->audio_comparison_errors++; + printAudioHex("NODATA", "", 0, taskinfo->audio_comparison_errors, rtpstream_apckts); + *comparison_acheck = 1; + } + /* advance playback pointer to next packet */ - taskinfo->seq++; + taskinfo->audio_seq_out++; /* must change if timer ticks per packet can be fractional */ - taskinfo->last_timestamp += taskinfo->timeticks_per_packet; - taskinfo->file_bytes_left -= taskinfo->bytes_per_packet; - if (taskinfo->file_bytes_left > 0) { - taskinfo->current_file_bytes += taskinfo->bytes_per_packet; - } else { - taskinfo->current_file_bytes = taskinfo->file_bytes_start - taskinfo->file_bytes_left; - taskinfo->file_bytes_left += taskinfo->file_num_bytes; - if (taskinfo->loop_count > 0) { + taskinfo->last_audio_timestamp += taskinfo->audio_timeticks_per_packet; + taskinfo->audio_file_bytes_left -= taskinfo->audio_bytes_per_packet; + if (taskinfo->audio_file_bytes_left > 0) + { + taskinfo->audio_current_file_bytes += taskinfo->audio_bytes_per_packet; + } + else + { + taskinfo->audio_current_file_bytes = taskinfo->audio_file_bytes_start - taskinfo->audio_file_bytes_left; + taskinfo->audio_file_bytes_left += taskinfo->audio_file_num_bytes; + if (taskinfo->audio_loop_count > 0) + { /* one less loop to play. -1 (infinite loops) will stay as is */ - taskinfo->loop_count--; + taskinfo->audio_loop_count--; } } - if (taskinfo->last_timestamp < target_timestamp) { + if (taskinfo->last_audio_timestamp < target_timestamp) + { /* no sleep if we are behind */ next_wake = timenow_ms; } - } + } /* if (rc < 0) */ + pthread_mutex_unlock(&uacAudioMutex); + } /* if (taskinfo->last_audio_timestamp < target_timestamp) */ + else + { + printAudioHex("TIMESTAMP NOT QUITE RIGHT...", "", 0, 0, 0); + *comparison_acheck = -1; } - } else { - /* not busy playing back a file - put possible rtp echo code here. */ + } /* if (taskinfo->audio_loop_count) */ + else + { + /* not busy playing back a file - put possible rtp echo code here. */ + } + } // if (taskinfo->audio_rtp_socket != -1) + + if (taskinfo->audio_rtcp_socket != -1) + { + /* just keep listening on rtcp socket (is this really required?) - ignore any errors */ + while ((rc = recv(taskinfo->audio_rtcp_socket, udp_recv_temp.buffer, sizeof(udp_recv_temp.buffer), 0)) >= 0) + { + /* + * rtpstream_abytes_in += rc; + */ } } - return next_wake; -} + if ((taskinfo->video_rtp_socket != -1) && + (taskindex >= 0) && + (taskindex <= (rs_vpackets.size() - 1))) + { + /* are we playing back a video file/pattern? */ + if (taskinfo->video_loop_count) + { + target_timestamp = timenow_ms * taskinfo->video_timeticks_per_ms; + next_wake = timenow_ms + taskinfo->video_ms_per_packet - timenow_ms%taskinfo->video_ms_per_packet; + if (taskinfo->flags & (TI_NULL_VIDEOIP | TI_PAUSERTP | TI_PAUSERTPVPATTERN)) + { + /* when paused, set timestamp so stream appears to be up to date */ + taskinfo->last_video_timestamp = target_timestamp; + } + + if (taskinfo->last_video_timestamp < target_timestamp) + { + /* need to send rtp payload - build rtp packet header... */ + memset(udp_send_video.buffer, 0, sizeof(udp_send_video)); + udp_send_video.hdr.flags = htons(0x8000 | taskinfo->video_payload_type); + udp_send_video.hdr.seq = htons(taskinfo->video_seq_out); + udp_send_video.hdr.timestamp = htonl((uint32_t) (taskinfo->last_video_timestamp & 0XFFFFFFFF)); + udp_send_video.hdr.ssrc_id = htonl(taskinfo->video_ssrc_id); + /* add payload data to the packet - handle buffer wraparound */ + if (taskinfo->video_file_bytes_left >= taskinfo->video_bytes_per_packet) + { + /* no need for fancy acrobatics */ + memcpy(udp_send_video.buffer + sizeof(rtp_header_t), taskinfo->video_current_file_bytes, taskinfo->video_bytes_per_packet); + } + else + { + /* copy from end and then begining of file. does not handle the */ + /* case where file is shorter than the packet length!! */ + memcpy(udp_send_video.buffer + sizeof(rtp_header_t), taskinfo->video_current_file_bytes, taskinfo->video_file_bytes_left); + memcpy(udp_send_video.buffer + sizeof(rtp_header_t) + taskinfo->video_file_bytes_left, taskinfo->video_file_bytes_start, taskinfo->video_bytes_per_packet - taskinfo->video_file_bytes_left); + } + + pthread_mutex_lock(&uacVideoMutex); +#ifdef USE_OPENSSL + if (g_txUACVideo.getCryptoTag() != 0) + { + // GRAB RTP HEADER + rtp_header.resize(sizeof(rtp_header_t), 0); + memcpy(rtp_header.data(), udp_send_video.buffer, sizeof(rtp_header_t) /*12*/); + // GRAB RTP PAYLOAD DATA + payload_data.resize(taskinfo->video_bytes_per_packet, 0); + memcpy(payload_data.data(), udp_send_video.buffer + sizeof(rtp_header_t), taskinfo->video_bytes_per_packet); + + // ENCRYPT + rc = g_txUACVideo.processOutgoingPacket(taskinfo->video_seq_out, rtp_header, payload_data, video_out); + printVideoHex("TXUACVIDEO -- processOutgoingPacket() rc == ", "", rc, 0, 0); + } + else + { +#endif // USE_OPENSSL + // NOENCRYPTION + video_out.resize(sizeof(rtp_header_t) + taskinfo->video_bytes_per_packet, 0); + memcpy(video_out.data(), udp_send_video.buffer, sizeof(rtp_header_t) + taskinfo->video_bytes_per_packet); +#ifdef USE_OPENSSL + } +#endif // USE_OPENSSL + /* now send the actual packet */ + rc = send(taskinfo->video_rtp_socket, video_out.data(), video_out.size(), 0); + if (rc < 0) + { + printVideoHex("SEND FAILED: ", "", rc, errno, 0); + /* handle sending errors */ + if ((errno == EAGAIN) || (errno == EWOULDBLOCK) || (errno == EINTR)) + { + next_wake = timenow_ms + 2; /* retry after short sleep */ + } + else + { + /* this looks like a permanent error - should we ignore ENETUNREACH? */ + debugprint("closing rtp socket %d due to error %d in rtpstream_new_call callinfo=%p\n", taskinfo->video_rtp_socket, errno); + close(taskinfo->video_rtp_socket); + taskinfo->video_rtp_socket = -1; + } + } + else + { + /* statistics - only count successful sends */ + rtpstream_vbytes_out += taskinfo->video_bytes_per_packet + sizeof(rtp_header_t); + rtpstream_vpckts++; // GLOBAL RTP packet counter + rs_vpackets[taskindex]++; // TASK-specific RTP packet counter + + printVideoHexUS("SIPP SUCCESS SEND LOG: ", video_out.data(), video_out.size(), rc, rtpstream_vpckts); + + FD_ZERO(&readfds); + FD_SET(taskinfo->video_rtp_socket, &readfds); + rc = select(taskinfo->video_rtp_socket + 1, &readfds, NULL, NULL, &tv); + + if (FD_ISSET(taskinfo->video_rtp_socket, &readfds)) + { + /* this is temp code - will have to reorganize if/when we include echo functionality */ + /* just keep listening on rtp socket (is this really required?) - ignore any errors */ +#ifdef USE_OPENSSL + if (g_rxUACVideo.getCryptoTag() != 0) + { + video_in_size = sizeof(rtp_header_t) + taskinfo->video_bytes_per_packet + g_rxUACVideo.getAuthenticationTagSize(); + } + else + { +#endif // USE_OPENSSL + // NOENCRYPTION + video_in_size = sizeof(rtp_header_t) + taskinfo->video_bytes_per_packet; +#ifdef USE_OPENSSL + } +#endif // USE_OPENSSL + video_in.resize(video_in_size, 0); + while ((rc = recv(taskinfo->video_rtp_socket, video_in.data(), video_in.size(), 0)) >= 0) + { + /* for now we will just ignore any received data or receive errors */ + /* separate code path for RTP echo */ + rtpstream_vbytes_in += rc; + printVideoHexUS("SIPP SUCCESS RECV LOG: ", video_in.data(), video_in.size(), rc, rtpstream_vpckts); + } + +#ifdef USE_OPENSSL + if (g_rxUACVideo.getCryptoTag() != 0) + { + // DECRYPT + rtp_header.clear(); + payload_data.clear(); + video_seq_in = ntohs(((rtp_header_t*)video_in.data())->seq); + rc = g_rxUACVideo.processIncomingPacket(video_seq_in, video_in, rtp_header, payload_data); + printVideoHex("RXUACVIDEO -- processIncomingPacket() rc == ", "", rc, 0, 0); + + host_flags = ntohs(((rtp_header_t*)video_in.data())->flags); + host_seqnum = ntohs(((rtp_header_t*)video_in.data())->seq); + host_timestamp = ntohl(((rtp_header_t*)video_in.data())->timestamp); + host_ssrc = ntohl(((rtp_header_t*)video_in.data())->ssrc_id); + + video_in[0] = (host_flags >> 8) & 0xFF; + video_in[1] = host_flags & 0xFF; + video_in[2] = (host_seqnum >> 8) & 0xFF; + video_in[3] = host_seqnum & 0xFF; + video_in[4] = (host_timestamp >> 24) & 0xFF; + video_in[5] = (host_timestamp >> 16) & 0xFF; + video_in[6] = (host_timestamp >> 8) & 0xFF; + video_in[7] = host_timestamp & 0xFF; + video_in[8] = (host_ssrc >> 24) & 0xFF; + video_in[9] = (host_ssrc >> 16) & 0xFF; + video_in[10] = (host_ssrc >> 8) & 0xFF; + video_in[11] = host_ssrc & 0xFF; + + memset(udp_recv_video.buffer, 0, sizeof(udp_recv_video)); + memcpy(udp_recv_video.buffer, rtp_header.data(), rtp_header.size()); + memcpy(udp_recv_video.buffer + sizeof(rtp_header_t), payload_data.data(), payload_data.size()); + } + else + { +#endif // USE_OPENSSL + // NOENCRYPTION + host_flags = ntohs(((rtp_header_t*)video_in.data())->flags); + host_seqnum = ntohs(((rtp_header_t*)video_in.data())->seq); + host_timestamp = ntohl(((rtp_header_t*)video_in.data())->timestamp); + host_ssrc = ntohl(((rtp_header_t*)video_in.data())->ssrc_id); + + video_in[0] = (host_flags >> 8) & 0xFF; + video_in[1] = host_flags & 0xFF; + video_in[2] = (host_seqnum >> 8) & 0xFF; + video_in[3] = host_seqnum & 0xFF; + video_in[4] = (host_timestamp >> 24) & 0xFF; + video_in[5] = (host_timestamp >> 16) & 0xFF; + video_in[6] = (host_timestamp >> 8) & 0xFF; + video_in[7] = host_timestamp & 0xFF; + video_in[8] = (host_ssrc >> 24) & 0xFF; + video_in[9] = (host_ssrc >> 16) & 0xFF; + video_in[10] = (host_ssrc >> 8) & 0xFF; + video_in[11] = host_ssrc & 0xFF; + + memset(udp_recv_video.buffer, 0, sizeof(udp_recv_video)); + memcpy(udp_recv_video.buffer, video_in.data(), video_in.size()); +#ifdef USE_OPENSSL + } +#endif // USE_OPENSSL + + // VALIDATION TEST + compresult = 0; + compresult = memcmp(udp_send_video.buffer + sizeof(rtp_header_t), + udp_recv_video.buffer + sizeof(rtp_header_t), + taskinfo->video_bytes_per_packet /* PAYLOAD comparison ONLY -- header EXCLUDED*/); + if (compresult == 0) + { + // SUCCESS + printVideoHex("COMPARISON OK ", "", 0, taskinfo->video_comparison_errors, rtpstream_vpckts); + *comparison_vcheck = 0; + } + else + { + // FAILURE + taskinfo->video_comparison_errors++; + printVideoHex("COMPARISON FAILED", "", 0, taskinfo->video_comparison_errors, rtpstream_vpckts); + *comparison_vcheck = 1; + } + } + else + { + taskinfo->video_comparison_errors++; + printVideoHex("NODATA", "", 0, taskinfo->video_comparison_errors, rtpstream_vpckts); + *comparison_vcheck = 1; + } + /* advance playback pointer to next packet */ + taskinfo->video_seq_out++; + /* must change if timer ticks per packet can be fractional */ + taskinfo->last_video_timestamp += taskinfo->video_timeticks_per_packet; + taskinfo->video_file_bytes_left -= taskinfo->video_bytes_per_packet; + if (taskinfo->video_file_bytes_left > 0) + { + taskinfo->video_current_file_bytes += taskinfo->video_bytes_per_packet; + } + else + { + taskinfo->video_current_file_bytes = taskinfo->video_file_bytes_start - taskinfo->video_file_bytes_left; + taskinfo->video_file_bytes_left += taskinfo->video_file_num_bytes; + if (taskinfo->video_loop_count > 0) + { + /* one less loop to play. -1 (infinite loops) will stay as is */ + taskinfo->video_loop_count--; + } + } + if (taskinfo->last_video_timestamp < target_timestamp) + { + /* no sleep if we are behind */ + next_wake = timenow_ms; + } + } /* if (rc < 0) */ + pthread_mutex_unlock(&uacVideoMutex); + } /* if (taskinfo->last_video_timestamp < target_timestamp) */ + else + { + printVideoHex("TIMESTAMP NOT QUITE RIGHT...", "", 0, 0, 0); + *comparison_vcheck = -1; + } + } /* if (taskinfo->video_loop_count) */ + else + { + /* not busy playing back a file - put possible rtp echo code here. */ + } + } -/*********************************************************************************/ -/*********************************************************************************/ -/*********************************************************************************/ + if (taskinfo->video_rtcp_socket != -1) + { + /* just keep listening on rtcp socket (is this really required?) - ignore any errors */ + while ((rc = recv(taskinfo->video_rtcp_socket, udp_recv_temp.buffer, sizeof(udp_recv_temp), 0)) >= 0) + { + /* + * rtpstream_vbytes_in += rc; + */ + } + } + return next_wake; +} /* code checked */ static void* rtpstream_playback_thread(void* params) @@ -283,19 +1183,88 @@ static void* rtpstream_playback_thread(void* params) unsigned long waketime_ms; int sleeptime_us; + unsigned long comparison_acheck; + unsigned long comparison_vcheck; + unsigned long rtpresult; + int i = 0; + std::vector rs_apackets; + std::vector rs_vpackets; + std::vector rs_artpcheck; + std::vector rs_vrtpcheck; + double verdict; + + comparison_acheck = 0; + comparison_vcheck = 0; + rtpresult = 0; /* includes BOTH AUDIO/VIDEO checks */ + rs_apackets.resize(threaddata->max_tasks); + rs_vpackets.resize(threaddata->max_tasks); + rs_artpcheck.resize(threaddata->max_tasks); + rs_vrtpcheck.resize(threaddata->max_tasks); + verdict = 0.0; + rtpstream_numthreads++; /* perhaps wrap this in a mutex? */ - while (!threaddata->exit_flag) { + // INITIALIZE AUDIO/VIDEO COMPARISON ERRORS + for (taskindex = 0; taskindex < threaddata->num_tasks; taskindex++) + { + (&threaddata->tasklist)[taskindex]->audio_comparison_errors = 0; + (&threaddata->tasklist)[taskindex]->video_comparison_errors = 0; + } + + // ROBUSTNESS CHECK + for (taskindex = 0; taskindex < threaddata->num_tasks; taskindex++) + { + taskinfo = (&threaddata->tasklist)[taskindex]; + + if (taskinfo->audio_active) + { + if ( + (taskinfo->new_audio_ms_per_packet == 0) || + (taskinfo->new_audio_loop_count < -1) || + (taskinfo->new_audio_pattern_id < -1) || + (taskinfo->new_audio_pattern_id > 6) || + (taskinfo->new_audio_payload_type < 0) || + (taskinfo->new_audio_payload_type > 127) + ) + { + // AUDIO VALIDATION FAILED -- ABORT MISSION + threaddata->exit_flag = 1; + } + } + else if (taskinfo->video_active) + { + if ( + (taskinfo->new_video_ms_per_packet == 0) || + (taskinfo->new_video_loop_count < -1) || + (taskinfo->new_video_pattern_id < -1) || + (taskinfo->new_video_pattern_id > 6) || + (taskinfo->new_video_payload_type < 0) || + (taskinfo->new_video_payload_type > 127) + ) + { + // VIDEO VALIDATION FAILED -- ABORT MISSION + threaddata->exit_flag = 1; + } + } + } + + while (!threaddata->exit_flag) + { timenow_ms = getmilliseconds(); waketime_ms = timenow_ms + 100; /* default sleep 100ms */ /* iterate through tasks and handle playback and other actions */ - for (taskindex = 0; taskindex < threaddata->num_tasks; taskindex++) { + for (taskindex = 0; taskindex < threaddata->num_tasks; taskindex++) + { + printAudioHex("----DEBUG CURRENTTASK/NUMTASKS----", "", 0, taskindex, threaddata->num_tasks); + printVideoHex("----DEBUG CURRENTTASK/NUMTASKS----", "", 0, taskindex, threaddata->num_tasks); taskinfo = (&threaddata->tasklist)[taskindex]; - if (taskinfo->flags & TI_CONFIGFLAGS) { - if (taskinfo->flags & TI_KILLTASK) { + if (taskinfo->flags & TI_CONFIGFLAGS) + { + if (taskinfo->flags & TI_KILLTASK) + { /* remove this task entry and release its resources */ - pthread_mutex_lock (&(threaddata->tasklist_mutex)); + pthread_mutex_lock(&(threaddata->tasklist_mutex)); (&threaddata->tasklist)[taskindex--] = (&threaddata->tasklist)[--threaddata->num_tasks]; threaddata->del_pending--; /* must decrease del_pending after num_tasks */ pthread_mutex_unlock(&(threaddata->tasklist_mutex)); @@ -307,23 +1276,116 @@ static void* rtpstream_playback_thread(void* params) } /* should we update current time inbetween tasks? */ - if (taskinfo->nextwake_ms <= timenow_ms) { + if (taskinfo->nextwake_ms <= timenow_ms) + { /* task needs to execute now */ - taskinfo->nextwake_ms = rtpstream_playrtptask(taskinfo, timenow_ms); + taskinfo->nextwake_ms = rtpstream_playrtptask(taskinfo, timenow_ms, &comparison_acheck, rs_apackets, &comparison_vcheck, rs_vpackets, taskindex); + + if (comparison_acheck == 1) + { + rs_artpcheck[taskindex]++; + printAudioHex("----FAILED RTP CHECK----", "", 0, rs_artpcheck[taskindex], rtpstream_apckts); + } + else + { + printAudioHex("----PASSED RTP CHECK----", "", 0, rs_artpcheck[taskindex], rtpstream_apckts); + } + + if (comparison_vcheck == 1) + { + rs_vrtpcheck[taskindex]++; + printVideoHex("----FAILED RTP CHECK----", "", 0, rs_vrtpcheck[taskindex], rtpstream_vpckts); + } + else + { + printVideoHex("----PASSED RTP CHECK----", "", 0, rs_vrtpcheck[taskindex], rtpstream_vpckts); + } } - if (waketime_ms > taskinfo->nextwake_ms) { + if (waketime_ms > taskinfo->nextwake_ms) + { waketime_ms = taskinfo->nextwake_ms; } } /* sleep until next iteration of playback loop */ sleeptime_us = (waketime_ms - getmilliseconds()) * 1000; - if (sleeptime_us > 0) { + if (sleeptime_us > 0) + { usleep(sleeptime_us); } } + // EXITING... CALCULATE RESULT + printAudioVector("----RTPCHECKS----", rs_artpcheck); + printVideoVector("----RTPCHECKS----", rs_vrtpcheck); + printAudioVector("----PACKET COUNTS----", rs_apackets); + printVideoVector("----PACKET COUNTS----", rs_vpackets); + + for (i = 0; i < threaddata->max_tasks; i++) + { + if (rs_apackets[i] > 0) + { + verdict = ((double)rs_artpcheck[i] / (double)rs_apackets[i]); + if (verdict >= audiotolerance) + { + // PACKETS TRANSMITTED IN TASK -- RTP CHECK FAILED + set_bit(&rtpresult, taskinfo->audio_pattern_id); + } + else + { + // PACKETS TRANSMITTED IN TASK -- RTP CHECK SUCCEEDED + // + // FIXME + // + // "rtpresult" is currently limiting us in reporting detailed + // results of per-task RTP check success/failures -- + // therefore at the present time we use it to indicate + // the combined results of ALL tasks RTP checks for ALL + // RTP patterns -- which means that bits are currently only + // set for a given pattern in a given task if its RTP check + // has failed -- this does not matter if its RTP check has + // succeeded since "rtpresult" is initialized to ZERO by + // default... + } + } + else + { + // NO PACKETS TRANSMITTED IN TASK -- NO-OP... + } + + if (rs_vpackets[i] > 0) + { + verdict = ((double)rs_vrtpcheck[i] / (double)rs_vpackets[i]); + if (verdict >= videotolerance) + { + // PACKETS TRANSMITTED IN TASK -- RTP CHECK FAILED + set_bit(&rtpresult, taskinfo->video_pattern_id); + } + else + { + // PACKETS TRANSMITTED IN TASK -- RTP CHECK SUCCEEDED + // + // FIXME + // + // "rtpresult" is currently limiting us in reporting detailed + // results of per-task RTP check success/failures -- + // therefore at the present time we use it to indicate + // the combined results of ALL tasks RTP checks for ALL + // RTP patterns -- which means that bits are currently only + // set for a given pattern in a given task if its RTP check + // has failed -- this does not matter if its RTP check has + // succeeded since "rtpresult" is initialized to ZERO by + // default... + } + } + else + { + // NO PACKETS TRANSMITTED IN TASK -- NO-OP... + } + } + /* Free all task and thread resources and exit the thread */ - for (taskindex = 0; taskindex < threaddata->num_tasks; taskindex++) { + for (taskindex = 0; taskindex < threaddata->num_tasks; taskindex++) + { /* check if we should delete this thread, else let owner call clear it */ /* small chance of race condition in this code */ taskinfo = (&threaddata->tasklist)[taskindex]; @@ -337,6 +1399,11 @@ static void* rtpstream_playback_thread(void* params) free(threaddata); rtpstream_numthreads--; /* perhaps wrap this in a mutex? */ + // PTHREAD EXIT... + printAudioHex("PLAYBACK THREAD EXITING...", "", 0, rtpresult, 0); + printVideoHex("PLAYBACK THREAD EXITING...", "", 0, rtpresult, 0); + pthread_exit((void*) rtpresult); + return NULL; } @@ -347,7 +1414,7 @@ static int rtpstream_start_task(rtpstream_callinfo_t* callinfo) int allocsize; threaddata_t **threadlist; threaddata_t *threaddata; - pthread_t newthread; + pthread_t threadID; /* safety check... */ if (!callinfo->taskinfo) { @@ -389,11 +1456,17 @@ static int rtpstream_start_task(rtpstream_callinfo_t* callinfo) threaddata->busy_list_index = -1; pthread_mutex_init(&(threaddata->tasklist_mutex), NULL); /* create the thread itself */ - if (pthread_create(&newthread, NULL, rtpstream_playback_thread, threaddata)) { + if (pthread_create(&threadID, NULL, rtpstream_playback_thread, threaddata)) { /* error creating the thread */ free(threaddata); return 0; } + + printAudioHex("CREATED THREAD: ", "", 0, getThreadId(threadID), 0); + printVideoHex("CREATED THREAD: ", "", 0, getThreadId(threadID), 0); + + // Save threadID + callinfo->threadID = threadID; /* Add thread to list of ready (spare capacity) threads */ ready_threads[num_ready_threads++] = threaddata; } @@ -438,33 +1511,42 @@ static void rtpstream_stop_task(rtpstream_callinfo_t* callinfo) taskentry_t *taskinfo = callinfo->taskinfo; int busy_index; - if (taskinfo) { - if (taskinfo->parent_thread) { + if (taskinfo) + { + if (taskinfo->parent_thread) + { /* this call's task is registered with an executing thread */ /* first move owning thread to the ready list - will be ready soon */ busy_index = taskinfo->parent_thread->busy_list_index; - if (busy_index >= 0) { + if (busy_index >= 0) + { /* make sure we have enough entries in ready list */ - if (num_ready_threads >= ready_threads_max) { + if (num_ready_threads >= ready_threads_max) + { /* need to allocate more memory for thread list */ ready_threads_max += RTPSTREAM_THREADBLOCKSIZE; threadlist = (threaddata_t **) realloc(ready_threads, sizeof(*ready_threads) * ready_threads_max); - if (!threadlist) { + if (!threadlist) + { /* could not allocate bigger block... reset max threads */ /* this is a problem - ready thread gets "lost" on busy list */ ready_threads_max -= RTPSTREAM_THREADBLOCKSIZE; - } else { + } + else + { ready_threads = threadlist; } } - if (num_ready_threads < ready_threads_max) { + if (num_ready_threads < ready_threads_max) + { /* OK, got space on ready list, move to ready list */ busy_threads[busy_index]->busy_list_index = -1; ready_threads[num_ready_threads++] = busy_threads[busy_index]; num_busy_threads--; /* fill up gap in the busy thread list */ - if (busy_index != num_busy_threads) { + if (busy_index != num_busy_threads) + { busy_threads[busy_index] = busy_threads[num_busy_threads]; busy_threads[busy_index]->busy_list_index = busy_index; } @@ -475,7 +1557,11 @@ static void rtpstream_stop_task(rtpstream_callinfo_t* callinfo) taskinfo->parent_thread->del_pending++; taskinfo->flags |= TI_KILLTASK; pthread_mutex_unlock(&(taskinfo->parent_thread->tasklist_mutex)); - } else { + + // PTHREAD IS NOT JOINABLE HERE... + } + else + { /* no playback thread owner, just free it */ rtpstream_free_taskinfo(taskinfo); } @@ -488,12 +1574,16 @@ int rtpstream_new_call(rtpstream_callinfo_t* callinfo) { debugprint("rtpstream_new_call callinfo=%p\n", callinfo); - taskentry_t* taskinfo; + taskentry_t *taskinfo; /* general init */ memset(callinfo, 0, sizeof(*callinfo)); - taskinfo= (taskentry_t *) malloc(sizeof(*taskinfo)); + // zero remote audio/video ports + callinfo->remote_audioport = 0; + callinfo->remote_videoport = 0; + + taskinfo = (taskentry_t *) malloc(sizeof(*taskinfo)); if (!taskinfo) { /* cannot allocate taskinfo memory - bubble error up */ return 0; @@ -504,8 +1594,20 @@ int rtpstream_new_call(rtpstream_callinfo_t* callinfo) taskinfo->flags = TI_NULLIP; /* socket descriptors */ taskinfo->audio_rtp_socket = -1; + taskinfo->audio_rtcp_socket = -1; + taskinfo->video_rtp_socket = -1; + taskinfo->video_rtcp_socket = -1; + +#ifdef USE_OPENSSL + /* audio/video SRTP echo activity indicators */ + taskinfo->audio_srtp_echo_active = 0; + taskinfo->video_srtp_echo_active = 0; +#endif // USE_OPENSSL + /* rtp stream members */ - taskinfo->ssrc_id = global_ssrc_id++; + taskinfo->audio_ssrc_id = global_ssrc_id++; + taskinfo->video_ssrc_id = global_ssrc_id++; + /* pthread mutexes */ pthread_mutex_init(&(callinfo->taskinfo->mutex), NULL); @@ -519,68 +1621,353 @@ void rtpstream_end_call(rtpstream_callinfo_t* callinfo) /* stop playback thread(s) for this call */ rtpstream_stop_task(callinfo); + + // zero remote audio/video ports + callinfo->remote_audioport = 0; + callinfo->remote_videoport = 0; } /* code checked */ -int rtpstream_cache_file(char* filename) +int rtpstream_cache_file(char* filename, + int mode /* 0: FILE -- 1: PATTERN */, + int id, + int bytes_per_packet, + int stream_type) { int count = 0; - cached_file_t *newcachelist; + cached_file_t *newfilecachelist; + cached_pattern_t *newpatterncachelist; char *filecontents; struct stat statbuffer; FILE *f; - debugprint ("rtpstream_cache_file filename=%s\n", filename); + debugprint("rtpstream_cache_file filename = %s mode = %d id = %d bytes_per_packet = %d stream_type = %d\n", filename, mode, id, bytes_per_packet, stream_type); - /* cached file entries are stored in a dynamically grown array. */ - /* could use a binary (or avl) tree but number of files should */ - /* be small and doesn't really justify the effort. */ - while (count < num_cached_files) { - if (!strcmp(cached_files[count].filename, filename)) { - /* found the file already loaded. just return index */ - return count; + if ((debugafile == NULL) && + rtpcheck_debug && + (stream_type == 0)) + { + debugafile = fopen("debugafile", "w"); + if (debugafile == NULL) + { + /* error encountered opening audio debug file */ + return -1; } - count++; } - /* Allocate memory and load file */ - if (stat(filename, &statbuffer)) { - /* could not get file information */ - return -1; - } - f = fopen(filename, "rb"); - if (!f) { - /* could not open file */ - return -1; + if ((debugvfile == NULL) && + rtpcheck_debug && + (stream_type == 1)) + { + debugvfile = fopen("debugvfile", "w"); + if (debugvfile == NULL) + { + /* error encountered opening video debug file */ + return -1; + } } - filecontents = (char *)malloc(statbuffer.st_size); - if (!filecontents) { - /* could not alloc mem */ - return -1; - } - if (!fread(filecontents, statbuffer.st_size, 1, f)) { - /* could not read file */ - free(filecontents); - return -1; - } - fclose(f); + if (mode == 1) + { + if ((id < 1) || (id > NUMPATTERNS)) + { + /* invalid pattern ID specified */ + return -1; + } + + /* cached pattern entries are stored in a dynamically grown array. */ + /* could use a binary (or avl) tree but number of files should */ + /* be small and doesn't really justify the effort. */ + while (count < num_cached_files) + { + count++; + } - if (!(num_cached_files % RTPSTREAM_FILESPERBLOCK)) { - /* Time to allocate more memory for the next block of files */ - newcachelist = (cached_file_t*) realloc(cached_files, sizeof(*cached_files) * (num_cached_files + RTPSTREAM_FILESPERBLOCK)); - if (!newcachelist) { + if (!(num_cached_files%RTPSTREAM_FILESPERBLOCK)) { + /* Time to allocate more memory for the next block of files */ + newpatterncachelist = (cached_pattern_t*) realloc(cached_patterns, sizeof(*cached_patterns) * (num_cached_files + RTPSTREAM_FILESPERBLOCK)); + if (!newpatterncachelist) { + /* out of memory */ + return -1; + } + cached_patterns = newpatterncachelist; + } + + cached_patterns[num_cached_files].bytes = (char*)malloc(bytes_per_packet); + if (cached_patterns[num_cached_files].bytes == NULL) + { /* out of memory */ + return -1; + } + + if (id == 1) + { + memset(cached_patterns[num_cached_files].bytes, PATTERN1, bytes_per_packet); + } + else if (id == 2) + { + memset(cached_patterns[num_cached_files].bytes, PATTERN2, bytes_per_packet); + } + else if (id == 3) + { + memset(cached_patterns[num_cached_files].bytes, PATTERN3, bytes_per_packet); + } + else if (id == 4) + { + memset(cached_patterns[num_cached_files].bytes, PATTERN4, bytes_per_packet); + } + else if (id == 5) + { + memset(cached_patterns[num_cached_files].bytes, PATTERN5, bytes_per_packet); + } + else if (id == 6) + { + memset(cached_patterns[num_cached_files].bytes, PATTERN6, bytes_per_packet); + } + + cached_patterns[num_cached_files].filesize = bytes_per_packet; + cached_patterns[num_cached_files].id = id; + + return num_cached_files++; /* one new cached pattern */ + } + else + { + /* cached file entries are stored in a dynamically grown array. */ + /* could use a binary (or avl) tree but number of files should */ + /* be small and doesn't really justify the effort. */ + while (count < num_cached_files) { + if (!strcmp(cached_files[count].filename, filename)) { + /* found the file already loaded. just return index */ + return count; + } + count++; + } + + /* Allocate memory and load file */ + if (stat(filename, &statbuffer)) { + /* could not get file information */ + return -1; + } + f = fopen(filename, "rb"); + if (!f) { + /* could not open file */ + return -1; + } + + filecontents = (char *)malloc(statbuffer.st_size); + if (!filecontents) { + /* could not alloc mem */ + return -1; + } + if (!fread(filecontents, statbuffer.st_size, 1, f)) { + /* could not read file */ free(filecontents); return -1; } - cached_files = newcachelist; + fclose(f); + + if (!(num_cached_files%RTPSTREAM_FILESPERBLOCK)) { + /* Time to allocate more memory for the next block of files */ + newfilecachelist = (cached_file_t*) realloc(cached_files, sizeof(*cached_files) * (num_cached_files + RTPSTREAM_FILESPERBLOCK)); + if (!newfilecachelist) { + /* out of memory */ + free(filecontents); + return -1; + } + cached_files = newfilecachelist; + } + cached_files[num_cached_files].bytes = filecontents; + strncpy(cached_files[num_cached_files].filename, filename, sizeof(cached_files[num_cached_files].filename) - 1); + cached_files[num_cached_files].filesize = statbuffer.st_size; + return num_cached_files++; + } +} + +static int rtpstream_setsocketoptions(int sock) +{ + /* set socket non-blocking */ + int flags = fcntl(sock, F_GETFL, 0); + if (fcntl(sock, F_SETFL, flags | O_NONBLOCK) == -1) { + return 0; + } + + /* set buffer size */ + unsigned int buffsize = rtp_buffsize; + + /* Increase buffer sizes for this sockets */ + if(setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char*)&buffsize, sizeof(buffsize))) { + return 0; + } + if(setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char*)&buffsize, sizeof(buffsize))) { + return 0; + } + + return 1; /* success */ +} + +/* code checked */ +static int rtpstream_get_localport(int* rtpsocket, int* rtcpsocket) +{ + int port_number; + int tries; + struct sockaddr_storage address; + + debugprint("rtpstream_get_localport\n"); + + if (user_media_port) { + next_rtp_port = user_media_port; + } else { + next_rtp_port = DEFAULT_MEDIA_PORT; + } + + /* initialise address family and IP address for media socket */ + memset(&address, 0, sizeof(address)); + address.ss_family = media_ip_is_ipv6?AF_INET6:AF_INET; + if ((media_ip_is_ipv6? + inet_pton(AF_INET6, media_ip, &((_RCAST(struct sockaddr_in6 *, &address))->sin6_addr)): + inet_pton(AF_INET, media_ip, &((_RCAST(struct sockaddr_in *, &address))->sin_addr))) != 1) { + WARNING("Could not set up media IP for RTP streaming"); + return 0; + } + + /* create new UDP listen socket */ + *rtpsocket = socket(media_ip_is_ipv6?PF_INET6:PF_INET, SOCK_DGRAM, 0); + if (*rtpsocket == -1) { + WARNING("Could not open socket for RTP streaming: %s", strerror(errno)); + return 0; + } + + for (tries = 0; tries < BIND_MAX_TRIES; tries++) { + /* try a sequence of port numbers until we find one where we can bind */ + /* should normally be the first port we try, unless we have long-running */ + /* calls or somebody else is nicking ports. */ + + port_number = next_rtp_port; + /* skip rtp ports in multples of 2 (allow for rtp plus rtcp) */ + next_rtp_port += 2; + if (next_rtp_port>(max_rtp_port - 1)) { + next_rtp_port = user_media_port; + } + + sockaddr_update_port(&address, port_number); + if (::bind(*rtpsocket, (sockaddr *) (void *)&address, + sizeof(address)) == 0) { + break; + } + } + /* Exit here if we didn't get a suitable port for rtp stream */ + if (tries == BIND_MAX_TRIES) { + close(*rtpsocket); + *rtpsocket = -1; + WARNING("Could not bind port for RTP streaming after %d tries", tries); + return 0; + } + + if (!rtpstream_setsocketoptions(*rtpsocket)) { + close(*rtpsocket); + *rtpsocket = -1; + WARNING("Could not set socket options for RTP streaming"); + return 0; + } + + /* create socket for rtcp - ignore any errors */ + *rtcpsocket = socket(media_ip_is_ipv6?PF_INET6:PF_INET, SOCK_DGRAM, 0); + if (*rtcpsocket != -1) { + /* try to bind it to our preferred address */ + sockaddr_update_port(&address, port_number + 1); + if (::bind(*rtcpsocket, (sockaddr *) (void *)&address, + sizeof(address)) == 0) { + /* could not bind the rtcp socket to required port. so we delete it */ + close(*rtcpsocket); + *rtcpsocket = -1; + } + if (!rtpstream_setsocketoptions(*rtcpsocket)) { + close(*rtcpsocket); + *rtcpsocket = -1; + } + } + + return port_number; +} + +/* code checked */ +int rtpstream_get_local_audioport(rtpstream_callinfo_t* callinfo) +{ + debugprint("rtpstream_get_local_audioport callinfo=%p", callinfo); + + int rtp_socket; + int rtcp_socket; + + if (!callinfo->taskinfo) { + return 0; + } + + if (callinfo->local_audioport) { + /* already a port assigned to this call */ + debugprint(" ==> %d\n", callinfo->local_audioport); + return callinfo->local_audioport; + } + + callinfo->local_audioport = rtpstream_get_localport(&rtp_socket, &rtcp_socket); + + debugprint(" ==> %d\n", callinfo->local_audioport); + + /* assign rtp and rtcp sockets to callinfo. must assign rtcp socket first */ + callinfo->taskinfo->audio_rtcp_socket = rtcp_socket; + callinfo->taskinfo->audio_rtp_socket = rtp_socket; + + /* start playback task if not already started */ + if (!callinfo->taskinfo->parent_thread) { + if (!rtpstream_start_task(callinfo)) { + /* error starting playback task */ + return 0; + } + } + + /* make sure the new socket gets bound to destination address (if any) */ + callinfo->taskinfo->flags |= TI_RECONNECTSOCKET; + + return callinfo->local_audioport; +} + +/* code checked */ +int rtpstream_get_local_videoport(rtpstream_callinfo_t* callinfo) +{ + debugprint("rtpstream_get_local_videoport callinfo=%p", callinfo); + + int rtp_socket; + int rtcp_socket; + + if (!callinfo->taskinfo) { + return 0; + } + + if (callinfo->local_videoport) { + /* already a port assigned to this call */ + debugprint(" ==> %d\n", callinfo->local_videoport); + return callinfo->local_videoport; + } + + callinfo->local_videoport = rtpstream_get_localport(&rtp_socket, &rtcp_socket); + + debugprint(" ==> %d\n", callinfo->local_videoport); + + /* assign rtp and rtcp sockets to callinfo. must assign rtcp socket first */ + callinfo->taskinfo->video_rtcp_socket = rtcp_socket; + callinfo->taskinfo->video_rtp_socket = rtp_socket; + + /* start playback task if not already started */ + if (!callinfo->taskinfo->parent_thread) { + if (!rtpstream_start_task(callinfo)) { + /* error starting playback task */ + return 0; + } } - cached_files[num_cached_files].bytes = filecontents; - strncpy(cached_files[num_cached_files].filename, filename, - sizeof(cached_files[num_cached_files].filename) - 1); - cached_files[num_cached_files].filesize = statbuffer.st_size; - return num_cached_files++; + + /* make sure the new socket gets bound to destination address (if any) */ + callinfo->taskinfo->flags |= TI_RECONNECTSOCKET; + + return callinfo->local_videoport; } /* code checked */ @@ -594,8 +1981,6 @@ void rtpstream_set_remote(rtpstream_callinfo_t* callinfo, int ip_ver, const char unsigned count; int nonzero_ip; - /* observe that we rely on ip_ver being in sync with media_ip_is_ipv6 */ - /* we never alloc a socket here, we reuse the global media socket */ debugprint("rtpstream_set_remote callinfo=%p, ip_ver %d ip_addr %s audio %d video %d\n", callinfo, ip_ver, ip_addr, audio_port, video_port); @@ -648,117 +2033,1492 @@ void rtpstream_set_remote(rtpstream_callinfo_t* callinfo, int ip_ver, const char /* clear out existing addresses */ memset(&(taskinfo->remote_audio_rtp_addr), 0, sizeof(taskinfo->remote_audio_rtp_addr)); + memset(&(taskinfo->remote_audio_rtcp_addr), 0, sizeof(taskinfo->remote_audio_rtcp_addr)); + memset(&(taskinfo->remote_video_rtp_addr), 0, sizeof(taskinfo->remote_video_rtp_addr)); + memset(&(taskinfo->remote_video_rtcp_addr), 0, sizeof(taskinfo->remote_video_rtcp_addr)); /* Audio */ if (audio_port) { + // store remote audio port for later reference + callinfo->remote_audioport = audio_port; sockaddr_update_port(&address, audio_port); memcpy(&(taskinfo->remote_audio_rtp_addr), &address, sizeof(address)); + + sockaddr_update_port(&address, audio_port + 1); + memcpy(&(taskinfo->remote_audio_rtcp_addr), &address, sizeof(address)); + taskinfo->flags &= ~TI_NULL_AUDIOIP; } + /* Video */ + if (video_port) { + // store remote video port for later reference + callinfo->remote_videoport = video_port; + sockaddr_update_port(&address, video_port); + memcpy(&(taskinfo->remote_video_rtp_addr), &address, sizeof(address)); + + sockaddr_update_port(&address, video_port + 1); + memcpy(&(taskinfo->remote_video_rtcp_addr), &address, sizeof(address)); + + taskinfo->flags &= ~TI_NULL_VIDEOIP; + } + /* ok, we are done with the shared memory objects. let go mutex */ - pthread_mutex_unlock (&(taskinfo->mutex)); + pthread_mutex_unlock(&(taskinfo->mutex)); + + taskinfo->flags |= TI_RECONNECTSOCKET; /* may want to start a playback (listen) task here if no task running? */ /* only makes sense if we decide to send 0-filled packets on idle */ } -/* code checked */ -void rtpstream_play(rtpstream_callinfo_t* callinfo, rtpstream_actinfo_t* actioninfo) +#ifdef USE_OPENSSL +int rtpstream_set_srtp_audio_local(rtpstream_callinfo_t* callinfo, SrtpAudioInfoParams &p) { - debugprint("rtpstream_play callinfo=%p filename %s loop %d bytes %d payload %d ptime %d tick %d\n", callinfo, actioninfo->filename, actioninfo->loop_count, actioninfo->bytes_per_packet, actioninfo->payload_type, actioninfo->ms_per_packet, actioninfo->ticks_per_packet); - - int file_index = rtpstream_cache_file(actioninfo->filename); - taskentry_t *taskinfo = callinfo->taskinfo; + taskentry_t *taskinfo; - if (file_index < 0) { - return; /* cannot find file to play */ + taskinfo = callinfo->taskinfo; + if (!taskinfo) { + /* no task info found - cannot set remote data. just return */ + return -1; } - if (!taskinfo) { - return; /* no task data structure */ + if (srtpcheck_debug) + { + if (debuglsrtpafile == NULL) + { + if (sendMode == MODE_CLIENT) + { + debuglsrtpafile = fopen("debuglsrtpafile_uac", "w"); + } + else if (sendMode == MODE_SERVER) + { + debuglsrtpafile = fopen("debuglsrtpafile_uas", "w"); + } + if (debuglsrtpafile == NULL) + { + /* error encountered opening local srtp debug file */ + return -1; + } + } } - /* make sure we have an open socket from which to play the audio file */ - taskinfo->audio_rtp_socket = media_socket_audio; + printLocalAudioSrtpStuff(p); - /* start playback task if not already started */ - if (!taskinfo->parent_thread) { - if (!rtpstream_start_task(callinfo)) { - /* error starting playback task */ - return; - } + /* enter critical section to lock address updates */ + /* may want to leave this out -- low chance of race condition */ + pthread_mutex_lock(&(taskinfo->mutex)); + + /* clear out existing addresses */ + memset(&(taskinfo->local_srtp_audio_params), 0, sizeof(taskinfo->local_srtp_audio_params)); + + /* Audio */ + if (p.audio_found) { + taskinfo->local_srtp_audio_params.audio_found = true; + taskinfo->local_srtp_audio_params.primary_audio_cryptotag = p.primary_audio_cryptotag; + taskinfo->local_srtp_audio_params.secondary_audio_cryptotag = p.secondary_audio_cryptotag; + strncpy(taskinfo->local_srtp_audio_params.primary_audio_cryptosuite, p.primary_audio_cryptosuite, 23); + strncpy(taskinfo->local_srtp_audio_params.secondary_audio_cryptosuite, p.secondary_audio_cryptosuite, 23); + strncpy(taskinfo->local_srtp_audio_params.primary_audio_cryptokeyparams, p.primary_audio_cryptokeyparams, 40); + strncpy(taskinfo->local_srtp_audio_params.secondary_audio_cryptokeyparams, p.secondary_audio_cryptokeyparams, 40); + taskinfo->local_srtp_audio_params.primary_unencrypted_audio_srtp = p.primary_unencrypted_audio_srtp; + taskinfo->local_srtp_audio_params.secondary_unencrypted_audio_srtp = p.secondary_unencrypted_audio_srtp; } - /* save file parameter in taskinfo structure */ - taskinfo->new_loop_count = actioninfo->loop_count; - taskinfo->new_bytes_per_packet = actioninfo->bytes_per_packet; - taskinfo->new_file_size = cached_files[file_index].filesize; - taskinfo->new_file_bytes = cached_files[file_index].bytes; - taskinfo->new_ms_per_packet = actioninfo->ms_per_packet; - taskinfo->new_timeticks_per_packet = actioninfo->ticks_per_packet; - taskinfo->new_payload_type = actioninfo->payload_type; + /* ok, we are done with the shared memory objects. let go mutex */ + pthread_mutex_unlock(&(taskinfo->mutex)); + + if (srtpcheck_debug) + { + if (debuglsrtpafile) + { + fclose(debuglsrtpafile); + debuglsrtpafile = NULL; + } + } - /* set flag that we have a new file to play */ - taskinfo->flags |= TI_PLAYFILE; + return 0; } -/* code checked */ -void rtpstream_pause(rtpstream_callinfo_t* callinfo) +int rtpstream_set_srtp_audio_remote(rtpstream_callinfo_t* callinfo, SrtpAudioInfoParams &p) { - debugprint("rtpstream_pause callinfo=%p\n", callinfo); + taskentry_t *taskinfo; - if (callinfo->taskinfo) { - callinfo->taskinfo->flags |= TI_PAUSERTP; + taskinfo = callinfo->taskinfo; + if (!taskinfo) { + /* no task info found - cannot set remote data. just return */ + return -1; } -} -/* code checked */ -void rtpstream_resume(rtpstream_callinfo_t* callinfo) -{ - debugprint("rtpstream_resume callinfo=%p\n", callinfo); + if (srtpcheck_debug) + { + if (debugrsrtpafile == NULL) + { + if (sendMode == MODE_CLIENT) + { + debugrsrtpafile = fopen("debugrsrtpafile_uac", "w"); + } + else if (sendMode == MODE_SERVER) + { + debugrsrtpafile = fopen("debugrsrtpafile_uas", "w"); + } + if (debugrsrtpafile == NULL) + { + /* error encountered opening local srtp debug file */ + return -1; + } + } + } - if (callinfo->taskinfo) { - callinfo->taskinfo->flags &= ~TI_PAUSERTP; + printRemoteAudioSrtpStuff(p); + + /* enter critical section to lock address updates */ + /* may want to leave this out -- low chance of race condition */ + pthread_mutex_lock(&(taskinfo->mutex)); + + /* clear out existing addresses */ + memset(&(taskinfo->remote_srtp_audio_params), 0, sizeof(taskinfo->remote_srtp_audio_params)); + + /* Audio */ + if (p.audio_found) { + taskinfo->remote_srtp_audio_params.audio_found = true; + taskinfo->remote_srtp_audio_params.primary_audio_cryptotag = p.primary_audio_cryptotag; + taskinfo->remote_srtp_audio_params.secondary_audio_cryptotag = p.secondary_audio_cryptotag; + strncpy(taskinfo->remote_srtp_audio_params.primary_audio_cryptosuite, p.primary_audio_cryptosuite, 23); + strncpy(taskinfo->remote_srtp_audio_params.secondary_audio_cryptosuite, p.secondary_audio_cryptosuite, 23); + strncpy(taskinfo->remote_srtp_audio_params.primary_audio_cryptokeyparams, p.primary_audio_cryptokeyparams, 40); + strncpy(taskinfo->remote_srtp_audio_params.secondary_audio_cryptokeyparams, p.secondary_audio_cryptokeyparams, 40); + taskinfo->remote_srtp_audio_params.primary_unencrypted_audio_srtp = p.primary_unencrypted_audio_srtp; + taskinfo->remote_srtp_audio_params.secondary_unencrypted_audio_srtp = p.secondary_unencrypted_audio_srtp; + } + + /* ok, we are done with the shared memory objects. let go mutex */ + pthread_mutex_unlock(&(taskinfo->mutex)); + + if (srtpcheck_debug) + { + if (debugrsrtpafile) + { + fclose(debugrsrtpafile); + debugrsrtpafile = NULL; + } } + + return 0; } -/* code checked */ -void rtpstream_shutdown(void) +int rtpstream_set_srtp_video_local(rtpstream_callinfo_t* callinfo, SrtpVideoInfoParams &p) { - int count = 0; + taskentry_t *taskinfo; - debugprint("rtpstream_shutdown\n"); + taskinfo = callinfo->taskinfo; + if (!taskinfo) { + /* no task info found - cannot set remote data. just return */ + return -1; + } - /* signal all playback threads that they should exit */ - if (ready_threads) { - for (count = 0; count < num_ready_threads; count++) { - ready_threads[count]->exit_flag = 1; + if (srtpcheck_debug) + { + if (debuglsrtpvfile == NULL) + { + if (sendMode == MODE_CLIENT) + { + debuglsrtpvfile = fopen("debuglsrtpvfile_uac", "w"); + } + else if (sendMode == MODE_SERVER) + { + debuglsrtpvfile = fopen("debuglsrtpvfile_uas", "w"); + } + if (debuglsrtpvfile == NULL) + { + /* error encountered opening local srtp debug file */ + return -1; + } } - free(ready_threads); - ready_threads = NULL; } - if (busy_threads) { - for (count = 0; count < num_busy_threads; count++) { - busy_threads[count]->exit_flag = 1; - } - free(busy_threads); - busy_threads = NULL; + printLocalVideoSrtpStuff(p); + + /* enter critical section to lock address updates */ + /* may want to leave this out -- low chance of race condition */ + pthread_mutex_lock(&(taskinfo->mutex)); + + /* clear out existing addresses */ + memset(&(taskinfo->local_srtp_video_params), 0, sizeof(taskinfo->local_srtp_video_params)); + + /* Video */ + if (p.video_found) { + taskinfo->local_srtp_video_params.video_found = true; + taskinfo->local_srtp_video_params.primary_video_cryptotag = p.primary_video_cryptotag; + taskinfo->local_srtp_video_params.secondary_video_cryptotag = p.secondary_video_cryptotag; + strncpy(taskinfo->local_srtp_video_params.primary_video_cryptosuite, p.primary_video_cryptosuite, 23); + strncpy(taskinfo->local_srtp_video_params.secondary_video_cryptosuite, p.secondary_video_cryptosuite, 23); + strncpy(taskinfo->local_srtp_video_params.primary_video_cryptokeyparams, p.primary_video_cryptokeyparams, 40); + strncpy(taskinfo->local_srtp_video_params.secondary_video_cryptokeyparams, p.secondary_video_cryptokeyparams, 40); + taskinfo->local_srtp_video_params.primary_unencrypted_video_srtp = p.primary_unencrypted_video_srtp; + taskinfo->local_srtp_video_params.secondary_unencrypted_video_srtp = p.secondary_unencrypted_video_srtp; } - /* first make sure no playback threads are accessing the file buffers */ - /* else small chance the playback thread tries to access freed memory */ - while (rtpstream_numthreads) { - usleep(50000); + /* ok, we are done with the shared memory objects. let go mutex */ + pthread_mutex_unlock(&(taskinfo->mutex)); + + if (srtpcheck_debug) + { + if (debuglsrtpvfile) + { + fclose(debuglsrtpvfile); + debuglsrtpvfile = NULL; + } } - /* now free cached file bytes and structure */ - for (count = 0; count < num_cached_files; count++) { - free(cached_files[count].bytes); + return 0; +} + +int rtpstream_set_srtp_video_remote(rtpstream_callinfo_t* callinfo, SrtpVideoInfoParams &p) +{ + taskentry_t *taskinfo; + + taskinfo = callinfo->taskinfo; + if (!taskinfo) { + /* no task info found - cannot set remote data. just return */ + return -1; } - if (cached_files) { - free(cached_files); - cached_files = NULL; + + if (srtpcheck_debug) + { + if (debugrsrtpvfile == NULL) + { + if (sendMode == MODE_CLIENT) + { + debugrsrtpvfile = fopen("debugrsrtpvfile_uac", "w"); + } + else if (sendMode == MODE_SERVER) + { + debugrsrtpvfile = fopen("debugrsrtpvfile_uas", "w"); + } + if (debugrsrtpvfile == NULL) + { + /* error encountered opening local srtp debug file */ + return -1; + } + } } + + printRemoteVideoSrtpStuff(p); + + /* enter critical section to lock address updates */ + /* may want to leave this out -- low chance of race condition */ + pthread_mutex_lock(&(taskinfo->mutex)); + + /* clear out existing addresses */ + memset(&(taskinfo->remote_srtp_video_params), 0, sizeof(taskinfo->remote_srtp_video_params)); + + /* Video */ + if (p.video_found) { + taskinfo->remote_srtp_video_params.video_found = true; + taskinfo->remote_srtp_video_params.primary_video_cryptotag = p.primary_video_cryptotag; + taskinfo->remote_srtp_video_params.secondary_video_cryptotag = p.secondary_video_cryptotag; + strncpy(taskinfo->remote_srtp_video_params.primary_video_cryptosuite, p.primary_video_cryptosuite, 23); + strncpy(taskinfo->remote_srtp_video_params.secondary_video_cryptosuite, p.secondary_video_cryptosuite, 23); + strncpy(taskinfo->remote_srtp_video_params.primary_video_cryptokeyparams, p.primary_video_cryptokeyparams, 40); + strncpy(taskinfo->remote_srtp_video_params.secondary_video_cryptokeyparams, p.secondary_video_cryptokeyparams, 40); + taskinfo->remote_srtp_video_params.primary_unencrypted_video_srtp = p.primary_unencrypted_video_srtp; + taskinfo->remote_srtp_video_params.secondary_unencrypted_video_srtp = p.secondary_unencrypted_video_srtp; + } + + /* ok, we are done with the shared memory objects. let go mutex */ + pthread_mutex_unlock(&(taskinfo->mutex)); + + if (srtpcheck_debug) + { + if (debugrsrtpvfile) + { + fclose(debugrsrtpvfile); + debugrsrtpvfile = NULL; + } + } + + return 0; +} +#endif // USE_OPENSSL + +/* code checked */ +void rtpstream_play(rtpstream_callinfo_t* callinfo, rtpstream_actinfo_t* actioninfo) +{ + debugprint("rtpstream_play callinfo=%p filename %s pattern_id %d loop %d bytes %d payload %d ptime %d tick %d\n", + callinfo, + actioninfo->filename, + actioninfo->pattern_id, + actioninfo->loop_count, + actioninfo->bytes_per_packet, + actioninfo->payload_type, + actioninfo->ms_per_packet, + actioninfo->ticks_per_packet); + + int file_index = rtpstream_cache_file(actioninfo->filename, + 0 /* FILE MODE */, + actioninfo->pattern_id, + actioninfo->bytes_per_packet, + 0 /* AUDIO */); + taskentry_t *taskinfo = callinfo->taskinfo; + + if (file_index < 0) { + return; /* cannot find file to play */ + } + + if (!taskinfo) { + return; /* no task data structure */ + } + + /* make sure we have an open socket from which to play the audio file */ + rtpstream_get_local_audioport(callinfo); + + /* save file parameter in taskinfo structure */ + taskinfo->new_audio_pattern_id = actioninfo->pattern_id; + taskinfo->new_audio_loop_count = actioninfo->loop_count; + taskinfo->new_audio_bytes_per_packet = actioninfo->bytes_per_packet; + taskinfo->new_audio_file_size = cached_files[file_index].filesize; + taskinfo->new_audio_file_bytes = cached_files[file_index].bytes; + taskinfo->new_audio_ms_per_packet = actioninfo->ms_per_packet; + taskinfo->new_audio_timeticks_per_packet = actioninfo->ticks_per_packet; + taskinfo->new_audio_payload_type = actioninfo->payload_type; + taskinfo->audio_active = actioninfo->audio_active; + taskinfo->video_active = actioninfo->video_active; + + /* set flag that we have a new file to play */ + taskinfo->flags |= TI_PLAYFILE; +} + +/* code checked */ +void rtpstream_pause(rtpstream_callinfo_t* callinfo) +{ + debugprint("rtpstream_pause callinfo=%p\n", callinfo); + + if (callinfo->taskinfo) { + callinfo->taskinfo->flags |= TI_PAUSERTP; + } +} + +/* code checked */ +void rtpstream_resume(rtpstream_callinfo_t* callinfo) +{ + debugprint("rtpstream_resume callinfo=%p\n", callinfo); + + if (callinfo->taskinfo) { + callinfo->taskinfo->flags &= ~TI_PAUSERTP; + } +} + +void rtpstream_playapattern(rtpstream_callinfo_t* callinfo, rtpstream_actinfo_t* actioninfo, JLSRTP& txUACAudio, JLSRTP& rxUACAudio) +{ + debugprint("rtpstream_playapattern callinfo=%p filename %s pattern_id %d loop %d bytes %d payload %d ptime %d tick %d\n", + callinfo, + actioninfo->filename, + actioninfo->pattern_id, + actioninfo->loop_count, + actioninfo->bytes_per_packet, + actioninfo->payload_type, + actioninfo->ms_per_packet, + actioninfo->ticks_per_packet); + + int file_index = rtpstream_cache_file(actioninfo->filename, + 1 /* PATTERN MODE */, + actioninfo->pattern_id, + actioninfo->bytes_per_packet, + 0 /* AUDIO */); + taskentry_t *taskinfo = callinfo->taskinfo; + + if (file_index < 0) + { + return; /* ERROR encountered */ + } + + if (!taskinfo) + { + return; /* no task data structure */ + } + + /* make sure we have an open socket from which to play the audio file */ + rtpstream_get_local_audioport(callinfo); + + /* save file parameter in taskinfo structure */ + taskinfo->new_audio_pattern_id = actioninfo->pattern_id; + taskinfo->new_audio_payload_type = actioninfo->payload_type; + taskinfo->new_audio_loop_count = actioninfo->loop_count; + + taskinfo->new_audio_file_size = cached_patterns[file_index].filesize; + taskinfo->new_audio_file_bytes = cached_patterns[file_index].bytes; + + taskinfo->new_audio_ms_per_packet = actioninfo->ms_per_packet; + taskinfo->new_audio_bytes_per_packet = actioninfo->bytes_per_packet; + taskinfo->new_audio_timeticks_per_packet = actioninfo->ticks_per_packet; + taskinfo->audio_comparison_errors = 0; + taskinfo->audio_active = actioninfo->audio_active; + taskinfo->video_active = actioninfo->video_active; + + /* set flag that we have a new file to play */ + taskinfo->flags |= TI_PLAYAPATTERN; + +#ifdef USE_OPENSSL + pthread_mutex_lock(&uacAudioMutex); + g_txUACAudio = txUACAudio; + g_rxUACAudio = rxUACAudio; + pthread_mutex_unlock(&uacAudioMutex); +#endif // USE_OPENSSL +} + +void rtpstream_pauseapattern(rtpstream_callinfo_t* callinfo) +{ + debugprint("rtpstream_pauseapattern callinfo=%p\n", callinfo); + + if (callinfo->taskinfo) { + callinfo->taskinfo->flags |= TI_PAUSERTPAPATTERN; + } +} + +void rtpstream_resumeapattern(rtpstream_callinfo_t* callinfo) +{ + debugprint("rtpstream_resumeapattern callinfo=%p\n", callinfo); + + if (callinfo->taskinfo) { + callinfo->taskinfo->flags &= ~TI_PAUSERTPAPATTERN; + } +} + +void rtpstream_playvpattern(rtpstream_callinfo_t* callinfo, rtpstream_actinfo_t* actioninfo, JLSRTP& txUACVideo, JLSRTP& rxUACVideo) +{ + debugprint("rtpstream_playvpattern callinfo=%p filename %s pattern_id %d loop %d bytes %d payload %d ptime %d tick %d\n", + callinfo, + actioninfo->filename, + actioninfo->pattern_id, + actioninfo->loop_count, + actioninfo->bytes_per_packet, + actioninfo->payload_type, + actioninfo->ms_per_packet, + actioninfo->ticks_per_packet); + + int file_index = rtpstream_cache_file(actioninfo->filename, + 1 /* PATTERN MODE */, + actioninfo->pattern_id, + actioninfo->bytes_per_packet, + 1 /* VIDEO */); + taskentry_t *taskinfo = callinfo->taskinfo; + + if (file_index < 0) + { + return; /* ERROR encountered */ + } + + if (!taskinfo) + { + return; /* no task data structure */ + } + + /* make sure we have an open socket from which to play the video file */ + rtpstream_get_local_videoport(callinfo); + + /* save file parameter in taskinfo structure */ + taskinfo->new_video_pattern_id = actioninfo->pattern_id; + taskinfo->new_video_payload_type = actioninfo->payload_type; + taskinfo->new_video_loop_count = actioninfo->loop_count; + + taskinfo->new_video_file_size = cached_patterns[file_index].filesize; + taskinfo->new_video_file_bytes = cached_patterns[file_index].bytes; + + taskinfo->new_video_ms_per_packet = actioninfo->ms_per_packet; + taskinfo->new_video_bytes_per_packet = actioninfo->bytes_per_packet; + taskinfo->new_video_timeticks_per_packet = actioninfo->ticks_per_packet; + taskinfo->video_comparison_errors = 0; + taskinfo->audio_active = actioninfo->audio_active; + taskinfo->video_active = actioninfo->video_active; + + /* set flag that we have a new file to play */ + taskinfo->flags |= TI_PLAYVPATTERN; + +#ifdef USE_OPENSSL + pthread_mutex_lock(&uacVideoMutex); + g_txUACVideo = txUACVideo; + g_rxUACVideo = rxUACVideo; + pthread_mutex_unlock(&uacVideoMutex); +#endif // USE_OPENSSL +} + +void rtpstream_pausevpattern(rtpstream_callinfo_t* callinfo) +{ + debugprint("rtpstream_pausevpattern callinfo=%p\n", callinfo); + + if (callinfo->taskinfo) { + callinfo->taskinfo->flags |= TI_PAUSERTPVPATTERN; + } +} + +void rtpstream_resumevpattern(rtpstream_callinfo_t* callinfo) +{ + debugprint("rtpstream_resumevpattern callinfo=%p\n", callinfo); + + if (callinfo->taskinfo) { + callinfo->taskinfo->flags &= ~TI_PAUSERTPVPATTERN; + } +} + +void rtpstream_audioecho_thread(void* param) +{ + unsigned char msg[media_bufsize]; + ssize_t nr; + ssize_t ns; + sipp_socklen_t len; + struct sockaddr_storage remote_rtp_addr; + sigset_t mask; + int rc = 0; + int exit_code = 0; + struct timespec tspec; + int sock = 0; + int flags; + std::vector rtp_header; + std::vector payload_data; + std::vector audio_packet_in; + std::vector audio_packet_out; + unsigned short audio_seq = 0; + unsigned short seq_num = 0; + unsigned short host_flags = 0; + unsigned short host_seqnum = 0; + unsigned int host_timestamp = 0; + unsigned int host_ssrc = 0; + unsigned short network_flags = 0; + unsigned short network_seqnum = 0; + unsigned int network_timestamp = 0; + unsigned int network_ssrc = 0; + bool abnormal_termination = false; + ParamPass p; + +#ifdef USE_OPENSSL + tspec.tv_sec = 0; + tspec.tv_nsec = 10000000; /* 10ms */ + + p.p = param; + + if (param != NULL) + { + sock = p.i; + } + + if ((flags = fcntl(sock, F_GETFL, 0)) < 0) + { + pthread_mutex_lock(&debugremutexaudio); + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "rtp_audioecho_thread(): fcntl() GETFL UNBLOCK failed...\n"); + } + pthread_mutex_unlock(&debugremutexaudio); + pthread_exit((void*) 1); + } + + if (fcntl(sock, F_SETFL, flags | O_NONBLOCK) < 0) + { + pthread_mutex_lock(&debugremutexaudio); + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "rtp_audioecho_thread(): fcntl() SETFL UNBLOCK failed...\n"); + } + pthread_mutex_unlock(&debugremutexaudio); + pthread_exit((void*) 2); + } + + sigfillset(&mask); /* Mask all allowed signals */ + rc = pthread_sigmask(SIG_BLOCK, &mask, NULL); + if (rc) { + //WARNING("pthread_sigmask returned %d in rtpstream_echo_thread", rc); + pthread_mutex_lock(&debugremutexaudio); + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "pthread_sigmask returned %d in rtpstream_audioecho_thread", rc); + } + pthread_mutex_unlock(&debugremutexaudio); + pthread_exit((void*) 3); + } + + pthread_mutex_lock(&quit_mutexaudio); + while (!quit_audioecho_thread) + { + rc = pthread_cond_timedwait(&quit_cvaudio, &quit_mutexaudio, &tspec); + if ((rc == ETIMEDOUT) && + !quit_audioecho_thread) + { + pthread_mutex_lock(&uasAudioMutex); + nr = 0; + memset(msg, 0, sizeof(msg)); + len = sizeof(remote_rtp_addr); + audio_packet_in.resize(sizeof(rtp_header_t) + g_rxUASAudio.getSrtpPayloadSize() + g_rxUASAudio.getAuthenticationTagSize(), 0); + nr = recvfrom(sock, audio_packet_in.data(), audio_packet_in.size(), MSG_DONTWAIT /* NON-BLOCKING */, (sockaddr *) (void *) &remote_rtp_addr, &len); + + if (nr >= 0) { + // Good to go -- buffer should contain "nr" bytes + seq_num = 0; + seq_num = (audio_packet_in[2] << 8) | audio_packet_in[3]; + + pthread_mutex_lock(&debugremutexaudio); + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "DATA SUCCESSFULLY RECEIVED [AUDIO] nr = %ld...", nr); + } + for (int i = 0; i < 12; i++) + { + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "%02X", 0xFFFFFFFF & audio_packet_in[i]); + } + } + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "\n"); + } + pthread_mutex_unlock(&debugremutexaudio); + + if (g_rxUASAudio.getCryptoTag() != 0) + { + rtp_header.clear(); + payload_data.clear(); + + // DECRYPT + rc = g_rxUASAudio.processIncomingPacket(audio_seq, audio_packet_in, rtp_header, payload_data); + pthread_mutex_lock(&debugremutexaudio); + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "RXUASAUDIO -- processIncomingPacket() rc == %d\n", rc); + } + pthread_mutex_unlock(&debugremutexaudio); + + host_flags = ntohs(((rtp_header_t*)audio_packet_in.data())->flags); + host_seqnum = ntohs(((rtp_header_t*)audio_packet_in.data())->seq); + host_timestamp = ntohl(((rtp_header_t*)audio_packet_in.data())->timestamp); + host_ssrc = ntohl(((rtp_header_t*)audio_packet_in.data())->ssrc_id); + + audio_packet_in[0] = (host_flags >> 8) & 0xFF; + audio_packet_in[1] = host_flags & 0xFF; + audio_packet_in[2] = (host_seqnum >> 8) & 0xFF; + audio_packet_in[3] = host_seqnum & 0xFF; + audio_packet_in[4] = (host_timestamp >> 24) & 0xFF; + audio_packet_in[5] = (host_timestamp >> 16) & 0xFF; + audio_packet_in[6] = (host_timestamp >> 8) & 0xFF; + audio_packet_in[7] = host_timestamp & 0xFF; + audio_packet_in[8] = (host_ssrc >> 24) & 0xFF; + audio_packet_in[9] = (host_ssrc >> 16) & 0xFF; + audio_packet_in[10] = (host_ssrc >> 8) & 0xFF; + audio_packet_in[11] = host_ssrc & 0xFF; + + memset(msg, 0, sizeof(msg)); + memcpy(msg, rtp_header.data(), rtp_header.size()); + memcpy(msg + sizeof(rtp_header_t), payload_data.data(), payload_data.size()); + } + + if (g_txUASAudio.getCryptoTag() != 0) + { + audio_packet_out.clear(); + + // GRAB RTP HEADER + rtp_header.resize(sizeof(rtp_header_t), 0); + memcpy(rtp_header.data(), msg, sizeof(rtp_header_t) /*12*/); + // GRAB RTP PAYLOAD DATA + payload_data.resize(g_txUASAudio.getSrtpPayloadSize(), 0); + memcpy(payload_data.data(), msg + sizeof(rtp_header_t), g_txUASAudio.getSrtpPayloadSize()); + + // ENCRYPT + rc = g_txUASAudio.processOutgoingPacket(audio_seq, rtp_header, payload_data, audio_packet_out); + pthread_mutex_lock(&debugremutexaudio); + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "TXUASAUDIO -- processOutgoingPacket() rc == %d\n", rc); + } + pthread_mutex_unlock(&debugremutexaudio); + } + + ns = sendto(sock, audio_packet_out.data(), sizeof(rtp_header_t) + g_txUASAudio.getSrtpPayloadSize() + g_txUASAudio.getAuthenticationTagSize(), MSG_DONTWAIT, (sockaddr *) (void *) &remote_rtp_addr, len); + + if (ns != nr) { + pthread_mutex_lock(&debugremutexaudio); + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "DATA SUCCESSFULLY SENT [AUDIO] seq_num = [%u] -- MISMATCHED RECV/SENT BYTE COUNT -- errno = %d nr = %ld ns = %ld\n", seq_num, errno, nr, ns); + } + pthread_mutex_unlock(&debugremutexaudio); + } else { + pthread_mutex_lock(&debugremutexaudio); + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "DATA SUCCESSFULLY SENT [AUDIO] seq_num = [%u]...\n", seq_num); + } + pthread_mutex_unlock(&debugremutexaudio); + } + + rtp_pckts++; + rtp_bytes += ns; + audio_seq++; + } + else if ((nr < 0) && + (errno == EAGAIN)) { + // No data to be read (no activity on socket) + //pthread_mutex_lock(&debugremutexaudio); + //if (debugrefileaudio != NULL) + //{ + // fprintf(debugrefileaudio, "No activity on audioecho socket (EAGAIN)...\n"); + //} + //pthread_mutex_unlock(&debugremutexaudio); + } + else { + // Other error occurred during read + //WARNING("%s %i", "Error on RTP echo reception - stopping rtpstream echo - errno = ", errno); + pthread_mutex_lock(&debugremutexaudio); + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "Error on RTP echo reception - unable to perform rtpstream audioecho - errno = %d\n", errno); + } + pthread_mutex_unlock(&debugremutexaudio); + abnormal_termination = true; + } + pthread_mutex_unlock(&uasAudioMutex); + } + else + { + pthread_mutex_lock(&debugremutexaudio); + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "rtp_audioecho_thread(): pthread_cond_timedwait() non-timeout: rc: %d quit_audioecho_thread: %d\n", rc, quit_audioecho_thread); + } + pthread_mutex_unlock(&debugremutexaudio); + } + } + pthread_mutex_unlock(&quit_mutexaudio); + + if ((flags = fcntl(sock, F_GETFL, 0)) < 0) + { + pthread_mutex_lock(&debugremutexaudio); + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "rtp_audioecho_thread(): fcntl() GETFL BLOCK failed...\n"); + } + pthread_mutex_unlock(&debugremutexaudio); + pthread_exit((void*) 6); + } + + if (fcntl(sock, F_SETFL, flags & (~O_NONBLOCK)) < 0) + { + pthread_mutex_lock(&debugremutexaudio); + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "rtp_audioecho_thread(): fcntl() SETFL BLOCK failed...\n"); + } + pthread_mutex_unlock(&debugremutexaudio); + pthread_exit((void*) 7); + } + + if (abnormal_termination) + { + exit_code = -1; + } + else + { + exit_code = 0; + } +#else // !USE_OPENSSL + exit_code = 0; // dummy +#endif // USE_OPENSSL + + pthread_exit((void*) (intptr_t) exit_code); +} + +void rtpstream_videoecho_thread(void* param) +{ + unsigned char msg[media_bufsize]; + ssize_t nr; + ssize_t ns; + sipp_socklen_t len; + struct sockaddr_storage remote_rtp_addr; + sigset_t mask; + int rc = 0; + int exit_code = 0; + struct timespec tspec; + int sock = 0; + int flags; + std::vector rtp_header; + std::vector payload_data; + std::vector video_packet_in; + std::vector video_packet_out; + unsigned short video_seq = 0; + unsigned short seq_num = 0; + unsigned short host_flags = 0; + unsigned short host_seqnum = 0; + unsigned int host_timestamp = 0; + unsigned int host_ssrc = 0; + unsigned short network_flags = 0; + unsigned short network_seqnum = 0; + unsigned int network_timestamp = 0; + unsigned int network_ssrc = 0; + bool abnormal_termination = false; + ParamPass p; + +#ifdef USE_OPENSSL + tspec.tv_sec = 0; + tspec.tv_nsec = 10000000; /* 10ms */ + + p.p = param; + + if (param != NULL) + { + sock = p.i; + } + + if ((flags = fcntl(sock, F_GETFL, 0)) < 0) + { + pthread_mutex_lock(&debugremutexvideo); + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "rtp_videoecho_thread(): fcntl() GETFL UNBLOCK failed...\n"); + } + pthread_mutex_unlock(&debugremutexvideo); + pthread_exit((void*) 1); + } + + if (fcntl(sock, F_SETFL, flags | O_NONBLOCK) < 0) + { + pthread_mutex_lock(&debugremutexvideo); + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "rtp_videoecho_thread(): fcntl() SETFL UNBLOCK failed...\n"); + } + pthread_mutex_unlock(&debugremutexvideo); + pthread_exit((void*) 2); + } + + sigfillset(&mask); /* Mask all allowed signals */ + rc = pthread_sigmask(SIG_BLOCK, &mask, NULL); + if (rc) { + //WARNING("pthread_sigmask returned %d in rtpstream_echo_thread", rc); + pthread_mutex_lock(&debugremutexvideo); + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "pthread_sigmask returned %d in rtpstream_videoecho_thread", rc); + } + pthread_mutex_unlock(&debugremutexvideo); + pthread_exit((void*) 3); + } + + pthread_mutex_lock(&quit_mutexvideo); + while (!quit_videoecho_thread) + { + rc = pthread_cond_timedwait(&quit_cvvideo, &quit_mutexvideo, &tspec); + if ((rc == ETIMEDOUT) && + !quit_videoecho_thread) + { + pthread_mutex_lock(&uasVideoMutex); + nr = 0; + memset(msg, 0, sizeof(msg)); + len = sizeof(remote_rtp_addr); + video_packet_in.resize(sizeof(rtp_header_t) + g_rxUASVideo.getSrtpPayloadSize() + g_rxUASVideo.getAuthenticationTagSize(), 0); + nr = recvfrom(sock, video_packet_in.data(), video_packet_in.size(), MSG_DONTWAIT /* NON-BLOCKING */, (sockaddr *) (void *) &remote_rtp_addr, &len); + + if (nr >= 0) { + // Good to go -- buffer should contain "nr" bytes + seq_num = 0; + seq_num = (video_packet_in[2] << 8) | video_packet_in[3]; + + pthread_mutex_lock(&debugremutexvideo); + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "DATA SUCCESSFULLY RECEIVED [VIDEO] nr = %ld...", nr); + } + for (int i = 0; i < 12; i++) + { + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "%02X", 0xFFFFFFFF & video_packet_in[i]); + } + } + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "\n"); + } + pthread_mutex_unlock(&debugremutexvideo); + + if (g_rxUASVideo.getCryptoTag() != 0) + { + rtp_header.clear(); + payload_data.clear(); + // DECRYPT + rc = g_rxUASVideo.processIncomingPacket(video_seq, video_packet_in, rtp_header, payload_data); + pthread_mutex_lock(&debugremutexvideo); + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "RXUASVIDEO -- processIncomingPacket() rc == %d\n", rc); + } + pthread_mutex_unlock(&debugremutexvideo); + + host_flags = ntohs(((rtp_header_t*)video_packet_in.data())->flags); + host_seqnum = ntohs(((rtp_header_t*)video_packet_in.data())->seq); + host_timestamp = ntohl(((rtp_header_t*)video_packet_in.data())->timestamp); + host_ssrc = ntohl(((rtp_header_t*)video_packet_in.data())->ssrc_id); + + video_packet_in[0] = (host_flags >> 8) & 0xFF; + video_packet_in[1] = host_flags & 0xFF; + video_packet_in[2] = (host_seqnum >> 8) & 0xFF; + video_packet_in[3] = host_seqnum & 0xFF; + video_packet_in[4] = (host_timestamp >> 24) & 0xFF; + video_packet_in[5] = (host_timestamp >> 16) & 0xFF; + video_packet_in[6] = (host_timestamp >> 8) & 0xFF; + video_packet_in[7] = host_timestamp & 0xFF; + video_packet_in[8] = (host_ssrc >> 24) & 0xFF; + video_packet_in[9] = (host_ssrc >> 16) & 0xFF; + video_packet_in[10] = (host_ssrc >> 8) & 0xFF; + video_packet_in[11] = host_ssrc & 0xFF; + + memset(msg, 0, sizeof(msg)); + memcpy(msg, rtp_header.data(), rtp_header.size()); + memcpy(msg + sizeof(rtp_header_t), payload_data.data(), payload_data.size()); + } + + if (g_txUASVideo.getCryptoTag() != 0) + { + video_packet_out.clear(); + // ENCRYPT + // GRAB RTP HEADER + rtp_header.resize(sizeof(rtp_header_t), 0); + memcpy(rtp_header.data(), msg, sizeof(rtp_header_t) /*12*/); + // GRAB RTP PAYLOAD DATA + payload_data.resize(g_txUASVideo.getSrtpPayloadSize(), 0); + memcpy(payload_data.data(), msg + sizeof(rtp_header_t), g_txUASVideo.getSrtpPayloadSize()); + + // ENCRYPT + rc = g_txUASVideo.processOutgoingPacket(video_seq, rtp_header, payload_data, video_packet_out); + pthread_mutex_lock(&debugremutexvideo); + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "TXUASVIDEO -- processOutgoingPacket() rc == %d\n", rc); + } + pthread_mutex_unlock(&debugremutexvideo); + } + + ns = sendto(sock, video_packet_out.data(), sizeof(rtp_header_t) + g_txUASVideo.getSrtpPayloadSize() + g_txUASVideo.getAuthenticationTagSize(), MSG_DONTWAIT, (sockaddr *) (void *) &remote_rtp_addr, len); + + if (ns != nr) { + pthread_mutex_lock(&debugremutexvideo); + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "DATA SUCCESSFULLY SENT [VIDEO] seq_num = [%u] -- MISMATCHED RECV/SENT BYTE COUNT -- errno = %d nr = %ld ns = %ld\n", seq_num, errno, nr, ns); + } + pthread_mutex_unlock(&debugremutexvideo); + } else { + pthread_mutex_lock(&debugremutexvideo); + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "DATA SUCCESSFULLY SENT [VIDEO] seq_num[%u]...\n", seq_num); + } + pthread_mutex_unlock(&debugremutexvideo); + } + + rtp2_pckts++; + rtp2_bytes += ns; + video_seq++; + } + else if ((nr < 0) && + (errno == EAGAIN)) { + // No data to be read (no activity on socket) + //pthread_mutex_lock(&debugremutexvideo); + //if (debugrefilevideo != NULL) + //{ + //fprintf(debugrefilevideo, "No activity on videoecho socket (EAGAIN)...\n"); + //} + //pthread_mutex_unlock(&debugremutexvideo); + } + else { + // Other error occurred during read + //WARNING("%s %i", "Error on RTP echo reception - stopping rtpstream echo - errno = ", errno); + pthread_mutex_lock(&debugremutexvideo); + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "Error on RTP echo reception - unable to perform rtpstream videoecho - errno = %d\n", errno); + } + pthread_mutex_unlock(&debugremutexvideo); + abnormal_termination = true; + } + pthread_mutex_unlock(&uasVideoMutex); + } + else + { + pthread_mutex_lock(&debugremutexvideo); + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "rtp_videoecho_thread(): pthread_cond_timedwait() non-timeout: rc: %d quit_videoecho_thread: %d\n", rc, quit_videoecho_thread); + } + pthread_mutex_unlock(&debugremutexvideo); + } + } + pthread_mutex_unlock(&quit_mutexvideo); + + if ((flags = fcntl(sock, F_GETFL, 0)) < 0) + { + pthread_mutex_lock(&debugremutexvideo); + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "rtp_videoecho_thread(): fcntl() GETFL BLOCK failed...\n"); + } + pthread_mutex_unlock(&debugremutexvideo); + pthread_exit((void*) 6); + } + + if (fcntl(sock, F_SETFL, flags & (~O_NONBLOCK)) < 0) + { + pthread_mutex_lock(&debugremutexvideo); + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "rtp_videoecho_thread(): fcntl() SETFL BLOCK failed...\n"); + } + pthread_mutex_unlock(&debugremutexvideo); + pthread_exit((void*) 7); + } + + if (abnormal_termination) + { + exit_code = -1; + } + else + { + exit_code = 0; + } +#else // !USE_OPENSSL + exit_code = 0; // dummy +#endif // USE_OPENSSL + + pthread_exit((void*) (intptr_t) exit_code); +} + +int rtpstream_rtpecho_startaudio(rtpstream_callinfo_t* callinfo, JLSRTP& rxUASAudio, JLSRTP& txUASAudio) +{ + debugprint("rtpstream_rtpecho_startaudio callinfo=%p\n", callinfo); + + taskentry_t *taskinfo = callinfo->taskinfo; + ParamPass p; + + if (!taskinfo) + { + return -1; /* no task data structure */ + } + +#ifdef USE_OPENSSL + taskinfo->audio_srtp_echo_active = 1; + + pthread_mutex_lock(&debugremutexaudio); + if (srtpcheck_debug) + { + if (debugrefileaudio == NULL) + { + debugrefileaudio = fopen("debugrefileaudio", "w"); + if (debugrefileaudio == NULL) + { + /* error encountered opening audio debug file */ + pthread_mutex_lock(&debugremutexaudio); + return -2; + } + } + } + pthread_mutex_unlock(&debugremutexaudio); + + pthread_mutex_lock(&debugremutexaudio); + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "rtpstream_rtpecho_startaudio reached...\n"); + } + printLocalAudioSrtpStuff(taskinfo->local_srtp_audio_params); + printRemoteAudioSrtpStuff(taskinfo->remote_srtp_audio_params); + pthread_mutex_unlock(&debugremutexaudio); + + /* Create first RTP echo thread for audio */ + pthread_mutex_lock(&uasAudioMutex); + g_rxUASAudio = rxUASAudio; + g_txUASAudio = txUASAudio; + pthread_mutex_unlock(&uasAudioMutex); + + p.i = taskinfo->audio_rtp_socket; + + if (taskinfo->audio_rtp_socket > 0) { + if (pthread_create(&pthread_audioecho_id, NULL, (void *(*) (void *)) rtpstream_audioecho_thread, p.p) == -1) { + ERROR_NO("Unable to create RTP audio echo thread"); + return -7; + } + } +#endif // USE_OPENSSL + + return 0; +} + +int rtpstream_rtpecho_updateaudio(rtpstream_callinfo_t* callinfo, JLSRTP& rxUASAudio, JLSRTP& txUASAudio) +{ + debugprint("rtpstream_rtpecho_updateaudio callinfo=%p\n", callinfo); + + taskentry_t *taskinfo = callinfo->taskinfo; + + if (!taskinfo) + { + return -1; /* no task data structure */ + } + +#ifdef USE_OPENSSL + taskinfo->audio_srtp_echo_active = 1; + + pthread_mutex_lock(&debugremutexaudio); + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "rtpstream_rtpecho_updateaudio reached...\n"); + } + printLocalAudioSrtpStuff(taskinfo->local_srtp_audio_params); + printRemoteAudioSrtpStuff(taskinfo->remote_srtp_audio_params); + pthread_mutex_unlock(&debugremutexaudio); + + pthread_mutex_lock(&uasAudioMutex); + g_rxUASAudio = rxUASAudio; + g_txUASAudio = txUASAudio; + pthread_mutex_unlock(&uasAudioMutex); +#endif // USE_OPENSSL + + return 0; } + +int rtpstream_rtpecho_stopaudio(rtpstream_callinfo_t* callinfo) +{ + debugprint("rtpstream_rtpecho_stopaudio callinfo=%p\n", callinfo); + + taskentry_t *taskinfo = callinfo->taskinfo; + ResultCheck r; + + if (!taskinfo) + { + return -1; /* no task data structure */ + } + +#ifdef USE_OPENSSL + taskinfo->audio_srtp_echo_active = 0; + + pthread_mutex_lock(&quit_mutexaudio); + + pthread_mutex_lock(&debugremutexaudio); + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "MAIN: Setting quit_audioecho_thread flag to TRUE...\n"); + } + pthread_mutex_unlock(&debugremutexaudio); + quit_audioecho_thread = true; + pthread_mutex_lock(&debugremutexaudio); + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "MAIN: Sending QUIT signal...\n"); + } + pthread_mutex_unlock(&debugremutexaudio); + pthread_cond_signal(&quit_cvaudio); + + pthread_mutex_unlock(&quit_mutexaudio); + + pthread_mutex_lock(&debugremutexaudio); + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "rtpstream_rtpecho_stopaudio reached...\n"); + } + printLocalAudioSrtpStuff(taskinfo->local_srtp_audio_params); + printRemoteAudioSrtpStuff(taskinfo->remote_srtp_audio_params); + pthread_mutex_unlock(&debugremutexaudio); + + if (pthread_join(pthread_audioecho_id, &r.p) == 0) + { + // successfully joined audio thread + pthread_mutex_lock(&debugremutexaudio); + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "successfully joined audio thread: %d\n", r.i); + } + pthread_mutex_unlock(&debugremutexaudio); + } + else + { + // error joining audio thread + pthread_mutex_lock(&debugremutexaudio); + if (debugrefileaudio != NULL) + { + fprintf(debugrefileaudio, "error joining audio thread: %d\n", r.i); + } + pthread_mutex_unlock(&debugremutexaudio); + } + + pthread_mutex_lock(&debugremutexaudio); + if (srtpcheck_debug) + { + if (debugrefileaudio) + { + fclose(debugrefileaudio); + } + } + pthread_mutex_unlock(&debugremutexaudio); +#else // !USE_OPENSSL + r.i = 0; // dummy +#endif // USE_OPENSSL + + return r.i; +} + +int rtpstream_rtpecho_startvideo(rtpstream_callinfo_t* callinfo, JLSRTP& rxUASVideo, JLSRTP& txUASVideo) +{ + debugprint("rtpstream_rtpecho_startvideo callinfo=%p\n", callinfo); + + taskentry_t *taskinfo = callinfo->taskinfo; + ParamPass p; + + if (!taskinfo) + { + return -1; /* no task data structure */ + } + +#ifdef USE_OPENSSL + taskinfo->video_srtp_echo_active = 1; + + pthread_mutex_lock(&debugremutexvideo); + if (srtpcheck_debug) + { + if (debugrefilevideo == NULL) + { + debugrefilevideo = fopen("debugrefilevideo", "w"); + if (debugrefilevideo == NULL) + { + /* error encountered opening audio debug file */ + pthread_mutex_unlock(&debugremutexvideo); + return -2; + } + } + } + pthread_mutex_unlock(&debugremutexvideo); + + pthread_mutex_lock(&debugremutexvideo); + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "rtpstream_rtpecho_startvideo reached...\n"); + } + printLocalVideoSrtpStuff(taskinfo->local_srtp_video_params); + printRemoteVideoSrtpStuff(taskinfo->remote_srtp_video_params); + pthread_mutex_unlock(&debugremutexvideo); + + /* Create second RTP echo thread for video */ + pthread_mutex_lock(&uasVideoMutex); + g_rxUASVideo = rxUASVideo; + g_txUASVideo = txUASVideo; + pthread_mutex_unlock(&uasVideoMutex); + + p.i = taskinfo->video_rtp_socket; + + if (taskinfo->video_rtp_socket > 0) { + if (pthread_create(&pthread_videoecho_id, NULL, (void *(*) (void *)) rtpstream_videoecho_thread, p.p) == -1) { + ERROR_NO("Unable to create RTP video echo thread"); + return -8; + } + } +#endif // USE_OPENSSL + + return 0; +} + +int rtpstream_rtpecho_updatevideo(rtpstream_callinfo_t* callinfo, JLSRTP& rxUASVideo, JLSRTP& txUASVideo) +{ + debugprint("rtpstream_rtpecho_updatevideo callinfo=%p\n", callinfo); + + taskentry_t *taskinfo = callinfo->taskinfo; + + if (!taskinfo) + { + return -1; /* no task data structure */ + } + +#ifdef USE_OPENSSL + taskinfo->video_srtp_echo_active = 1; + + pthread_mutex_lock(&debugremutexvideo); + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "rtpstream_rtpecho_updatevideo reached...\n"); + } + printLocalVideoSrtpStuff(taskinfo->local_srtp_video_params); + printRemoteVideoSrtpStuff(taskinfo->remote_srtp_video_params); + pthread_mutex_unlock(&debugremutexvideo); + + pthread_mutex_lock(&uasVideoMutex); + g_rxUASVideo = rxUASVideo; + g_txUASVideo = txUASVideo; + pthread_mutex_unlock(&uasVideoMutex); +#endif // USE_OPENSSL + + return 0; +} + +int rtpstream_rtpecho_stopvideo(rtpstream_callinfo_t* callinfo) +{ + debugprint("rtpstream_rtpecho_stopvideo callinfo=%p\n", callinfo); + + taskentry_t *taskinfo = callinfo->taskinfo; + ResultCheck r; + + if (!taskinfo) + { + return -1; /* no task data structure */ + } + +#ifdef USE_OPENSSL + taskinfo->video_srtp_echo_active = 0; + + pthread_mutex_lock(&quit_mutexvideo); + + pthread_mutex_lock(&debugremutexvideo); + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "MAIN: Setting quit_videoecho_thread flags to TRUE...\n"); + } + pthread_mutex_unlock(&debugremutexvideo); + quit_videoecho_thread = true; + pthread_mutex_lock(&debugremutexvideo); + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "MAIN: Sending QUIT signal...\n"); + } + pthread_mutex_unlock(&debugremutexvideo); + pthread_cond_signal(&quit_cvvideo); + + pthread_mutex_unlock(&quit_mutexvideo); + + pthread_mutex_lock(&debugremutexvideo); + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "rtpstream_rtpecho_stopvideo reached...\n"); + } + printLocalVideoSrtpStuff(taskinfo->local_srtp_video_params); + printRemoteVideoSrtpStuff(taskinfo->remote_srtp_video_params); + pthread_mutex_unlock(&debugremutexvideo); + + if (pthread_join(pthread_videoecho_id, &r.p) == 0) + { + // successfully joined video thread + pthread_mutex_lock(&debugremutexvideo); + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "successfully joined video thread: %d\n", r.i); + } + pthread_mutex_unlock(&debugremutexvideo); + } + else + { + // error joining video thread + pthread_mutex_lock(&debugremutexvideo); + if (debugrefilevideo != NULL) + { + fprintf(debugrefilevideo, "error joining video thread: %d\n", r.i); + } + pthread_mutex_unlock(&debugremutexvideo); + } + + pthread_mutex_lock(&debugremutexvideo); + if (srtpcheck_debug) + { + if (debugrefilevideo) + { + fclose(debugrefilevideo); + } + } + pthread_mutex_unlock(&debugremutexvideo); +#else // !USE_OPENSSL + r.i = 0; // dummy +#endif // USE_OPENSSL + + return r.i; +} + +/* code checked */ +int rtpstream_shutdown(std::unordered_map& threadIDs) +{ + int count = 0; + void* rtpresult; + int total_rtpresults; + + rtpresult = NULL; + total_rtpresults = 0; + + debugprint("rtpstream_shutdown\n"); + + /* signal all playback threads that they should exit */ + if (ready_threads) { + for (count = 0; count < num_ready_threads; count++) { + ready_threads[count]->exit_flag = 1; + } + free(ready_threads); + ready_threads = NULL; + } + + if (busy_threads) { + for (count = 0; count < num_busy_threads; count++) { + busy_threads[count]->exit_flag = 1; + } + free(busy_threads); + busy_threads = NULL; + } + + /* first make sure no playback threads are accessing the file buffers */ + /* else small chance the playback thread tries to access freed memory */ + while (rtpstream_numthreads) { + usleep(50000); + } + + // PTHREAD JOIN HERE... + for (std::unordered_map::iterator iter = threadIDs.begin(); iter != threadIDs.end(); ++iter) + { + printAudioHex("EXISTING THREADID: ", "", 0, getThreadId(iter->first), 0); + printVideoHex("EXISTING THREADID: ", "", 0, getThreadId(iter->first), 0); + if (pthread_join(iter->first, &rtpresult)) + { + // error joining thread + printAudioHex("ERROR RETURNED BY PTHREAD_JOIN!", "", 0, 0, 0); + printVideoHex("ERROR RETURNED BY PTHREAD_JOIN!", "", 0, 0, 0); + return -2; + } + + total_rtpresults |= (long)rtpresult; + printAudioHex("JOINED THREAD: ", "", 0, (long)rtpresult, total_rtpresults); + printVideoHex("JOINED THREAD: ", "", 0, (long)rtpresult, total_rtpresults); + } + + /* now free cached file bytes and structure */ + if (cached_files) + { + for (count = 0; count < num_cached_files; count++) { + free(cached_files[count].bytes); + } + free(cached_files); + cached_files = NULL; + } + + /* now free cached patterns bytes and structure */ + if (cached_patterns) + { + for (count = 0; count < num_cached_files; count++) { + free(cached_patterns[count].bytes); + } + free(cached_patterns); + cached_patterns = NULL; + } + + if (debugvfile && + rtpcheck_debug) + { + fclose(debugvfile); + } + + if (debugafile && + rtpcheck_debug) + { + fclose(debugafile); + } + + pthread_mutex_destroy(&debugamutex); + + return total_rtpresults; +} + diff --git a/src/scenario.cpp b/src/scenario.cpp index 39f7f024..829ec9e4 100644 --- a/src/scenario.cpp +++ b/src/scenario.cpp @@ -404,6 +404,23 @@ int scenario::find_var(const char *varName) return allocVars->find(varName, false); } +#ifdef RTP_STREAM +void scenario::addRtpTaskThreadID(pthread_t id) +{ + threadIDs[id] = "threadID"; +} + +void scenario::removeRtpTaskThreadID(pthread_t id) +{ + threadIDs.erase(id); +} + +std::unordered_map& scenario::fetchRtpTaskThreadIDs() +{ + return threadIDs; +} +#endif // RTP_STREAM + int scenario::get_var(const char *varName, const char *what) { /* Check the name's validity. */ @@ -1661,20 +1678,96 @@ void scenario::parseAction(CActions *actions) ERROR("Scenario specifies a play_dtmf action, but this version of SIPp does not have PCAP support"); #endif #ifdef RTP_STREAM - } else if ((ptr = xp_get_keyword_value("rtp_stream"))) { + } + else if ((ptr = xp_get_keyword_value("rtp_stream"))) + { hasMedia = 1; - if (strcmp(ptr, "pause") == 0) { + if (!strcmp(ptr, "pauseapattern")) + { + tmpAction->setActionType(CAction::E_AT_RTP_STREAM_PAUSEAPATTERN); + } + else if (!strcmp(ptr, "resumeapattern")) + { + tmpAction->setActionType(CAction::E_AT_RTP_STREAM_RESUMEAPATTERN); + } + else if (!strncmp(ptr, "apattern", 8)) + { + tmpAction->setRTPStreamActInfo(ptr); + tmpAction->setActionType(CAction::E_AT_RTP_STREAM_PLAYAPATTERN); + } + else if (!strcmp(ptr, "pausevpattern")) + { + tmpAction->setActionType(CAction::E_AT_RTP_STREAM_PAUSEVPATTERN); + } + else if (!strcmp(ptr, "resumevpattern")) + { + tmpAction->setActionType(CAction::E_AT_RTP_STREAM_RESUMEVPATTERN); + } + else if (!strncmp(ptr, "vpattern", 8)) + { + tmpAction->setRTPStreamActInfo(ptr); + tmpAction->setActionType(CAction::E_AT_RTP_STREAM_PLAYVPATTERN); + } + else if (!strcmp(ptr, "pause")) + { tmpAction->setActionType(CAction::E_AT_RTP_STREAM_PAUSE); - } else if (strcmp(ptr, "resume") == 0) { + } + else if (!strcmp(ptr, "resume")) + { tmpAction->setActionType(CAction::E_AT_RTP_STREAM_RESUME); - } else { + } + else + { tmpAction->setRTPStreamActInfo(ptr); tmpAction->setActionType(CAction::E_AT_RTP_STREAM_PLAY); } free(ptr); #else - } else if ((cptr = xp_get_value("rtp_stream"))) { - ERROR("Scenario specifies a rtp_stream action, but this version of SIPp does not have RTP stream support"); + else if ((cptr = xp_get_value("rtp_stream"))) + { + ERROR("Scenario specifies a rtp_stream action -- but this version of SIPp does not have RTP stream support"); + } +#endif + } +#ifdef RTP_STREAM + else if ((ptr = xp_get_keyword_value("rtp_echo"))) + { + hasMedia = 1; + if (!strncmp(ptr, "startaudio", 10)) + { + tmpAction->setRTPEchoActInfo(ptr); + tmpAction->setActionType(CAction::E_AT_RTP_STREAM_RTPECHO_STARTAUDIO); + } + else if (!strncmp(ptr, "updateaudio", 11)) + { + tmpAction->setRTPEchoActInfo(ptr); + tmpAction->setActionType(CAction::E_AT_RTP_STREAM_RTPECHO_UPDATEAUDIO); + } + else if (!strncmp(ptr, "stopaudio", 9)) + { + tmpAction->setRTPEchoActInfo(ptr); + tmpAction->setActionType(CAction::E_AT_RTP_STREAM_RTPECHO_STOPAUDIO); + } + else if (!strncmp(ptr, "startvideo", 10)) + { + tmpAction->setRTPEchoActInfo(ptr); + tmpAction->setActionType(CAction::E_AT_RTP_STREAM_RTPECHO_STARTVIDEO); + } + else if (!strncmp(ptr, "updatevideo", 11)) + { + tmpAction->setRTPEchoActInfo(ptr); + tmpAction->setActionType(CAction::E_AT_RTP_STREAM_RTPECHO_UPDATEVIDEO); + } + else if (!strncmp(ptr, "stopvideo", 9)) + { + tmpAction->setRTPEchoActInfo(ptr); + tmpAction->setActionType(CAction::E_AT_RTP_STREAM_RTPECHO_STOPVIDEO); + } +#else + else if ((cptr = xp_get_value("rtp_echo"))) + { + ERROR("Scenario specifies a rtp_echo action -- but this version of SIPp does not have RTP stream::RtpEcho support"); + } #endif } else { ERROR("illegal in the scenario"); @@ -1687,7 +1780,7 @@ void scenario::parseAction(CActions *actions) ERROR("Scenario specifies a rtp_echo action, but this version of SIPp does not have RTP stream support"); #endif } else { - ERROR("Unknown action: %s", actionElem); + ERROR("Unknown action: %s", actionElem); } /* If the action was not well-formed, there should have already been an diff --git a/src/screen.cpp b/src/screen.cpp index 436bcdc1..e4978987 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -31,8 +31,10 @@ int screen_inited = 0; ScreenPrinter* sp; #ifdef RTP_STREAM -double last_rtpstream_rate_out = 0; -double last_rtpstream_rate_in = 0; +double last_artpstream_rate_out= 0; +double last_vrtpstream_rate_out= 0; +double last_artpstream_rate_in= 0; +double last_vrtpstream_rate_in= 0; #endif /* ERR is actually -1, but this prevents us from needing to use curses.h in @@ -388,37 +390,47 @@ void ScreenPrinter::draw_scenario_screen() #ifdef RTP_STREAM /* if we have rtp stream thread running */ if (rtpstream_numthreads) { - unsigned long tempbytes; + unsigned long TempABytes; + unsigned long TempVBytes; unsigned long last_tick = clock_tick; /* Saved clock_tick to last_tick and use that in calcs since clock tick */ /* can change during calculations. */ if (ms_since_last_tick) { - tempbytes = rtpstream_bytes_out; + TempABytes= rtpstream_abytes_out; + TempVBytes= rtpstream_vbytes_out; /* Calculate integer and fraction parts of rtp bandwidth; this value * will be saved and reused in the case where last_tick==last_report_time */ - last_rtpstream_rate_out = ((double)tempbytes) / ms_since_last_tick; + last_artpstream_rate_out= ((double)TempABytes)/ ms_since_last_tick; + last_vrtpstream_rate_out= ((double)TempVBytes)/ ms_since_last_tick; /* Potential race condition betwen multiple threads updating the - * rtpstream_bytes value. We subtract the saved tempbytes value + * rtpstream_bytes value. We subtract the saved TempBytes value * rather than setting it to zero to minimise the chances of missing * an update to rtpstream_bytes [update between printing stats and * zeroing the counter]. Ideally we would atomically subtract - * tempbytes from rtpstream_bytes. + * TempBytes from rtpstream_bytes. */ - rtpstream_bytes_out -= tempbytes; - tempbytes = rtpstream_bytes_in; - last_rtpstream_rate_in = ((double)tempbytes) / ms_since_last_tick; - rtpstream_bytes_in -= tempbytes; + rtpstream_abytes_out -= TempABytes; + rtpstream_vbytes_out -= TempVBytes; + TempABytes= rtpstream_abytes_in; + TempVBytes= rtpstream_vbytes_in; + last_artpstream_rate_in= ((double)TempABytes)/ ms_since_last_tick; + last_vrtpstream_rate_in= ((double)TempVBytes)/ ms_since_last_tick; + rtpstream_abytes_in -= TempABytes; + rtpstream_vbytes_in -= TempVBytes; } - snprintf(left_buf, 40, "%lu Total RTP pckts sent", rtpstream_pckts); - snprintf(buf, bufsiz," %-38s %.3f kB/s RTP OUT", - left_buf, last_rtpstream_rate_out); + snprintf(left_buf, 40, "%lu Total AUDIO RTP pckts sent", rtpstream_apckts); + snprintf(buf, bufsiz, " %-38s %.3f kB/s AUDIO RTP OUT", left_buf, last_artpstream_rate_out); + lines.push_back(buf); + snprintf(left_buf, 40, "%lu Total VIDEO RTP pckts sent", rtpstream_vpckts); + snprintf(buf, bufsiz, " %-38s %.3f KB/s VIDEO RTP OUT", left_buf, last_vrtpstream_rate_out); lines.push_back(buf); snprintf(left_buf, 40, "%lu RTP sending threads active", rtpstream_numthreads); - snprintf(buf, bufsiz, " %-38s %.3f kB/s RTP IN", - left_buf, last_rtpstream_rate_in); + snprintf(buf, bufsiz, " %-38s %.3f kB/s AUDIO RTP IN", left_buf, last_artpstream_rate_in); + lines.push_back(buf); + snprintf(buf, bufsiz, " %-38s %.3f KB/s VIDEO RTP IN", left_buf, last_vrtpstream_rate_in); lines.push_back(buf); } #endif diff --git a/src/sipp.cpp b/src/sipp.cpp index e4a7224c..13248cbf 100644 --- a/src/sipp.cpp +++ b/src/sipp.cpp @@ -240,6 +240,7 @@ struct sipp_option options_table[] = { "- bye\tSend byes for aborted calls\n" "- abortunexp\tAbort calls on unexpected messages\n" "- pingreply\tReply to ping requests\n" + "- cseq\tCheck CSeq of ACKs\n" "If a behavior is prefaced with a -, then it is turned off. Example: all,-bye\n", SIPP_OPTION_DEFAULTS, &default_behaviors, 1}, {"nd", "No Default. Disable all default behavior of SIPp which are the following:\n" @@ -248,6 +249,7 @@ struct sipp_option options_table[] = { "- On unexpected BYE send a 200 OK and close the call\n" "- On unexpected CANCEL send a 200 OK and close the call\n" "- On unexpected PING send a 200 OK and continue the call\n" + "- On unexpected ACK CSeq do nothing\n" "- On any other unexpected message, abort the call by sending a BYE or a CANCEL\n", SIPP_OPTION_UNSETFLAG, &default_behaviors, 1}, {"pause_msg_ign", "Ignore the messages received during a pause defined in the scenario ", SIPP_OPTION_SETFLAG, &pause_msg_ign, 1}, @@ -272,10 +274,18 @@ struct sipp_option options_table[] = { {"mb", "Set the RTP echo buffer size (default: 2048).", SIPP_OPTION_INT, &media_bufsize, 1}, {"mp", "Set the local RTP echo port number. Default is 6000.", SIPP_OPTION_INT, &user_media_port, 1}, #ifdef RTP_STREAM + {"min_rtp_port", "Minimum port number for RTP socket range.", SIPP_OPTION_INT, &min_rtp_port, 1}, + {"max_rtp_port", "Maximum port number for RTP socket range.", SIPP_OPTION_INT, &max_rtp_port, 1}, {"rtp_payload", "RTP default payload type.", SIPP_OPTION_INT, &rtp_default_payload, 1}, {"rtp_threadtasks", "RTP number of playback tasks per thread.", SIPP_OPTION_INT, &rtp_tasks_per_thread, 1}, {"rtp_buffsize", "Set the rtp socket send/receive buffer size.", SIPP_OPTION_INT, &rtp_buffsize, 1}, -#endif + {"rtpcheck_debug", "Write RTP check debug information to file", SIPP_OPTION_SETFLAG, &rtpcheck_debug, 1}, +#ifdef USE_OPENSSL + {"srtpcheck_debug", "Write SRTP check debug information to file", SIPP_OPTION_SETFLAG, &srtpcheck_debug, 1}, +#endif // USE_OPENSSL + {"audiotolerance", "Audio error tolerance for RTP checks (0.0-1.0) -- default: 1.0", SIPP_OPTION_FLOAT, &audiotolerance, 1}, + {"videotolerance", "Video error tolerance for RTP checks (0.0-1.0) -- default: 1.0", SIPP_OPTION_FLOAT, &videotolerance, 1}, +#endif // RTP_STREAM {"", "Call rate options:", SIPP_HELP_TEXT_HEADER, NULL, 0}, {"r", "Set the call rate (in calls per seconds). This value can be" @@ -449,7 +459,7 @@ void timeout_alarm(int /*param*/) /* Send loop & trafic generation*/ -static void traffic_thread() +static void traffic_thread(int &rtp_errors, int &echo_errors) { /* create the file */ char L_file_name[MAX_PATH]; @@ -508,8 +518,10 @@ static void traffic_thread() /* We can have calls that do not count towards our open-call count (e.g., dead calls). */ abort_all_tasks(); #ifdef RTP_STREAM - rtpstream_shutdown(); + rtp_errors = rtpstream_shutdown(main_scenario->fetchRtpTaskThreadIDs()); #endif + echo_errors = main_scenario->stats->getRtpEchoErrors(); + /* Reverse order shutdown, because deleting reorders the * sockets list. */ for (int i = pollnfds - 1; i >= 0; --i) { @@ -879,6 +891,9 @@ static void help() " 1: At least one call failed\n" " 97: Exit on internal command. Calls may have been processed\n" " 99: Normal exit without calls processed\n" +#ifdef RTP_STREAM + " 253: RTP validation failure\n" +#endif // RTP_STREAM " -1: Fatal error\n" " -2: Fatal error binding a socket\n"); @@ -1064,7 +1079,7 @@ static void releaseGlobalAllocations() delete globalVariables; } -void sipp_exit(int rc) +void sipp_exit(int rc, int rtp_errors, int echo_errors) { unsigned long counter_value_failed = 0; unsigned long counter_value_success = 0; @@ -1113,21 +1128,28 @@ void sipp_exit(int rc) // successful or not. In order to compute the return code, get // the counter of failed calls. If there is 0 failed calls, // then everything is OK! - if (counter_value_failed == 0) { - if (timeout_exit && counter_value_success < 1) { - exit(EXIT_TEST_RES_INTERNAL); + if ((rtp_errors > 0) || (echo_errors > 0)) + { + exit(EXIT_RTPCHECK_FAILED); + } + else + { + if (counter_value_failed == 0) { + if ((timeout_exit) && (counter_value_success < 1)) { + exit (EXIT_TEST_RES_INTERNAL); + } else { + exit(EXIT_TEST_OK); + } } else { - exit(EXIT_TEST_OK); + exit(EXIT_TEST_FAILED); } - } else { - exit(EXIT_TEST_FAILED); } } } static void sipp_sighandler(int signum) { - sipp_exit(EXIT_TEST_RES_UNKNOWN); + sipp_exit(EXIT_TEST_RES_UNKNOWN, 0, 0); } static void sighandle_set() @@ -1212,7 +1234,8 @@ static int bind_rtp_sockets(struct sockaddr_storage* media_sa, int try_port, int } ::close(media_socket_audio); ::close(media_socket_video); - media_socket_audio = media_socket_video = -1; + media_socket_audio = -1; + media_socket_video = -1; return -1; } @@ -1230,47 +1253,64 @@ static void setup_media_sockets() struct addrinfo hints = {0,}; struct addrinfo* local_addr; struct sockaddr_storage media_sockaddr = {0,}; + int try_counter = 0; + int max_tries = user_media_port ? 1 : 100; + int last_attempt = 0; - hints.ai_flags = AI_PASSIVE; - hints.ai_family = PF_UNSPEC; /* use local_ip_is_ipv6 as hint? */ + media_port = user_media_port ? user_media_port : DEFAULT_MEDIA_PORT; + // [JLTAG] + // + // RTPCHECK functionality needs port binding to happen only when rtp echo is in use + // However since the refactoring in commit "99e847e2a129b5e4c4ccfdd502f79a029929ceb9" + // was done media_ip needs to be set unconditionally so I have moved the media_ip + // strcpy() to happen outside of the if-block... + // /* Defaults for media sockets */ if (media_ip[0] == '\0') { strcpy(media_ip, local_ip); } + // assert that an IPv6 'media_ip' is not surrounded by brackets? + // +#ifdef RTP_STREAM + if ((user_media_port > 0) && rtp_echo_enabled) { +#else + if (1) { +#endif // RTP_STREAM + hints.ai_flags = AI_PASSIVE; + hints.ai_family = PF_UNSPEC; /* use local_ip_is_ipv6 as hint? */ + + /* Resolving local IP */ + if (getaddrinfo(media_ip, + NULL, + &hints, + &local_addr) != 0) { + ERROR("Unknown RTP address '%s'.\n" + "Use 'sipp -h' for details", media_ip); + } + memcpy(&media_sockaddr, local_addr->ai_addr, socklen_from_addr(_RCAST(struct sockaddr_storage*, local_addr->ai_addr))); + freeaddrinfo(local_addr); - /* Resolving local IP */ - if (getaddrinfo(media_ip, - NULL, - &hints, - &local_addr) != 0) { - ERROR("Unknown RTP address '%s'.\n" - "Use 'sipp -h' for details", media_ip); - } - memcpy(&media_sockaddr, local_addr->ai_addr, - socklen_from_addr(_RCAST(struct sockaddr_storage*, local_addr->ai_addr))); - freeaddrinfo(local_addr); + media_ip_is_ipv6 = (media_sockaddr.ss_family == AF_INET6); - media_ip_is_ipv6 = (media_sockaddr.ss_family == AF_INET6); + media_socket_audio = -1; + media_socket_video = -1; - int try_counter; - int max_tries = user_media_port ? 1 : 100; - media_port = user_media_port ? user_media_port : DEFAULT_MEDIA_PORT; - media_socket_audio = media_socket_video = -1; - for (try_counter = 1; try_counter <= max_tries; try_counter++) { - int last_attempt = (try_counter == max_tries); + for (try_counter = 1; try_counter <= max_tries; try_counter++) { + last_attempt = (try_counter == max_tries); - if (bind_rtp_sockets(&media_sockaddr, media_port, last_attempt) == 0) { - break; - } + if (bind_rtp_sockets(&media_sockaddr, media_port, last_attempt) == 0) { + break; + } - // Old RFC 3551 says: - // > RTP data SHOULD be carried on an even UDP port number and - // > the corresponding RTCP packets SHOULD be carried on the - // > next higher (odd) port number. - // So, try only even numbers. - media_port += 2; + // Old RFC 3551 says: + // > RTP data SHOULD be carried on an even UDP port number and + // > the corresponding RTCP packets SHOULD be carried on the + // > next higher (odd) port number. + // So, try only even numbers. + media_port += 2; + } } } @@ -1281,6 +1321,11 @@ int main(int argc, char *argv[]) pthread_t pthread2_id = 0, pthread3_id = 0; unsigned int generic_count = 0; bool slave_masterSet = false; + int rtp_errors; + int echo_errors; + + rtp_errors = 0; + echo_errors = 0; generic[0] = NULL; @@ -1366,8 +1411,8 @@ int main(int argc, char *argv[]) "-PCAP" #endif #ifdef RTP_STREAM - "-RTPSTREAM" -#endif + "-RTPSTREAM-RTPCHECK" +#endif // RTP_STREAM ); printf @@ -1780,6 +1825,8 @@ int main(int argc, char *argv[]) mask = DEFAULT_BEHAVIOR_ABORTUNEXP; } else if (!strcmp(p, "pingreply")) { mask = DEFAULT_BEHAVIOR_PINGREPLY; + } else if (!strcmp(p, "cseq")) { + mask = DEFAULT_BEHAVIOR_BADCSEQ; } else { ERROR("Unknown default behavior: '%s'", token); } @@ -2078,8 +2125,16 @@ int main(int argc, char *argv[]) /* to avoid ICMP errors from us. */ setup_media_sockets(); - /* Creating the remote control socket thread. */ + /* Creating the remote control socket thread */ +#ifdef RTP_STREAM + if ((user_media_port > 0) && rtp_echo_enabled) + { + setup_ctrl_socket(); + } +#else setup_ctrl_socket(); +#endif // RTP_STREAM + if (!nostdin) { setup_stdin_socket(); } @@ -2099,7 +2154,7 @@ int main(int argc, char *argv[]) } } - traffic_thread(); + traffic_thread(rtp_errors, echo_errors); /* Cancel and join other threads. */ if (pthread2_id) { @@ -2122,5 +2177,5 @@ int main(int argc, char *argv[]) free(scenario_file); free(scenario_path); - sipp_exit(EXIT_TEST_RES_UNKNOWN); + sipp_exit(EXIT_TEST_RES_UNKNOWN, rtp_errors, echo_errors); // MAIN EXIT PATH HERE...); } diff --git a/src/sipp_unittest.cpp b/src/sipp_unittest.cpp index aa4c66c0..0cb2076d 100644 --- a/src/sipp_unittest.cpp +++ b/src/sipp_unittest.cpp @@ -40,7 +40,7 @@ int main(int argc, char* argv[]) /* Quickfix to fix unittests that depend on sipp_exit availability, * now that sipp_exit has been moved into sipp.cpp which is not * included. */ -void sipp_exit(int rc) +void sipp_exit(int rc, int rtp_errors, int echo_errors) { exit(rc); } diff --git a/src/stat.cpp b/src/stat.cpp index 2e9af2e7..1dbb9303 100644 --- a/src/stat.cpp +++ b/src/stat.cpp @@ -485,6 +485,15 @@ void CStat::initRepartition(unsigned int* repartition, (*tabRepartition)[nombre].nbInThisBorder = 0; } +void CStat::setRtpEchoErrors(int value) +{ + M_rtpEchoErrors = value; +} + +int CStat::getRtpEchoErrors() +{ + return M_rtpEchoErrors; +} int CStat::computeStat (E_Action P_action) { @@ -1049,6 +1058,7 @@ CStat::CStat () M_dumpRespTime = NULL; M_fileNameRtt = NULL; M_rtdInfo = NULL; + M_rtpEchoErrors = 0; init(); }