-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mode-set issue when transcoding not in use #10
Comments
Asterisk is designed not as SIP Proxy but Media Gateway. The Asterisk Team therefore claims that the SDP negotiation does not propagate between the participants but happens only with Asterisk. Therefore, it would be the job of Asterisk to transcode to lower modes. That is the theory and the official line. As you noticed, the Callee does get the mode-set of the Caller. Therefore, I am not sure what the Asterisk Team is about. Or stated differently: I am not going to hide myself behind such an explanation. Your Caller → Callee path is one of my usual test-cases and (therefore) works. If I am not totally mistaken, I tested the reverse – your mentioned scenario – at least once as well. I thought it works. To debug this yourself, I recommend to print/log the pointer address of all I had to patch/fix a lot code parts which killed the format attributes unintentionally. Just recently, I found another one. All known issues are fixed in the current Asterisk release. Nevertheless:
|
Thanks for the feedback! I'm not at work this week, but I'll get back to you after I've had time to debug more. We use a custom version (to fit in our IMS network) based on 13.8, with a lot of newer relevant commits backported. I will check if your patches is in or not. Another question. It seems like you've good knowledge for Asterisk and RTP stuff. Would you be interested in doing some paid work for our company? We currently do not have any specific cases, but we're interested getting in contact with experts in different fields. I work for a company owned by a large mobile network operator. |
Investigated a little bit further. What I see:
However, in the amr_generate_sdp_fmtp for forwarding the 183 the first format is used, and here there is no limitation of mode-set again. This hack in the getjoint function gives the correct reply to the caller: Questions/Thoughts:
|
With SIP status 183, you are about the answer (SDP response) of the Callee?
When it comes to the implementation in Asterisk, an existing ast_format (or its attribute) may not be changed but a new ast_format (with new attribute) must be created/returned instead. That is an architectural thing. From my experience, if you do not change a ‘cached’ ast_format, your are fine. However, you won’t be able to submit such a change into Asterisk because the Asterisk Team sees a ast_format (and all structures included) as immutable ‘objects’. Those may only be copied/replaced at runtime, their value/content must not be edited.
Not sure, I got that question.
FreeSWITCH, yes. Asterisk, no. Or stated differently: From the point of Asterisk, you have a transcoding situation actually. Asterisk should transcode but my AMR module is not designed to do so in a scenario like yours. Consequently, one approach is to get that SDP negotiation going. Another one would be to transcode even in such a case.
There is a hot debate in the SIP community, whether SDP negotiation (of AMR) works that way at all, whether the Callee is able to change the incoming request in his answer/response at all. Some claim that there is only accept/reject and changes were not allowed. Therefore, your call would not be created at all, because the Caller did not offer a mode-set compatible with your Callee. When you look at newer RFCs and 3GPP EVS, you get a picture of that mess. For example, according to those, you would have to create at least two rtpmaps, one fmtp with octet-align=0 and another with octet-align=1. I am not aware of any reason for that. SDP is able to negotiate that. If the caller is specifying something, he allows all. If the caller allows a set, the callee is able to go for a subset. So yes, I am on your side. 3GPP, ETSI, and IETF are not.
I have to double-check what is wrong exactly or whether this is possible with Asterisk at all. Currently, Asterisk uses the joined format between Caller/Asterisk in both
I sent you an E-mail to discuss this off-GitHub. |
Yes.
Could we implement a compare function for the AMR format as well, like for example in the SILK format? SILK also compares sample rate to report them as equal. We could do this for (at least) mode-set. Of course, this will burn extra cpu and potentially add delay, distortion etc. Most of my calls do not involve transcoding today.
I already have this in the IMS network. Had to make a workaround ignoring octet-aligned (bw efficient is supported by all devices anyway), or else I had a situation where Asterisk choose octet-align on one leg and bw efficient on the other - without transcoding. I will dig more into this when I'm back at work next week. |
I've look a bit more into this. However, I'm not quite sure how it's intended to work. What seems reasonable to me for a simple call through asterisk with AMR-WB all the way:
There will in the end (after call has early media or is answered) be two formats containing attributes for each call leg (4 in total). However, this is what it seems to do now:
So, for the first call leg there's only one format. For the second call leg there two. The one from the first leg and the one created by 'amr_parse_sdp_fmtp'. Possible solutions?
|
Hello! I made a proof of concept of something like approach 1 above. This is dirty work, but it seems to do the trick. In short:
I only replace format in the backwards direction (after parsing fmtp for outgoing_calls only). I would really like your opinion :) |
Hello!
Note that this regarding how the amr format works, and not the transcoding module.
Consider this scenario:
Caller -> Asterisk -> Callee.
AMR-WB used all the way.
Caller invites with all modes available. This is also offered in Asterisk's invite to the Callee.
Callee's 183 response is with mode-set "0,1,2" only.
Asterisk will send a 183 to the Caller with all modes (which is the same as the Caller has sent in the first Invite).
The problem now is when the Caller sends a higher rate than the Callee can handle (mobile network), which for some handsets will result in distorted audio. Scenario is a VoLTE mobile calling a mobile which is on 2G or 3G.
Current workaround is changing this line:
.mode_set = 0, /* all modes /
to:
.mode_set = 7, / mode 0,1,2 */
But that limits the possible call quality.
I assume:
The correct thing would be to pass mode "0,1,2" all the way from the Callee to the Caller? This will probably need a core change in Asterisk?
I'm not asking for a fix. Just some guidance for further debugging myself :-)
The text was updated successfully, but these errors were encountered: