From 2817d86b43de9db69871204026d2f04f510fb316 Mon Sep 17 00:00:00 2001 From: Pietro Bertera Date: Sat, 17 Sep 2016 19:19:50 +0200 Subject: [PATCH 1/4] Support for the ! suffix into the [last_*] --- src/call.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/call.cpp b/src/call.cpp index 457d3559..83a68748 100644 --- a/src/call.cpp +++ b/src/call.cpp @@ -923,9 +923,18 @@ char * call::get_last_header(const char * name) if (name[len - 1] == ':') { return get_header(last_recv_msg, name, false); } else { + bool content = false; + char no_colon[MAX_HEADER_LEN]; char with_colon[MAX_HEADER_LEN]; - sprintf(with_colon, "%s:", name); - return get_header(last_recv_msg, with_colon, false); + if (name[len-1] == '!') { + content = true; + snprintf(no_colon, len, "%s", name); + sprintf(with_colon, "%s:", no_colon); + } + else { + sprintf(with_colon, "%s", name); + } + return get_header(last_recv_msg, with_colon, content); } } From d19b9af79dba57c0cdebd5223a52961fa5dbed62 Mon Sep 17 00:00:00 2001 From: Pietro Bertera Date: Sun, 18 Sep 2016 00:11:04 +0200 Subject: [PATCH 2/4] header values test case --- regress/github-header-values/run | 22 +++++++++++ regress/github-header-values/uac.xml | 54 +++++++++++++++++++++++++++ regress/github-header-values/uas.xml | 56 ++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100755 regress/github-header-values/run create mode 100644 regress/github-header-values/uac.xml create mode 100644 regress/github-header-values/uas.xml diff --git a/regress/github-header-values/run b/regress/github-header-values/run new file mode 100755 index 00000000..d584259d --- /dev/null +++ b/regress/github-header-values/run @@ -0,0 +1,22 @@ +#!/bin/sh +# This regression test is a part of SIPp. +# Author: Walter Doekes, OSSO B.V., 2016 +. "`dirname "$0"`/../functions"; init + +sippfg -m 1 -sf uas.xml -p 5070 \ + -trace_logs -log_file log.log >/dev/null 2>&1 & +job=$! +sippfg -m 1 -sf uac.xml 127.0.0.1:5070 \ + -timeout 4 -timeout_error >/dev/null 2>&1 +status=$? +wait $job || status=1 + +if test $status -eq 0; then + if grep -e ^LAST\ From:\ \"Tom\ Jones\"\ \\;tag=SIPpTag001$ log.log > /dev/null; then + ok + else + fail "From header not found" + fi +else + fail "process failure" +fi diff --git a/regress/github-header-values/uac.xml b/regress/github-header-values/uac.xml new file mode 100644 index 00000000..6074000c --- /dev/null +++ b/regress/github-header-values/uac.xml @@ -0,0 +1,54 @@ + + + + + ;tag=SIPpTag00[call_number] + To: "Fromage" + Call-ID: [call_id] + CSeq: 1 INVITE + Contact: sip:sipp@[local_ip]:[local_port] + Content-Length: 0 + + ]]> + + + + + + ;tag=SIPpTag00[call_number] + To: "Fromage" [peer_tag_param] + Call-ID: [call_id] + CSeq: 1 ACK + Contact: sip:sipp@[local_ip]:[local_port] + Content-Length: 0 + + ]]> + + + + + + + Content-Length: 0 + + ]]> + + + + diff --git a/regress/github-header-values/uas.xml b/regress/github-header-values/uas.xml new file mode 100644 index 00000000..cf02780d --- /dev/null +++ b/regress/github-header-values/uas.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 3f7162f9e6e8a3b86c2642ab916ffd24d730d195 Mon Sep 17 00:00:00 2001 From: Pietro Bertera Date: Sat, 17 Sep 2016 19:19:50 +0200 Subject: [PATCH 3/4] Support for the ! suffix into the [last_*] --- src/call.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/call.cpp b/src/call.cpp index 457d3559..83a68748 100644 --- a/src/call.cpp +++ b/src/call.cpp @@ -923,9 +923,18 @@ char * call::get_last_header(const char * name) if (name[len - 1] == ':') { return get_header(last_recv_msg, name, false); } else { + bool content = false; + char no_colon[MAX_HEADER_LEN]; char with_colon[MAX_HEADER_LEN]; - sprintf(with_colon, "%s:", name); - return get_header(last_recv_msg, with_colon, false); + if (name[len-1] == '!') { + content = true; + snprintf(no_colon, len, "%s", name); + sprintf(with_colon, "%s:", no_colon); + } + else { + sprintf(with_colon, "%s", name); + } + return get_header(last_recv_msg, with_colon, content); } } From 812617013e09616ed88efbcb7fdea2606872404a Mon Sep 17 00:00:00 2001 From: Pietro Bertera Date: Sun, 18 Sep 2016 00:11:04 +0200 Subject: [PATCH 4/4] header values test case --- regress/github-header-values/run | 22 +++++++++++ regress/github-header-values/uac.xml | 54 +++++++++++++++++++++++++++ regress/github-header-values/uas.xml | 56 ++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100755 regress/github-header-values/run create mode 100644 regress/github-header-values/uac.xml create mode 100644 regress/github-header-values/uas.xml diff --git a/regress/github-header-values/run b/regress/github-header-values/run new file mode 100755 index 00000000..d584259d --- /dev/null +++ b/regress/github-header-values/run @@ -0,0 +1,22 @@ +#!/bin/sh +# This regression test is a part of SIPp. +# Author: Walter Doekes, OSSO B.V., 2016 +. "`dirname "$0"`/../functions"; init + +sippfg -m 1 -sf uas.xml -p 5070 \ + -trace_logs -log_file log.log >/dev/null 2>&1 & +job=$! +sippfg -m 1 -sf uac.xml 127.0.0.1:5070 \ + -timeout 4 -timeout_error >/dev/null 2>&1 +status=$? +wait $job || status=1 + +if test $status -eq 0; then + if grep -e ^LAST\ From:\ \"Tom\ Jones\"\ \\;tag=SIPpTag001$ log.log > /dev/null; then + ok + else + fail "From header not found" + fi +else + fail "process failure" +fi diff --git a/regress/github-header-values/uac.xml b/regress/github-header-values/uac.xml new file mode 100644 index 00000000..6074000c --- /dev/null +++ b/regress/github-header-values/uac.xml @@ -0,0 +1,54 @@ + + + + + ;tag=SIPpTag00[call_number] + To: "Fromage" + Call-ID: [call_id] + CSeq: 1 INVITE + Contact: sip:sipp@[local_ip]:[local_port] + Content-Length: 0 + + ]]> + + + + + + ;tag=SIPpTag00[call_number] + To: "Fromage" [peer_tag_param] + Call-ID: [call_id] + CSeq: 1 ACK + Contact: sip:sipp@[local_ip]:[local_port] + Content-Length: 0 + + ]]> + + + + + + + Content-Length: 0 + + ]]> + + + + diff --git a/regress/github-header-values/uas.xml b/regress/github-header-values/uas.xml new file mode 100644 index 00000000..cf02780d --- /dev/null +++ b/regress/github-header-values/uas.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +