diff --git a/daemon/call.c b/daemon/call.c index 85a45370b..6b6549091 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -674,7 +674,7 @@ static const struct extmap_ops extmap_ops_short = { .header = extmap_header_short, .print = extmap_print_short, }; -static const struct extmap_ops extmap_ops_long = { +const struct extmap_ops extmap_ops_long = { .lookup = call_media_ext_lookup_ht, .length = extmap_length_long, .header = extmap_header_long, diff --git a/daemon/media_socket.c b/daemon/media_socket.c index 714deb116..26e379cb4 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -2185,6 +2185,12 @@ size_t extmap_length_short(const struct media_packet *mp) { continue; if (!extmap_short_is_valid(ext)) { + if (mp->media_out && !MEDIA_ISSET(mp->media_out, EXTMAP_SHORT)) { + // attempt in long form + ilog(LOG_DEBUG, "Switching RTP header extension format to long form"); + mp->media_out->extmap_ops = &extmap_ops_long; + return extmap_ops_long.length(mp); + } ilog(LOG_WARN | LOG_FLAG_LIMIT, "RTP extension with id %d length %zu not valid " "for short form", ext->ext->id, ext->content.len); continue; diff --git a/include/call.h b/include/call.h index bf10d9b12..78cf18f21 100644 --- a/include/call.h +++ b/include/call.h @@ -475,6 +475,8 @@ struct extmap_ops { size_t (*print)(void *dst, const struct rtp_extension_data *); }; +extern const struct extmap_ops extmap_ops_long; + /** * Protected by call->master_lock, except the RO elements.