phparia icon indicating copy to clipboard operation
phparia copied to clipboard

Event not fired

Open byphone opened this issue 7 years ago • 0 comments

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

byphone avatar Sep 10 '17 19:09 byphone