fix(calls): outgoing 1:1 calls ring the callee, raw ADM state in the call timeline
- epconv sent suppressDialout: true for every call. With callees in participants.to the controller never dialed out: the callee saw no ring, the mixer accepted the caller alone, and the call timer started at once. Now true only when to is empty (Echo, meetings). - Incoming calls report 0 audio devices with no libwebrtc log line. The audio setup timeline line now carries raw ADM values (acquired, device counts, refs), and diagnostics.log also keeps audio_device_impl and voice engine lines (endpoint dump and 10 s buffer stats skipped). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -8,7 +8,9 @@ const MAX_BYTES: u64 = 1024 * 1024;
8
8
9
9
static PATH: OnceLock<PathBuf> = OnceLock::new();
10
10
11
const WEBRTC_AUDIO_MARKERS: [&str; 3] = ["AdmProxy", "audio_device_core_win", "core_audio"];
11
const WEBRTC_AUDIO_MARKERS: [&str; 5] = ["AdmProxy", "audio_device", "core_audio", "WebRtcVoiceEngine", "webrtc_voice_engine"];
12
const WEBRTC_SKIPPED: [&str; 1] = ["audio_device_buffer"];
13
const ENDPOINT_DUMP_LINES: std::ops::Range<u32> = 4040..4170;
12
14
13
15
pub fn install(path: PathBuf) {
14
16
let _ = PATH.set(path);
@@ -29,7 +31,7 @@ impl log::Log for WebrtcAudioLog {
29
31
return;
30
32
}
31
33
let text = entry.args().to_string();
32
if WEBRTC_AUDIO_MARKERS.iter().any(|marker| text.contains(marker)) {
34
if keeps_webrtc_line(&text) {
33
35
record(format!("webrtc: {text}"));
34
36
}
35
37
}
@@ -37,6 +39,19 @@ impl log::Log for WebrtcAudioLog {
37
39
fn flush(&self) {}
38
40
}
39
41
42
fn keeps_webrtc_line(text: &str) -> bool {
43
WEBRTC_AUDIO_MARKERS.iter().any(|marker| text.contains(marker))
44
&& !WEBRTC_SKIPPED.iter().any(|skipped| text.contains(skipped))
45
&& !is_endpoint_dump(text)
46
}
47
48
fn is_endpoint_dump(text: &str) -> bool {
49
text.split_once("audio_device_core_win.cc:")
50
.and_then(|(_, rest)| rest.split_once(')'))
51
.and_then(|(line, _)| line.parse::<u32>().ok())
52
.is_some_and(|line| ENDPOINT_DUMP_LINES.contains(&line))
53
}
54
40
55
pub fn directory() -> Option<PathBuf> {
41
56
PATH.get().and_then(|path| path.parent()).map(PathBuf::from)
42
57
}
@@ -66,3 +81,18 @@ fn line_prefix() -> String {
66
81
env!("TEAMS_BUILD_VERSION")
67
82
)
68
83
}
84
85
#[cfg(test)]
86
mod tests {
87
use super::keeps_webrtc_line;
88
89
#[test]
90
fn audio_lines_are_kept_and_endpoint_dumps_and_noise_are_skipped() {
91
assert!(keeps_webrtc_line("(audio_device_impl.cc:123): Init"));
92
assert!(keeps_webrtc_line("(webrtc_voice_engine.cc:10): WebRtcVoiceEngine::Init"));
93
assert!(!keeps_webrtc_line("(audio_device_core_win.cc:4090): endpoint 3"));
94
assert!(keeps_webrtc_line("(audio_device_core_win.cc:412): AvRevertMmThreadCharacteristics() is OK"));
95
assert!(!keeps_webrtc_line("(audio_device_buffer.cc:450): [REC : 10000msec, 48kHz] callbacks: 1000"));
96
assert!(!keeps_webrtc_line("(peer_connection.cc:55): something"));
97
}
98
}
@@ -8,7 +8,9 @@ const MAX_BYTES: u64 = 1024 * 1024;8
8
9
static PATH: OnceLock<PathBuf> = OnceLock::new();9
static PATH: OnceLock<PathBuf> = OnceLock::new();10
10
11
const WEBRTC_AUDIO_MARKERS: [&str; 3] = ["AdmProxy", "audio_device_core_win", "core_audio"];11
const WEBRTC_AUDIO_MARKERS: [&str; 5] = ["AdmProxy", "audio_device", "core_audio", "WebRtcVoiceEngine", "webrtc_voice_engine"];12
const WEBRTC_SKIPPED: [&str; 1] = ["audio_device_buffer"];13
const ENDPOINT_DUMP_LINES: std::ops::Range<u32> = 4040..4170;12
14
13
pub fn install(path: PathBuf) {15
pub fn install(path: PathBuf) {14
let _ = PATH.set(path);16
let _ = PATH.set(path);@@ -29,7 +31,7 @@ impl log::Log for WebrtcAudioLog {29
return;31
return;30
}32
}31
let text = entry.args().to_string();33
let text = entry.args().to_string();32
if WEBRTC_AUDIO_MARKERS.iter().any(|marker| text.contains(marker)) {34
if keeps_webrtc_line(&text) {33
record(format!("webrtc: {text}"));35
record(format!("webrtc: {text}"));34
}36
}35
}37
}@@ -37,6 +39,19 @@ impl log::Log for WebrtcAudioLog {37
fn flush(&self) {}39
fn flush(&self) {}38
}40
}39
41
42
fn keeps_webrtc_line(text: &str) -> bool {43
WEBRTC_AUDIO_MARKERS.iter().any(|marker| text.contains(marker))44
&& !WEBRTC_SKIPPED.iter().any(|skipped| text.contains(skipped))45
&& !is_endpoint_dump(text)46
}47
48
fn is_endpoint_dump(text: &str) -> bool {49
text.split_once("audio_device_core_win.cc:")50
.and_then(|(_, rest)| rest.split_once(')'))51
.and_then(|(line, _)| line.parse::<u32>().ok())52
.is_some_and(|line| ENDPOINT_DUMP_LINES.contains(&line))53
}54
40
pub fn directory() -> Option<PathBuf> {55
pub fn directory() -> Option<PathBuf> {41
PATH.get().and_then(|path| path.parent()).map(PathBuf::from)56
PATH.get().and_then(|path| path.parent()).map(PathBuf::from)42
}57
}@@ -66,3 +81,18 @@ fn line_prefix() -> String {66
env!("TEAMS_BUILD_VERSION")81
env!("TEAMS_BUILD_VERSION")67
)82
)68
}83
}84
85
#[cfg(test)]86
mod tests {87
use super::keeps_webrtc_line;88
89
#[test]90
fn audio_lines_are_kept_and_endpoint_dumps_and_noise_are_skipped() {91
assert!(keeps_webrtc_line("(audio_device_impl.cc:123): Init"));92
assert!(keeps_webrtc_line("(webrtc_voice_engine.cc:10): WebRtcVoiceEngine::Init"));93
assert!(!keeps_webrtc_line("(audio_device_core_win.cc:4090): endpoint 3"));94
assert!(keeps_webrtc_line("(audio_device_core_win.cc:412): AvRevertMmThreadCharacteristics() is OK"));95
assert!(!keeps_webrtc_line("(audio_device_buffer.cc:450): [REC : 10000msec, 48kHz] callbacks: 1000"));96
assert!(!keeps_webrtc_line("(peer_connection.cc:55): something"));97
}98
}@@ -43,9 +43,14 @@ pub struct AudioSetup {
43
43
pub track: RtcAudioTrack,
44
44
pub listen_only: bool,
45
45
platform_acquired: bool,
46
pub adm_state: String,
46
47
feeder: Option<(JoinHandle<()>, Arc<AtomicBool>)>,
47
48
}
48
49
50
fn device_count_text(count: Option<i16>) -> String {
51
count.map_or_else(|| "n/a".to_owned(), |count| count.to_string())
52
}
53
49
54
impl AudioSetup {
50
55
pub fn start(
51
56
factory: &PeerConnectionFactory,
@@ -55,8 +60,19 @@ impl AudioSetup {
55
60
output: &DeviceChoice,
56
61
) -> Self {
57
62
let platform_acquired = mode == AudioMode::Platform && factory.acquire_platform_adm();
58
let has_input = platform_acquired && factory.recording_devices() > 0;
59
let has_output = platform_acquired && factory.playout_devices() > 0;
63
let (recording_devices, playout_devices) = if platform_acquired {
64
(Some(factory.recording_devices()), Some(factory.playout_devices()))
65
} else {
66
(None, None)
67
};
68
let has_input = recording_devices.is_some_and(|count| count > 0);
69
let has_output = playout_devices.is_some_and(|count| count > 0);
70
let adm_state = format!(
71
"acquired {platform_acquired}, recording devices {}, playout devices {}, adm refs {}",
72
device_count_text(recording_devices),
73
device_count_text(playout_devices),
74
factory.platform_adm_ref_count()
75
);
60
76
if platform_acquired {
61
77
factory.set_adm_recording_enabled(has_input);
62
78
factory.set_adm_playout_enabled(has_output);
@@ -73,6 +89,7 @@ impl AudioSetup {
73
89
track: factory.create_device_audio_track("microphone"),
74
90
listen_only: false,
75
91
platform_acquired,
92
adm_state,
76
93
feeder: None,
77
94
};
78
95
}
@@ -86,6 +103,7 @@ impl AudioSetup {
86
103
track,
87
104
listen_only: mode == AudioMode::Platform,
88
105
platform_acquired,
106
adm_state,
89
107
feeder: Some((task, running)),
90
108
}
91
109
}
@@ -43,9 +43,14 @@ pub struct AudioSetup {43
pub track: RtcAudioTrack,43
pub track: RtcAudioTrack,44
pub listen_only: bool,44
pub listen_only: bool,45
platform_acquired: bool,45
platform_acquired: bool,46
pub adm_state: String,46
feeder: Option<(JoinHandle<()>, Arc<AtomicBool>)>,47
feeder: Option<(JoinHandle<()>, Arc<AtomicBool>)>,47
}48
}48
49
50
fn device_count_text(count: Option<i16>) -> String {51
count.map_or_else(|| "n/a".to_owned(), |count| count.to_string())52
}53
49
impl AudioSetup {54
impl AudioSetup {50
pub fn start(55
pub fn start(51
factory: &PeerConnectionFactory,56
factory: &PeerConnectionFactory,@@ -55,8 +60,19 @@ impl AudioSetup {55
output: &DeviceChoice,60
output: &DeviceChoice,56
) -> Self {61
) -> Self {57
let platform_acquired = mode == AudioMode::Platform && factory.acquire_platform_adm();62
let platform_acquired = mode == AudioMode::Platform && factory.acquire_platform_adm();58
let has_input = platform_acquired && factory.recording_devices() > 0;63
let (recording_devices, playout_devices) = if platform_acquired {59
let has_output = platform_acquired && factory.playout_devices() > 0;64
(Some(factory.recording_devices()), Some(factory.playout_devices()))65
} else {66
(None, None)67
};68
let has_input = recording_devices.is_some_and(|count| count > 0);69
let has_output = playout_devices.is_some_and(|count| count > 0);70
let adm_state = format!(71
"acquired {platform_acquired}, recording devices {}, playout devices {}, adm refs {}",72
device_count_text(recording_devices),73
device_count_text(playout_devices),74
factory.platform_adm_ref_count()75
);60
if platform_acquired {76
if platform_acquired {61
factory.set_adm_recording_enabled(has_input);77
factory.set_adm_recording_enabled(has_input);62
factory.set_adm_playout_enabled(has_output);78
factory.set_adm_playout_enabled(has_output);@@ -73,6 +89,7 @@ impl AudioSetup {73
track: factory.create_device_audio_track("microphone"),89
track: factory.create_device_audio_track("microphone"),74
listen_only: false,90
listen_only: false,75
platform_acquired,91
platform_acquired,92
adm_state,76
feeder: None,93
feeder: None,77
};94
};78
}95
}@@ -86,6 +103,7 @@ impl AudioSetup {86
track,103
track,87
listen_only: mode == AudioMode::Platform,104
listen_only: mode == AudioMode::Platform,88
platform_acquired,105
platform_acquired,106
adm_state,89
feeder: Some((task, running)),107
feeder: Some((task, running)),90
}108
}91
}109
}@@ -602,7 +602,7 @@ async fn drive(
602
602
let device_lists = devices::list_devices(&factory);
603
603
timeline.record(
604
604
"audio setup",
605
format!("listen only {}, {} input(s), {} output(s)", audio.listen_only, device_lists.inputs.len(), device_lists.outputs.len()),
605
format!("listen only {}, {} input(s), {} output(s); {}", audio.listen_only, device_lists.inputs.len(), device_lists.outputs.len(), audio.adm_state),
606
606
);
607
607
control.send(CallUpdate::Devices(device_lists));
608
608
control.send(CallUpdate::Selected {
@@ -602,7 +602,7 @@ async fn drive(602
let device_lists = devices::list_devices(&factory);602
let device_lists = devices::list_devices(&factory);603
timeline.record(603
timeline.record(604
"audio setup",604
"audio setup",605
format!("listen only {}, {} input(s), {} output(s)", audio.listen_only, device_lists.inputs.len(), device_lists.outputs.len()),605
format!("listen only {}, {} input(s), {} output(s); {}", audio.listen_only, device_lists.inputs.len(), device_lists.outputs.len(), audio.adm_state),606
);606
);607
control.send(CallUpdate::Devices(device_lists));607
control.send(CallUpdate::Devices(device_lists));608
control.send(CallUpdate::Selected {608
control.send(CallUpdate::Selected {@@ -646,7 +646,7 @@ pub fn epconv_body(invitation: &Invitation<'_>) -> Value {
646
646
let mut request = json!({
647
647
"conversationType": null,
648
648
"subject": null,
649
"suppressDialout": true,
649
"suppressDialout": to.is_empty(),
650
650
"roster": roster_request(callbacks),
651
651
"properties": conversation_properties(),
652
652
"links": link_map(&CONVERSATION_LINK_NAMES, |name| callbacks.conversation(name)),
@@ -1241,6 +1241,13 @@ mod tests {
1241
1241
assert_eq!(body["callInvitation"]["callModalities"], json!(["Audio", "Video"]));
1242
1242
}
1243
1243
1244
#[test]
1245
fn people_calls_dial_out_and_echo_does_not() {
1246
let people = InviteTarget::People { callees: vec![callee("8:orgid:b", "Bea")], thread_id: "19:a_b@unq.gbl.spaces".into() };
1247
assert_eq!(body_for(&people)["conversationRequest"]["suppressDialout"], false);
1248
assert_eq!(body_for(&InviteTarget::Echo)["conversationRequest"]["suppressDialout"], true);
1249
}
1250
1244
1251
#[test]
1245
1252
fn ringing_progress_names_the_sender() {
1246
1253
let body = ringing_body(&from());
@@ -646,7 +646,7 @@ pub fn epconv_body(invitation: &Invitation<'_>) -> Value {646
let mut request = json!({646
let mut request = json!({647
"conversationType": null,647
"conversationType": null,648
"subject": null,648
"subject": null,649
"suppressDialout": true,649
"suppressDialout": to.is_empty(),650
"roster": roster_request(callbacks),650
"roster": roster_request(callbacks),651
"properties": conversation_properties(),651
"properties": conversation_properties(),652
"links": link_map(&CONVERSATION_LINK_NAMES, |name| callbacks.conversation(name)),652
"links": link_map(&CONVERSATION_LINK_NAMES, |name| callbacks.conversation(name)),@@ -1241,6 +1241,13 @@ mod tests {1241
assert_eq!(body["callInvitation"]["callModalities"], json!(["Audio", "Video"]));1241
assert_eq!(body["callInvitation"]["callModalities"], json!(["Audio", "Video"]));1242
}1242
}1243
1243
1244
#[test]1245
fn people_calls_dial_out_and_echo_does_not() {1246
let people = InviteTarget::People { callees: vec![callee("8:orgid:b", "Bea")], thread_id: "19:a_b@unq.gbl.spaces".into() };1247
assert_eq!(body_for(&people)["conversationRequest"]["suppressDialout"], false);1248
assert_eq!(body_for(&InviteTarget::Echo)["conversationRequest"]["suppressDialout"], true);1249
}1250
1244
#[test]1251
#[test]1245
fn ringing_progress_names_the_sender() {1252
fn ringing_progress_names_the_sender() {1246
let body = ringing_body(&from());1253
let body = ringing_body(&from());