diff --git a/regress/github-header-values/run b/regress/github-header-values/run new file mode 100755 index 000000000..d584259d7 --- /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 000000000..6074000c8 --- /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 000000000..cf02780d6 --- /dev/null +++ b/regress/github-header-values/uas.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/call.cpp b/src/call.cpp index 457d3559d..83a687482 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); } }