A live Call in the Edesy SDK has four controls: toggleMute() mutes or unmutes the microphone, toggleHold() holds or resumes the call, sendDigit(d) sends a DTMF keypad digit (for example to navigate an IVR menu), and hangup() ends the call. The mute, hold and dtmf events tell your UI when state changes.
Controls#
| Method | What it does | Event |
|---|---|---|
call.toggleMute() |
Mutes the microphone, or unmutes it if muted | mute |
call.toggleHold() |
Puts the call on hold, or resumes it if held | hold |
call.isHeld |
true while the call is on hold |
- |
call.sendDigit(d) |
Sends one DTMF digit: 0-9, * or # |
dtmf |
call.hangup() |
Ends the call | ended |
Example: call controls#
muteBtn.onclick = () => call.toggleMute();
holdBtn.onclick = () => call.toggleHold();
hangupBtn.onclick = () => call.hangup();
call.on("mute", (muted) => (muteBtn.textContent = muted ? "Unmute" : "Mute"));
call.on("hold", (held) => (holdBtn.textContent = held ? "Resume" : "Hold"));
// On-screen keypad
for (const key of "123456789*0#") {
const b = document.createElement("button");
b.textContent = key;
b.onclick = () => call.sendDigit(key);
keypad.appendChild(b);
}
How to build the controls#
- Show the controls after
answered. - Wire the buttons to
toggleMute(),toggleHold(),sendDigit()andhangup(). - Update labels from the
muteandholdevents rather than tracking state yourself. - Hide the controls on
endedorfailed.
FAQ#
Does mute stop the other person hearing me?#
Yes. Mute stops sending audio from the microphone. You still hear the other side.
What does the other person hear on hold?#
The call is held until you resume it with toggleHold() again.
How do I send a digit to an IVR menu?#
Call call.sendDigit("1") while the call is answered. Send one digit per call to sendDigit().
Can I send several digits at once?#
Call sendDigit() once per digit. Leave a short pause between digits if the far end misses any.
How do I know whether the call is on hold?#
Read call.isHeld, or listen for the hold event.
Does the drop-in dialer support DTMF?#
Yes. Its keypad sends digits with sendDigit() while a call is active.