My provider called me to say that my rtp packages aren’t marked correctly for QoS. They use TOS (type of service) 46 (or ef or 0xb8) to prioritize the rtp stream.
I grabed some packages with tcpdump and really there isn’t. I have seen that FreePBX mark same rtp with old chan_sip by default but not with chan_pjsip. I found a tip in this forum (QoS / ToS / DSCP not configurable and defaulting to no priority with PJSIP) to add an entry ‘tos_audio=ef’ in file ‘pjsip_endpoint_custom_post.conf’. This is an uncomfortable solution for the trunk.
Then I checked that all packages from my internal devices to FreePBX server are marked also, but no one from server to the device.
Itsn’t it possible to mark rtp packages via pjsip by default by adding the line ‘tos_audio=ef’ in ‘pjsip_endpoint.conf’ in each extension.
Thank you for your answer. That’s the half way only. I entered your proposed transport tos and cos values. PJSIP shows 184 on both also.
BUT this is SIP signaling and not the audio stream package of RTP. My UDP (and TLS) packages with SIP have a DSCP value “ef” now (checked with tcpdump). The RTP package from FreePBX to client device have still value ‘cs0’.
I think this is settable in section “endpoint” per extension only with “tos_audio=ef”.
Unlike chan_sip, no way to set pjsip tos_audio globally AFAIK, which is a nuisance.
It must be set for each individual endpoint and updated each time one adds/removes/renames an endpoint.
Here’s a sample entry for pjsip.endpoint_custom_post.conf:
I have almost 400 extensions on this PBX, can you imagine the work?
I added a rule in iptables that all RTP traffic must be tagged with DSCP 46, it seems to work fine.
I just hope FreePBX won’t overwrite the config file …
It’s not that bad. In pjsip-speak an endpoint is either an extension or a trunk. You can ignore extensions and set tos_audio on trunks. But you seem to have solved the problem already with iptables.
I have never used the FreePBX firewall. If you do use it, I don’t know if it will mess with your manual changes to iptables.
[ EDIT ]
One other note: Once your packets hit the public Internet no one pays any attention to your QoS. Your QoS is solely for the benefit of your own router.