Ryan Wagoner
2013-Dec-15 03:31 UTC
[asterisk-users] Why doesn't Asterisk try to prevent transcoding
Let's say I have two devices configured and the follow call scenarios occur. [100] disallow=all allow=g722&ulaw Polycom phone with g722,ulaw,alaw,g729 [101] disallow=all allow=ulaw Polycom phone with g722,ulaw,alaw,g729 101 dials 100 -> ulaw to ulaw is chosen 100 dials 101 -> g722 to ulaw is chosen Ideally when 100 dials 101 ulaw would be chosen since it is the common format. Looking into this deeper Device 100 sends INVITE to Asterisk offering g722,ulaw,alaw,g729 Asterisk sends INVITE to device 101 offering ulaw Device 101 sends 200 OK to Asterisk offering ulaw Asterisk sends 200 OK to device 100 offering g722,ulaw I can prevent transcoding by adding SIP_CODEC_INBOUND=ulaw to the dialplan for extension 101. This causes Asterisk to send 200 OK to device 100 offering ulaw. Am I missing why Asterisk wouldn't just offer the highest priority codec they have in common to prevent transcoding? Ryan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20131214/28209c12/attachment.html>
Ryan Wagoner
2013-Dec-15 04:06 UTC
[asterisk-users] Why doesn't Asterisk try to prevent transcoding
On Sat, Dec 14, 2013 at 10:31 PM, Ryan Wagoner <rswagoner at gmail.com> wrote:> Let's say I have two devices configured and the follow call scenarios > occur. > > [100] > disallow=all > allow=g722&ulaw > > Polycom phone with g722,ulaw,alaw,g729 > > [101] > disallow=all > allow=ulaw > > Polycom phone with g722,ulaw,alaw,g729 > > 101 dials 100 -> ulaw to ulaw is chosen > 100 dials 101 -> g722 to ulaw is chosen > > Ideally when 100 dials 101 ulaw would be chosen since it is the common > format. Looking into this deeper > > Device 100 sends INVITE to Asterisk offering g722,ulaw,alaw,g729 > Asterisk sends INVITE to device 101 offering ulaw > Device 101 sends 200 OK to Asterisk offering ulaw > Asterisk sends 200 OK to device 100 offering g722,ulaw > > I can prevent transcoding by adding SIP_CODEC_INBOUND=ulaw to the dialplan > for extension 101. This causes Asterisk to send 200 OK to device 100 > offering ulaw. Am I missing why Asterisk wouldn't just offer the highest > priority codec they have in common to prevent transcoding? > > Ryan >I should have mentioned I'm using Asterisk 11.2-cert2. The core debug from the above shows [2013-12-14 22:51:59] DEBUG[25200][C-0000004d]: chan_sip.c:7911 sip_new: *** Our native formats are (g722) [2013-12-14 22:51:59] DEBUG[25200][C-0000004d]: chan_sip.c:7912 sip_new: *** Joint capabilities are (ulaw|g722) [2013-12-14 22:51:59] DEBUG[25200][C-0000004d]: chan_sip.c:7913 sip_new: *** Our capabilities are (ulaw|g722) [2013-12-14 22:51:59] DEBUG[25200][C-0000004d]: chan_sip.c:7914 sip_new: *** AST_CODEC_CHOOSE formats are g722 [2013-12-14 22:51:59] DEBUG[27830][C-0000004d]: chan_sip.c:7911 sip_new: *** Our native formats are (ulaw) [2013-12-14 22:51:59] DEBUG[27830][C-0000004d]: chan_sip.c:7912 sip_new: *** Joint capabilities are (nothing) [2013-12-14 22:51:59] DEBUG[27830][C-0000004d]: chan_sip.c:7913 sip_new: *** Our capabilities are (ulaw) [2013-12-14 22:51:59] DEBUG[27830][C-0000004d]: chan_sip.c:7914 sip_new: *** AST_CODEC_CHOOSE formats are ulaw [2013-12-14 22:51:59] DEBUG[27830][C-0000004d]: chan_sip.c:7916 sip_new: *** Our preferred formats from the incoming channel are (g722) I'm looking at the code now. I am hoping to write a patch, if I can wrap my head around the code, to determine join capabilities between the joint capabilities of each channel. If this exists then set both channels this codec. Ryan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20131214/a399302c/attachment.html>
I think the order or elements is relevant: [100] disallow=all allow=ulaw allow=g722 or [100] allow=!all,ulaw,g722 should work. jg
CDR
2013-Dec-15 20:55 UTC
[asterisk-users] Why doesn't Asterisk try to prevent transcoding
I have had the issue for years. The problem is that Asterisk developers are removed from the business. We desperately need simple way to eliminate transcoding when unnecessary. Transcoding brings a server to its knees. It is a very simple new setting in sip.conf prioritize_matching_codecs=yes I vote for this new feature. However, I don't have the expertise to write a patch. I would say that only Digium developers could attempt to do this without disrupting the code too much. I also tried to migrate to PJSIP, but had to go back when I realized there was no channel variable contaning the inbound IP address. In general, any channel hast to provide the information to the dialplan, somehow, otherwise we cannot do business. I hope the PJSIP integration matures soon.
Possibly Parallel Threads
- Setting codec on originating (calling) channel with chan_pjsip (SIP_CODEC_INBOUND equivalent)
- Setting codec on originating (calling) channel with chan_pjsip (SIP_CODEC_INBOUND equivalent)
- Setting codec on originating (calling) channel with chan_pjsip (SIP_CODEC_INBOUND equivalent)
- Only 8kHz recorded after disallowing all but G722 codec on inbound
- Transcoding OPUS?