summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pjmedia/src/pjmedia/sdp_neg.c9
-rw-r--r--tests/pjsua/scripts-recvfrom/400_inv_answered_with_less_media.py32
2 files changed, 41 insertions, 0 deletions
diff --git a/pjmedia/src/pjmedia/sdp_neg.c b/pjmedia/src/pjmedia/sdp_neg.c
index 5fb160de..8c33468a 100644
--- a/pjmedia/src/pjmedia/sdp_neg.c
+++ b/pjmedia/src/pjmedia/sdp_neg.c
@@ -1007,6 +1007,15 @@ static pj_status_t process_answer(pj_pool_t *pool,
/* Now update each media line in the offer with the answer. */
for (; omi<offer->media_count; ++omi) {
if (ami == answer->media_count) {
+ /* The answer has less media than the offer */
+ pjmedia_sdp_media *am;
+
+ /* Generate matching-but-disabled-media for the answer */
+ am = pjmedia_sdp_media_clone(pool, offer->media[omi]);
+ am->desc.port = 0;
+ answer->media[answer->media_count++] = am;
+ ++ami;
+
/* No answer media to be negotiated */
offer->media[omi]->desc.port = 0;
continue;
diff --git a/tests/pjsua/scripts-recvfrom/400_inv_answered_with_less_media.py b/tests/pjsua/scripts-recvfrom/400_inv_answered_with_less_media.py
new file mode 100644
index 00000000..61b32fc6
--- /dev/null
+++ b/tests/pjsua/scripts-recvfrom/400_inv_answered_with_less_media.py
@@ -0,0 +1,32 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+# Offer with 2 media lines answered with only 1 media line
+
+pjsua = "--null-audio sip:127.0.0.1:$PORT --use-srtp=3 --srtp-secure=0"
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=pjmedia
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 4000 RTP/AVP 0 101
+a=rtpmap:0 PCMU/8000
+a=sendrecv
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+"""
+
+req = sip.RecvfromTransaction("Receiving 2 media lines, answer with 1 media line", 200,
+ include=["m=audio \d+ RTP/SAVP", "m=audio \d+ RTP/AVP"],
+ exclude=[],
+ resp_hdr=["Content-type: application/sdp"],
+ resp_body=sdp,
+ )
+
+recvfrom_cfg = sip.RecvfromCfg("Receiving answer with less media lines",
+ pjsua, [req])
+