Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Cancel Event Not Triggered When Ignoring Call #92

Open
8 tasks done
JAD3N opened this issue May 26, 2022 · 7 comments
Open
8 tasks done

[BUG] Cancel Event Not Triggered When Ignoring Call #92

JAD3N opened this issue May 26, 2022 · 7 comments
Labels
bug Something isn't working jira added

Comments

@JAD3N
Copy link

JAD3N commented May 26, 2022

  • I have verified that the issue occurs with the latest twilio.js release and is not marked as a known issue in the CHANGELOG.md.
  • I reviewed the Common Issues and open GitHub issues and verified that this report represents a potentially new issue.
  • I verified that the Quickstart application works in my environment.
  • I am not sharing any Personally Identifiable Information (PII)
    or sensitive account information (API keys, credentials, etc.) when reporting this issue.

Expected behavior:

When receiving an incoming call, using a button I call the ignore method on the call. I am expecting the cancel event to be emitted as a result of that.

This is mentioned on this page here:
https://www.twilio.com/docs/voice/sdks/javascript/twiliocall#cancel-event

Actual behavior:

No event is triggered but the call is ignored successfully.

Software versions:

  • Browser(s): Firefox
  • Operating System: Manjaro + Gnome
  • twilio.js: 2.1.1
  • Third-party libraries (e.g., Angular, React, etc.): React
@JAD3N JAD3N added the bug Something isn't working label May 26, 2022
@bld010
Copy link

bld010 commented May 26, 2022

Can you share the code you're using to produce this behavior (specifically where you're adding the "cancel" event listener for the incoming call, and where you're invoking call.ignore)?

@JAD3N
Copy link
Author

JAD3N commented May 26, 2022

I'm adding the event listener to the incoming call immediately after receiving it via the incoming event. I'm using the events to listen for status changes:

const events = [
	'accept',
	'cancel',
	'disconnect',
	'error',
	'mute',
	'reconnected',
	'reconnecting',
	'reject',
	'ignore',
];

let prevStatus = call.status();
for (const event of events) {
	call.on(event, () => {
		const status = call.status();
		if (prevStatus !== status) {
			prevStatus = status;
			win.postMessage({ type: 'status', status });
		}
	});
}

The ignore method is called based on a button click in another window and communicated via postMessage, which is always after the event listeners are registered.

EDIT: You can view full file here https://gist.github.com/JAD3N/1623da78ab9aeba055d053161e1bbcbc

@mhuynh5757
Copy link
Collaborator

Hi all, thanks for bringing this issue up, we've created a ticket to track this one internally.

@aehrenthal
Copy link

I am facing the same issue. When calling

call.ignore();

the cancel event listener does not get triggered. I am registering it in the following manner:

call.on('cancel', onCallCancel);

I can confirm that all other event listeners are properly working, e.g. calling

call.disconnect()

is triggering the cancel event listener. As per the Twilio Voice SDK documentation, the cancel event listener should be called when either

  1. Invoking call.ignore() on an incoming call.
  2. Invoking call.disconnect() on an outgoing call before the recipient answered.

As per the description above, #2 gets properly invoked while #1 does not. Happy to provide a more elaborate example in case it helps 😊

@thexeos
Copy link

thexeos commented May 31, 2023

In our case, it is the opposite. Number 1 from that list - Invoking call.disconnect() on an outgoing call before the recipient answered. - does not trigger cancel.

We are using v2.5.0 and we end the call when the dialing tones are coming through the user's speakers by calling device.disconnectAll().

@gruckion
Copy link

@JAD3N
Copy link
Author

JAD3N commented Sep 18, 2023

@gruckion

Nice find, then some of docs must be out-of-date then for the JavaScript SDK.

Since this appears to be intentional, should I raise a separate issue (feature request) for perhaps adding an ignore event for whenever a call is ignored?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working jira added
Projects
None yet
Development

No branches or pull requests

7 participants