]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merge "res_pjsip_session: Change some asserts to warning/debug messages" into 15
authorJoshua Colp <jcolp@digium.com>
Fri, 22 Sep 2017 16:09:40 +0000 (11:09 -0500)
committerGerrit Code Review <gerrit2@gerrit.digium.api>
Fri, 22 Sep 2017 16:09:40 +0000 (11:09 -0500)
1  2 
res/res_pjsip_session.c

index 163c2b8681e0dd5b2f2bb08b724d86f5cc028260,978c95a0c4c50068c37c03067d5f5ece08e63225..b5874574e2bdf3e1d93d4e69fd951f1249fb2378
@@@ -765,8 -769,31 +769,32 @@@ static int handle_negotiated_sdp(struc
  {
        int i;
        struct ast_stream_topology *topology;
 +      unsigned int changed = 0;
  
+       /* This situation can legitimately happen when an SDP is received in a
+        * 183 Session Progress message.  In that case, everything's been done
+        * by the time this function is called and there are no more pending
+        * streams.
+        */
+       if (!session->pending_media_state->topology) {
+               ast_debug(1, "Pending topology was NULL for channel '%s'\n",
+                       session->channel ? ast_channel_name(session->channel) : "unknown");
+               return 0;
+       }
+       /* If we're handling negotiated streams, then we should already have set
+        * up session media instances (and Asterisk streams) that correspond to
+        * the local SDP, and there should be the same number of session medias
+        * and streams as there are local SDP streams
+        */
+       if (ast_stream_topology_get_count(session->pending_media_state->topology) != local->media_count
+               || AST_VECTOR_SIZE(&session->pending_media_state->sessions) != local->media_count) {
+               ast_log(LOG_WARNING, "Local SDP for channel '%s' contains %d media streams while we expected it to contain %u\n",
+                       session->channel ? ast_channel_name(session->channel) : "unknown",
+                       ast_stream_topology_get_count(session->pending_media_state->topology), local->media_count);
+               return -1;
+       }
        for (i = 0; i < local->media_count; ++i) {
                struct ast_sip_session_media *session_media;
                struct ast_stream *stream;