phparia
phparia copied to clipboard
Event not fired
Hi,
I use the code provided in examples
$channel->onChannelDtmfReceived(function (ChannelDtmfReceived $event) {
$this->log("Got digit: {$event->getDigit()}");
});
but events seems not be fired, however i can in asterisk cli ari debug see that event is sent.
To have to the code that works, i need to add use ($channel) as :
$channel->onChannelDtmfReceived(function (ChannelDtmfReceived $event) use ($channel) {
$this->log("Got digit: {$event->getDigit()}");
});
I don't understand why