[Home]

Summary:ASTERISK-24779: Passthrough OPUS codec not working with chan_pjsip
Reporter:PowerPBX (PowerPBX)Labels:
Date Opened:2015-02-10 16:36:28.000-0600Date Closed:2015-11-11 08:10:43.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:Channels/chan_pjsip
Versions:13.6.0 Frequency of
Occurrence
Related
Issues:
Environment:CentOS 6.6 x86 pjsip v2.3 compiled from source according to Asterisk recommendations Asterisk v13.2.0 compiled from source opus-devel-1.1-1.el6.i686.rpm installed from epel repo (if that matters?)Attachments:( 0) asterisk-24779.patch
( 1) asterisk-24779-version-2.patch
( 2) full
( 3) full_pjsip
Description:With 2 extensions and no NAT operating as direct_media=yes with no "r" in dial option (ie.  Passthrough codec mode) I am unable to communicate from one extension to another using the build in Opus Codec in the 2 extensions with Opus as the only active codec on the extensions.  I tried PhonerLite v2.21 and v2.22 beta as well as Xlite v4.7

When I switched the extensions from using chan_pjsip to chan_sip they were able to communicate with each other via OPUS codec.  There is no OPUS codec installed on Asterisk so passthrough is the only possible way they can communicate using that codec.

The following errors were observed from CLI

{noformat}
res_pjsip_sdp_rtp.c:247 set_caps: No joint capabilities for 'audio' media stream between our configuration((speex|opus)) and incoming SDP((nothing))

chan_pjsip.c:530 chan_pjsip_answer: Unable to push answer task to the threadpool. Cannot answer call
{noformat}
Comments:By: Matt Jordan (mjordan) 2015-02-10 16:58:14.760-0600

We require a complete debug log to help triage the issue. This document will provide instructions on how to collect debugging logs from an Asterisk machine for the purpose of helping bug marshals troubleshoot an issue: https://wiki.asterisk.org/wiki/display/AST/Collecting+Debug+Information



By: PowerPBX (PowerPBX) 2015-02-10 17:27:37.461-0600

I have the debug log ready.  I need to wait for you guys to approve me for file attachment.

By: Rusty Newton (rnewton) 2015-02-10 18:19:09.885-0600

A license agreement is not required to attach general files, including debug.

A license agreement is *only required* when making contributions for the Asterisk project, such as source code, sound files or contrib scripts.

Your intended attachment of debug does not require a license agreement. If you are unable to attach the file, it is because you are selecting "contribution" in the file upload dialog mistakenly.

Make sure to use Enter Feedback or Send Back to send the issue back to us.

By: PowerPBX (PowerPBX) 2015-02-10 20:16:49.293-0600

Logfile has been attached

By: Matt Jordan (mjordan) 2015-02-16 12:16:11.502-0600

We need the PJSIP message traffic as well. Please enable this using {{pjsip set logger on}}, and provide the full debug capture with the message traffic.

By: PowerPBX (PowerPBX) 2015-02-16 15:03:53.372-0600

See attached debug log with pjsip logging enabled.

By: PowerPBX (PowerPBX) 2015-02-25 12:19:54.222-0600

Hi, would it be possible for me to view or get a copy of  [SWP-7799|https://jira.digium.com/browse/SWP-7799] ?

By: Richard Mudgett (rmudgett) 2015-02-25 12:24:51.256-0600

The SWP-7799 issue is an internal copy of this issue used by Digium for issue prioritization purposes.  Anything that happens will be reported here.

By: Sean Bright (seanbright) 2015-05-13 09:39:09.879-0500

I uploaded a preliminary patch that at least gets audio flowing. An error is spewed to the console during the entire session:

   {{codec.c: Unable to calculate samples for codec opus}}

I believe this is because I am using WebRTC to test and the leg from the browser is SRTP while the leg to my test client is not, so Asterisk has to "unwrap" the SRTP packet... But I don't have the time to work it out now.

By: Matt Jordan (mjordan) 2015-06-16 10:57:47.464-0500

This actually would be a bug in whatever {{codec_opus}} is being used - it hasn't defined the {{samples_count}} callback on the {{ast_codec}} struct, and so Asterisk has no way to determine how many samples are in the given audio frame.

Since that's an issue in a module outside Asterisk, I'm going to close this issue as fixed (thanks [~seanbright])

By: Matt Jordan (mjordan) 2015-06-16 10:59:12.338-0500

Or not, since the patch wasn't put up for review and/or merged. Whoops :-)

By: Sean Bright (seanbright) 2015-06-16 11:08:27.551-0500

We're talking about passthrough, so no {{codec_opus}} is loaded. Asterisk defines the opus ast_codec struct at line ~700 of {{main/codec_builtin.c}} and doesn't include the {{samples_count}} callback (because the stream needs to be decoded to determine that information).

The part I was getting stuck on is why Asterisk needs to care about the number of samples for the purposes of passthrough, and I don't know enough about Asterisk's RTP stack to make an intelligent guess.

By: Matt Jordan (mjordan) 2015-06-16 11:28:40.135-0500

Well, rats. Hm.

That would be a bug as well.

By: Alexander Traud (traud) 2015-11-06 07:47:00.445-0600

Sean, thank you for your patch. I took it over for review because it works here and I need it. I hope, you do not mind. About that warning message {{ast_codec_samples_count}}: Please, open a new issue and describe your setup in greater detail. Because, I am not able to reproduce that warning yet (chan_pjsip pass-through, chan_pjsip transcoding, internally or bridged to chan_sip). I would be very interested in that, because I have two transcoding modules myself which (would) need the amount of samples calculated from actual data in the payload. So, I am not sure either why pass-through needs that information.

By: Sean Bright (seanbright) 2015-11-11 11:20:38.088-0600

What was the fix? Not seeing any patches in gerrit?

Scratch that - I see it now