[pjsip] bug report: pjsua refuses video-only sessions

Eeri Kask Eeri.Kask at mailbox.tu-dresden.de
Fri May 9 13:47:55 EDT 2014


Hello,

if setting all audio-codec priorities to '0' by 'Cp' for pjsua
(pjsip-apps/src/pjsua/*) prior to initiating/answering a call, a
video-only session can be attempted.  Though, pjsip later in
SDP-negotiations refuses to negotiate a connection.  A possible fix is
attached.

    Eeri Kask

-------------- next part --------------
--- pjsip/src/pjsua-lib/pjsua_media.c.orig	2014-05-05 08:19:16.000000000 +0200
+++ pjsip/src/pjsua-lib/pjsua_media.c	2014-05-05 08:22:09.000000000 +0200
@@ -1631,12 +1631,6 @@
     if (rem_sdp) {
 	sort_media(rem_sdp, &STR_AUDIO, acc->cfg.use_srtp,
 		   maudidx, &maudcnt, &mtotaudcnt);
-	if (maudcnt==0) {
-	    /* Expecting audio in the offer */
-	    if (sip_err_code) *sip_err_code = PJSIP_SC_NOT_ACCEPTABLE_HERE;
-	    status = PJSIP_ERRNO_FROM_SIP_STATUS(PJSIP_SC_NOT_ACCEPTABLE_HERE);
-	    goto on_error;
-	}
 
 #if PJMEDIA_HAS_VIDEO
 	sort_media(rem_sdp, &STR_VIDEO, acc->cfg.use_srtp,
@@ -1646,6 +1640,13 @@
 	PJ_UNUSED_ARG(STR_VIDEO);
 #endif
 
+	if (maudcnt + mvidcnt == 0) {
+	    /* Expecting audio/video in the offer */
+	    if (sip_err_code) *sip_err_code = PJSIP_SC_NOT_ACCEPTABLE_HERE;
+	    status = PJSIP_ERRNO_FROM_SIP_STATUS(PJSIP_SC_NOT_ACCEPTABLE_HERE);
+	    goto on_error;
+	}
+
 	/* Update media count only when remote add any media, this media count
 	 * must never decrease. Also note that we shouldn't apply the media
 	 * count setting (of the call setting) before the SDP negotiation.
@@ -1672,11 +1673,12 @@
 
 	    sort_media(sdp, &STR_AUDIO, acc->cfg.use_srtp,
 		       maudidx, &maudcnt, &mtotaudcnt);
-	    pj_assert(maudcnt > 0);
 
 	    sort_media(sdp, &STR_VIDEO, acc->cfg.use_srtp,
 		       mvididx, &mvidcnt, &mtotvidcnt);
 
+	    pj_assert(maudcnt + mvidcnt > 0);
+
 	    /* Call setting may add or remove media. Adding media is done by
 	     * enabling any disabled/port-zeroed media first, then adding new
 	     * media whenever needed. Removing media is done by disabling


More information about the pjsip mailing list