/// RFC 4733 telephone-event code to character mapping.
pub fn dtmf_code_to_char(code: u8) -> Option<char> {
match code {
0..=9 => Some((b'0' + code) as char),
10 => Some('*'),
11 => Some('#'),
12..=15 => Some((b'A' + (code - 12)) as char),
_ => None,
}
}
/// RFC 4733 character to telephone-event code mapping.
pub fn dtmf_char_to_code(c: char) -> Option<u8> {
match c {
'0'..='9' => Some(c as u8 - b'0'),
'*' => Some(10),
'#' => Some(11),
'A' | 'a' => Some(12),
'B' | 'b' => Some(13),
'C' | 'c' => Some(14),
'D' | 'd' => Some(15),
_ => None,
}
}