diff --git a/UPGRADE-3.1.md b/UPGRADE-3.1.md new file mode 100644 index 0000000..b757717 --- /dev/null +++ b/UPGRADE-3.1.md @@ -0,0 +1,12 @@ +Breaking Changes +--- + +3.0 to 3.1 + +```php +const DEVICE_STATE_CHANGE = 'DeviceStateChange'; +``` +changed to +```php +const DEVICE_STATE_CHANGED = 'DeviceStateChanged'; +``` \ No newline at end of file diff --git a/src/wormling/phparia/Events/Event.php b/src/wormling/phparia/Events/Event.php index 283e819..1a9ba30 100644 --- a/src/wormling/phparia/Events/Event.php +++ b/src/wormling/phparia/Events/Event.php @@ -40,6 +40,7 @@ class Event extends Message implements EventInterface const CHANNEL_CREATED = 'ChannelCreated'; const CHANNEL_CONNECTED_LINE = 'ChannelConnectedLine'; const CHANNEL_DESTROYED = 'ChannelDestroyed'; + const CHANNEL_DIALPLAN = 'ChannelDialplan'; const CHANNEL_DTMF_RECEIVED = 'ChannelDtmfReceived'; const CHANNEL_ENTERED_BRIDGE = 'ChannelEnteredBridge'; const CHANNEL_HANGUP_REQUEST = 'ChannelHangupRequest'; @@ -51,7 +52,7 @@ class Event extends Message implements EventInterface const CHANNEL_TALKING_STARTED = 'ChannelTalkingStarted'; const CHANNEL_USEREVENT = 'ChannelUserevent'; const CHANNEL_VARSET = 'ChannelVarset'; - const DEVICE_STATE_CHANGE = 'DeviceStateChange'; + const DEVICE_STATE_CHANGED = 'DeviceStateChanged'; const DIAL = 'Dial'; const DIALED = 'Dialed'; const ENDPOINT_STATE_CHANGE = 'EndpointStateChange'; diff --git a/src/wormling/phparia/Resources/Channel.php b/src/wormling/phparia/Resources/Channel.php index 0ced7b8..cc25c50 100644 --- a/src/wormling/phparia/Resources/Channel.php +++ b/src/wormling/phparia/Resources/Channel.php @@ -142,7 +142,7 @@ public function getState() */ public function onStasisEnd(callable $callback) { - $this->on(Event::STASIS_END.'_'.$this->getId(), $callback); + $this->on(Event::STASIS_END . '_' . $this->getId(), $callback); } /** @@ -150,7 +150,7 @@ public function onStasisEnd(callable $callback) */ public function onceStasisEnd(callable $callback) { - $this->once(Event::STASIS_END.'_'.$this->getId(), $callback); + $this->once(Event::STASIS_END . '_' . $this->getId(), $callback); } /** @@ -158,7 +158,7 @@ public function onceStasisEnd(callable $callback) */ public function onStasisStart(callable $callback) { - $this->on(Event::STASIS_START.'_'.$this->getId(), $callback); + $this->on(Event::STASIS_START . '_' . $this->getId(), $callback); } /** @@ -166,7 +166,7 @@ public function onStasisStart(callable $callback) */ public function onceStasisStart(callable $callback) { - $this->once(Event::STASIS_START.'_'.$this->getId(), $callback); + $this->once(Event::STASIS_START . '_' . $this->getId(), $callback); } /** @@ -174,7 +174,7 @@ public function onceStasisStart(callable $callback) */ public function onChannelCallerId(callable $callback) { - $this->on(Event::CHANNEL_CALLER_ID.'_'.$this->getId(), $callback); + $this->on(Event::CHANNEL_CALLER_ID . '_' . $this->getId(), $callback); } /** @@ -182,7 +182,7 @@ public function onChannelCallerId(callable $callback) */ public function onceChannelCallerId(callable $callback) { - $this->once(Event::CHANNEL_CALLER_ID.'_'.$this->getId(), $callback); + $this->once(Event::CHANNEL_CALLER_ID . '_' . $this->getId(), $callback); } /** @@ -190,7 +190,7 @@ public function onceChannelCallerId(callable $callback) */ public function onChannelCreated(callable $callback) { - $this->on(Event::CHANNEL_CREATED.'_'.$this->getId(), $callback); + $this->on(Event::CHANNEL_CREATED . '_' . $this->getId(), $callback); } /** @@ -198,7 +198,7 @@ public function onChannelCreated(callable $callback) */ public function onceChannelCreated(callable $callback) { - $this->once(Event::CHANNEL_CREATED.'_'.$this->getId(), $callback); + $this->once(Event::CHANNEL_CREATED . '_' . $this->getId(), $callback); } /** @@ -206,7 +206,7 @@ public function onceChannelCreated(callable $callback) */ public function onChannelDestroyed(callable $callback) { - $this->on(Event::CHANNEL_DESTROYED.'_'.$this->getId(), $callback); + $this->on(Event::CHANNEL_DESTROYED . '_' . $this->getId(), $callback); } /** @@ -214,7 +214,7 @@ public function onChannelDestroyed(callable $callback) */ public function onceChannelDestroyed(callable $callback) { - $this->once(Event::CHANNEL_DESTROYED.'_'.$this->getId(), $callback); + $this->once(Event::CHANNEL_DESTROYED . '_' . $this->getId(), $callback); } /** @@ -222,7 +222,23 @@ public function onceChannelDestroyed(callable $callback) */ public function removeChannelDestroyedListener(callable $callback) { - $this->removeListener(Event::CHANNEL_DESTROYED.'_'.$this->getId(), $callback); + $this->removeListener(Event::CHANNEL_DESTROYED . '_' . $this->getId(), $callback); + } + + /** + * @param callable $callback + */ + public function onChannelDialplan(callable $callback) + { + $this->on(Event::CHANNEL_DIALPLAN . '_' . $this->getId(), $callback); + } + + /** + * @param callable $callback + */ + public function onceChannelDialplan(callable $callback) + { + $this->once(Event::CHANNEL_DIALPLAN . '_' . $this->getId(), $callback); } /** @@ -230,7 +246,7 @@ public function removeChannelDestroyedListener(callable $callback) */ public function onChannelDtmfReceived(callable $callback) { - $this->on(Event::CHANNEL_DTMF_RECEIVED.'_'.$this->getId(), $callback); + $this->on(Event::CHANNEL_DTMF_RECEIVED . '_' . $this->getId(), $callback); } /** @@ -238,7 +254,7 @@ public function onChannelDtmfReceived(callable $callback) */ public function onceChannelDtmfReceived(callable $callback) { - $this->once(Event::CHANNEL_DTMF_RECEIVED.'_'.$this->getId(), $callback); + $this->once(Event::CHANNEL_DTMF_RECEIVED . '_' . $this->getId(), $callback); } /** @@ -246,7 +262,7 @@ public function onceChannelDtmfReceived(callable $callback) */ public function onChannelEnteredBridge(callable $callback) { - $this->on(Event::CHANNEL_ENTERED_BRIDGE.'_'.$this->getId(), $callback); + $this->on(Event::CHANNEL_ENTERED_BRIDGE . '_' . $this->getId(), $callback); } /** @@ -254,7 +270,7 @@ public function onChannelEnteredBridge(callable $callback) */ public function onceChannelEnteredBridge(callable $callback) { - $this->once(Event::CHANNEL_ENTERED_BRIDGE.'_'.$this->getId(), $callback); + $this->once(Event::CHANNEL_ENTERED_BRIDGE . '_' . $this->getId(), $callback); } /** @@ -262,7 +278,7 @@ public function onceChannelEnteredBridge(callable $callback) */ public function onChannelHangupRequest(callable $callback) { - $this->on(Event::CHANNEL_HANGUP_REQUEST.'_'.$this->getId(), $callback); + $this->on(Event::CHANNEL_HANGUP_REQUEST . '_' . $this->getId(), $callback); } /** @@ -270,7 +286,7 @@ public function onChannelHangupRequest(callable $callback) */ public function onceChannelHangupRequest(callable $callback) { - $this->once(Event::CHANNEL_HANGUP_REQUEST.'_'.$this->getId(), $callback); + $this->once(Event::CHANNEL_HANGUP_REQUEST . '_' . $this->getId(), $callback); } /** @@ -278,7 +294,7 @@ public function onceChannelHangupRequest(callable $callback) */ public function onChannelLeftBridge(callable $callback) { - $this->on(Event::CHANNEL_LEFT_BRIDGE.'_'.$this->getId(), $callback); + $this->on(Event::CHANNEL_LEFT_BRIDGE . '_' . $this->getId(), $callback); } /** @@ -286,7 +302,7 @@ public function onChannelLeftBridge(callable $callback) */ public function onceChannelLeftBridge(callable $callback) { - $this->once(Event::CHANNEL_LEFT_BRIDGE.'_'.$this->getId(), $callback); + $this->once(Event::CHANNEL_LEFT_BRIDGE . '_' . $this->getId(), $callback); } /** @@ -294,7 +310,7 @@ public function onceChannelLeftBridge(callable $callback) */ public function onChannelStateChange(callable $callback) { - $this->on(Event::CHANNEL_STATE_CHANGE.'_'.$this->getId(), $callback); + $this->on(Event::CHANNEL_STATE_CHANGE . '_' . $this->getId(), $callback); } /** @@ -302,7 +318,7 @@ public function onChannelStateChange(callable $callback) */ public function onceChannelStateChange(callable $callback) { - $this->once(Event::CHANNEL_STATE_CHANGE.'_'.$this->getId(), $callback); + $this->once(Event::CHANNEL_STATE_CHANGE . '_' . $this->getId(), $callback); } /** @@ -310,7 +326,7 @@ public function onceChannelStateChange(callable $callback) */ public function onChannelHold(callable $callback) { - $this->on(Event::CHANNEL_HOLD.'_'.$this->getId(), $callback); + $this->on(Event::CHANNEL_HOLD . '_' . $this->getId(), $callback); } /** @@ -318,7 +334,7 @@ public function onChannelHold(callable $callback) */ public function onceChannelHold(callable $callback) { - $this->once(Event::CHANNEL_HOLD.'_'.$this->getId(), $callback); + $this->once(Event::CHANNEL_HOLD . '_' . $this->getId(), $callback); } /** @@ -326,7 +342,7 @@ public function onceChannelHold(callable $callback) */ public function onChannelUnhold(callable $callback) { - $this->on(Event::CHANNEL_UNHOLD.'_'.$this->getId(), $callback); + $this->on(Event::CHANNEL_UNHOLD . '_' . $this->getId(), $callback); } /** @@ -334,7 +350,7 @@ public function onChannelUnhold(callable $callback) */ public function onceChanneUnhold(callable $callback) { - $this->once(Event::CHANNEL_UNHOLD.'_'.$this->getId(), $callback); + $this->once(Event::CHANNEL_UNHOLD . '_' . $this->getId(), $callback); } /** @@ -342,7 +358,7 @@ public function onceChanneUnhold(callable $callback) */ public function onChannelTalkingFinished(callable $callback) { - $this->on(Event::CHANNEL_TALKING_FINISHED.'_'.$this->getId(), $callback); + $this->on(Event::CHANNEL_TALKING_FINISHED . '_' . $this->getId(), $callback); } /** @@ -350,7 +366,7 @@ public function onChannelTalkingFinished(callable $callback) */ public function onceChannelTalkingFinished(callable $callback) { - $this->once(Event::CHANNEL_TALKING_FINISHED.'_'.$this->getId(), $callback); + $this->once(Event::CHANNEL_TALKING_FINISHED . '_' . $this->getId(), $callback); } /** @@ -358,7 +374,7 @@ public function onceChannelTalkingFinished(callable $callback) */ public function onChannelTalkingStarted(callable $callback) { - $this->on(Event::CHANNEL_TALKING_STARTED.'_'.$this->getId(), $callback); + $this->on(Event::CHANNEL_TALKING_STARTED . '_' . $this->getId(), $callback); } /** @@ -366,7 +382,7 @@ public function onChannelTalkingStarted(callable $callback) */ public function onceChannelTalkingStarted(callable $callback) { - $this->once(Event::CHANNEL_TALKING_STARTED.'_'.$this->getId(), $callback); + $this->once(Event::CHANNEL_TALKING_STARTED . '_' . $this->getId(), $callback); } /** @@ -374,7 +390,7 @@ public function onceChannelTalkingStarted(callable $callback) */ public function onChannelUserevent(callable $callback) { - $this->on(Event::CHANNEL_USEREVENT.'_'.$this->getId(), $callback); + $this->on(Event::CHANNEL_USEREVENT . '_' . $this->getId(), $callback); } /** @@ -382,7 +398,7 @@ public function onChannelUserevent(callable $callback) */ public function onceChannelUserevent(callable $callback) { - $this->once(Event::CHANNEL_USEREVENT.'_'.$this->getId(), $callback); + $this->once(Event::CHANNEL_USEREVENT . '_' . $this->getId(), $callback); } /** @@ -390,7 +406,7 @@ public function onceChannelUserevent(callable $callback) */ public function onChannelVarset(callable $callback) { - $this->on(Event::CHANNEL_VARSET.'_'.$this->getId(), $callback); + $this->on(Event::CHANNEL_VARSET . '_' . $this->getId(), $callback); } /** @@ -398,7 +414,7 @@ public function onChannelVarset(callable $callback) */ public function onceChannelVarset(callable $callback) { - $this->once(Event::CHANNEL_VARSET.'_'.$this->getId(), $callback); + $this->once(Event::CHANNEL_VARSET . '_' . $this->getId(), $callback); } /** @@ -645,7 +661,8 @@ public function record( $ifExists = null, $beep = null, $terminateOn = null - ) { + ) + { return $this->client->channels()->record($this->id, $name, $format, $maxDurationSeconds, $maxSilenceSeconds, $ifExists, $beep, $terminateOn); }