drachtio / drachtio-srf

drachtio signaling resource framework
https://drachtio.org
MIT License
168 stars 59 forks source link

"destroy" event not triggered if dialog.destroy() #174

Closed marcus-orchard closed 3 months ago

marcus-orchard commented 3 months ago

My implementation sets up a call using b2bua and has "destroy" event handling per the documentation that receives the "destroy" event when one side terminates the call and then handles end of call logic and calls dialog.destroy() on the other side of the call.

This works and has been working as expected for some time. A new feature requires retrieving the dialog via srf.findDialogById(stackDialogId), then calling dialog.destroy() on that dialog.

When I do that the dialog does get destroyed, but I don't see the "destroy" event being invoked and the rest of the call handling that usually is then kicked off in response to one dialog being destroyed doesn't occur.

Is this expected behavior, and is there a way to get the event to trigger?

marcus-orchard commented 3 months ago

Was able to resolve my issue by manually emitting the destroy event, like so:

dialog.emit('destroy', stateObj);

Closing the issue