pub async fn answer_replacing(
endpoint: &Handle,
incoming: &Incoming,
media_address: IpAddr,
replaced: &mut Call,
) -> Result<Call>Expand description
Answer an INVITE that asks to take the place of an existing call (RFC 3891).
The second half of an attended transfer: the transferor has spoken to the target, and hands
its original call over by telling one party to call the other with a Replaces header
naming the dialog to displace.
The header must name replaced, all three fields of it. A Call-ID travels in every
message of a dialog and is visible to every element on the path; the tags are random and
known only to the two parties. Accepting a match on the Call-ID alone — or trusting the
caller to have checked — turns this into a call-hijack primitive, so the check is here and
not in whoever calls it.
On success the replaced call is hung up and its media torn down. On failure the new INVITE is refused and the existing call is left exactly as it was: a replacement that cannot be honoured must not cost the user the call they already had.
Answers from the default codec set, Codecs::G711. answer_replacing_with takes a
selection.