seanbright / asterisk-opus

Opus (transcoding) and VP8 (passthrough) support for Asterisk, needed for a better WebRTC integration
35 stars 14 forks source link

Opus codec installs, but I can't seem to make it work #12

Closed KevinSeghetti closed 9 years ago

KevinSeghetti commented 9 years ago

If I try dialing in from PhonerLite with only the Opus codec selected, asterisk gives me "No compatible codecs, not accepting this offer!" (the other device I am dialing also supposedly has Opus support, but unsure if it the same bitrate, but has other codecs enabled as well. If I understand correctly asterisk should trancode in that case instead of refuse the call).

I am running 13.5.0, built from source with this mod applied. 'core show codecs' includes: 28 audio opus (Opus Codec) 'opus show' gives me: 0/0 encoders/decoders are in use.

'core show help opus' gives me opus show -- Display Opus codec utilization.

is that supposed to be the only command opus supports, or does that indicate something has gone wrong?

I have built with: ./configure --with-pjproject --with-ssl --with-srtp --enable-dev-mode

Any help debugging this would be greatly appreciated.

KevinSeghetti commented 9 years ago

Here is a SIP log of an incoming call from PhonerLite, up to the point where it says no compatible codecs:

sip set debug on
SIP Debugging enabled

<--- SIP read from UDP:208.74.110.40:1024 --->
INVITE sip:100@**redacted sever name** SIP/2.0
Via: SIP/2.0/UDP 208.74.110.40:1024;branch=z9hG4bK0071db2f2b49e511a90292d628f5615f;rport
From: "PhonerLite" <sip:ktswindows@**redacted sever name**>;tag=3875399682
To: <sip:100@**redacted sever name**>
Call-ID: 0071DB2F-2B49-E511-A901-92D628F5615F@192.168.1.30
CSeq: 13 INVITE
Contact: <sip:ktswindows@208.74.110.40:1024>
Content-Type: application/sdp
Allow: INVITE, OPTIONS, ACK, BYE, CANCEL, INFO, NOTIFY, MESSAGE, UPDATE
Max-Forwards: 70
Supported: 100rel, replaces, from-change
P-Early-Media: supported
User-Agent: SIPPER for PhonerLite
P-Preferred-Identity: <sip:ktswindows@**redacted sever name**>
Content-Length: 183

v=0
o=- 1616703947 1 IN IP4 208.74.110.40
s=SIPPER for PhonerLite
c=IN IP4 208.74.110.40
t=0 0
m=audio 5062 RTP/AVP 107
a=rtpmap:107 opus/48000/2
a=ssrc:802519144
a=sendrecv
<------------->
--- (15 headers 9 lines) ---
Sending to 208.74.110.40:1024 (NAT)
Sending to 208.74.110.40:1024 (NAT)
Using INVITE request as basis request - 0071DB2F-2B49-E511-A901-92D628F5615F@192.168.1.30
Found peer 'ktswindows' for 'ktswindows' from 208.74.110.40:1024

<--- Reliably Transmitting (NAT) to 208.74.110.40:1024 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 208.74.110.40:1024;branch=z9hG4bK0071db2f2b49e511a90292d628f5615f;received=208.74.110.40;rport=1024
From: "PhonerLite" <sip:ktswindows@**redacted sever name**>;tag=3875399682
To: <sip:100@**redacted sever name**>;tag=as49dba143
Call-ID: 0071DB2F-2B49-E511-A901-92D628F5615F@192.168.1.30
CSeq: 13 INVITE
Server: Asterisk PBX 13.5.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="1ab9b4d5"
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog '0071DB2F-2B49-E511-A901-92D628F5615F@192.168.1.30' in 32000 ms (Method: INVITE)

<--- SIP read from UDP:208.74.110.40:1024 --->
ACK sip:100@**redacted sever name** SIP/2.0
Via: SIP/2.0/UDP 208.74.110.40:1024;branch=z9hG4bK0071db2f2b49e511a90292d628f5615f;rport
From: "PhonerLite" <sip:ktswindows@**redacted sever name**>;tag=3875399682
To: <sip:100@**redacted sever name**>;tag=as49dba143
Call-ID: 0071DB2F-2B49-E511-A901-92D628F5615F@192.168.1.30
CSeq: 13 ACK
Content-Length: 0

<------------->
--- (7 headers 0 lines) ---

<--- SIP read from UDP:208.74.110.40:1024 --->
INVITE sip:100@**redacted sever name** SIP/2.0
Via: SIP/2.0/UDP 208.74.110.40:1024;branch=z9hG4bK0071db2f2b49e511a90392d628f5615f;rport
From: "PhonerLite" <sip:ktswindows@**redacted sever name**>;tag=3875399682
To: <sip:100@**redacted sever name**>
Call-ID: 0071DB2F-2B49-E511-A901-92D628F5615F@192.168.1.30
CSeq: 14 INVITE
Contact: <sip:ktswindows@208.74.110.40:1024>
Authorization: Digest username="ktswindows", realm="asterisk", nonce="1ab9b4d5", uri="sip:100@**redacted sever name**", response="55323560acb5aea3f10fbcc8edb96539", algorithm=MD5
Content-Type: application/sdp
Allow: INVITE, OPTIONS, ACK, BYE, CANCEL, INFO, NOTIFY, MESSAGE, UPDATE
Max-Forwards: 70
Supported: 100rel, replaces, from-change
P-Early-Media: supported
User-Agent: SIPPER for PhonerLite
P-Preferred-Identity: <sip:ktswindows@**redacted sever name**>
Content-Length: 183

v=0
o=- 1616703947 1 IN IP4 208.74.110.40
s=SIPPER for PhonerLite
c=IN IP4 208.74.110.40
t=0 0
m=audio 5062 RTP/AVP 107
a=rtpmap:107 opus/48000/2
a=ssrc:802519144
a=sendrecv
<------------->
--- (16 headers 9 lines) ---
Sending to 208.74.110.40:1024 (NAT)
Using INVITE request as basis request - 0071DB2F-2B49-E511-A901-92D628F5615F@192.168.1.30
Found peer 'ktswindows' for 'ktswindows' from 208.74.110.40:1024
  == Using SIP RTP CoS mark 5
Found RTP audio format 107
Found audio description format opus for ID 107
[Aug 24 19:09:13] NOTICE[25071][C-00000001]: chan_sip.c:10563 process_sdp: No compatible codecs, not accepting this offer!
stokkeland commented 9 years ago

just FYI - I used the 13.3 patch with asterisk 13.5.0 and that seems to work fine.

only opus command i have is also just opus show

core show codec: 28 audio opus (Opus Codec)

KevinSeghetti commented 9 years ago

I have done some digging into the sip incoming call code (where it prints that rejection notice), and have learned the SIP driver itself has a list of codecs, and opus isn't on it, which is what is causing the call to get rejected.

If I do: 'sip show settings' I get a lot of output, one of the lines under Global Signalling Settings is: Codecs: (ulaw|alaw|gsm|h263)

I suspect for those the Opus codec is working for it appears in that list. (I do have Opus showing in 'core show codecs').

(I am new to asterisk, so I could have just made a configuration mistake somewhere. I am mostly using the configuration you get from make samples).

stokkeland commented 9 years ago

Kevin - in your sip.conf - under general and the user, do you have allow=opus ?

KevinSeghetti commented 9 years ago

That was the problem. I mistakenly assumed the default was 'allow=all', and failed to specify. (now mildly curious how the default list of codecs is determined).

Either allow=opus or the more general allow=all makes things work. Yay!

(I actually thought I tried allow=all at one point, but must have biffed it somehow)

Might want to mention that in the README, that one needs to do one of those to have the code enabled.

Thanks for the help!