Up until a fairly recent revision of asterisk 1.4 (I don’t know exactly when), asterisk by default tagged SIP and RTP packets with 0x68 for the IP TOS field. This worked fine with my shaper script (astshape, a variant of wondershaper). Worked great, since I could do all kinds of BT uploads and such and still talk on my VOIP connection. Last night, I had BT going and was talking to a friend and he noticed things were very choppy. I ran the script to look at stats and saw that there were zero packets flagged as having been processed as VOIP priority. Long story short: TOS is deprecated, so asterisk 1.4 has migrated to DSCP for packet tagging. By default, one of the sip config files tags SIP as cs3 and RTP as ef (expedited forwarding). The problem? Any DSCP/TOS value passed to setsockopt() in the kernel that has high bits set (for high priority) cannot be used unless running as root. The posix runtime code has a way of saving your privileges before giving up root (as I understand it). Asterisk 1.4 takes advantage of this. Unfortunately, this doesn’t seem to be working. I’ve dodged it for now by patching that sip config file to use 0x10. I’m not yet sure why this is happening, but I wanted to give people a heads-up if they’ve seen this behavior…
i don’t have this root-caused yet, but it appears to be something about the linux capabilities code that is biting asterisk 1.4, so not related to freepbx (at first I thought it might be because freepbx launches asterisk via safe_asterisk…)
Truly weird. I had upgraded asterisk by building new version, doing ‘make install’ and in asterisk remote console, doing ‘restart now’. When I happened to do this via ‘amportal restart’, it all started working. I don’t know if I’m relieved or not, since I can’t imagine why that made a difference. Oh well
I’ve this problem too. I’ve read somewhere that Asterisk can now use the pcap library to set the hi DSCP bit even if not root. I’m not sure if it’s version 1.4 or 1.6.
In the meantime, i’m using an AF value instead of EF for DSCP.
Yeah, I have that patch. That’s why I was so confused about the behavior. Regardless, it’s working now. I did think of using a value like AF but didn’t want to deal with another non-default value…
This is supported inside Asterisk version 1.6 :
Ability to use libcap to set high ToS bits when non-root on Linux. If configure is unable to find libcap then you can use --with-cap to specify the path.
so technically no patch is now needed.
So what are the new af settings for sip and rtp? I was using AF31 for sip, but our cisco router is no longer catching the traffic. In the meantime I have nbar catching the rtp traffic, but i’d much rather do it with dscp values.
SIP is cs3 and RTP is ef.