PJSIP Codec Negotiation Issue

Home » Asterisk Users » PJSIP Codec Negotiation Issue
Asterisk Users 3 Comments

Hi List

I have come over a codec negotiation issue.

A (asterisk) is sending in INVITE containing
* opus (type 107)
* g722
* alaw (type 8)

B answers with 183 containing SDP
* alaw a=sendrecv

B then answer the call with 200 and NO SDP

I suppose that result in B telling us, it only support alaw.

But ‘set rtp debug on’ show B sending type 8 and A sending type 107. As the remote only announced to be capable of 8, shouldn’t asterisk send type 8? Or even send a Re-Invite to tell it switches to alaw?

Also reading:
https://wiki.asterisk.org/wiki/display/AST/PJSIP+Advanced+Codec+Negotiation

does not explain what I see.


Mit freundlichen Grüssen

-Benoît Panizzon- @ HomeOffice und normal erreichbar

I m p r o W a r e A G – Leiter Commerce Kunden

3 thoughts on - PJSIP Codec Negotiation Issue

  • What is the specific issue that is happening? If it’s that one call leg negotiated at opus and the other at alaw, that is currently the way things still work. Each call leg is still ultimately negotiated independently so the A leg can be opus, and the B leg can be alaw. I hope that we’re able to eventually return to codec negotiation work to improve that with the foundation put into place previously, but I don’t know when that will happen.

  • Hi Joshua

    It looks like I had some other misconfiguration also causing some weird effects.

    Well wheat I wonder is how codec negotiation should work in this situation.

    I am aware, the SDP defines what the device can send, not what it is able to receive. But can’t we assume this is the same?

    Device A <=> Asterisk <=> TSP Trunk <=> [WORLD] <=> Device B

    Let’s assume Device B is alaw only, but we don’t know, it could also be possible of better quality codecs.

    Device A support opus,g711,alaw

    So towards Device A I would define !all,opus,g722,alaw And towards the TSP Trunk the same.

    But when Device B replies with an SDP containing ‘only’ alaw, shouldn’t this SDP be passed to Device A which then hopefully use the same codec?

    Of course Device A can receive alaw and send opus. But device B might not understand opus.

    And I just realized, this advanced codec negotiation is only available on Asterisk 18. I’m still on 16 🙂


    Mit freundlichen Grüssen

    -Benoît Panizzon- @ HomeOffice und normal erreichbar

    I m p r o W a r e A G – Leiter Commerce Kunden

  • Asterisk isn’t a SIP proxy, so there is no passing of SDP. Each call leg is currently independent on the answer. So between Device A and Asterisk is negotiated separately from Asterisk and Device B. Each side can end up using different codecs, and Asterisk would transcode if possible.