Skip to content

Commit

Permalink
Merge commit 'refs/pull/157/merge' of github.com:marcelog/PAMI into PR
Browse files Browse the repository at this point in the history
PR: marcelog#157
Provided by: @wizzle
PR: Description: added bridgelist action, event and tests for it

Adding A mix of Actions and Events
Updating several comments / doc descriptions
  • Loading branch information
dkgroot committed Apr 24, 2019
2 parents b5d244f + a8b4272 commit 79b66ff
Show file tree
Hide file tree
Showing 24 changed files with 500 additions and 158 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ after_script:
- travis_retry php vendor/bin/coveralls -v
- vendor/bin/test-reporter

addons:
code_climate:
repo_token: 5d81d5163c7f9b810b46451042cb0069d24c91a5887466ba774bf89a56f0187e
#addons:
# code_climate:
# repo_token: 5d81d5163c7f9b810b46451042cb0069d24c91a5887466ba774bf89a56f0187e
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ can still catch them. If you catch one of these, please report it!
* Bridge
* BridgeInfoChannel
* BridgeInfoComplete
* BridgeListItem
* CEL
* ChannelUpdate
* ConfbridgeEnd
Expand Down Expand Up @@ -208,6 +209,7 @@ can still catch them. If you catch one of these, please report it!
* Atxfer (asterisk 1.8?)
* Bridge
* BridgeInfo
* BridgeList
* ChangeMonitor
* Command
* ConfbridgeList
Expand Down
5 changes: 5 additions & 0 deletions src/PAMI/AsyncAgi/AsyncClientImpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ public function handle(EventMessage $event)
/**
* (non-PHPdoc)
* @see ClientImpl::send()
* @param $text
* @return Result
* @throws \PAGI\Exception\ChannelDownException
* @throws \PAGI\Exception\InvalidCommandException
* @throws \PAMI\Client\Exception\ClientException
*/
protected function send($text)
{
Expand Down
4 changes: 3 additions & 1 deletion src/PAMI/Client/Impl/ClientImpl.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(ticks=1);
/**
* TCP Client implementation for AMI.
*
Expand Down Expand Up @@ -28,6 +27,7 @@
* limitations under the License.
*
*/
declare(ticks=1);
namespace PAMI\Client\Impl;

use PAMI\Message\OutgoingMessage;
Expand Down Expand Up @@ -417,6 +417,8 @@ private function messageToEvent($msg)
*
* @todo not suitable for multithreaded applications.
*
* @param OutgoingMessage $message
*
* @return \PAMI\Message\Response\ResponseMessage
*/
protected function getRelated(OutgoingMessage $message)
Expand Down
8 changes: 5 additions & 3 deletions src/PAMI/Message/Action/AGIAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,16 @@ class AGIAction extends ActionMessage
/**
* Constructor.
*
* @return void
* @param $channel
* @param $command
* @param string $commandId
*/
public function __construct($channel, $command, $commandId = false)
public function __construct($channel, $command, $commandId = null)
{
parent::__construct('AGI');
$this->setKey('Channel', $channel);
$this->setKey('Command', $command);
if ($commandId !== false) {
if ($commandId !== null) {
$this->setKey('CommandId', $commandId);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/PAMI/Message/Action/BridgeAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class BridgeAction extends ActionMessage
* Constructor.
*
* @param string $channel1 Channel1
* @param string $channel1 Channel1
* @param string $channel2 Channel2
* @param boolean $tone Play courtesy tone to Channel2
*
* @return void
Expand Down
55 changes: 55 additions & 0 deletions src/PAMI/Message/Action/BridgeListAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
/**
* BridgeList action message.
*
* PHP Version 5
*
* Get a list of bridges in the system.
* Returns a list of bridges, optionally filtering on a bridge type.
*
* @category Pami
* @package Message
* @subpackage Action
*
* Copyright 2011 Marcelo Gornstein <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace PAMI\Message\Action;

/**
* BridgeList action message.
*
* Get a list of bridges in the system.
* Returns a list of bridges, optionally filtering on a bridge type.
*
* @category Pami
* @package Message
* @subpackage Action
*/
class BridgeListAction extends ActionMessage
{
/**
* Constructor.
*
* @param string|bool $bridgeType Optional type for filtering the resulting list of bridges.
* @param string $actionId ActionID for this transaction. Will be returned.
*/
public function __construct($bridgeType = false, $actionId = '')
{
parent::__construct('BridgeList');
if (false !== $bridgeType) {
$this->setKey('BridgeType', $bridgeType);
}
}
}
3 changes: 2 additions & 1 deletion src/PAMI/Message/Action/DAHDIDialOffHookAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class DAHDIDialOffHookAction extends ActionMessage
/**
* Constructor.
*
* @return void
* @param $channel
* @param $number
*/
public function __construct($channel, $number)
{
Expand Down
2 changes: 1 addition & 1 deletion src/PAMI/Message/Action/MonitorAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function setFormat($format)
*
* @return void
*/
public function setFormat($mix)
public function setMix($mix)
{
$this->setKey('Mix', $mix ? 'true' : 'false');
}
Expand Down
8 changes: 7 additions & 1 deletion src/PAMI/Message/Action/PJSIPShowEndpointsAction.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
/**
* PJSIPShowEndpoints action message.
* Lists PJSIP endpoints.
*
* PHP Version 5
*
Expand Down Expand Up @@ -31,6 +32,11 @@

/**
* PJSIPShowEndpoints action message.
* Lists PJSIP endpoints.
*
* Provides a listing of all endpoints. For each endpoint an 'EndpointList'
* event is raised that contains relevant attributes and status information.
* Once all endpoints have been listed an 'EndpointListComplete' event is issued.
*
* PHP Version 5
*
Expand All @@ -53,4 +59,4 @@ public function __construct()
parent::__construct('PJSIPShowEndpoints');
$this->setResponseHandler("PJSIPGeneric");
}
}
}
6 changes: 2 additions & 4 deletions src/PAMI/Message/Action/PlayDTMFAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@ class PlayDTMFAction extends ActionMessage
/**
* Constructor.
*
* @param string $user AMI username.
* @param string $password AMI password.
*
* @return void
* @param $channel
* @param $digit
*/
public function __construct($channel, $digit)
{
Expand Down
10 changes: 6 additions & 4 deletions src/PAMI/Message/Action/QueuePauseAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,17 @@ class QueuePauseAction extends ActionMessage
/**
* Constructor.
*
* @return void
* @param $interface
* @param string $queue
* @param string $reason
*/
public function __construct($interface, $queue = false, $reason = false)
public function __construct($interface, $queue = null, $reason = null)
{
parent::__construct('QueuePause');
if ($queue !== false) {
if ($queue !== null) {
$this->setKey('Queue', $queue);
}
if ($reason !== false) {
if ($reason !== null) {
$this->setKey('Reason', $reason);
}
$this->setKey('Interface', $interface);
Expand Down
9 changes: 4 additions & 5 deletions src/PAMI/Message/Action/QueuePenaltyAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,16 @@ class QueuePenaltyAction extends ActionMessage
/**
* Constructor.
*
* @param $interface
* @param $penalty
* @param string $queue Queue name.
* @param string $event Event.
*
* @return void
*/
public function __construct($interface, $penalty, $queue = false)
public function __construct($interface, $penalty, $queue = null)
{
parent::__construct('QueuePenalty');
$this->setKey('Interface', $interface);
$this->setKey('Penalty', $penalty);
if ($queue !== false) {
if ($queue !== null) {
$this->setKey('Queue', $queue);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/PAMI/Message/Action/QueueStatusAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ class QueueStatusAction extends ActionMessage
*
* @param string $queue The queue (optional).
*
* @return void
* @param string $member
*/
public function __construct($queue = false, $member = false)
public function __construct($queue = null, $member = null)
{
parent::__construct('QueueStatus');
if ($queue != false) {
if ($queue != null) {
$this->setKey('Queue', $queue);
}
if ($member != false) {
if ($member != null) {
$this->setKey('Member', $member);
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/PAMI/Message/Action/QueueUnpauseAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ class QueueUnpauseAction extends ActionMessage
/**
* Constructor.
*
* @return void
* @param $interface
* @param bool $queue
* @param bool $reason
*/
public function __construct($interface, $queue = false, $reason = false)
{
Expand Down
23 changes: 12 additions & 11 deletions src/PAMI/Message/Action/UpdateConfigAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
*/
class UpdateConfigAction extends ActionMessage
{
/** @var int */
protected static $counter = -1;

/**
Expand All @@ -57,33 +58,33 @@ public function __construct()
}

/**
* Sets Src filename key.
* Sets source filename key.
*
* @param string $filename.
* @param string $fileName.
*
* @return void
*/
public function setSrcFilename($filename)
public function setSrcFilename($fileName)
{
$this->setKey('SrcFilename', $filename);
$this->setKey('SrcFilename', $fileName);
}

/**
* Sets Dst Filename key.
* Sets destination Filename key.
*
* @param string $filename.
* @param string $fileName.
*
* @return void
*/
public function setDstFilename($filename)
public function setDstFilename($fileName)
{
$this->setKey('DstFilename', $filename);
$this->setKey('DstFilename', $fileName);
}

/**
* Sets Reload key.
*
* @param string $input.
* @param string $reload.
*
* @return void
*/
Expand Down Expand Up @@ -113,9 +114,9 @@ public function setAction($input)
*
* @return void
*/
public function setCat($input)
public function setCat($cat)
{
$this->setKey('Cat-'.$this->getPaddedCounter(), $input);
$this->setKey('Cat-'.$this->getPaddedCounter(), $cat);
}

/**
Expand Down
13 changes: 8 additions & 5 deletions src/PAMI/Message/Action/VGSMSMSTxAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,21 @@ public function setContent($content)
/**
* Sets X-SMS-Class key. Optional
*
* @param string $sms_class Class of SMS to send. Values are 0, 1. 0 is Flash message.
* @param string $smsClass Class of SMS to send. Values are 0, 1. 0 is Flash message.
*
* @return void
*/
public function setSmsClass($class)
public function setSmsClass($smsClass)
{
$this->setKey('X-SMS-Class', $class);
$this->setKey('X-SMS-Class', $smsClass);
}


/**
* Sets X-SMS-Concatenate-RefID . Optional. Should be set with
* setConcatSeqNum and setConcatSeqNum
*
* @param $refid
* @return void
*/
public function setConcatRefId($refid)
Expand All @@ -134,17 +135,19 @@ public function setConcatRefId($refid)
* Sets X-SMS-Concatenate-Sequence-Number. Optional. Should be set with
* setConcatSeqNum: setConcatTotalMsg
*
* @param $seqNum
* @return void
*/
public function setConcatSeqNum($seqnum)
public function setConcatSeqNum($seqNum)
{
$this->setKey('X-SMS-Concatenate-Sequence-Number', $seqnum);
$this->setKey('X-SMS-Concatenate-Sequence-Number', $seqNum);
}

/**
* Sets X-SMS-Concatenate-Total-Messages. Optional. Should be set with
* setConcatRefId and setConcatSeqNum
*
* @param $totalmsg
* @return void
*/
public function setConcatTotalMsg($totalmsg)
Expand Down
Loading

0 comments on commit 79b66ff

Please sign in to comment.