Jonas Kellens
2010-Aug-02 12:12 UTC
[asterisk-users] Codec negotiation : expecting G726, getting G711a (alaw)
Hello list, Grandstream GXP2010 phone calling to Snom 320, Asterisk in the middle. Grandstream allows for 8 different codec specifications. I have defined them as 4 x G726 & 4 x alaw. Snom allow for 7 different codec specifications. I have defined them as 3 x G726 & 4 x G729. The SIP peers are both defined as : disallow=all allow=g726 allow=alaw allow=g729 allow=gsm This is the SIP trace : INVITE sip:20 at 192.168.1.150 SIP/2.0 Via: SIP/2.0/UDP 192.168.1.102:5062;branch=z9hG4bK1dc39a962389c1a9 From: "User" <sip:user at 192.168.1.150>;tag=2383fb163ee6befa To: <sip:20 at 192.168.1.150> Contact: <sip:user at 192.168.1.102:5062;transport=udp> Supported: replaces, timer, path Proxy-Authorization: Digest username="user", realm="domain.be", algorithm=MD5, uri="sip:20 at 192.168.1.150", nonce="1ae22736", response="c90d0d9bf1f3c2bbc020651a5b67b608" Call-ID: 8910dbc6f2d5f71f at 192.168.1.102 CSeq: 35396 INVITE *User-Agent: Grandstream GXP2010 1.2.1.4* Max-Forwards: 70 Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE,UPDATE,PRACK,MESSAGE Content-Type: application/sdp Content-Length: 250 v=0 o=user 8000 8001 IN IP4 192.168.1.102 s=SIP Call c=IN IP4 192.168.1.102 t=0 0 m=audio 10126 RTP/AVP 2 8 101 a=sendrecv *a=rtpmap:2 G726-32/8000 a=rtpmap:8 PCMA/8000* a=ptime:20 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-11 <-------------> [Aug 2 13:56:57] --- (14 headers 12 lines) --- [Aug 2 13:56:57] Sending to 192.168.1.102 : 5062 (NAT) [Aug 2 13:56:57] Using INVITE request as basis request - 8910dbc6f2d5f71f at 192.168.1.102 [Aug 2 13:56:57] Found user 'user' [Aug 2 13:56:57] Found RTP audio format 2 [Aug 2 13:56:57] Found RTP audio format 8 [Aug 2 13:56:57] Found RTP audio format 101 [Aug 2 13:56:57] Found audio description format G726-32 for ID 2 [Aug 2 13:56:57] Found audio description format PCMA for ID 8 [Aug 2 13:56:57] Found audio description format telephone-event for ID 101 *[Aug 2 13:56:57] Capabilities: us - 0x90a (gsm|alaw|g726|g729), peer - audio=0x808 (alaw|g726)/video=0x0 (nothing), combined - 0x808 (alaw|g726)* [Aug 2 13:56:57] Non-codec capabilities (dtmf): us - 0x1 (telephone-event), peer - 0x1 (telephone-event), combined - 0x1 (telephone-event) [Aug 2 13:56:57] Peer audio RTP is at port 192.168.1.102:10126 [Aug 2 13:56:57] Looking for 20 in from-STERKEN (domain 192.168.1.150) [Aug 2 13:56:57] list_route: hop: <sip:user at 192.168.1.102:5062;transport=udp> [Aug 2 13:56:57] <--- Transmitting (NAT) to 192.168.1.102:5062 ---> SIP/2.0 100 Trying Via: SIP/2.0/UDP 192.168.1.102:5062;branch=z9hG4bK1dc39a962389c1a9;received=192.168.1.102 From: "User" <sip:user at 192.168.1.150>;tag=2383fb163ee6befa To: <sip:20 at 192.168.1.150> Call-ID: 8910dbc6f2d5f71f at 192.168.1.102 CSeq: 35396 INVITE User-Agent: my-asterisk-server Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces Contact: <sip:20 at 192.168.1.150> Content-Length: 0 <-------------> [Aug 2 13:56:57] --- (11 headers 0 lines) --- [Aug 2 13:56:57] SIP Response message for INCOMING dialog NOTIFY arrived [Aug 2 13:56:57] -- SIP/sterkendries2-00000054 is ringing [Aug 2 13:56:57] <--- Transmitting (NAT) to 192.168.1.102:5062 ---> SIP/2.0 180 Ringing Via: SIP/2.0/UDP 192.168.1.102:5062;branch=z9hG4bK1dc39a962389c1a9;received=192.168.1.102 From: "User" <sip:user at 192.168.1.150>;tag=2383fb163ee6befa To: <sip:20 at 192.168.1.150>;tag=as655a8251 Call-ID: 8910dbc6f2d5f71f at 192.168.1.102 CSeq: 35396 INVITE *User-Agent: my-asterisk-server* Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces Contact: <sip:20 at 192.168.1.150> Content-Length: 0 --- [Aug 2 13:57:00] Extension Changed 20[105002-blf] new state InUse for Notify User user [Aug 2 13:57:00] -- SIP/sterkendries2-00000054 answered SIP/user-00000053 [Aug 2 13:57:00] Audio is at 192.168.1.150 port 11500 [Aug 2 13:57:00] Adding codec 0x8 (alaw) to SDP [Aug 2 13:57:00] Adding codec 0x800 (g726) to SDP [Aug 2 13:57:00] Adding non-codec 0x1 (telephone-event) to SDP [Aug 2 13:57:00] <--- Reliably Transmitting (NAT) to 192.168.1.102:5062 ---> SIP/2.0 200 OK Via: SIP/2.0/UDP 192.168.1.102:5062;branch=z9hG4bK1dc39a962389c1a9;received=192.168.1.102 From: "User" <sip:user at 192.168.1.150>;tag=2383fb163ee6befa To: <sip:20 at 192.168.1.150>;tag=as655a8251 Call-ID: 8910dbc6f2d5f71f at 192.168.1.102 CSeq: 35396 INVITE *User-Agent: my-asterisk-server* Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces Contact: <sip:20 at 192.168.1.150> Content-Type: application/sdp Content-Length: 267 v=0 o=root 1947 1947 IN IP4 192.168.1.150 s=session c=IN IP4 192.168.1.150 t=0 0 m=audio 11500 RTP/AVP 8 2 101 *a=rtpmap:8 PCMA/8000 a=rtpmap:2 G726-32/8000* a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv <-------------> [Aug 2 13:57:00] --- (11 headers 0 lines) --- [Aug 2 13:57:00] SIP Response message for INCOMING dialog NOTIFY arrived [Aug 2 13:57:00] <--- SIP read from 192.168.1.102:5062 ---> ACK sip:20 at 192.168.1.150 SIP/2.0 Via: SIP/2.0/UDP 192.168.1.102:5062;branch=z9hG4bK76a685e83ba8aef8 From: "User" <sip:user at 192.168.1.150>;tag=2383fb163ee6befa To: <sip:20 at 192.168.1.150>;tag=as655a8251 Contact: <sip:user at 192.168.1.102:5062;transport=udp> Supported: path Proxy-Authorization: Digest username="user", realm="domain.be", algorithm=MD5, uri="sip:20 at 192.168.1.150", nonce="1ae22736", response="c90d0d9bf1f3c2bbc020651a5b67b608" Call-ID: 8910dbc6f2d5f71f at 192.168.1.102 CSeq: 35396 ACK *User-Agent: Grandstream GXP2010 1.2.1.4* Max-Forwards: 70 Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE,UPDATE,PRACK,MESSAGE Content-Length: 0 Question 1 : *[Aug 2 13:56:57] Capabilities: us - 0x90a (gsm|alaw|g726|g729), peer - audio=0x808 (alaw|g726)/video=0x0 (nothing), combined - 0x808 (alaw|g726)* why is combined alaw|g726 and not g726|alaw (reverse) ?? Question 2 : why do I see on my Grandstream phone that the codec being used is alaw in stead of g726 ?? Question 3 : How can I get g726 as first preferred codec ?? Kind regards, Jonas. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100802/9091f031/attachment.htm
Philipp von Klitzing
2010-Aug-03 11:21 UTC
[asterisk-users] Codec negotiation : expecting G726, getting G711a (alaw)
Hi!> Question 1 : > [Aug 2 13:56:57] Capabilities: us - 0x90a (gsm|alaw|g726|g729), peer - > audio=0x808 (alaw|g726)/video=0x0 (nothing), combined - 0x808 (alaw|g726) > why is combined alaw|g726 and not g726|alaw (reverse) ??Guess: Here the order presented has no meaning for the order of codec negotiation.> Question 2 : > why do I see on my Grandstream phone that the codec being used is alaw in > stead of g726 ??Because that is what the phone and Asterisk have negotiated. ;-)> Question 3 : > How can I get g726 as first preferred codec ??Which Asterisk version are you using? * check if you have disallow/allow settings in the [general] section of sip.conf. Depending on your Asterisk version only the order in [general] would be respected, but not the order in the individual sip peer/user definition * look at the variable SIP_CODEC for the inbound (first) call leg, and in Asterisk 1.8 (or 1.6.2?) also at SIP_CODEC_OUTBOUND * many Asterisk operators have applied the third party "codec negotiation patch" Philipp
Jonas Kellens
2010-Aug-03 13:15 UTC
[asterisk-users] Codec negotiation : expecting G726, getting G711a (alaw)
Hello Philipp, thank you for your answer. On 08/03/2010 01:21 PM, Philipp von Klitzing wrote:>> Question 3 : >> How can I get g726 as first preferred codec ?? >> > Which Asterisk version are you using? >Using Asterisk 1.4.30> * check if you have disallow/allow settings in the [general] section of > sip.conf. Depending on your Asterisk version only the order in [general] > would be respected, but not the order in the individual sip peer/user > definition >In the [general] section of sip.conf I have : disallow=all allow=g726 allow=alaw allow=g729 allow=gsm> * look at the variable SIP_CODEC for the inbound (first) call leg, and in > Asterisk 1.8 (or 1.6.2?) also at SIP_CODEC_OUTBOUND >When I read the value of this variable just before the Dial()-statement, it is empty. Jonas.
Philipp von Klitzing
2010-Aug-03 14:21 UTC
[asterisk-users] Codec negotiation : expecting G726, getting G711a (alaw)
Also: There are at least two implementations of the g726 codec, i.e. g726 and g726aal2. For this also look at the g726nonstandard setting in sip.conf. It is quite possible that your problem is here. For quick testing to see if the codec works at all: Configure your phones to do g726 only (so no alaw/ualaw at all). Philipp
Philipp von Klitzing
2010-Aug-03 14:29 UTC
[asterisk-users] Codec negotiation : expecting G726, getting G711a (alaw)
Hi!> In the [general] section of sip.conf I have : > > disallow=all > allow=g726 > allow=alaw > allow=g729 > allow=gsmSo change the order there and see what happens.> > * look at the variable SIP_CODEC for the inbound (first) call leg, and > > in Asterisk 1.8 (or 1.6.2?) also at SIP_CODEC_OUTBOUND > > When I read the value of this variable just before the Dial()-statement, > it is empty.You need to set it, not read it. Philipp
Jonas Kellens
2010-Aug-05 07:27 UTC
[asterisk-users] Codec negotiation : expecting G726, getting G711a (alaw)
On 08/03/2010 04:21 PM, Philipp von Klitzing wrote:> Also: > > There are at least two implementations of the g726 codec, i.e. g726 and > g726aal2. For this also look at the g726nonstandard setting in sip.conf. > It is quite possible that your problem is here. >I have the following setting in sip.conf : g726nonstandard = no ; If the peer negotiates G726-32 audio, use AAL2 packing ; order instead of RFC3551 packing order (this is required ; for Sipura and Grandstream ATAs, among others). This is ; contrary to the RFC3551 specification, the peer _should_ ; be negotiating AAL2-G726-32 instead (so it uses RFC3551)> For quick testing to see if the codec works at all: Configure your phones > to do g726 only (so no alaw/ualaw at all). >Only when I configure my Grandstream to use only G726 (I have 8 choices), I see that the g726-codec is used. When I configure 7 x g726 and 1 x alaw, then again alaw is used ! Is it normal that Asterisk has such a great preference for alaw ?! The moment the peer suggests codec alaw (even if it is last choice), alaw is chosen by Asterisk for the communication. Kind regards, Jonas.
Philipp von Klitzing
2010-Aug-05 10:03 UTC
[asterisk-users] Codec negotiation : expecting G726, getting G711a (alaw)
> Only when I configure my Grandstream to use only G726 (I have 8 > choices), I see that the g726-codec is used. > When I configure 7 x g726 and 1 x alaw, then again alaw is used ! > > Is it normal that Asterisk has such a great preference for alaw ?! The > moment the peer suggests codec alaw (even if it is last choice), alaw is > chosen by Asterisk for the communication.Please look at the first part of my last message (order of codecs in the [general] section) and apply changes there, followed by a "sip reload". Philipp