marcelog / PAMI

PHP Asterisk Manager Interface ( AMI ) supports synchronous command ( action )/ responses and asynchronous events using the pattern observer-listener. Supports commands with responses with multiple events. Very suitable for development of operator consoles and / or asterisk / channels / peers monitoring through SOA, etc
http://marcelog.github.com/PAMI
Apache License 2.0
397 stars 278 forks source link

Asterisk 12 support #56

Open wormling opened 9 years ago

wormling commented 9 years ago

https://issues.asterisk.org/jira/browse/ASTERISK-21470

I would like to add support for asterisk 12 but would like some direction. Creating the new event classes would possibly be a breaking change for backward compatibility, catching the events and populating the sub-events seems a little hacky. Any suggestions?

marcelog commented 9 years ago

Hello :)

I have to admit that I haven't used v12 myself, so I don't fully understand the changes involved. Could you elaborate a bit more on what would be needed and/or what has changed exactly?

Thanks!

wormling commented 9 years ago

In asterisk 12, AsyncAGI events should be refactored based on the SubEvent type to be: 'AsyncAGIStart', 'AsyncAGIEnd', 'AsyncAGIExec', 'AGIExecStart', 'AGIExecEnd'

So rather than changing anything, so far I've added those events and am looking at the code to make sure they will function properly along side of the AsyncAGIEvent. EventFactoryImpl::createFromRaw will not need to change this way.

Things like "if ($event instanceof \PAMI\Message\Event\AsyncAGIEvent) {" will still need to be updated to allow for the new events.

I'm also about done updating the unit tests, and will try to update the example code with at least a note for 12+ users.

wormling commented 9 years ago

It may not be feasible to maintain backward compatibility once an attempt to fully conform to the AMI v2 specification is made, but I'll maintain a branch for a bit updating any parts I need as I go.

parhamdoustdar commented 9 years ago

@wormling What's the status on your changes? I need to work with Asterisk 12+, and I wonder if I can use your changes?

wormling commented 9 years ago

It didn't fit well with ARI, your code should still work, but if you need ARI you can use the wormling/phparia project. It does not include menu logic, but it's very simple.

wormling commented 9 years ago

Ahh... you'll still need to switch to 'AsyncAGIStart', 'AsyncAGIEnd', 'AsyncAGIExec', 'AGIExecStart', 'AGIExecEnd', there might be something it that clone of PAGI on my github

ldo commented 1 year ago

Something else new in Asterisk 12 is ARI. This nicely separates the command/response traffic from the event listening, with the latter being done via WebSockets.