Skip to content

Commit 79b66ff

Browse files
committed
Merge commit 'refs/pull/157/merge' of github.com:marcelog/PAMI into PR
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
2 parents b5d244f + a8b4272 commit 79b66ff

24 files changed

+500
-158
lines changed

.travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ after_script:
2121
- travis_retry php vendor/bin/coveralls -v
2222
- vendor/bin/test-reporter
2323

24-
addons:
25-
code_climate:
26-
repo_token: 5d81d5163c7f9b810b46451042cb0069d24c91a5887466ba774bf89a56f0187e
24+
#addons:
25+
# code_climate:
26+
# repo_token: 5d81d5163c7f9b810b46451042cb0069d24c91a5887466ba774bf89a56f0187e

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ can still catch them. If you catch one of these, please report it!
116116
* Bridge
117117
* BridgeInfoChannel
118118
* BridgeInfoComplete
119+
* BridgeListItem
119120
* CEL
120121
* ChannelUpdate
121122
* ConfbridgeEnd
@@ -208,6 +209,7 @@ can still catch them. If you catch one of these, please report it!
208209
* Atxfer (asterisk 1.8?)
209210
* Bridge
210211
* BridgeInfo
212+
* BridgeList
211213
* ChangeMonitor
212214
* Command
213215
* ConfbridgeList

src/PAMI/AsyncAgi/AsyncClientImpl.php

+5
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ public function handle(EventMessage $event)
100100
/**
101101
* (non-PHPdoc)
102102
* @see ClientImpl::send()
103+
* @param $text
104+
* @return Result
105+
* @throws \PAGI\Exception\ChannelDownException
106+
* @throws \PAGI\Exception\InvalidCommandException
107+
* @throws \PAMI\Client\Exception\ClientException
103108
*/
104109
protected function send($text)
105110
{

src/PAMI/Client/Impl/ClientImpl.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
declare(ticks=1);
32
/**
43
* TCP Client implementation for AMI.
54
*
@@ -28,6 +27,7 @@
2827
* limitations under the License.
2928
*
3029
*/
30+
declare(ticks=1);
3131
namespace PAMI\Client\Impl;
3232

3333
use PAMI\Message\OutgoingMessage;
@@ -417,6 +417,8 @@ private function messageToEvent($msg)
417417
*
418418
* @todo not suitable for multithreaded applications.
419419
*
420+
* @param OutgoingMessage $message
421+
*
420422
* @return \PAMI\Message\Response\ResponseMessage
421423
*/
422424
protected function getRelated(OutgoingMessage $message)

src/PAMI/Message/Action/AGIAction.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,16 @@ class AGIAction extends ActionMessage
4646
/**
4747
* Constructor.
4848
*
49-
* @return void
49+
* @param $channel
50+
* @param $command
51+
* @param string $commandId
5052
*/
51-
public function __construct($channel, $command, $commandId = false)
53+
public function __construct($channel, $command, $commandId = null)
5254
{
5355
parent::__construct('AGI');
5456
$this->setKey('Channel', $channel);
5557
$this->setKey('Command', $command);
56-
if ($commandId !== false) {
58+
if ($commandId !== null) {
5759
$this->setKey('CommandId', $commandId);
5860
}
5961
}

src/PAMI/Message/Action/BridgeAction.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class BridgeAction extends ActionMessage
4747
* Constructor.
4848
*
4949
* @param string $channel1 Channel1
50-
* @param string $channel1 Channel1
50+
* @param string $channel2 Channel2
5151
* @param boolean $tone Play courtesy tone to Channel2
5252
*
5353
* @return void
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
/**
3+
* BridgeList action message.
4+
*
5+
* PHP Version 5
6+
*
7+
* Get a list of bridges in the system.
8+
* Returns a list of bridges, optionally filtering on a bridge type.
9+
*
10+
* @category Pami
11+
* @package Message
12+
* @subpackage Action
13+
*
14+
* Copyright 2011 Marcelo Gornstein <[email protected]>
15+
*
16+
* Licensed under the Apache License, Version 2.0 (the "License");
17+
* you may not use this file except in compliance with the License.
18+
* You may obtain a copy of the License at
19+
*
20+
* http://www.apache.org/licenses/LICENSE-2.0
21+
*
22+
* Unless required by applicable law or agreed to in writing, software
23+
* distributed under the License is distributed on an "AS IS" BASIS,
24+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25+
* See the License for the specific language governing permissions and
26+
* limitations under the License.
27+
*/
28+
namespace PAMI\Message\Action;
29+
30+
/**
31+
* BridgeList action message.
32+
*
33+
* Get a list of bridges in the system.
34+
* Returns a list of bridges, optionally filtering on a bridge type.
35+
*
36+
* @category Pami
37+
* @package Message
38+
* @subpackage Action
39+
*/
40+
class BridgeListAction extends ActionMessage
41+
{
42+
/**
43+
* Constructor.
44+
*
45+
* @param string|bool $bridgeType Optional type for filtering the resulting list of bridges.
46+
* @param string $actionId ActionID for this transaction. Will be returned.
47+
*/
48+
public function __construct($bridgeType = false, $actionId = '')
49+
{
50+
parent::__construct('BridgeList');
51+
if (false !== $bridgeType) {
52+
$this->setKey('BridgeType', $bridgeType);
53+
}
54+
}
55+
}

src/PAMI/Message/Action/DAHDIDialOffHookAction.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ class DAHDIDialOffHookAction extends ActionMessage
4646
/**
4747
* Constructor.
4848
*
49-
* @return void
49+
* @param $channel
50+
* @param $number
5051
*/
5152
public function __construct($channel, $number)
5253
{

src/PAMI/Message/Action/MonitorAction.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function setFormat($format)
8585
*
8686
* @return void
8787
*/
88-
public function setFormat($mix)
88+
public function setMix($mix)
8989
{
9090
$this->setKey('Mix', $mix ? 'true' : 'false');
9191
}

src/PAMI/Message/Action/PJSIPShowEndpointsAction.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
/**
33
* PJSIPShowEndpoints action message.
4+
* Lists PJSIP endpoints.
45
*
56
* PHP Version 5
67
*
@@ -31,6 +32,11 @@
3132

3233
/**
3334
* PJSIPShowEndpoints action message.
35+
* Lists PJSIP endpoints.
36+
*
37+
* Provides a listing of all endpoints. For each endpoint an 'EndpointList'
38+
* event is raised that contains relevant attributes and status information.
39+
* Once all endpoints have been listed an 'EndpointListComplete' event is issued.
3440
*
3541
* PHP Version 5
3642
*
@@ -53,4 +59,4 @@ public function __construct()
5359
parent::__construct('PJSIPShowEndpoints');
5460
$this->setResponseHandler("PJSIPGeneric");
5561
}
56-
}
62+
}

src/PAMI/Message/Action/PlayDTMFAction.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@ class PlayDTMFAction extends ActionMessage
4646
/**
4747
* Constructor.
4848
*
49-
* @param string $user AMI username.
50-
* @param string $password AMI password.
51-
*
52-
* @return void
49+
* @param $channel
50+
* @param $digit
5351
*/
5452
public function __construct($channel, $digit)
5553
{

src/PAMI/Message/Action/QueuePauseAction.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,17 @@ class QueuePauseAction extends ActionMessage
4646
/**
4747
* Constructor.
4848
*
49-
* @return void
49+
* @param $interface
50+
* @param string $queue
51+
* @param string $reason
5052
*/
51-
public function __construct($interface, $queue = false, $reason = false)
53+
public function __construct($interface, $queue = null, $reason = null)
5254
{
5355
parent::__construct('QueuePause');
54-
if ($queue !== false) {
56+
if ($queue !== null) {
5557
$this->setKey('Queue', $queue);
5658
}
57-
if ($reason !== false) {
59+
if ($reason !== null) {
5860
$this->setKey('Reason', $reason);
5961
}
6062
$this->setKey('Interface', $interface);

src/PAMI/Message/Action/QueuePenaltyAction.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,16 @@ class QueuePenaltyAction extends ActionMessage
4646
/**
4747
* Constructor.
4848
*
49+
* @param $interface
50+
* @param $penalty
4951
* @param string $queue Queue name.
50-
* @param string $event Event.
51-
*
52-
* @return void
5352
*/
54-
public function __construct($interface, $penalty, $queue = false)
53+
public function __construct($interface, $penalty, $queue = null)
5554
{
5655
parent::__construct('QueuePenalty');
5756
$this->setKey('Interface', $interface);
5857
$this->setKey('Penalty', $penalty);
59-
if ($queue !== false) {
58+
if ($queue !== null) {
6059
$this->setKey('Queue', $queue);
6160
}
6261
}

src/PAMI/Message/Action/QueueStatusAction.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ class QueueStatusAction extends ActionMessage
4848
*
4949
* @param string $queue The queue (optional).
5050
*
51-
* @return void
51+
* @param string $member
5252
*/
53-
public function __construct($queue = false, $member = false)
53+
public function __construct($queue = null, $member = null)
5454
{
5555
parent::__construct('QueueStatus');
56-
if ($queue != false) {
56+
if ($queue != null) {
5757
$this->setKey('Queue', $queue);
5858
}
59-
if ($member != false) {
59+
if ($member != null) {
6060
$this->setKey('Member', $member);
6161
}
6262
}

src/PAMI/Message/Action/QueueUnpauseAction.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ class QueueUnpauseAction extends ActionMessage
4646
/**
4747
* Constructor.
4848
*
49-
* @return void
49+
* @param $interface
50+
* @param bool $queue
51+
* @param bool $reason
5052
*/
5153
public function __construct($interface, $queue = false, $reason = false)
5254
{

src/PAMI/Message/Action/UpdateConfigAction.php

+12-11
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
*/
4444
class UpdateConfigAction extends ActionMessage
4545
{
46+
/** @var int */
4647
protected static $counter = -1;
4748

4849
/**
@@ -57,33 +58,33 @@ public function __construct()
5758
}
5859

5960
/**
60-
* Sets Src filename key.
61+
* Sets source filename key.
6162
*
62-
* @param string $filename.
63+
* @param string $fileName.
6364
*
6465
* @return void
6566
*/
66-
public function setSrcFilename($filename)
67+
public function setSrcFilename($fileName)
6768
{
68-
$this->setKey('SrcFilename', $filename);
69+
$this->setKey('SrcFilename', $fileName);
6970
}
7071

7172
/**
72-
* Sets Dst Filename key.
73+
* Sets destination Filename key.
7374
*
74-
* @param string $filename.
75+
* @param string $fileName.
7576
*
7677
* @return void
7778
*/
78-
public function setDstFilename($filename)
79+
public function setDstFilename($fileName)
7980
{
80-
$this->setKey('DstFilename', $filename);
81+
$this->setKey('DstFilename', $fileName);
8182
}
8283

8384
/**
8485
* Sets Reload key.
8586
*
86-
* @param string $input.
87+
* @param string $reload.
8788
*
8889
* @return void
8990
*/
@@ -113,9 +114,9 @@ public function setAction($input)
113114
*
114115
* @return void
115116
*/
116-
public function setCat($input)
117+
public function setCat($cat)
117118
{
118-
$this->setKey('Cat-'.$this->getPaddedCounter(), $input);
119+
$this->setKey('Cat-'.$this->getPaddedCounter(), $cat);
119120
}
120121

121122
/**

src/PAMI/Message/Action/VGSMSMSTxAction.php

+8-5
Original file line numberDiff line numberDiff line change
@@ -109,20 +109,21 @@ public function setContent($content)
109109
/**
110110
* Sets X-SMS-Class key. Optional
111111
*
112-
* @param string $sms_class Class of SMS to send. Values are 0, 1. 0 is Flash message.
112+
* @param string $smsClass Class of SMS to send. Values are 0, 1. 0 is Flash message.
113113
*
114114
* @return void
115115
*/
116-
public function setSmsClass($class)
116+
public function setSmsClass($smsClass)
117117
{
118-
$this->setKey('X-SMS-Class', $class);
118+
$this->setKey('X-SMS-Class', $smsClass);
119119
}
120120

121121

122122
/**
123123
* Sets X-SMS-Concatenate-RefID . Optional. Should be set with
124124
* setConcatSeqNum and setConcatSeqNum
125125
*
126+
* @param $refid
126127
* @return void
127128
*/
128129
public function setConcatRefId($refid)
@@ -134,17 +135,19 @@ public function setConcatRefId($refid)
134135
* Sets X-SMS-Concatenate-Sequence-Number. Optional. Should be set with
135136
* setConcatSeqNum: setConcatTotalMsg
136137
*
138+
* @param $seqNum
137139
* @return void
138140
*/
139-
public function setConcatSeqNum($seqnum)
141+
public function setConcatSeqNum($seqNum)
140142
{
141-
$this->setKey('X-SMS-Concatenate-Sequence-Number', $seqnum);
143+
$this->setKey('X-SMS-Concatenate-Sequence-Number', $seqNum);
142144
}
143145

144146
/**
145147
* Sets X-SMS-Concatenate-Total-Messages. Optional. Should be set with
146148
* setConcatRefId and setConcatSeqNum
147149
*
150+
* @param $totalmsg
148151
* @return void
149152
*/
150153
public function setConcatTotalMsg($totalmsg)

0 commit comments

Comments
 (0)