[sr-dev] git:master:8d4c2e41: test/unit: update unit test 60
Mikko Lehto
mslehto at iki.fi
Wed Nov 30 11:17:25 CET 2016
Module: kamailio
Branch: master
Commit: 8d4c2e419068b034ced89828878c6635d69c8d6f
URL: https://github.com/kamailio/kamailio/commit/8d4c2e419068b034ced89828878c6635d69c8d6f
Author: Mikko Lehto <mslehto at iki.fi>
Committer: Mikko Lehto <mslehto at iki.fi>
Date: 2016-11-17T01:17:00+02:00
test/unit: update unit test 60
- Kamailio sdpops manipulates SDP in MESSAGE request
- count certain SDP lines before and after sdp_remove_line_by_prefix()
- only m=video is to be manipulated
- verify by counting prefix line count vs. other lines
---
Added: test/unit/60-message-sdp9.sip
Modified: test/unit/60.cfg
Modified: test/unit/60.sh
---
Diff: https://github.com/kamailio/kamailio/commit/8d4c2e419068b034ced89828878c6635d69c8d6f.diff
Patch: https://github.com/kamailio/kamailio/commit/8d4c2e419068b034ced89828878c6635d69c8d6f.patch
---
diff --git a/test/unit/60-message-sdp9.sip b/test/unit/60-message-sdp9.sip
new file mode 100644
index 0000000..1e0019a
--- /dev/null
+++ b/test/unit/60-message-sdp9.sip
@@ -0,0 +1,31 @@
+MESSAGE sip:bob at example.invalid SIP/2.0
+From: sip:alice at example.invalid;tag=45dfdf49
+To: sip:bob at example.invalid
+Call-ID: 1172299593a
+CSeq: 1 MESSAGE
+Content-Type: application/sdp
+Max-Forwards: 2
+X-Case: 60-test9
+X-Info: sdpops remove_line_by_prefix test9 - filter video attribute
+
+v=0
+o=FreeSWITCH 1447318678 1447318679 IN IP4 10.0.0.145
+s=FreeSWITCH
+c=IN IP4 10.0.0.145
+t=0 0
+m=audio 28504 RTP/AVP 96 101
+a=rtpmap:96 opus/48000/2
+a=fmtp:96 useinbandfec=1; maxaveragebitrate=14400; maxplaybackrate=8000
+a=rtpmap:101 telephone-event/48000
+a=fmtp:101 0-16
+a=ptime:20
+a=sendrecv
+a=rtcp:28505 IN IP4 10.0.0.145
+a=rtcp-fb:101 nack
+m=video 21992 RTP/SAVPF 100
+a=rtpmap:100 VP8/90000
+a=rtcp:21992 IN IP4 10.0.0.150
+a=rtcp-fb:100 ccm fir
+a=rtcp-fb:100 nack
+a=rtcp-fb:100 nack pli
+
diff --git a/test/unit/60.cfg b/test/unit/60.cfg
index 62c0a5b..cd7aa1c 100644
--- a/test/unit/60.cfg
+++ b/test/unit/60.cfg
@@ -26,6 +26,13 @@ route {
sl_send_reply(200,"OK");
exit;
}
+ if ($hdr(X-Case) == '60-test9') {
+ sdp_remove_line_by_prefix("a=rtcp","video");
+ msg_apply_changes();
+ set_reply_body($rb,"application/sdp");
+ sl_send_reply(200,"OK");
+ exit;
+ }
sl_send_reply(500,"Unknown test case");
exit;
diff --git a/test/unit/60.sh b/test/unit/60.sh
index e3f0b02..54d514c 100755
--- a/test/unit/60.sh
+++ b/test/unit/60.sh
@@ -85,6 +85,27 @@ else
exit ${ret}
fi
+# Filter only video stream attributes
+FILE="60-message-sdp9.sip"
+TOTALBEFORE=$(awk '/^v=0/,/^$/ {total++; if ($0 ~ /^a=rtcp/ ) { prefix++;} else { other++} } END {if (prefix) {print other " + " prefix} else { print other " + 0"} }' ${FILE})
+OTHERBEFORE=$(echo ${TOTALBEFORE}|cut -d+ -f1)
+PREFIXBEFORE=$(echo ${TOTALBEFORE}|cut -d+ -f2)
+sipsak ${SIPSAKOPTS} -f ${FILE} > ${TMPFILE}
+ret=$?
+if [ "${ret}" -eq 0 ] ; then
+ TOTALAFTER=$(awk '/^v=0/,/^$/ {total++; if ($0 ~ /^a=rtcp:/ ) { prefix++;} else { other++} } END {if (prefix) {print other " + " prefix} else { print other " + 0"} }' ${TMPFILE})
+ OTHERAFTER=$(echo ${TOTALBEFORE}|cut -d+ -f1)
+ PREFIXAFTER=$(echo ${TOTALAFTER}|cut -d+ -f2)
+ if [ ${PREFIXAFTER} -eq 1 ] && [ ${OTHERBEFORE} -eq ${OTHERAFTER} ]; then
+ ret=0
+ else
+ ret=1
+ echo "found ${PREFIXAFTER} lines with prefix \"a=rtcp\", was expecting 1 (in m=audio)(${FILE})"
+ fi
+ else
+ echo "invalid sipsak return: ${ret}"
+fi
+
kill_kamailio
rm ${TMPFILE}
exit ${ret}
More information about the sr-dev
mailing list