Skip to content

Commit

Permalink
Merge pull request #114 from thomasvargiu/feature/new-actions
Browse files Browse the repository at this point in the history
Added new actions for Asterisk 12-14
  • Loading branch information
marcelog committed Nov 9, 2016
2 parents bf5295e + fb34b06 commit 34f2655
Show file tree
Hide file tree
Showing 8 changed files with 450 additions and 1 deletion.
60 changes: 60 additions & 0 deletions src/PAMI/Message/Action/BlindTransferAction.php
@@ -0,0 +1,60 @@
<?php
/**
* BlindTransfer action message.
*
* PHP Version 5
*
* @category Pami
* @package Message
* @subpackage Action
* @author Marcelo Gornstein <marcelog@gmail.com>
* @license http://marcelog.github.com/PAMI/ Apache License 2.0
* @version SVN: $Id$
* @link http://marcelog.github.com/PAMI/
*
* Copyright 2011 Marcelo Gornstein <marcelog@gmail.com>
*
* 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;

/**
* BlindTransfer action message.
*
* PHP Version 5
*
* @category Pami
* @package Message
* @subpackage Action
* @author Marcelo Gornstein <marcelog@gmail.com>
* @license http://marcelog.github.com/PAMI/ Apache License 2.0
* @link http://marcelog.github.com/PAMI/
*/
class BlindTransferAction extends ActionMessage
{
/**
* Constructor.
*
* @param string $channel Transferer's channel.
* @param string $extension Extension to transfer to.
* @param string $context Context to transfer to.
*/
public function __construct($channel, $extension, $context)
{
parent::__construct('BlindTransfer');
$this->setKey('Channel', $channel);
$this->setKey('Exten', $extension);
$this->setKey('Context', $context);
}
}
55 changes: 55 additions & 0 deletions src/PAMI/Message/Action/ChallengeAction.php
@@ -1 +1,56 @@
<?php
/**
* Challenge action message.
*
* PHP Version 5
*
* @category Pami
* @package Message
* @subpackage Action
* @author Marcelo Gornstein <marcelog@gmail.com>
* @license http://marcelog.github.com/PAMI/ Apache License 2.0
* @version SVN: $Id$
* @link http://marcelog.github.com/PAMI/
*
* Copyright 2011 Marcelo Gornstein <marcelog@gmail.com>
*
* 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;

/**
* Challenge action message.
*
* PHP Version 5
*
* @category Pami
* @package Message
* @subpackage Action
* @author Marcelo Gornstein <marcelog@gmail.com>
* @license http://marcelog.github.com/PAMI/ Apache License 2.0
* @link http://marcelog.github.com/PAMI/
*/
class ChallengeAction extends ActionMessage
{
/**
* Constructor.
*
* @param string $authType Auth type
*/
public function __construct($authType = 'MD5')
{
parent::__construct('Challenge');
$this->setKey('AuthType', $authType);
}
}
55 changes: 55 additions & 0 deletions src/PAMI/Message/Action/DAHDITransferAction.php
@@ -1 +1,56 @@
<?php
/**
* DAHDITransfer action message.
*
* PHP Version 5
*
* @category Pami
* @package Message
* @subpackage Action
* @author Marcelo Gornstein <marcelog@gmail.com>
* @license http://marcelog.github.com/PAMI/ Apache License 2.0
* @version SVN: $Id$
* @link http://marcelog.github.com/PAMI/
*
* Copyright 2011 Marcelo Gornstein <marcelog@gmail.com>
*
* 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;

/**
* DAHDITransfer action message.
*
* PHP Version 5
*
* @category Pami
* @package Message
* @subpackage Action
* @author Marcelo Gornstein <marcelog@gmail.com>
* @license http://marcelog.github.com/PAMI/ Apache License 2.0
* @link http://marcelog.github.com/PAMI/
*/
class DAHDITransferAction extends ActionMessage
{
/**
* Constructor.
*
* @param string $channel DAHDIChannel
*/
public function __construct($channel)
{
parent::__construct('DAHDITransfer');
$this->setKey('DAHDIChannel', $channel);
}
}
90 changes: 90 additions & 0 deletions src/PAMI/Message/Action/MixMonitorMuteAction.php
@@ -0,0 +1,90 @@
<?php
/**
* MixMonitorMute action message.
*
* PHP Version 5
*
* @category Pami
* @package Message
* @subpackage Action
* @author Matt Styles <mstyleshk@gmail.com>
* @license http://marcelog.github.com/PAMI/ Apache License 2.0
* @version SVN: $Id$
* @link http://marcelog.github.com/PAMI/
*
* Copyright 2011 Marcelo Gornstein <marcelog@gmail.com>
*
* 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;

/**
* MixMonitorMute action message.
*
* PHP Version 5
*
* @category Pami
* @package Message
* @subpackage Action
* @author Matt Styles <mstyleshk@gmail.com>
* @license http://marcelog.github.com/PAMI/ Apache License 2.0
* @link http://marcelog.github.com/PAMI/
*/
class MixMonitorMuteAction extends ActionMessage
{
const DIRECTION_READ = 'read';
const DIRECTION_WRITE = 'write';
const DIRECTION_BOTH = 'both';

/**
* Sets state key.
*
* @param bool $state Mute state
*
* @return void
*/
public function setState($state)
{
$this->setKey('State', $state ? 1 : 0);
}

/**
* Sets state key.
*
* @param string $direction Which part of the recording to mute:
* read, write or both (from channel, to channel or both channels).
*
* @return void
*/
public function setDirection($direction)
{
$this->setKey('Direction', $direction);
}

/**
* Constructor.
*
* @param string $channel Channel on which to act.
* @param bool $state Turn mute on or off
* @param string $direction Which part of the recording to mute:
* read, write or both (from channel, to channel or both channels).
*/
public function __construct($channel, $state = true, $direction = 'both')
{
parent::__construct('MixMonitorMute');
$this->setKey('Channel', $channel);
$this->setState($state);
$this->setDirection($direction);
}
}
1 change: 0 additions & 1 deletion src/PAMI/Message/Action/SetCDRUserFieldAction.php

This file was deleted.

59 changes: 59 additions & 0 deletions src/PAMI/Message/Action/UserEventAction.php
@@ -1 +1,60 @@
<?php
/**
* UserEvent action message.
*
* PHP Version 5
*
* @category Pami
* @package Message
* @subpackage Action
* @author Marcelo Gornstein <marcelog@gmail.com>
* @license http://marcelog.github.com/PAMI/ Apache License 2.0
* @version SVN: $Id$
* @link http://marcelog.github.com/PAMI/
*
* Copyright 2011 Marcelo Gornstein <marcelog@gmail.com>
*
* 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;

/**
* UserEvent action message.
*
* PHP Version 5
*
* @category Pami
* @package Message
* @subpackage Action
* @author Marcelo Gornstein <marcelog@gmail.com>
* @license http://marcelog.github.com/PAMI/ Apache License 2.0
* @link http://marcelog.github.com/PAMI/
*/
class UserEventAction extends ActionMessage
{
/**
* Constructor.
*
* @param string $userEvent UserEvent
* @param array $headers
*/
public function __construct($userEvent, array $headers = [])
{
parent::__construct('UserEvent');
$this->setKey('UserEvent', $userEvent);
foreach ($headers as $key => $value) {
$this->setKey((string)$key, (string)$value);
}
}
}
55 changes: 55 additions & 0 deletions src/PAMI/Message/Action/WaitEventAction.php
@@ -1 +1,56 @@
<?php
/**
* WaitEvent action message.
*
* PHP Version 5
*
* @category Pami
* @package Message
* @subpackage Action
* @author Marcelo Gornstein <marcelog@gmail.com>
* @license http://marcelog.github.com/PAMI/ Apache License 2.0
* @version SVN: $Id$
* @link http://marcelog.github.com/PAMI/
*
* Copyright 2011 Marcelo Gornstein <marcelog@gmail.com>
*
* 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;

/**
* WaitEvent action message.
*
* PHP Version 5
*
* @category Pami
* @package Message
* @subpackage Action
* @author Marcelo Gornstein <marcelog@gmail.com>
* @license http://marcelog.github.com/PAMI/ Apache License 2.0
* @link http://marcelog.github.com/PAMI/
*/
class WaitEventAction extends ActionMessage
{
/**
* Constructor.
*
* @param int $timeout Timeout in seconds
*/
public function __construct($timeout)
{
parent::__construct('WaitEvent');
$this->setKey('Timeout', (int)$timeout);
}
}

0 comments on commit 34f2655

Please sign in to comment.