QoS / ToS / DSCP not configurable and defaulting to no priority with PJSIP

L.S.,

I found that the latest distro/FreePBX core release does not set PJSIP transport tos or endpoint tos_audio/tos_video and as far as I can see doesn’t allow for a webgui method of setting these parameters.

As result all SIP and RTP traffic from the PBX is not and can not be prioritized on the network when using PJSIP, which is bad practise.

A temporary workaround is changing modules/core/functions.inc/pjsip.class.php at lines 428 and 752 for respectively trunks and endpoints. Further adding the SIP tos parameter for both transports to /etc/asterisk/pjsip.transports_custom_post with .

Would be great to see custom (or dedicated) FreePBX fields for PJSIP as they exist for chan_sip in the future.

It’s noteworthy that endpoints need individual tos params, but would hate to have to set it per extension.

Sidestepping, but: is there a generic gui way to alter extensions default settings?

Thanks.

File a feature request at http://issues.freepbx.org

This has been requested, but rejected, at least for now. The slightest mis-configuration of pjsip causes asterisk to unload the pjsip module(s) creating havoc. Custom user settings will be confined to the *custom.conf files for the time being.

Thanks for the info, sensible choice.

Feature request has been made.

http://issues.freepbx.org/browse/FREEPBX-12299

1 Like

I was trying to play with pjsip.endpoint_custom_post.conf and pjsip.transport_custom_post.conf files but with no success. (Edit: originally I stated *_custom.conf, but this was a mistyping)
FreePBX13 + Asterisk 13 official distibution with all updates installed.

Transport:
[0.0.0.0-udp]
type=transport
tos=cs3
cos=3
causes PJSIP fail to load

Endpoint:
[## endpoint ##]
type=endpoint
tos_audio=ef
tos_video=af41
cos_audio=5
cos_video=4
Does nothig - TOS fields are still 0.

Any progress?

The same settings for endpoint in “manual mode” - right in pjsip.endpoint.conf

Yes, I do know this file will be overwriten next tine I use web interface, but it was worth trying.

And it worked! Now my outgoing RTP stream is marked with tos=0xb8

17:52:51.854331 IP (tos 0xb8, ttl 64, id 0, offset 0, flags [DF], proto UDP (17), length 120) 192.168.1.34.13870 > sip.provider.com.12414: UDP, length 92

Generally in FreePBX, the *custom.conf files are intended for users to add their own contexts, and *post.conf files are intended to modify FreePBX generated contexts. To use the pjsip conf files for adding your own parameters to existing generated contexts, do the following:

Locate the conf file in /etc/asterisk/ that contains the context which you wish to modify. Make a note of the file name and the context.

Locate the corresponding *post.conf file to the file from step 1.

If the context you wish to modify is called [2014] in file pjsip.endpoint.conf, then to the file pjsip.endpoint_custom_post.conf, you add the lines:

[2014](+)
tos_audio=ef
tos_video=af41
cos_audio=5
cos_video=4

Do a ‘core reload’ then ‘pjsip show contact 2014’ and you can verify that the settings have applied properly.

Sorry. My mistake - I did changes to the *custom_post.conf files, not *_custom.conf

Results are described in the first message

My big mistake is - I did not put a (+) after section name

New configs are working perfectly!

pjsip.transports_custom_post.conf:
[0.0.0.0-udp](+)
tos=cs3
cos=3

pjsip.endpoint_custom_post.conf:
[2014](+)
tos_audio=ef
tos_video=af41
cos_audio=5
cos_video=4

Thanks!

1 Like

HI ,
thank you for your post, and it works fine. But… Is there a way to set tos_audio globally and not each extension? I have a lot of extensions and it could be much easier…

Thank you

1 Like

If you have a decent router you can prioritize traffic by IP, port, and protocol.

You can use tos/dscp in conjunction with the above QoS.

Using both will be helpful in case some devices don’t have tos/dscp or if their implementations are broken.

Is it possible in the Endpoint_Custom_Post file to do this (so you don’t have to apply the markers to each extension)?:

[0.0.0.0-udp](+)
tos_audio=0xb8
tos_video=0x88
cos_audio=184
cos_video=136

[0.0.0.0-tcp](+)
tos_audio=0xb8
tos_video=0x88
cos_audio=184
cos_video=136

[0.0.0.0-tls](+)
tos_audio=0xb8
tos_video=0x88
cos_audio=184
cos_video=136

[0.0.0.0-ws](+)
tos_audio=0xb8
tos_video=0x88
cos_audio=184
cos_video=136
1 Like

Assuming the context settings for those are named correctly, that should work fine as long as the trunks settings carry down to the extensions. Your syntax seems to be correct.

Yeah, it ended up killing all SIP activity, when I added this info, so maybe you can’t globally do those settings on a global basis…