Issue when using playback application for outbound video call

I posted this on Reddit as well as here, I’ll be happy to post the fix back to Reddit too if someone can help! I have an issue with video calls outbound when using playback, I’m running asterisk 16.0.1 with pjsip

When placing an outbound call using the playback application ftmp data is not included in the invite. This seems to be a common theme with other users, and is the same when using h263 and h264.

I can get a call up, in this case to a Cisco Expressway, but it seems to be the same whatever I call, including direct to endpoints, and video is sent in both directions, verified by packet capture where I can see both my g722 audio and my h264 traffic. However, the traffic at the remote end is unable to be processed. The end application reports TAA_H264_INVALID_PPS_REFERENCED.

What I’m trying to figure out here is why Asterisk/pjsip doesn’t sent fmtp info at all, as I suspect that’s the reason the remote end can’t handle the media. Here, for example, is an invite or OK received’s SDP

a=rtpmap:97 H264/90000

a=fmtp:97 profile-level-id=42E01F;packetization-mode=0;max-fs=3601;level-asymmetry-allowed=1

looks healthy, and this is a known worker for b2b calling against other platforms. Asterisk, however, both in invite’s and responses only shows

a=rtpmap:99 H264/90000

Protocol number is different at 99, which I don’t think is a problem, but the fmtp information is missing. Audio negotiates absolutely fine, and both sites in that case don’t include fmtp information.

I’ve been going round and round on this one for days now. I’ve been amending code of the vid_codec_util.c, which I can only figure out for h263, recompiling. I’ve loaded in the following modules

load = res_format_attr_h263.so

load = res_format_attr_h264.so

load = format_h263.so

load = format_h264.so

I can also place a video call in and record fine, validated by downloading the recorded files and playing them locally. And again, packet capture shows the media is being sent, it’s just not possible to properly decode it due to mismatched parameters.

If I understand you are saying that when Asterisk sends an offer (outgoing) the sdp is missing the fmtp line for the associated video defined in the rtpmap correct? If so that sounds “buggy” to me, so might be worth opening an issue on the issue tracker.

However, it sounds like you are willing to do some more self diagnosis and even modify some code. I’ll try to give a few suggestions of places to look that might help narrow things down by following the code.

To start, the fmtp line is created and formatted in the format attribute resource file. In this particular case that would be res/res_format_attr_h264.c. The fmtp line for h264 is generated in the h264_generate_sdp_fmtp function. You could add in extra logging here to make sure Asterisk is actually reaching that part of the code for your scenario.

The function that calls that though can be found in main/format.c, ast_format_generate_sdp_fmtp. You’re using pjsip so this function is then called by the generate_fmtp_attr function found in res/res_pjsip_sdp_rtp.c, which is called by the create_outgoing_sdp_stream function found in the same file. You can keep going up the call chain if you like, but I’d add extra logging to each of those methods making sure that they are being called and the fmtp is being correctly created and passed around by Asterisk.

This is exactly what I needed to point me in the right direction. Thanks! I’ll report back to see what I find.