Multicast service is not delivering all "to" attributes to all the recipient of address stanza.
UserA sends a packet to UserB and UserC
<message type="chat" to="multicast.example.com" id="">
<addresses xmlns="http://jabber.org/protocol/address">
<address type="to" jid="[email protected]"/>
<address type="to" jid="[email protected]"/>
</addresses>
<body>One</body>
<active xmlns="http://jabber.org/protocol/chatstates"/>
</message>
However UserB receives
<message xmlns="jabber:client" from="[email protected]/iPhone" to="[email protected]" type="chat" id="">
<addresses xmlns="http://jabber.org/protocol/address">
<address type="to" jid="[email protected]"/>
</addresses>
<body>One</body>
<active xmlns="http://jabber.org/protocol/chatstates"/>
</message>
And UserC receives
<message xmlns="jabber:client" from="[email protected]/iPhone" to="[email protected]" type="chat" id="">
<addresses xmlns="http://jabber.org/protocol/address">
<address type="to" jid="[email protected]"/>
</addresses>
<body>One</body>
<active xmlns="http://jabber.org/protocol/chatstates"/>
</message>
So, UserB and UserC are missing 'to' attribute for each other in the address stanza.
I use ejabberd 16.01 and I use https://docs.ejabberd.im/admin/guide/configuration/#modmulticast to configure
Try this change. It's strange, because those lines haven't changed since many years ago. Maybe the bug is somewhere else, and this is only a workaround:
--- a/src/mod_multicast.erl
+++ b/src/mod_multicast.erl
@@ -599,7 +599,7 @@ add_addresses(Delivereds, Groups) ->
add_addresses2(_, [], Res, _, []) -> Res;
add_addresses2(Delivereds, [Group | Groups], Res, Pa,
[Pi | Pz]) ->
- Addresses = lists:append([Delivereds] ++ Pa ++ Pz),
+ Addresses = lists:append([Delivereds] ++ Pa ++ [Pi] ++ Pz),
Group2 = Group#group{addresses = Addresses},
add_addresses2(Delivereds, Groups, [Group2 | Res],
[Pi | Pa], Pz).
@@ -655,7 +655,7 @@ route_packet_multicast(From, ToS, Packet, AAttrs, Dests,
route_packet2(From, ToS, Dests, Packet, AAttrs,
Addresses) ->
#xmlel{name = T, attrs = A, children = C} = Packet,
- C2 = case append_dests(Dests, Addresses) of
+ C2 = case Addresses of
[] -> C;
ACs ->
[#xmlel{name = <<"addresses">>, attrs = AAttrs,