Skip to content

Commit

Permalink
Added array parameters for sendRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
ofbeaton committed Dec 12, 2016
1 parent 39c09e6 commit 92ddf80
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@

<arg name="extensions" value="php"/>

<rule ref="phpcs/PHPAMI"/>
<rule ref="phpcs/PHPAMI"/>

<config name="php_version" value="50400"/>
</ruleset>
8 changes: 7 additions & 1 deletion src/Ami.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,13 @@ public function sendRequest($action, array $parameters = [])
{
$req = 'Action: '.$action."\r\n";
foreach ($parameters as $var => $val) {
$req .= $var.': '.$val."\r\n";
if (is_array($val) === true) { // only supported by Asterisk > 1.4
foreach ($val as $k => $v) {
$req .= $var.': '.$k.'='.$v."\r\n";
}
} else {
$req .= $var.': '.$val."\r\n";
}
}

$req .= "\r\n";
Expand Down

0 comments on commit 92ddf80

Please sign in to comment.