Skip to content

Commit

Permalink
Merge pull request #26 from wormling/3.1
Browse files Browse the repository at this point in the history
3.1
  • Loading branch information
wormling authored Jul 4, 2017
2 parents dab5629 + 60103f5 commit 6c12049
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 35 deletions.
12 changes: 12 additions & 0 deletions UPGRADE-3.1.md
Original file line number Diff line number Diff line change
@@ -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';
```
3 changes: 2 additions & 1 deletion src/wormling/phparia/Events/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down
85 changes: 51 additions & 34 deletions src/wormling/phparia/Resources/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,263 +142,279 @@ public function getState()
*/
public function onStasisEnd(callable $callback)
{
$this->on(Event::STASIS_END.'_'.$this->getId(), $callback);
$this->on(Event::STASIS_END . '_' . $this->getId(), $callback);
}

/**
* @param callable $callback
*/
public function onceStasisEnd(callable $callback)
{
$this->once(Event::STASIS_END.'_'.$this->getId(), $callback);
$this->once(Event::STASIS_END . '_' . $this->getId(), $callback);
}

/**
* @param callable $callback
*/
public function onStasisStart(callable $callback)
{
$this->on(Event::STASIS_START.'_'.$this->getId(), $callback);
$this->on(Event::STASIS_START . '_' . $this->getId(), $callback);
}

/**
* @param callable $callback
*/
public function onceStasisStart(callable $callback)
{
$this->once(Event::STASIS_START.'_'.$this->getId(), $callback);
$this->once(Event::STASIS_START . '_' . $this->getId(), $callback);
}

/**
* @param 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);
}

/**
* @param 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);
}

/**
* @param callable $callback
*/
public function onChannelCreated(callable $callback)
{
$this->on(Event::CHANNEL_CREATED.'_'.$this->getId(), $callback);
$this->on(Event::CHANNEL_CREATED . '_' . $this->getId(), $callback);
}

/**
* @param callable $callback
*/
public function onceChannelCreated(callable $callback)
{
$this->once(Event::CHANNEL_CREATED.'_'.$this->getId(), $callback);
$this->once(Event::CHANNEL_CREATED . '_' . $this->getId(), $callback);
}

/**
* @param callable $callback
*/
public function onChannelDestroyed(callable $callback)
{
$this->on(Event::CHANNEL_DESTROYED.'_'.$this->getId(), $callback);
$this->on(Event::CHANNEL_DESTROYED . '_' . $this->getId(), $callback);
}

/**
* @param callable $callback
*/
public function onceChannelDestroyed(callable $callback)
{
$this->once(Event::CHANNEL_DESTROYED.'_'.$this->getId(), $callback);
$this->once(Event::CHANNEL_DESTROYED . '_' . $this->getId(), $callback);
}

/**
* @param 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);
}

/**
* @param 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);
}

/**
* @param 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);
}

/**
* @param 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);
}

/**
* @param 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);
}

/**
* @param 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);
}

/**
* @param 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);
}

/**
* @param 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);
}

/**
* @param 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);
}

/**
* @param 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);
}

/**
* @param 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);
}

/**
* @param callable $callback
*/
public function onChannelHold(callable $callback)
{
$this->on(Event::CHANNEL_HOLD.'_'.$this->getId(), $callback);
$this->on(Event::CHANNEL_HOLD . '_' . $this->getId(), $callback);
}

/**
* @param callable $callback
*/
public function onceChannelHold(callable $callback)
{
$this->once(Event::CHANNEL_HOLD.'_'.$this->getId(), $callback);
$this->once(Event::CHANNEL_HOLD . '_' . $this->getId(), $callback);
}

/**
* @param callable $callback
*/
public function onChannelUnhold(callable $callback)
{
$this->on(Event::CHANNEL_UNHOLD.'_'.$this->getId(), $callback);
$this->on(Event::CHANNEL_UNHOLD . '_' . $this->getId(), $callback);
}

/**
* @param callable $callback
*/
public function onceChanneUnhold(callable $callback)
{
$this->once(Event::CHANNEL_UNHOLD.'_'.$this->getId(), $callback);
$this->once(Event::CHANNEL_UNHOLD . '_' . $this->getId(), $callback);
}

/**
* @param 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);
}

/**
* @param 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);
}

/**
* @param 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);
}

/**
* @param 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);
}

/**
* @param callable $callback
*/
public function onChannelUserevent(callable $callback)
{
$this->on(Event::CHANNEL_USEREVENT.'_'.$this->getId(), $callback);
$this->on(Event::CHANNEL_USEREVENT . '_' . $this->getId(), $callback);
}

/**
* @param callable $callback
*/
public function onceChannelUserevent(callable $callback)
{
$this->once(Event::CHANNEL_USEREVENT.'_'.$this->getId(), $callback);
$this->once(Event::CHANNEL_USEREVENT . '_' . $this->getId(), $callback);
}

/**
* @param callable $callback
*/
public function onChannelVarset(callable $callback)
{
$this->on(Event::CHANNEL_VARSET.'_'.$this->getId(), $callback);
$this->on(Event::CHANNEL_VARSET . '_' . $this->getId(), $callback);
}

/**
* @param callable $callback
*/
public function onceChannelVarset(callable $callback)
{
$this->once(Event::CHANNEL_VARSET.'_'.$this->getId(), $callback);
$this->once(Event::CHANNEL_VARSET . '_' . $this->getId(), $callback);
}

/**
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 6c12049

Please sign in to comment.