owntone / owntone-server

Linux/FreeBSD DAAP (iTunes) and MPD audio server with support for AirPlay 1 and 2 speakers (multiroom), Apple Remote (and compatibles), Chromecast, Spotify and internet radio.
https://owntone.github.io/owntone-server
GNU General Public License v2.0
2.09k stars 237 forks source link

sonos beam airplay2 no volume control #613

Closed snizzleorg closed 3 years ago

snizzleorg commented 6 years ago

I have a sonos beam with airplay2 and it is working nicely. Only problem is that I cannot control the volume from its buttons. unfortunately I do not even see anything in the log (debug level) when I press one of the buttons.

If I play straight from the iPhone to the beam via airplay I can control the volume. Any idea on how to get more info on this?

trusted networks is set to any

cosinekitty commented 6 years ago

I have a Sonos One here. I will try later today with Wireshark and see if I can figure out what's going on. I will report back when I know something.

cosinekitty commented 6 years ago

Here is what I see. I have a Pioneer speaker whose volume buttons work fine with forked-daapd. The Sonos One volume buttons do not work with forked-daapd, just like what @snizzleorg reports about the Sonos Beam. The difference is, when I press the increase or decrease volume button on the Pioneer speaker, it sends a message like this to forked-daapd:

GET /ctrl-int/1/setproperty?dmcp.device-volume=-12.670807 HTTP/1.1
Host: spearmint.local.
Active-Remote: 472056063

And forked-daapd responds with:

HTTP/1.1 204 No Content
DAAP-Server: forked-daapd/26.4
Content-Type: application/x-dmap-tagged
Access-Control-Allow-Origin: *
Date: Sat, 27 Oct 2018 16:29:42 GMT

When I do the same with the Sonos One speaker, nothing at all happens in the network traffic.

When I play from the Spotify app running on my iPhone, the Sonos One volume buttons work. Unfortunately, I don't know how to capture this network traffic.

If anyone knows what to look for, I will be happy to provide more details. I looked through the connection traffic with both the Pioneer and Sonos One speakers, and I don't see anything obviously different.

snizzleorg commented 6 years ago

Can it be that available features or controls are communicated in the setup process?

cosinekitty commented 6 years ago

That is possible. Here are more details. First I will show the conversation between forked-daapd and my Pioneer speaker. Hopefully it is clear which parts are from forked-daapd and which are from the Pioneer. Note the volume commands at the end, which coincide with me pressing the speaker's volume buttons.

OPTIONS * RTSP/1.0
CSeq: 1
User-Agent: forked-daapd/26.4
Client-Instance: CE0E95D0385D5BBE
DACP-ID: CE0E95D0385D5BBE
Active-Remote: 472056063

RTSP/1.0 200 OK
Public: ANNOUNCE, SETUP, RECORD, PAUSE, FLUSH, TEARDOWN, OPTIONS, GET_PARAMETER, SET_PARAMETER, POST, GET
Server: AirTunes/103.2
CSeq: 1

POST /auth-setup RTSP/1.0
CSeq: 2
User-Agent: forked-daapd/26.4
Client-Instance: CE0E95D0385D5BBE
DACP-ID: CE0E95D0385D5BBE
Active-Remote: 472056063
Content-Type: application/octet-stream
Content-Length: 33
<...>

RTSP/1.0 200 OK
Content-Type: application/octet-stream
Content-Length: 1076
Server: AirTunes/103.2
CSeq: 2
<...>

ANNOUNCE rtsp://192.168.1.216/1523689283 RTSP/1.0
CSeq: 3
User-Agent: forked-daapd/26.4
Client-Instance: CE0E95D0385D5BBE
DACP-ID: CE0E95D0385D5BBE
Active-Remote: 472056063
Content-Type: application/sdp
Content-Length: 184

v=0
o=iTunes 1523689283 0 IN IP4 192.168.1.216
s=iTunes
c=IN IP4 192.168.1.204
t=0 0
m=audio 0 RTP/AVP 96
a=rtpmap:96 AppleLossless
a=fmtp:96 352 0 16 40 10 14 2 255 0 0 44100

RTSP/1.0 200 OK
Server: AirTunes/103.2
CSeq: 3

SETUP rtsp://192.168.1.216/1523689283 RTSP/1.0
CSeq: 4
User-Agent: forked-daapd/26.4
Client-Instance: CE0E95D0385D5BBE
DACP-ID: CE0E95D0385D5BBE
Active-Remote: 472056063
Transport: RTP/AVP/UDP;unicast;interleaved=0-1;mode=record;control_port=43135;timing_port=33826

RTSP/1.0 200 OK
Transport: RTP/AVP/UDP;unicast;mode=record;server_port=1418;control_port=1419;timing_port=1420
Session: 1
Audio-Jack-Status: connected; type=analog
Server: AirTunes/103.2
CSeq: 4

RECORD rtsp://192.168.1.216/1523689283 RTSP/1.0
CSeq: 5
User-Agent: forked-daapd/26.4
Client-Instance: CE0E95D0385D5BBE
DACP-ID: CE0E95D0385D5BBE
Active-Remote: 472056063
Session: 1
Range: npt=0-
RTP-Info: seq=29400;rtptime=1166588357

RTSP/1.0 200 OK
Audio-Latency: 4096
Server: AirTunes/103.2
CSeq: 5

SET_PARAMETER rtsp://192.168.1.216/1523689283 RTSP/1.0
CSeq: 6
User-Agent: forked-daapd/26.4
Client-Instance: CE0E95D0385D5BBE
DACP-ID: CE0E95D0385D5BBE
Active-Remote: 472056063
Session: 1
Content-Type: text/parameters
Content-Length: 20

volume: -12.899999

RTSP/1.0 200 OK
Server: AirTunes/103.2
CSeq: 6

GET /ctrl-int/1/setproperty?dmcp.device-busy=0 HTTP/1.1
Host: spearmint.local.
Active-Remote: 472056063

HTTP/1.1 204 No Content
DAAP-Server: forked-daapd/26.4
Content-Type: application/x-dmap-tagged
Access-Control-Allow-Origin: *
Date: Sat, 27 Oct 2018 16:29:42 GMT

GET /ctrl-int/1/setproperty?dmcp.device-volume=-12.670807 HTTP/1.1
Host: spearmint.local.
Active-Remote: 472056063

HTTP/1.1 204 No Content
DAAP-Server: forked-daapd/26.4
Content-Type: application/x-dmap-tagged
Access-Control-Allow-Origin: *
Date: Sat, 27 Oct 2018 16:29:42 GMT

GET /ctrl-int/1/setproperty?dmcp.device-volume=-11.925465 HTTP/1.1
Host: spearmint.local.
Active-Remote: 472056063

HTTP/1.1 204 No Content
DAAP-Server: forked-daapd/26.4
Content-Type: application/x-dmap-tagged
Access-Control-Allow-Origin: *
Date: Sat, 27 Oct 2018 16:30:09 GMT

Now here is the conversation between forked-daapd and the Sonos One speaker:

OPTIONS * RTSP/1.0
CSeq: 1
User-Agent: forked-daapd/26.4
Client-Instance: CE0E95D0385D5BBE
DACP-ID: CE0E95D0385D5BBE
Active-Remote: 3401786252

RTSP/1.0 200 OK
Public: ANNOUNCE, SETUP, RECORD, PAUSE, FLUSH, FLUSHBUFFERED, TEARDOWN, OPTIONS, POST, GET, PUT
Server: AirTunes/366.0
CSeq: 1

POST /auth-setup RTSP/1.0
CSeq: 2
User-Agent: forked-daapd/26.4
Client-Instance: CE0E95D0385D5BBE
DACP-ID: CE0E95D0385D5BBE
Active-Remote: 3401786252
Content-Type: application/octet-stream
Content-Length: 33
<...>

RTSP/1.0 200 OK
Content-Length: 1076
Content-Type: application/octet-stream
Server: AirTunes/366.0
CSeq: 2
<...>

ANNOUNCE rtsp://192.168.1.216/3430791679 RTSP/1.0
CSeq: 3
User-Agent: forked-daapd/26.4
Client-Instance: CE0E95D0385D5BBE
DACP-ID: CE0E95D0385D5BBE
Active-Remote: 3401786252
Content-Type: application/sdp
Content-Length: 184

v=0
o=iTunes 3430791679 0 IN IP4 192.168.1.216
s=iTunes
c=IN IP4 192.168.1.176
t=0 0
m=audio 0 RTP/AVP 96
a=rtpmap:96 AppleLossless
a=fmtp:96 352 0 16 40 10 14 2 255 0 0 44100

RTSP/1.0 200 OK
Server: AirTunes/366.0
CSeq: 3

SETUP rtsp://192.168.1.216/3430791679 RTSP/1.0
CSeq: 4
User-Agent: forked-daapd/26.4
Client-Instance: CE0E95D0385D5BBE
DACP-ID: CE0E95D0385D5BBE
Active-Remote: 3401786252
Transport: RTP/AVP/UDP;unicast;interleaved=0-1;mode=record;control_port=43135;timing_port=33826

RTSP/1.0 200 OK
Transport: RTP/AVP/UDP;unicast;mode=record;server_port=45550;control_port=42943;timing_port=48262
Session: 1
Audio-Jack-Status: connected; type=analog
Server: AirTunes/366.0
CSeq: 4

RECORD rtsp://192.168.1.216/3430791679 RTSP/1.0
CSeq: 5
User-Agent: forked-daapd/26.4
Client-Instance: CE0E95D0385D5BBE
DACP-ID: CE0E95D0385D5BBE
Active-Remote: 3401786252
Session: 1
Range: npt=0-
RTP-Info: seq=19235;rtptime=1163010277

RTSP/1.0 200 OK
Server: AirTunes/366.0
CSeq: 5

SET_PARAMETER rtsp://192.168.1.216/3430791679 RTSP/1.0
CSeq: 6
User-Agent: forked-daapd/26.4
Client-Instance: CE0E95D0385D5BBE
DACP-ID: CE0E95D0385D5BBE
Active-Remote: 3401786252
Session: 1
Content-Type: text/parameters
Content-Length: 20

volume: -24.899999

RTSP/1.0 200 OK
Server: AirTunes/366.0
CSeq: 6

SET_PARAMETER rtsp://192.168.1.216/3430791679 RTSP/1.0
CSeq: 7
User-Agent: forked-daapd/26.4
Client-Instance: CE0E95D0385D5BBE
DACP-ID: CE0E95D0385D5BBE
Active-Remote: 3401786252
Session: 1
Content-Type: application/x-dmap-tagged
RTP-Info: rtptime=1115055937
Content-Length: 333
<... binary song metadata ...>

RTSP/1.0 200 OK
Server: AirTunes/366.0
CSeq: 7

SET_PARAMETER rtsp://192.168.1.216/3430791679 RTSP/1.0
CSeq: 8
User-Agent: forked-daapd/26.4
Client-Instance: CE0E95D0385D5BBE
DACP-ID: CE0E95D0385D5BBE
Active-Remote: 3401786252
Session: 1
Content-Type: text/parameters
Content-Length: 44

progress: 1115040577/1163010277/1266492073

RTSP/1.0 200 OK
Server: AirTunes/366.0
CSeq: 8

It might also be helpful to see the TXT records from both speakers. Here is the Pioneer's TXT record. Its name is Office.

745E1C2300FF@Office._raop._tcp                  SRV     0 0 1024 Office.local. ; Replace with unicast FQDN of target host
745E1C2300FF@Office._raop._tcp                  TXT     
"txtvers=1" 
"ch=2" 
"cn=0,1" 
"et=0,4" 
"sv=false" 
"da=true" 
"sr=44100" 
"ss=16" 
"pw=false" 
"vn=65537" 
"tp=UDP" 
"vs=103.2" 
"am=XW-SMA4" 
"fv=s1051.1000.0"

Here is the TXT record for the Sonos One speaker, which is named Garage:

7828CAC3238C@Garage._raop._tcp                  SRV     0 0 7000 Sonos-7828CAC3238C.local. ; Replace with unicast FQDN of target host
7828CAC3238C@Garage._raop._tcp                  TXT     
"cn=0,1" 
"da=true" 
"et=0,4" 
"ft=0x445F8A00,0x1C340" 
"fv=p20.46.3-57250" 
"md=0,1,2"   // 0=supports metadata, 1=supports cover art, 2=supports progress updates
"am=One" 
"sf=0x4" 
"tp=UDP" 
"vn=65537" 
"vs=366.0" 
"pk=f410d2290e85081e295313aca75693fdca2a6cb3c35b0661b795782e8f3f2358"

Note in particular the Sonos One advertises md=0,1,2 which is why forked-daapd sends metadata and progress information to the Sonos One but not the Pioneer.

Maybe you can spot something interesting that I'm missing?

snizzleorg commented 6 years ago

What hits me is that GET_PARAMETER, SET_PARAMETER are missing in the sonos but are present for the pioneer.

snizzleorg commented 6 years ago
RTSP/1.0 200 OK
Public: ANNOUNCE, SETUP, RECORD, PAUSE, FLUSH, TEARDOWN, OPTIONS, GET_PARAMETER, SET_PARAMETER, POST, GET
Server: AirTunes/103.2
CSeq: 1

and

RTSP/1.0 200 OK
Public: ANNOUNCE, SETUP, RECORD, PAUSE, FLUSH, FLUSHBUFFERED, TEARDOWN, OPTIONS, POST, GET, PUT
Server: AirTunes/366.0
CSeq: 1

the TXT record for the beam are identical only pk and am are different

cosinekitty commented 6 years ago

Yes, I noticed that too. And yet, we see the Sonos One respond with a success message when SET_PARAMETER is used to set the volume on the speaker:

SET_PARAMETER rtsp://192.168.1.216/3430791679 RTSP/1.0
CSeq: 6
User-Agent: forked-daapd/26.4
Client-Instance: CE0E95D0385D5BBE
DACP-ID: CE0E95D0385D5BBE
Active-Remote: 3401786252
Session: 1
Content-Type: text/parameters
Content-Length: 20

volume: -24.899999

RTSP/1.0 200 OK
Server: AirTunes/366.0
CSeq: 6

And the Sonos One volume changes correctly when I adjust it from the forked-daapd web UI.

But it's not clear this has anything to do with changing volume at the speaker. Maybe it does, but I don't see how.

snizzleorg commented 6 years ago

Yes it does respond correctly. but I suppose since the protocol is different version AirTunes/366 vs. Airtunes/103.2 It might think that it cannot send volume commands to forked-daapd.

Could you capture what your iPhone communicates with the sonos while airplaying to it? The volume buttons work when airplaying from iOS.

Might be worth trying if one can change the volume from the sonos when playing from iTunes to it.

cosinekitty commented 6 years ago

I don't know how to capture that traffic. I captured the traffic above by running Wireshark on the same machine as forked-daapd, so that Wireshark could filter the traffic outside WiFi's encryption and security measures. If you know how to do this, I will give it a shot.

snizzleorg commented 6 years ago

hm... me neither. But maybe trying iTunes might get you something....

cosinekitty commented 6 years ago

I just tried that... good idea. I ran iTunes 12.9.0.167 on my Windows 10 laptop and targeted the Sonos One speaker. Unfortunately, it turns out the speaker's volume buttons do not work with iTunes either! The Wireshark log shows nothing coming from the speaker when I pressed the volume buttons, just like when sending audio from forked-daapd.

ejurgensen commented 6 years ago

Some info that might help you: Speaker volume on the Pioneer works because forked-daapd makes an mdns announcement of its dacp service, and also provides the speaker with an "Active-Remote" id in the response headers.

If the Sonos One volume doesn't work with iTunes they are probably doing something significantly different.

cosinekitty commented 6 years ago

Thanks, @ejurgensen . That does make sense. I'm wondering if anyone knows of AirPlay transmitting software that (a) runs on a platform where Wireshark is supported (Linux, Windows, maybe Mac?) and (b) does whatever magic is needed to persuade the Sonos speakers to send it DACP notifications when its volume buttons are pressed? Then maybe there would be some clue what is causing the speaker to behave differently in each case.

chme commented 6 years ago

Maybe it is possible to connect the speaker and an iPhone to an access point opened on the desktop pc? Wireshark should then be able to capture the traffic between them.

cosinekitty commented 6 years ago

I tried using the Windows 10 mobile hotspot. I reconfigured my Sonos One to connect to it, and made my iPhone connect to it as a WiFi station. I can see some traffic from the speaker (SSDP and MDNS) and I can see some traffic from the phone. The weird thing is I can't see them talking to each other, even though I am playing audio from the iPhone to the speaker through this hotspot. In this mode, none of my other AirPlay speakers show up for the phone. The phone thinks it is on a little local network with only the Sonos One speaker available as an AirPlay target, as I would expect.

Wireshark had 2 options to connect to: Local Area Connection and WiFi. I tried both of them but in neither case can I see the usual RTSP or RAOP UDP traffic.

I suspect there is something about the internals of Windows and how it implements its mobile hotspot that it does not allow Wireshark to snoop on traffic between third parties. I'm guessing SSDP and MDNS are broadcast/multicast, and that works. But point-to-point conversations are hidden from my snooping.

I'm open to ideas if someone can think of something else for me to try.

snizzleorg commented 6 years ago

I tried on a mac with iTunes and the buttons for volume control work. No Idea how to use wireshark though

So I installed wireshark but no idea how top analyse this. It all looks a bit gibberish to me. I tried filtering the traffic to only show traffic with the ip of the snow beam. But I still get lots of traffic and I can make sense of it. @cosinekitty Can I maybe just send you a dump?

cosinekitty commented 6 years ago

@snizzleorg That is great news. I can borrow a Mac later today and try that with Wireshark running. I will report back here in a few hours.

snizzleorg commented 6 years ago

@cosinekitty Would still be interesting to know how to setup wireshark to get what you posted above. I get stuff like that but obviously I don't know how to read it correctly.

screenshot 2018-10-28 at 13-16-26
cosinekitty commented 6 years ago

@snizzleorg

The main thing is to right-click on just the data portion of a TCP packet in the middle window (not the whole packet), navigate into the Copy sub-menu, and choose "as printable text". In this case the traffic we are interested in will be ASCII text or mostly ASCII text. You can paste into another text editor. That is how I got the examples above in this thread.

I can see you already know a little about filtering. One thing that might help also is to filter on the MAC address instead of IPv4 address. It is possible IPv6 communication is involved. If you can determine the MAC address of your speaker, use eth.addr == xx:xx:xx:xx:xx instead of ip.addr == nnn.nnn.nnn.nnn. It is a good idea to keep filtering on TCP only like you did in your screen shot.

cosinekitty commented 6 years ago

OK, this is not good news. I can see that in this case, iTunes running on the Mac and the Sonos One speaker are negotiating an encrypted channel. After that all their communication is encrypted and I can't read any of it. Also they are using IPv6 instead of IPv4, so like I said above, filtering on MAC address is helpful in Wireshark. Here is what I see before everything turns into encrypted binary noise:

GET /info RTSP/1.0
X-Apple-ProtocolVersion: 1
Content-Length: 70
Content-Type: application/x-apple-binary-plist
CSeq: 0
DACP-ID: 838C6AF2834296C0
Active-Remote: 3225933693
User-Agent: AirPlay/366.76.2
0000   47 45 54 20 2f 69 6e 66 6f 20 52 54 53 50 2f 31  GET /info RTSP/1
0010   2e 30 0d 0a 58 2d 41 70 70 6c 65 2d 50 72 6f 74  .0..X-Apple-Prot
0020   6f 63 6f 6c 56 65 72 73 69 6f 6e 3a 20 31 0d 0a  ocolVersion: 1..
0030   43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20  Content-Length: 
0040   37 30 0d 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65  70..Content-Type
0050   3a 20 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d  : application/x-
0060   61 70 70 6c 65 2d 62 69 6e 61 72 79 2d 70 6c 69  apple-binary-pli
0070   73 74 0d 0a 43 53 65 71 3a 20 30 0d 0a 44 41 43  st..CSeq: 0..DAC
0080   50 2d 49 44 3a 20 38 33 38 43 36 41 46 32 38 33  P-ID: 838C6AF283
0090   34 32 39 36 43 30 0d 0a 41 63 74 69 76 65 2d 52  4296C0..Active-R
00a0   65 6d 6f 74 65 3a 20 33 32 32 35 39 33 33 36 39  emote: 322593369
00b0   33 0d 0a 55 73 65 72 2d 41 67 65 6e 74 3a 20 41  3..User-Agent: A
00c0   69 72 50 6c 61 79 2f 33 36 36 2e 37 36 2e 32 0d  irPlay/366.76.2.
00d0   0a 0d 0a 62 70 6c 69 73 74 30 30 d1 01 02 59 71  ...bplist00...Yq
00e0   75 61 6c 69 66 69 65 72 a1 03 5a 74 78 74 41 69  ualifier..ZtxtAi
00f0   72 50 6c 61 79 08 0b 15 17 00 00 00 00 00 00 01  rPlay...........
0100   01 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00  ................
0110   00 00 00 00 00 00 00 00 22                       ........"

0000   52 54 53 50 2f 31 2e 30 20 32 30 30 20 4f 4b 0d  RTSP/1.0 200 OK.
0010   0a 43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a  .Content-Length:
0020   20 31 31 35 30 0d 0a 43 6f 6e 74 65 6e 74 2d 54   1150..Content-T
0030   79 70 65 3a 20 61 70 70 6c 69 63 61 74 69 6f 6e  ype: application
0040   2f 78 2d 61 70 70 6c 65 2d 62 69 6e 61 72 79 2d  /x-apple-binary-
0050   70 6c 69 73 74 0d 0a 53 65 72 76 65 72 3a 20 41  plist..Server: A
0060   69 72 54 75 6e 65 73 2f 33 36 36 2e 30 0d 0a 43  irTunes/366.0..C
0070   53 65 71 3a 20 30 0d 0a 0d 0a 62 70 6c 69 73 74  Seq: 0....bplist
0080   30 30 df 10 15 01 02 03 04 05 06 07 08 09 0a 0b  00..............
0090   0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b  ................
00a0   2a 2b 2c 2d 2e 2a 2f 30 31 32 33 34 35 36 37 53  *+,-.*/01234567S
00b0   73 64 6b 52 70 69 5f 10 10 66 69 72 6d 77 61 72  sdkRpi_..firmwar
00c0   65 52 65 76 69 73 69 6f 6e 56 4f 53 49 6e 66 6f  eRevisionVOSInfo
00d0   5c 6d 61 6e 75 66 61 63 74 75 72 65 72 5e 61 75  \manufacturer^au
00e0   64 69 6f 4c 61 74 65 6e 63 69 65 73 5f 10 11 6b  dioLatencies_..k
00f0   65 65 70 41 6c 69 76 65 4c 6f 77 50 6f 77 65 72  eepAliveLowPower
0100   5f 10 11 66 69 72 6d 77 61 72 65 42 75 69 6c 64  _..firmwareBuild
0110   44 61 74 65 55 6d 6f 64 65 6c 5f 10 14 6e 61 6d  DateUmodel_..nam
0120   65 49 73 46 61 63 74 6f 72 79 44 65 66 61 75 6c  eIsFactoryDefaul
0130   74 5f 10 10 68 61 72 64 77 61 72 65 52 65 76 69  t_..hardwareRevi
0140   73 69 6f 6e 5f 10 18 6b 65 65 70 41 6c 69 76 65  sion_..keepAlive
0150   53 65 6e 64 53 74 61 74 73 41 73 42 6f 64 79 5b  SendStatsAsBody[
0160   73 74 61 74 75 73 46 6c 61 67 73 58 64 65 76 69  statusFlagsXdevi
0170   63 65 49 44 55 62 75 69 6c 64 5a 74 78 74 41 69  ceIDUbuildZtxtAi
0180   72 50 6c 61 79 57 50 54 50 49 6e 66 6f 5f 10 0f  rPlayWPTPInfo_..
0190   70 72 6f 74 6f 63 6f 6c 56 65 72 73 69 6f 6e 5d  protocolVersion]
01a0   73 6f 75 72 63 65 56 65 72 73 69 6f 6e 58 66 65  sourceVersionXfe
01b0   61 74 75 72 65 73 54 6e 61 6d 65 5d 41 69 72 50  aturesTname]AirP
01c0   6c 61 79 3b 32 2e 30 2e 32 5f 10 24 33 62 62 34  lay;2.0.2_.$3bb4
01d0   31 34 66 64 2d 31 61 36 34 2d 34 33 36 37 2d 39  14fd-1a64-4367-9
01e0   66 35 31 2d 34 35 62 38 63 61 30 31 63 31 36 30  f51-45b8ca01c160
01f0   5a 34 36 2e 33 2d 35 37 32 35 30 5d 4c 69 6e 75  Z46.3-57250]Linu
0200   78 20 33 2e 31 30 2e 35 33 55 53 6f 6e 6f 73 a4  x 3.10.53USonos.
0210   1c 23 26 28 d3 1d 1e 1f 20 21 22 5f 10 12 69 6e  .#&(.... !"_..in
0220   70 75 74 4c 61 74 65 6e 63 79 4d 69 63 72 6f 73  putLatencyMicros
0230   54 74 79 70 65 5f 10 13 6f 75 74 70 75 74 4c 61  Ttype_..outputLa
0240   74 65 6e 63 79 4d 69 63 72 6f 73 10 00 10 64 12  tencyMicros...d.
0250   00 06 1a 80 d4 1d 24 1e 1f 20 25 21 22 59 61 75  ......$.. %!"Yau
0260   64 69 6f 54 79 70 65 57 64 65 66 61 75 6c 74 d4  dioTypeWdefault.
0270   1d 24 1e 1f 20 27 21 22 55 6d 65 64 69 61 d4 1d  .$.. '!"Umedia..
0280   24 1e 1f 20 27 29 22 10 66 09 5b 53 65 70 20 32  $.. ')".f.[Sep 2
0290   35 20 32 30 31 38 53 4f 6e 65 08 5a 31 2e 32 31  5 2018SOne.Z1.21
02a0   2e 31 2e 38 2d 31 10 04 5f 10 11 37 38 3a 32 38  .1.8-1.._..78:28
02b0   3a 43 41 3a 43 33 3a 32 33 3a 38 43 54 31 36 2e  :CA:C3:23:8CT16.
02c0   30 4f 11 01 57 05 61 63 6c 3d 30 1a 64 65 76 69  0O..W.acl=0.devi
02d0   63 65 69 64 3d 37 38 3a 32 38 3a 43 41 3a 43 33  ceid=78:28:CA:C3
02e0   3a 32 33 3a 38 43 1b 66 65 61 74 75 72 65 73 3d  :23:8C.features=
02f0   30 78 34 34 35 46 38 41 30 30 2c 30 78 31 43 33  0x445F8A00,0x1C3
0300   34 30 07 72 73 66 3d 30 78 30 11 66 76 3d 70 32  40.rsf=0x0.fv=p2
0310   30 2e 34 36 2e 33 2d 35 37 32 35 30 09 66 6c 61  0.46.3-57250.fla
0320   67 73 3d 30 78 34 09 6d 6f 64 65 6c 3d 4f 6e 65  gs=0x4.model=One
0330   12 6d 61 6e 75 66 61 63 74 75 72 65 72 3d 53 6f  .manufacturer=So
0340   6e 6f 73 20 73 65 72 69 61 6c 4e 75 6d 62 65 72  nos serialNumber
0350   3d 37 38 2d 32 38 2d 43 41 2d 43 33 2d 32 33 2d  =78-28-CA-C3-23-
0360   38 43 3a 42 0d 70 72 6f 74 6f 76 65 72 73 3d 31  8C:B.protovers=1
0370   2e 31 0d 73 72 63 76 65 72 73 3d 33 36 36 2e 30  .1.srcvers=366.0
0380   27 70 69 3d 33 62 62 34 31 34 66 64 2d 31 61 36  'pi=3bb414fd-1a6
0390   34 2d 34 33 36 37 2d 39 66 35 31 2d 34 35 62 38  4-4367-9f51-45b8
03a0   63 61 30 31 63 31 36 30 28 67 69 64 3d 33 62 62  ca01c160(gid=3bb
03b0   34 31 34 66 64 2d 31 61 36 34 2d 34 33 36 37 2d  414fd-1a64-4367-
03c0   39 66 35 31 2d 34 35 62 38 63 61 30 31 63 31 36  9f51-45b8ca01c16
03d0   30 06 67 63 67 6c 3d 30 43 70 6b 3d 66 34 31 30  0.gcgl=0Cpk=f410
03e0   64 32 32 39 30 65 38 35 30 38 31 65 32 39 35 33  d2290e85081e2953
03f0   31 33 61 63 61 37 35 36 39 33 66 64 63 61 32 61  13aca75693fdca2a
0400   36 63 62 33 63 33 35 62 30 36 36 31 62 37 39 35  6cb3c35b0661b795
0410   37 38 32 65 38 66 33 66 32 33 35 38 5f 10 2f 4f  782e8f3f2358_./O
0420   70 65 6e 41 56 4e 55 20 41 72 74 41 6e 64 4c 6f  penAVNU ArtAndLo
0430   67 69 63 2d 61 50 54 50 2d 63 68 61 6e 67 65 73  gic-aPTP-changes
0440   20 61 35 64 37 66 39 34 2d 30 2e 30 2e 31 53 31   a5d7f94-0.0.1S1
0450   2e 31 55 33 36 36 2e 30 13 00 01 c3 40 44 5f 8a  .1U366.0....@D_.
0460   00 56 47 61 72 61 67 65 00 08 00 35 00 39 00 3c  .VGarage...5.9.<
0470   00 4f 00 56 00 63 00 72 00 86 00 9a 00 a0 00 b7  .O.V.c.r........
0480   00 ca 00 e5 00 f1 00 fa 01 00 01 0b 01 13 01 25  ...............%
0490   01 33 01 3c 01 41 01 4f 01 76 01 81 01 8f 01 95  .3.<.A.O.v......
04a0   01 9a 01 a1 01 b6 01 bb 01 d1 01 d3 01 d5 01 da  ................
04b0   01 e3 01 ed 01 f5 01 fe 02 04 02 0d 02 0f 02 10  ................
04c0   02 1c 02 20 02 21 02 2c 02 2e 02 42 02 47 03 a2  ... .!.,...B.G..
04d0   03 d4 03 d8 03 de 03 e7 00 00 00 00 00 00 02 01  ................
04e0   00 00 00 00 00 00 00 38 00 00 00 00 00 00 00 00  .......8........
04f0   00 00 00 00 00 00 03 ee                          ........

POST /pair-setup RTSP/1.0
X-Apple-HKP: 4
X-Apple-Client-Name: MariaMac
Content-Length: 9
Content-Type: application/x-apple-binary-plist
CSeq: 1
DACP-ID: 838C6AF2834296C0
Active-Remote: 3225933693
User-Agent: AirPlay/366.76.2
00e0   33 36 36 2e 37 36 2e 32 0d 0a 0d 0a 00 01 00 06  366.76.2........
00f0   01 01 13 01 10                                   .....

RTSP/1.0 200 OK
Content-Length: 409
Content-Type: application/octet-stream
Server: AirTunes/366.0
CSeq: 1
0060   36 36 2e 30 0d 0a 43 53 65 71 3a 20 31 0d 0a 0d  66.0..CSeq: 1...
0070   0a 06 01 02 02 10 b8 2e a0 b6 34 98 ad f0 94 50  ..........4....P
0080   28 8d 3b 70 e4 b3 03 ff 9d 59 d4 e5 db f5 51 61  (.;p.....Y....Qa
0090   9b d2 03 d9 2a 56 23 ec 47 7b c2 93 de 18 ac a7  ....*V#.G{......
00a0   bc 06 69 ad 6e f9 82 fc 24 f6 c4 0e e4 38 db 84  ..i.n...$....8..
00b0   68 b7 f0 1c e9 fd 9a e5 c6 93 31 22 cf 9f 90 bc  h.........1"....
00c0   6f 8e 80 67 7f 6d 2d 3c 67 3f 81 53 7f 44 6e ff  o..g.m-<g?.S.Dn.
00d0   50 ac 85 5d 43 1a 4d 58 6f 1f eb 55 1f df 85 90  P..]C.MXo..U....
00e0   f2 69 3d b5 f1 2c 8d a8 5f c7 30 66 3f 31 51 67  .i=..,.._.0f?1Qg
00f0   f3 06 16 df ba 0d 6e 33 3c 4d 76 e5 50 5a 12 21  ......n3<Mv.PZ.!
0100   a5 83 4f c9 4a 81 22 f1 b3 9f a3 f3 fa 31 3a 4c  ..O.J."......1:L
0110   3f 9e df 0a 43 19 c5 c3 99 d8 d2 ac df 80 83 d3  ?...C...........
0120   ea de b0 44 c5 b2 f3 9c e9 8b 99 4f 03 06 4b 01  ...D.......O..K.
0130   4f f2 33 eb c0 3a ff 96 eb b4 b9 6c 1c a8 94 4a  O.3..:.....l...J
0140   18 93 67 6e c2 5d 09 46 d3 fa b7 73 b1 44 a1 ea  ..gn.].F...s.D..
0150   0a 7f ac 41 1b 4c ee 52 91 06 41 58 dc 94 48 71  ...A.L.R..AX..Hq
0160   64 e1 f6 6e be 5f 27 3d 0e 37 6b 8b 60 e7 3e 37  d..n._'=.7k.`.>7
0170   3c c1 43 32 cf fd 6d 01 b9 9f 62 cf ad 07 c4 cb  <.C2..m...b.....
0180   b0 23 f6 09 d8 8b 66 03 81 4a b9 ae 50 06 41 83  .#....f..J..P.A.
0190   a3 59 e1 a8 d0 75 13 b7 77 dd 9f c4 e7 31 20 f5  .Y...u..w....1 .
01a0   f4 bd 9f ce 33 1d 1a 36 fa b9 ed c8 e2 5e 77 e5  ....3..6.....^w.
01b0   19 14 9c dc 85 f0 74 95 7a 14 4e 2d a1 77 85 02  ......t.z.N-.w..
01c0   03 29 81 fa 92 ec 7f fb 8c cc 82 ff 8c 98 2e de  .)..............
01d0   20 dd 7e f1 15 de a1 72 78 19 da 1d 2c 55 30 14   .~....rx...,U0.
01e0   d5 a9 a8 a3 05 2d b8 78 dd 10 39 4a d0 c2 90 4c  .....-.x..9J...L
01f0   9e 8c 02 51 d8 ea 8a e7 6a 45 66 67 59 81 51 53  ...Q....jEfgY.QS
0200   a7 c3 77 27 00 07 47 1e 9b 1e                    ..w'..G...

POST /pair-setup RTSP/1.0
X-Apple-HKP: 4
X-Apple-Client-Name: MariaMac
Content-Length: 457
Content-Type: application/x-apple-binary-plist
CSeq: 2
DACP-ID: 838C6AF2834296C0
Active-Remote: 3225933693
User-Agent: AirPlay/366.76.2
00e0   79 2f 33 36 36 2e 37 36 2e 32 0d 0a 0d 0a 06 01  y/366.76.2......
00f0   03 03 ff ae 53 f0 ff 04 fb 74 c5 3e 67 72 e4 4c  ....S....t.>gr.L
0100   32 da e4 e3 bd b6 3a 8d 02 8f 27 8c 47 bd 93 6b  2.....:...'.G..k
0110   b4 1c 2d 04 a5 86 6b 2b c8 38 95 17 a5 df 8c 29  ..-...k+.8.....)
0120   98 e8 e1 e7 96 f7 ff 6c 9c 5b 68 e7 08 be 74 36  .......l.[h...t6
0130   5d 21 14 15 e0 2d a6 63 58 25 a7 f8 87 ac bc 0a  ]!...-.cX%......
0140   d5 cd 03 71 36 f1 a1 49 59 47 ed bf 67 61 08 d6  ...q6..IYG..ga..
0150   e0 30 68 4b 79 df 1f f8 59 e8 68 81 c1 c7 55 60  .0hKy...Y.h...U`
0160   8f 2a a0 38 3e 58 11 52 5d 95 bc ce 01 33 e5 de  .*.8>X.R]....3..
0170   3e 7e db 12 ce c5 5e d2 b4 de b0 ab ab 71 65 4b  >~....^......qeK
0180   6a 2d 45 c5 61 92 1c 4a 8e 01 09 04 e5 36 61 d2  j-E.a..J.....6a.
0190   1a a2 03 cf 11 7c 2a 51 e7 6c 37 35 7c ce 1b 3e  .....|*Q.l75|..>
01a0   4b b5 7e be e8 75 29 7d 40 b9 40 d8 ed 4e fd 57  K.~..u)}@.@..N.W
01b0   5f 23 48 5d 59 7d ce ce 3b 90 18 b2 80 d5 10 e1  _#H]Y}..;.......
01c0   99 0f c4 33 c2 d8 99 9e c8 a7 7a 8f cc 9b 21 41  ...3......z...!A
01d0   5e 9b 66 b5 1c fe 97 7e 69 25 c1 de c9 41 ec 49  ^.f....~i%...A.I
01e0   64 37 e9 0b 38 cb 3d b8 d8 60 5a a8 ab 1e 8b a1  d7..8.=..`Z.....
01f0   c7 b1 03 81 b9 0d 46 24 9f 41 c7 87 07 70 eb 98  ......F$.A...p..
0200   4c 9f cd 2d f6 db b1 cc 17 64 c4 f8 92 dc 02 92  L..-.....d......
0210   b4 b1 91 24 e8 6a 6a e3 63 02 da 3a 0c fa ac 26  ...$.jj.c..:...&
0220   2c 29 f1 ac 69 8b 03 e8 63 77 68 2b 8e 68 c2 62  ,)..i...cwh+.h.b
0230   b5 1b 14 74 2d 82 19 f4 18 98 26 01 54 44 ab 70  ...t-.....&.TD.p
0240   43 33 2b a9 e2 3e 74 96 fe a2 bc 98 0b 92 9b 5d  C3+..>t........]
0250   5c f7 11 61 72 c8 00 c0 b6 d3 6c 74 03 dc 3e e6  \..ar.....lt..>.
0260   68 36 2e 09 a8 d7 de aa 3a 49 e9 ef 69 17 ef 4e  h6......:I..i..N
0270   15 50 06 cc 9d 04 40 c1 8a ff 60 13 f0 72 9c c4  .P....@...`..r..
0280   08 38 ff d0 4a 50 2f 6a 93 cc c3 9b 94 86 9c fd  .8..JP/j........
0290   8d 2c 56 ea 86 68 d1 85 c7 48 1b dc dc 74 52 42  .,V..h...H...tRB
02a0   d4 c7 22 f0 3c b7 04 47 66 8d 1e 1b 75 fe 6b 5b  ..".<..Gf...u.k[
02b0   ca 12 dc 39 b4 6d 99                             ...9.m.

0000   52 54 53 50 2f 31 2e 30 20 32 30 30 20 4f 4b 0d  RTSP/1.0 200 OK.
0010   0a 43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a  .Content-Length:
0020   20 36 39 0d 0a 43 6f 6e 74 65 6e 74 2d 54 79 70   69..Content-Typ
0030   65 3a 20 61 70 70 6c 69 63 61 74 69 6f 6e 2f 6f  e: application/o
0040   63 74 65 74 2d 73 74 72 65 61 6d 0d 0a 53 65 72  ctet-stream..Ser
0050   76 65 72 3a 20 41 69 72 54 75 6e 65 73 2f 33 36  ver: AirTunes/36
0060   36 2e 30 0d 0a 43 53 65 71 3a 20 32 0d 0a 0d 0a  6.0..CSeq: 2....
0070   06 01 04 04 40 db 38 60 8e c6 5f 32 5a 22 9a e5  ....@.8`.._2Z"..
0080   c6 0f 23 99 6b 8e 79 68 a9 73 8d 82 0f f7 84 4f  ..#.k.yh.s.....O
0090   15 e3 ba fa ec bb f4 c0 3c 50 55 08 4b cd 16 05  ........<PU.K...
00a0   86 d7 bc 19 ab a7 07 83 62 d2 88 0d 33 93 df d4  ........b...3...
00b0   c2 1d 2b ab a6                                   ..+..
snizzleorg commented 5 years ago

I guess there has not been any progress on the volume control issue?

ahpohl commented 4 years ago

I can provide a WireShark dump of the Sonos app running on Android, while changing the volume with the buttons of a Sonos One 2. Gen. I use PCAP Remote for the traffic logging.

dimsh99 commented 3 years ago

I have same issue with volume control from either sonos beam or sonos app on iphone. I'm not too familiar with airplay, but it sonos seems to send remote's request to player that gets dispatched to player's volume_update_speaker, which in turn updates stored value for volume without requesting speaker. I locally applied simple patch, that fixed issue for me:

--- a/src/player.c
+++ b/src/player.c
@@ -2920,8 +2920,11 @@ volume_update_speaker(void *arg, int *retval)
     }

   outputs_device_volume_register(device, volume, -1);
+  *retval = outputs_device_volume_set(device, device_volume_cb);
+
+  if (*retval > 0)
+    return COMMAND_PENDING; // async

-  *retval = 0;
   return COMMAND_END;
 }

Unfortunately beam is my only airplay device and I can not tell if this change could cause issues with other vendors.

ejurgensen commented 3 years ago

Yes, I'm not sure what would be the best solution here. There was a specific reason why forked-daapd didn't send the volume to the speaker, but I couldn't find it when searching old issues. Might have been something about avoiding infinite requests between forked-daapd and shairport-sync? I'll see if I can find out what iTunes does in this scenario, probably best if forked-daapd does the same.

ejurgensen commented 3 years ago

Finally got around to (hopefully) fixing this long-standing issue. I got a Sonos speaker, which made it much easier, both to check what iTunes does, and of course to test.

cosinekitty commented 3 years ago

@ejurgensen So the issue wasn't because of encryption after all?

ejurgensen commented 3 years ago

Yes, it seems like the issue was just related to how owntone handles the volume change request. In principle, an Airplay 2 device could use the encrypted event channel to send volume changes, but at least my Sonos Symfonisk doesn't do that. It just uses old non-encrypted dacp. It would seem that the same applies to Sonos Beam, since @dimsh99 was able to fix it with the patch above. I believe volume changes from HomePod's are also dacp.

I will also be adding support for the encrypted event channel, you can follow progress on that via issue #1181