First I connect those 3 Ariclient to the asterisk’s server.
My issues is 2 of those application needs events ChannelDtmfReceivedEvent and when I Handle the event ChannelDtmfReceivedEvent on the one application, the two applications gets the same events, like the events is handled for the two applications together.
Does someone have an idea how to manage this events because each application has his own actions when this event is happened.
There’s not really enough information here to be able to answer. You receive the events from the things that your application is subscribed to. If two applications are subscribed to the same channel, then they’ll get the same events.
I mean
first: app1 => on events ChannelDtmfReceivedEvent : the user has to enter his number of command
second app2 => on events ChannelDtmfReceivedEvent:the user has to enter his number of phone.
And now the diaplan is into the stasis with app2, but app1 received also the event ChannelDtmfReceivedEvent.
And I see the channelId is the same.
Hope you can understand what I mean
I asked the same question before, and unfortunately Asterisk will generate an event for each subscribed application, no matter what application created the channel.
For example, if application A originates a channel, and A, B and C are subscribed to channel events. Then Asterisk repeats the channel events (Dial, ChannelDestroyed, etc) for all apps. In my opinion Asterisk should only generate channel events for the application that created the channel (application A in this case), otherwise I see it as a waste of resources on the Asterisk server. Of course, this is just my opinion.
Note: I noticed that Asterisk does generate the Stasis-related events only for the application that created the channel (A), instead of all the subscribed apps.
Asterisk only sends all channel events to an application if the application specifically requests all events, which is not the default behavior. The default is that you only receive events for channels that you are subscribed to explicitly or channels you create, so I’m not sure exactly what you mean.
Yes I understand this behavior, my issue is if I want to built 2 differents actions on two applications differents on event ChannelDtmfReceivedEvent with the same channel, app1 and app2 receive the events, even the diaplan is not into stasis(app1) but into stasis(app2)