├── AsteriskManager.php ├── AsteriskManagerException.php ├── LICENSE ├── README.md ├── docs ├── README.md ├── examples │ └── example.php └── html │ ├── Net_AsteriskManager │ ├── AsteriskManager.html │ └── _asterisk.php.html │ ├── blank.html │ ├── classtrees_Net_AsteriskManager.html │ ├── elementindex.html │ ├── elementindex_Net_AsteriskManager.html │ ├── errors.html │ ├── index.html │ ├── li_Net_AsteriskManager.html │ ├── media │ ├── banner.css │ └── stylesheet.css │ └── packages.html └── package.xml /AsteriskManager.php: -------------------------------------------------------------------------------- 1 | 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * - Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * - Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * - Neither the name of the author nor the names of its 19 | * contributors may be used to endorse or promote products derived from 20 | * this software without specific prior written permission. 21 | 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 26 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 29 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 31 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 32 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | * PHP version 4 35 | * 36 | * @category Net 37 | * @package Net_AsteriskManager 38 | * @author Doug Bromley 39 | * @copyright 2008-2014 Doug Bromley 40 | * @license http://www.debian.org/misc/bsd.license New BSD License 41 | * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=543 42 | * @link https://github.com/OdinsHat/asterisk-php-manager 43 | */ 44 | 45 | /** 46 | * Including the libraries exception class which extends PEAR_Exception 47 | */ 48 | require 'AsteriskManagerException.php'; 49 | 50 | /** 51 | * Class for accessing the Asterisk Manager interface 52 | * {@link http://www.voip-info.org/wiki/view/Asterisk+manager+API} 53 | * 54 | * @category Net 55 | * @package Net_AsteriskManager 56 | * @author Doug Bromley 57 | * @license http://www.debian.org/misc/bsd.license New BSD License 58 | * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=543 59 | */ 60 | class Net_AsteriskManager 61 | { 62 | /** 63 | * The Asterisk server which will recieve the manager commands 64 | * @access public 65 | * @var string 66 | */ 67 | public $server; 68 | 69 | /** 70 | * The port to use when connecting to the Asterisk server 71 | * @access public 72 | * @var integer 73 | */ 74 | public $port = 5038; 75 | 76 | /** 77 | * The opened socket to the Asterisk server 78 | * @access private 79 | * @var object 80 | */ 81 | private $_socket; 82 | 83 | /** 84 | * Class constructor 85 | * 86 | * @param array $params Array of the parameters used to connect to the server 87 | * 88 | * array( 89 | * 'server' => '127.0.0.1' // The server to connect to 90 | * 'port' => '5038', // Port of manager API 91 | * 'auto_connect' => true // Autoconnect on construction? 92 | * ); 93 | * 94 | * 95 | * @throws Net_AsteriskManagerException when server not set 96 | * 97 | * @uses AsteriskManager::$server 98 | * @uses AsteriskManager::$port 99 | * @uses AsteriskManager::$_socket 100 | */ 101 | public function __construct($params = array()) 102 | { 103 | if (!isset($params['server'])) { 104 | throw new Net_AsteriskManagerException( 105 | Net_AsteriskManagerException::NOSERVER 106 | ); 107 | } 108 | $this->server = $params['server']; 109 | 110 | if (isset($params['port'])) { 111 | $this->port = $params['port']; 112 | } 113 | 114 | if (isset($params['auto_connect'])) { 115 | if ($params['auto_connect']) { 116 | $this->connect(); 117 | } 118 | } 119 | } 120 | 121 | /** 122 | * Private method for checking there is a socket open to the Asterisk 123 | * server. 124 | * 125 | * @throws Net_AsteriskManagerException when no socket established 126 | * 127 | * @return null 128 | */ 129 | private function _checkSocket() 130 | { 131 | if (!$this->_socket) { 132 | throw new Net_AsteriskManagerException( 133 | Net_AsteriskManagerException::NOSOCKET 134 | ); 135 | } 136 | } 137 | 138 | /** 139 | * Consolidated method for sending the given command to the server and returning 140 | * its reponse. Any failure in writing or reading will raise an exception. 141 | * 142 | * @param string $command The command to send 143 | * @param string $terminationString If supplied, and we find it in the result quit reading now and don't wait for the timeout 144 | * 145 | * @throws Net_AsteriskManagerException when failing to write command to Asterisk 146 | * 147 | * @return string 148 | */ 149 | private function _sendCommand($command, $terminationString = null, $stripTerminator = true) 150 | { 151 | if (!fwrite($this->_socket, $command)) { 152 | throw new Net_AsteriskManagerException( 153 | Net_AsteriskManagerException::CMDSENDERR 154 | ); 155 | } 156 | 157 | 158 | $response = false; 159 | $break = false; 160 | while (!$break && $line = fgets($this->_socket)) { 161 | if (!empty($terminationString) && strstr($line, $terminationString) !== false ) { 162 | //found termination string 163 | $break = true; 164 | if (!$stripTerminator) { 165 | $response .= $line; 166 | } 167 | //what about extra chars after? 168 | } else { 169 | $response .= $line; 170 | } 171 | 172 | } 173 | 174 | if (!$response) { 175 | throw new Net_AsteriskManagerException( 176 | Net_AsteriskManagerException::RESPERR 177 | ); 178 | } 179 | 180 | return $response; 181 | } 182 | 183 | /** 184 | * If not already connected then connect to the Asterisk server 185 | * otherwise close active connection and reconnect 186 | * 187 | * @throws Net_AsteriskManagerException if connection fails 188 | * 189 | * @return bool 190 | */ 191 | public function connect() 192 | { 193 | if ($this->_socket) { 194 | $this->close(); 195 | } 196 | 197 | if ($this->_socket = fsockopen($this->server, $this->port)) { 198 | stream_set_timeout($this->_socket, 3); 199 | return true; 200 | } 201 | 202 | throw new Net_AsteriskManagerException ( 203 | Net_AsteriskManagerException::CONNECTFAILED 204 | ); 205 | } 206 | 207 | /** 208 | * Login into Asterisk Manager interface given the user credentials 209 | * 210 | * @param string $username The username to access the interface 211 | * @param string $password The password defined in manager interface of server 212 | * @param string $authtype Enabling the ability to handle encrypted connections 213 | * 214 | * @throws Net_AsteriskManagerException 215 | * 216 | * @return bool 217 | */ 218 | public function login($username, $password, $authtype = null, $eventsoff = false) 219 | { 220 | $this->_checkSocket(); 221 | $events = $eventsoff ? "Events: off\r\n": ""; 222 | 223 | if (strtolower($authtype) == 'md5') { 224 | $response = $this->_sendCommand( 225 | "Action: Challenge\r\n" 226 | ."AuthType: MD5\r\n\r\n" 227 | ); 228 | if (strpos($response, "Response: Success") !== false) { 229 | $challenge = trim(substr($response, 230 | strpos($response, "Challenge: ")+strlen("Challenge: "))); 231 | 232 | $md5_key = md5($challenge . $password); 233 | $response = $this->_sendCommand("Action: Login\r\nAuthType: MD5\r\n" 234 | ."Username: {$username}\r\n" 235 | ."Key: {$md5_key}\r\n$events\r\n"); 236 | } else { 237 | throw new Net_AsteriskManagerException( 238 | Net_AsteriskManagerException::AUTHFAIL 239 | ); 240 | } 241 | } else { 242 | $response = $this->_sendCommand( 243 | "Action: login\r\n" 244 | ."Username: {$username}\r\n" 245 | ."Secret: {$password}\r\n$events\r\n", 246 | 'Message: Authentication', 247 | false 248 | ); 249 | } 250 | 251 | if (strpos($response, "Message: Authentication accepted") !== false) { 252 | return true; 253 | } 254 | throw new Net_AsteriskManagerException( 255 | Net_AsteriskManagerException::AUTHFAIL 256 | ); 257 | } 258 | 259 | /** 260 | * Logout of the current manager session attached to $this::socket 261 | * 262 | * @return bool 263 | */ 264 | public function logout() 265 | { 266 | $this->_checkSocket(); 267 | 268 | $this->_sendCommand("Action: Logoff\r\n\r\n"); 269 | 270 | return true; 271 | } 272 | 273 | /** 274 | * Close the connection 275 | * 276 | * @return bool 277 | */ 278 | public function close() 279 | { 280 | $this->_checkSocket(); 281 | 282 | return fclose($this->_socket); 283 | } 284 | 285 | /** 286 | * Send a command to the Asterisk CLI interface. Acceptable commands 287 | * are dependent on the Asterisk installation. 288 | * 289 | * @param string $command Command to execute on server 290 | * 291 | * @throws Net_AsteriskManagerException if Asterisk responds that command not known 292 | * 293 | * @return string|bool 294 | */ 295 | public function command($command) 296 | { 297 | $this->_checkSocket(); 298 | 299 | $response = $this->_sendCommand("Action: Command\r\n" 300 | ."Command: $command\r\n\r\n", "--END COMMAND--"); 301 | 302 | if (strpos($response, 'No such command') !== false) { 303 | throw new Net_AsteriskManagerException( 304 | Net_AsteriskManagerException::NOCOMMAND 305 | ); 306 | } 307 | return $response; 308 | } 309 | 310 | /** 311 | * A simple 'ping' command which the server responds with 'pong' 312 | * 313 | * @return bool 314 | */ 315 | public function ping() 316 | { 317 | $this->_checkSocket(); 318 | 319 | $response = $this->_sendCommand("Action: Ping\r\n\r\n", "Response", false); 320 | if (strpos($response, "Pong") === false) { 321 | return false; 322 | } 323 | return true; 324 | } 325 | 326 | /** 327 | * Make a call to an extension with a given channel acting as the originator 328 | * 329 | * @param string $extension The number to dial 330 | * @param string $channel The channel where you wish to originate the call 331 | * @param string $context The context that the call will be dropped into 332 | * @param string $cid The caller ID to use 333 | * @param integer $priority The priority of this command 334 | * @param integer $timeout Timeout in milliseconds before attempt dropped 335 | * @param array $variables An array of variables to pass to Asterisk 336 | * @param string $action_id A unique identifier for this command 337 | * 338 | * @return bool 339 | */ 340 | public function originateCall( 341 | $extension, 342 | $channel, 343 | $context, 344 | $cid, 345 | $priority = 1, 346 | $timeout = 30000, 347 | $variables = null, 348 | $action_id = null) 349 | { 350 | $this->_checkSocket(); 351 | 352 | $command = "Action: Originate\r\nChannel: $channel\r\n" 353 | ."Context: $context\r\nExten: $extension\r\nPriority: $priority\r\n" 354 | ."Callerid: $cid\r\nTimeout: $timeout\r\n"; 355 | 356 | if (count($variables) > 0) { 357 | $chunked_vars = array(); 358 | foreach ($variables as $key => $val) { 359 | $chunked_vars[] = "$key=$val"; 360 | } 361 | $chunked_vars = implode('|', $chunked_vars); 362 | $command .= "Variable: $chunked_vars\r\n"; 363 | } 364 | 365 | if ($action_id) { 366 | $command .= "ActionID: $action_id\r\n"; 367 | } 368 | $this->_sendCommand($command."\r\n"); 369 | return true; 370 | } 371 | 372 | /** 373 | * Returns a list of queues and their status 374 | * 375 | * @return string|bool 376 | */ 377 | public function getQueues() 378 | { 379 | $this->_checkSocket(); 380 | 381 | $response = $this->_sendCommand("Action: Queues\r\n\r\n"); 382 | return $response; 383 | } 384 | 385 | /** 386 | * Add a handset to a queue on the server 387 | * 388 | * @param string $queue The name of the queue you wish to add the handset too 389 | * @param string $handset The handset to add, e.g. SIP/234 390 | * @param integer $penalty Penalty 391 | * @param string $memberName Human readable name of handset 392 | * 393 | * @return bool 394 | */ 395 | public function queueAdd($queue, $handset, $penalty = null, $memberName = null) 396 | { 397 | $this->_checkSocket(); 398 | 399 | $command = "Action: QueueAdd\r\nQueue: $queue\r\n" 400 | ."Interface: $handset\r\n"; 401 | 402 | if ($memberName) { 403 | $command .= "MemberName: $memberName\r\n"; 404 | } 405 | 406 | if ($penalty) { 407 | $this->_sendCommand($command."Penalty: $penalty\r\n\r\n"); 408 | return true; 409 | } 410 | 411 | $this->_sendCommand($command."\r\n"); 412 | return true; 413 | } 414 | 415 | /** 416 | * Remove a handset from the given queue 417 | * 418 | * @param string $queue The queue you wish to perform this action on 419 | * @param string $handset The handset you wish to remove (e.g. SIP/200) 420 | * 421 | * @return bool 422 | */ 423 | public function queueRemove($queue, $handset) 424 | { 425 | $this->_checkSocket(); 426 | 427 | $this->_sendCommand( 428 | "Action: QueueRemove\r\nQueue: $queue\r\n" 429 | ."Interface: $handset\r\n\r\n" 430 | ); 431 | 432 | return true; 433 | } 434 | 435 | /** 436 | * Pause a handset from the given queue 437 | * 438 | * @param string $queue The queue you wish to perform this action on 439 | * @param string $handset The handset you wish to remove (e.g. SIP/200) 440 | * 441 | * @return bool 442 | */ 443 | public function queuePause($queue, $handset) 444 | { 445 | $this->_checkSocket(); 446 | 447 | $this->_sendCommand( 448 | "Action: QueuePause\r\nQueue: $queue\r\n" 449 | ."Interface: $handset\r\n" 450 | ."Paused: True\r\n\r\n" 451 | ); 452 | 453 | return true; 454 | } 455 | 456 | /** 457 | * Unpause a handset from the given queue 458 | * 459 | * @param string $queue The queue you wish to perform this action on 460 | * @param string $handset The handset you wish to remove (e.g. SIP/200) 461 | * 462 | * @return bool 463 | */ 464 | public function queueUnpause($queue, $handset) 465 | { 466 | $this->_checkSocket(); 467 | 468 | $this->_sendCommand( 469 | "Action: QueuePause\r\nQueue: $queue\r\n" 470 | ."Interface: $handset\r\n" 471 | ."Paused: False\r\n\r\n" 472 | ); 473 | 474 | return true; 475 | } 476 | 477 | /** 478 | * Monitor(record) a channel to given file in given format 479 | * 480 | * @param string $channel Channel to monitor (e.g. SIP/234, ZAP/1) 481 | * @param string $filename The filename to save to 482 | * @param string $format The format of the file (e.g. gsm, wav) 483 | * @param integer $mix Boolean 1 or 0 on whether to mix 484 | * 485 | * @throws Net_AsteriskManagerException if the monitor command fails 486 | * 487 | * @return bool 488 | */ 489 | public function startMonitor($channel, $filename, $format, $mix = null) 490 | { 491 | 492 | $this->_checkSocket(); 493 | 494 | $response = $this->_sendCommand( 495 | "Action: Monitor\r\nChannel: $channel\r\n" 496 | ."File: $filename\r\nFormat: $format\r\n" 497 | ."Mix: $mix\r\n\r\n" 498 | ); 499 | 500 | if (strpos($response, "Success") === false) { 501 | throw new Net_AsteriskManagerException( 502 | Net_AsteriskManagerException::MONITORFAIL 503 | ); 504 | } else { 505 | return true; 506 | } 507 | } 508 | 509 | /** 510 | * Stop monitoring a channel 511 | * 512 | * @param string $channel The channel you wish to stop monitoring 513 | * 514 | * @return bool 515 | */ 516 | public function stopMonitor($channel) 517 | { 518 | $this->_checkSocket(); 519 | 520 | $this->_sendCommand( 521 | "Action: StopMonitor\r\n" 522 | ."Channel: $channel\r\n\r\n" 523 | ); 524 | return true; 525 | } 526 | 527 | /** 528 | * Get the status information for a channel 529 | * 530 | * @param string $channel The channel to query 531 | * 532 | * @return string|string 533 | */ 534 | public function getChannelStatus($channel = null) 535 | { 536 | $this->_checkSocket(); 537 | 538 | $response = $this->_sendCommand( 539 | "Action: Status\r\nChannel: " 540 | ."$channel\r\n\r\n" 541 | ); 542 | 543 | return $response; 544 | } 545 | 546 | /** 547 | * Get a list of SIP peers and their status 548 | * 549 | * @return string|bool 550 | */ 551 | public function getSipPeers() 552 | { 553 | $this->_checkSocket(); 554 | 555 | $response = $this->_sendCommand("Action: Sippeers\r\n\r\n", 'ListItems', false); 556 | return $response; 557 | } 558 | 559 | /** 560 | * Return a list of IAX peers and their status 561 | * 562 | * @return string|bool 563 | */ 564 | public function getIaxPeers() 565 | { 566 | $this->_checkSocket(); 567 | 568 | $response = $this->_sendCommand( 569 | "Action: IAXPeers\r\n\r\n", 570 | ' iax2 peers', 571 | false 572 | ); 573 | return $response; 574 | } 575 | 576 | /** 577 | * Returns a list of all parked calls on the server. 578 | * 579 | * @return string 580 | */ 581 | public function parkedCalls() 582 | { 583 | $this->_checkSocket(); 584 | 585 | $response = $this->_sendCommand( 586 | "Action: ParkedCalls\r\n" 587 | ."Parameters: ActionID\r\n\r\n", 588 | 'ParkedCallsComplete' 589 | ); 590 | return $response; 591 | } 592 | } 593 | 594 | ?> 595 | -------------------------------------------------------------------------------- /AsteriskManagerException.php: -------------------------------------------------------------------------------- 1 | 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * - Neither the name of the author nor the names of its 18 | * contributors may be used to endorse or promote products derived from 19 | * this software without specific prior written permission. 20 | 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 23 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 25 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 30 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 31 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | * 33 | * PHP version 5 34 | * 35 | * @category Net 36 | * @package Net_AsteriskManager 37 | * @author Doug Bromley 38 | * @copyright 2008-2014 Doug Bromley 39 | * @license http://www.debian.org/misc/bsd.license New BSD License 40 | * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=543 41 | * @link https://github.com/OdinsHat/asterisk-php-manager 42 | */ 43 | 44 | /** 45 | * PEAR Exception class is used for exception handling 46 | */ 47 | require_once 'PEAR/Exception.php'; 48 | 49 | /** 50 | * The exception class for the Asterisk Manager library. Extends PEAR exception. 51 | * This class contains static values of error types. 52 | * 53 | * @category Net 54 | * @package Net_AsteriskManager 55 | * @author Doug Bromley 56 | * @license http://www.debian.org/misc/bsd.license New BSD License 57 | * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=543 58 | */ 59 | class Net_AsteriskManagerException extends PEAR_Exception 60 | { 61 | const NOSOCKET = 'No socket defined'; 62 | const AUTHFAIL = 'Authorisation failed'; 63 | const CONNECTFAILED = 'Connection failed'; 64 | const NOCOMMAND = 'Unknown command specified'; 65 | const NOPONG = 'No response to ping'; 66 | const NOSERVER = 'No server specified'; 67 | const MONITORFAIL = 'Monitoring of channel failed'; 68 | const RESPERR = 'Server didn\'t respond as expected'; 69 | const CMDSENDERR = 'Sending of command failed'; 70 | } 71 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, OdinsHat 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Asterisk PHP Manager 2 | 3 | [![Maintenance](https://img.shields.io/badge/Maintained%3F-no-red.svg)](https://bitbucket.org/lbesson/ansi-colors) [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) 4 | 5 | 6 | 7 | This was originally hosted at Google Project Code hosting but has been moved to GitHub to make it easier or people to do with as they please. 8 | 9 | However, it is no longer actively developed by me (the original author). 10 | 11 | The [Asterisk](http://www.asterisk.org) Manager PHP API enables a developer to control their Asterisk PBX system from a PHP application. Allowing for call origination, monitoring, queue management, etc. Other examples include: 12 | 13 | * Adding handset to a queue. 14 | * Monitoring a channel. 15 | * Originating a call. 16 | * Getting server status. 17 | * Closing channels. 18 | 19 | This was originally developed to help integrate PHP-driven CRM systems in the lending industry into the Asterisk PBX. 20 | 21 | ## Example 22 | 23 | ```php 24 | require "../../AsteriskManager.php"; 25 | 26 | $params = array('server' => '127.0.0.1', 'port' => '5038'); 27 | 28 | /** 29 | * Instantiate Asterisk object and connect to server 30 | */ 31 | $ast = new Net_AsteriskManager($params); 32 | 33 | /** 34 | * Connect to server 35 | */ 36 | try { 37 | $ast->connect(); 38 | } catch (PEAR_Exception $e) { 39 | echo $e; 40 | } 41 | 42 | /** 43 | * Login to manager API 44 | */ 45 | try { 46 | $ast->login('user', 'pass'); 47 | } catch(PEAR_Exception $e) { 48 | echo $e; 49 | } 50 | 51 | /** 52 | * Monitoring 53 | * Begin monitoring channel to filename "test.gsm" 54 | * If it fails then echo Asterisk error 55 | */ 56 | $chan = 'SIP/868'; 57 | 58 | try { 59 | $ast->startMonitor($chan, 'test', 'gsm', 1); 60 | } catch (PEAR_Exception $e) { 61 | echo $e; 62 | } 63 | 64 | /** 65 | * Queues 66 | * List queues then add and remove a handset from a queue 67 | */ 68 | 69 | // Print all the queues on the server 70 | try { 71 | echo $ast->getQueues(); 72 | } catch(PEAR_Exception $e) { 73 | echo $e; 74 | } 75 | 76 | // Add the SIP handset 234 to a the applicants queue 77 | try { 78 | $ast->queueAdd('applicants', 'SIP/234', 1); 79 | } catch(PEAR_Exception $e) { 80 | echo $e; 81 | } 82 | 83 | // Take it out again 84 | try { 85 | $ast->queueRemove('applicants', 'SIP/234'); 86 | } catch (PEAR_Exception $e) { 87 | echo $e; 88 | } 89 | ``` 90 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | * **/examples** - contains a single basic example of usage 2 | * **/html** - the original PHPDoc generated documentation for the package 3 | -------------------------------------------------------------------------------- /docs/examples/example.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 2008 Doug Bromley 11 | * @license New BSD License 12 | * @link http://www.straw-dogs.co.uk 13 | * 14 | *** 15 | * Copyright (c) 2008, Doug Bromley 16 | * All rights reserved. 17 | * 18 | * Redistribution and use in source and binary forms, with or without modification, 19 | * are permitted provided that the following conditions are met: 20 | * - Redistributions of source code must retain the above copyright notice, 21 | * this list of conditions and the following disclaimer. 22 | * - Redistributions in binary form must reproduce the above copyright notice, 23 | * this list of conditions and the following disclaimer in the documentation 24 | * and/or other materials provided with the distribution. 25 | * - Neither the name of the nor the names of its 26 | * contributors may be used to endorse or promote products derived from 27 | * this software without specific prior written permission. 28 | 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 30 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 31 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 32 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 33 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 34 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 35 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 36 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 37 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 38 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 39 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | *** 41 | * 42 | */ 43 | 44 | /** 45 | * Including the Asterisk Manager library 46 | */ 47 | require "../../AsteriskManager.php"; 48 | 49 | 50 | /** 51 | * The parameters for connecting to the server 52 | */ 53 | $params = array('server' => '127.0.0.1', 'port' => '5038'); 54 | 55 | /** 56 | * Instantiate Asterisk object and connect to server 57 | */ 58 | $ast = new Net_AsteriskManager($params); 59 | 60 | /** 61 | * Connect to server 62 | */ 63 | try { 64 | $ast->connect(); 65 | } catch (PEAR_Exception $e) { 66 | echo $e; 67 | } 68 | 69 | /** 70 | * Login to manager API 71 | */ 72 | try { 73 | $ast->login('user', 'pass'); 74 | } catch(PEAR_Exception $e) { 75 | echo $e; 76 | } 77 | 78 | /** 79 | * Monitoring 80 | * Begin monitoring channel to filename "test.gsm" 81 | * If it fails then echo Asterisk error 82 | */ 83 | $chan = 'SIP/868'; 84 | 85 | try { 86 | $ast->startMonitor($chan, 'test', 'gsm', 1); 87 | } catch (PEAR_Exception $e) { 88 | echo $e; 89 | } 90 | 91 | /** 92 | * Queues 93 | * List queues then add and remove a handset from a queue 94 | */ 95 | 96 | // Print all the queues on the server 97 | try { 98 | echo $ast->getQueues(); 99 | } catch(PEAR_Exception $e) { 100 | echo $e; 101 | } 102 | 103 | // Add the SIP handset 234 to a the applicants queue 104 | try { 105 | $ast->queueAdd('applicants', 'SIP/234', 1); 106 | } catch(PEAR_Exception $e) { 107 | echo $e; 108 | } 109 | 110 | // Take it out again 111 | try { 112 | $ast->queueRemove('applicants', 'SIP/234'); 113 | } catch (PEAR_Exception $e) { 114 | echo $e; 115 | } 116 | 117 | ?> 118 | -------------------------------------------------------------------------------- /docs/html/Net_AsteriskManager/AsteriskManager.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Docs For Class AsteriskManager 7 | 8 | 9 | 10 | 11 |
12 |

Class AsteriskManager

13 | 14 | 15 |
16 |
Description
17 | 23 |
24 | 25 |

Class for accessing the Asterisk Manager interface http://www.voip-info.org/wiki/view/Asterisk+manager+API

26 | 31 |

32 | Located in /asterisk.php (line 57) 33 |

34 | 35 | 36 |

 37 | 	
 38 | 			
39 |
40 | 41 | 42 | 43 | 44 |
45 |
Variable Summary
46 | 53 |
54 |
55 |
56 | string 57 | $password 58 |
59 |
60 | integer 61 | $port 62 |
63 |
64 | string 65 | $server 66 |
67 |
68 | string 69 | $username 70 |
71 |
72 |
73 |
74 | 75 | 76 |
77 |
Method Summary
78 | 85 |
86 |
87 | 88 |
89 | AsteriskManager 90 | __construct 91 | (string $server, string $username, string $password, [integer $port = 5038]) 92 |
93 |
94 | bool 95 | close 96 | () 97 |
98 |
99 | string|bool 100 | command 101 | (string $command) 102 |
103 |
104 | string|bool 105 | iaxPeers 106 | () 107 |
108 |
109 | bool 110 | login 111 | () 112 |
113 |
114 | bool 115 | logout 116 | () 117 |
118 |
119 | bool 120 | monitor 121 | (string $channel, string $filename, string $format, [integer $mix = null]) 122 |
123 |
124 | bool 125 | originateCall 126 | (string $extension, string $channel, string $context, string $cid, [integer $priority = 1], [integer $timeout = 30000], [array $variables = null], [string $action_id = null]) 127 |
128 |
129 | bool 130 | ping 131 | () 132 |
133 |
134 | bool 135 | queueAdd 136 | (string $queue, string $handset, integer $penalty) 137 |
138 |
139 | bool 140 | queueRemove 141 | (string $queue, string $handset) 142 |
143 |
144 | string|bool 145 | queues 146 | () 147 |
148 |
149 | string|bool 150 | sipPeers 151 | () 152 |
153 |
154 | string|string 155 | status 156 | ([string $channel = null]) 157 |
158 |
159 | bool 160 | stopMonitor 161 | (string $channel) 162 |
163 |
164 |
165 |
166 | 167 | 168 |
169 |
Variables
170 | 179 |
180 | 181 |
182 | 183 |
184 | 185 | string 186 | $password 187 | (line 85) 188 | 189 |
190 | 191 | 192 |

The password used to access the Asterisk manager interface

193 | 197 | 198 | 199 | 200 | 201 | 202 |
203 | 204 |
205 | 206 |
207 | 208 | integer 209 | $port 210 | = 5038 (line 71) 211 | 212 |
213 | 214 | 215 |

The port to use when connecting to the Asterisk server

216 | 220 | 221 | 222 | 223 | 224 | 225 |
226 | 227 |
228 | 229 |
230 | 231 | string 232 | $server 233 | (line 64) 234 | 235 |
236 | 237 | 238 |

The Asterisk server which will recieve the manager commands

239 | 243 | 244 | 245 | 246 | 247 | 248 |
249 | 250 |
251 | 252 |
253 | 254 | string 255 | $username 256 | (line 78) 257 | 258 |
259 | 260 | 261 |

The username to access the Asterisk manager interface

262 | 266 | 267 | 268 | 269 | 270 | 271 |
272 | 273 |
274 |
275 | 276 | 277 |
278 |
Methods
279 | 285 |
286 | 287 | 288 | 289 |
290 | 291 |
292 | Constructor __construct (line 108) 293 |
294 | 295 | 296 |

Class constructor

297 | 304 | 305 |
306 | AsteriskManager 307 | 308 | __construct 309 | 310 | (string $server, string $username, string $password, [integer $port = 5038]) 311 |
312 | 313 |
    314 |
  • 315 | string 316 | $server: The server hostname or IP address
  • 317 |
  • 318 | string 319 | $username: Username credential for the manager interface
  • 320 |
  • 321 | string 322 | $password: The password for the manager interface
  • 323 |
  • 324 | integer 325 | $port: The port the interface is listening on
  • 326 |
327 | 328 | 329 |
330 | 331 |
332 | 333 |
334 | close (line 168) 335 |
336 | 337 | 338 |

Just kill the connection without logging off

339 | 340 |
341 | bool 342 | 343 | close 344 | 345 | () 346 |
347 | 348 | 349 | 350 |
351 | 352 |
353 | 354 |
355 | command (line 184) 356 |
357 | 358 | 359 |

Send a command to the Asterisk CLI interface

360 | 361 |
362 | string|bool 363 | 364 | command 365 | 366 | (string $command) 367 |
368 | 369 |
    370 |
  • 371 | string 372 | $command: Command to execute on server
  • 373 |
374 | 375 | 376 |
377 | 378 |
379 | 380 |
381 | iaxPeers (line 408) 382 |
383 | 384 | 385 |

Return a list of IAX peers and their status

386 | 387 |
388 | string|bool 389 | 390 | iaxPeers 391 | 392 | () 393 |
394 | 395 | 396 | 397 |
398 | 399 |
400 | 401 |
402 | login (line 136) 403 |
404 | 405 | 406 |

Login into Asterisk Manager interface

407 | 408 |
409 | bool 410 | 411 | login 412 | 413 | () 414 |
415 | 416 | 417 | 418 |
419 | 420 |
421 | 422 |
423 | logout (line 153) 424 |
425 | 426 | 427 |

Logout of the current manager session attached to $this::socket

428 | 429 |
430 | bool 431 | 432 | logout 433 | 434 | () 435 |
436 | 437 | 438 | 439 |
440 | 441 |
442 | 443 |
444 | monitor (line 331) 445 |
446 | 447 | 448 |

Monitor(record) a channel to given file in given format

449 | 450 |
451 | bool 452 | 453 | monitor 454 | 455 | (string $channel, string $filename, string $format, [integer $mix = null]) 456 |
457 | 458 |
    459 |
  • 460 | string 461 | $channel: Channel to monitor (e.g. SIP/234, ZAP/1)
  • 462 |
  • 463 | string 464 | $filename: The filename to save to
  • 465 |
  • 466 | string 467 | $format: The format of the file (e.g. gsm, wav)
  • 468 |
  • 469 | integer 470 | $mix: Boolean 1 or 0 on whether to mix
  • 471 |
472 | 473 | 474 |
475 | 476 |
477 | 478 |
479 | originateCall (line 230) 480 |
481 | 482 | 483 |

Make a call to an extension with a given channel acting as the originator

484 | 485 |
486 | bool 487 | 488 | originateCall 489 | 490 | (string $extension, string $channel, string $context, string $cid, [integer $priority = 1], [integer $timeout = 30000], [array $variables = null], [string $action_id = null]) 491 |
492 | 493 |
    494 |
  • 495 | string 496 | $extension: The extension to use on connection
  • 497 |
  • 498 | string 499 | $channel: The channel where you wish to originate the call
  • 500 |
  • 501 | string 502 | $context: The context that the call will be dropped into
  • 503 |
  • 504 | string 505 | $cid: The caller ID to use
  • 506 |
  • 507 | integer 508 | $priority: The priority of this command
  • 509 |
  • 510 | integer 511 | $timeout: Timeout in milliseconds before attempt dropped
  • 512 |
  • 513 | array 514 | $variables: An array of variables to pass to Asterisk
  • 515 |
  • 516 | string 517 | $action_id: A unique identifier for this command
  • 518 |
519 | 520 | 521 |
522 | 523 |
524 | 525 |
526 | ping (line 199) 527 |
528 | 529 | 530 |

A simple 'ping' command which the server responds with 'pong'

531 | 532 |
533 | bool 534 | 535 | ping 536 | 537 | () 538 |
539 | 540 | 541 | 542 |
543 | 544 |
545 | 546 |
547 | queueAdd (line 285) 548 |
549 | 550 | 551 |

Add a handset to a queue on the server

552 | 553 |
554 | bool 555 | 556 | queueAdd 557 | 558 | (string $queue, string $handset, integer $penalty) 559 |
560 | 561 |
    562 |
  • 563 | string 564 | $queue: The name of the queue you wish to add the handset too
  • 565 |
  • 566 | string 567 | $handset: The handset to add, e.g. SIP/234
  • 568 |
  • 569 | integer 570 | $penalty: Penalty
  • 571 |
572 | 573 | 574 |
575 | 576 |
577 | 578 |
579 | queueRemove (line 310) 580 |
581 | 582 | 583 |

Remove a handset from the given queue

584 | 585 |
586 | bool 587 | 588 | queueRemove 589 | 590 | (string $queue, string $handset) 591 |
592 | 593 |
    594 |
  • 595 | string 596 | $queue: The queue you wish to perform this action on
  • 597 |
  • 598 | string 599 | $handset: The handset you wish to remove (e.g. SIP/200)
  • 600 |
601 | 602 | 603 |
604 | 605 |
606 | 607 |
608 | queues (line 265) 609 |
610 | 611 | 612 |

Returns a list of queues and their status

613 | 614 |
615 | string|bool 616 | 617 | queues 618 | 619 | () 620 |
621 | 622 | 623 | 624 |
625 | 626 |
627 | 628 |
629 | sipPeers (line 392) 630 |
631 | 632 | 633 |

Get a list of SIP peers and their status

634 | 635 |
636 | string|bool 637 | 638 | sipPeers 639 | 640 | () 641 |
642 | 643 | 644 | 645 |
646 | 647 |
648 | 649 |
650 | status (line 376) 651 |
652 | 653 | 654 |

Get the status information for a channel

655 | 656 |
657 | string|string 658 | 659 | status 660 | 661 | ([string $channel = null]) 662 |
663 | 664 |
    665 |
  • 666 | string 667 | $channel: The channel to query
  • 668 |
669 | 670 | 671 |
672 | 673 |
674 | 675 |
676 | stopMonitor (line 358) 677 |
678 | 679 | 680 |

Stop monitoring a channel

681 | 682 |
683 | bool 684 | 685 | stopMonitor 686 | 687 | (string $channel) 688 |
689 | 690 |
    691 |
  • 692 | string 693 | $channel: The channel you wish to stop monitoring
  • 694 |
695 | 696 | 697 |
698 | 699 |
700 |
701 | 702 | 703 |

704 | Documentation generated on Fri, 21 Mar 2008 15:36:30 +0000 by phpDocumentor 1.4.1 705 |

706 |
707 | -------------------------------------------------------------------------------- /docs/html/Net_AsteriskManager/_asterisk.php.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Docs fo page asteisk.php 7 | 8 | 9 | 10 | 11 |
12 | 13 |

/asteisk.php

14 | 15 | 16 |
17 |
Desciption
18 | 22 |
23 | 24 |

This package is capable of intefacing with the open souce Asteisk PBX via its built in Manage API. This will allow you to execute manage commands fo administation and maintenance of the seve.

25 |

PHP vesion 5

26 | 61 | 62 |
63 |
64 | 65 | 66 |
67 |
Classes
68 | 72 |
73 | 74 | 75 | 76 | 77 | 78 | 79 | 82 | 85 | 86 |
ClassDesciption 80 | AsteiskManage 81 | 83 | Class fo accessing the Asteisk Manage inteface http://www.voip-info.og/wiki/view/Asteisk+manage+API 84 |
87 |
88 |
89 | 90 | 91 | 92 | 93 | 94 |

95 | Documentation geneated on Fi, 21 Ma 2008 15:36:30 +0000 by phpDocumento 1.4.1 96 |

97 |
98 | 99 | -------------------------------------------------------------------------------- /docs/html/blank.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Generated Documentation 4 | 5 | 6 | 7 | 8 |

Generated Documentation

9 | Welcome to Net_AsteriskManager!
10 |
11 | This documentation was generated by phpDocumentor v1.4.1
12 | 13 | -------------------------------------------------------------------------------- /docs/html/classtrees_Net_AsteriskManager.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

14 | 15 |

16 |

Root class Net_AsteriskManager

17 | 19 | 20 |

21 | Documentation generated on Mon, 24 Mar 2008 13:20:33 +0000 by phpDocumentor 1.4.1 22 |

23 | 24 | -------------------------------------------------------------------------------- /docs/html/elementindex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

Full index

13 |

Package indexes

14 | 17 |
18 |
19 | a 20 | c 21 | g 22 | l 23 | n 24 | o 25 | p 26 | 27 | s 28 |
29 | 30 | 31 |
32 |
a
33 | 34 |
35 |
36 |
37 |
38 | AsteriskManager.php 39 |
40 |
41 |
AsteriskManager.php in AsteriskManager.php
42 |
43 |
44 | 45 |
46 |
c
47 | 48 |
49 |
50 |
51 |
52 | close 53 |
54 |
55 |
Net_AsteriskManager::close() in AsteriskManager.php
56 |
Close the connection
57 |
58 |
59 | command 60 |
61 |
62 |
Net_AsteriskManager::command() in AsteriskManager.php
63 |
Send a command to the Asterisk CLI interface. Acceptable commands are dependent on the Asterisk installation.
64 |
65 |
66 | connect 67 |
68 |
69 |
Net_AsteriskManager::connect() in AsteriskManager.php
70 |
If not already connected then connect to the Asterisk server otherwise close active connection and reconnect
71 |
72 |
73 | 74 |
75 |
g
76 | 77 |
78 |
79 |
80 |
81 | getChannelStatus 82 |
83 |
84 | 85 |
Get the status information for a channel
86 |
87 |
88 | getIaxPeers 89 |
90 |
91 |
Net_AsteriskManager::getIaxPeers() in AsteriskManager.php
92 |
Return a list of IAX peers and their status
93 |
94 |
95 | getQueues 96 |
97 |
98 |
Net_AsteriskManager::getQueues() in AsteriskManager.php
99 |
Returns a list of queues and their status
100 |
101 |
102 | getSipPeers 103 |
104 |
105 |
Net_AsteriskManager::getSipPeers() in AsteriskManager.php
106 |
Get a list of SIP peers and their status
107 |
108 |
109 | 110 |
111 |
l
112 | 113 |
114 |
115 |
116 |
117 | login 118 |
119 |
120 |
Net_AsteriskManager::login() in AsteriskManager.php
121 |
Login into Asterisk Manager interface given the user credentials
122 |
123 |
124 | logout 125 |
126 |
127 |
Net_AsteriskManager::logout() in AsteriskManager.php
128 |
Logout of the current manager session attached to $this::socket
129 |
130 |
131 | 132 |
133 |
n
134 | 135 |
136 |
137 |
138 |
139 | Net_AsteriskManager 140 |
141 |
142 |
Net_AsteriskManager in AsteriskManager.php
143 |
Class for accessing the Asterisk Manager interface http://www.voip-info.org/wiki/view/Asterisk+manager+API
144 |
145 |
146 | 147 |
148 |
o
149 | 150 |
151 |
152 |
153 |
154 | originateCall 155 |
156 |
157 | 158 |
Make a call to an extension with a given channel acting as the originator
159 |
160 |
161 | 162 |
163 |
p
164 | 165 |
166 |
167 |
168 |
169 | $port 170 |
171 |
172 |
Net_AsteriskManager::$port in AsteriskManager.php
173 |
The port to use when connecting to the Asterisk server
174 |
175 |
176 | ping 177 |
178 |
179 |
Net_AsteriskManager::ping() in AsteriskManager.php
180 |
A simple 'ping' command which the server responds with 'pong'
181 |
182 |
183 | 184 |
185 |
q
186 | 187 |
188 |
189 |
190 |
191 | queueAdd 192 |
193 |
194 |
Net_AsteriskManager::queueAdd() in AsteriskManager.php
195 |
Add a handset to a queue on the server
196 |
197 |
198 | queueRemove 199 |
200 |
201 |
Net_AsteriskManager::queueRemove() in AsteriskManager.php
202 |
Remove a handset from the given queue
203 |
204 |
205 | 206 |
207 |
s
208 | 209 |
210 |
211 |
212 |
213 | $server 214 |
215 |
216 |
Net_AsteriskManager::$server in AsteriskManager.php
217 |
The Asterisk server which will recieve the manager commands
218 |
219 |
220 | startMonitor 221 |
222 |
223 | 224 |
Monitor(record) a channel to given file in given format
225 |
226 |
227 | stopMonitor 228 |
229 |
230 |
Net_AsteriskManager::stopMonitor() in AsteriskManager.php
231 |
Stop monitoring a channel
232 |
233 |
234 | 235 |
236 |
_
237 | 238 |
239 |
240 |
241 |
242 | __construct 243 |
244 |
245 |
Net_AsteriskManager::__construct() in AsteriskManager.php
246 |
Class constructor
247 |
248 |
249 | 250 |
251 | a 252 | c 253 | g 254 | l 255 | n 256 | o 257 | p 258 | 259 | s 260 |
261 | -------------------------------------------------------------------------------- /docs/html/elementindex_Net_AsteriskManager.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

[Net_AsteriskManager] element index

13 | All elements 14 |
15 |
16 | a 17 | c 18 | g 19 | l 20 | n 21 | o 22 | p 23 | q 24 | s 25 | _ 26 |
27 | 28 | 29 |
30 |
_
31 | 32 |
33 |
34 |
35 |
36 | __construct 37 |
38 |
39 |
Net_AsteriskManager::__construct() in AsteriskManager.php
40 |
Class constructor
41 |
42 |
43 | 44 |
45 |
a
46 | 47 |
48 |
49 |
50 |
51 | AsteriskManager.php 52 |
53 |
54 |
AsteriskManager.php in AsteriskManager.php
55 |
56 |
57 | 58 |
59 |
c
60 | 61 |
62 |
63 |
64 |
65 | close 66 |
67 |
68 |
Net_AsteriskManager::close() in AsteriskManager.php
69 |
Close the connection
70 |
71 |
72 | command 73 |
74 |
75 |
Net_AsteriskManager::command() in AsteriskManager.php
76 |
Send a command to the Asterisk CLI interface. Acceptable commands are dependent on the Asterisk installation.
77 |
78 |
79 | connect 80 |
81 |
82 |
Net_AsteriskManager::connect() in AsteriskManager.php
83 |
If not already connected then connect to the Asterisk server otherwise close active connection and reconnect
84 |
85 |
86 | 87 |
88 |
g
89 | 90 |
91 |
92 |
93 |
94 | getChannelStatus 95 |
96 |
97 | 98 |
Get the status information for a channel
99 |
100 |
101 | getIaxPeers 102 |
103 |
104 |
Net_AsteriskManager::getIaxPeers() in AsteriskManager.php
105 |
Return a list of IAX peers and their status
106 |
107 |
108 | getQueues 109 |
110 |
111 |
Net_AsteriskManager::getQueues() in AsteriskManager.php
112 |
Returns a list of queues and their status
113 |
114 |
115 | getSipPeers 116 |
117 |
118 |
Net_AsteriskManager::getSipPeers() in AsteriskManager.php
119 |
Get a list of SIP peers and their status
120 |
121 |
122 | 123 |
124 |
l
125 | 126 |
127 |
128 |
129 |
130 | login 131 |
132 |
133 |
Net_AsteriskManager::login() in AsteriskManager.php
134 |
Login into Asterisk Manager interface given the user credentials
135 |
136 |
137 | logout 138 |
139 |
140 |
Net_AsteriskManager::logout() in AsteriskManager.php
141 |
Logout of the current manager session attached to $this::socket
142 |
143 |
144 | 145 |
146 |
n
147 | 148 |
149 |
150 |
151 |
152 | Net_AsteriskManager 153 |
154 |
155 |
Net_AsteriskManager in AsteriskManager.php
156 |
Class for accessing the Asterisk Manager interface http://www.voip-info.org/wiki/view/Asterisk+manager+API
157 |
158 |
159 | 160 |
161 |
o
162 | 163 |
164 |
165 |
166 |
167 | originateCall 168 |
169 |
170 | 171 |
Make a call to an extension with a given channel acting as the originator
172 |
173 |
174 | 175 |
176 |
p
177 | 178 |
179 |
180 |
181 |
182 | $port 183 |
184 |
185 |
Net_AsteriskManager::$port in AsteriskManager.php
186 |
The port to use when connecting to the Asterisk server
187 |
188 |
189 | ping 190 |
191 |
192 |
Net_AsteriskManager::ping() in AsteriskManager.php
193 |
A simple 'ping' command which the server responds with 'pong'
194 |
195 |
196 | 197 |
198 |
q
199 | 200 |
201 |
202 |
203 |
204 | queueAdd 205 |
206 |
207 |
Net_AsteriskManager::queueAdd() in AsteriskManager.php
208 |
Add a handset to a queue on the server
209 |
210 |
211 | queueRemove 212 |
213 |
214 |
Net_AsteriskManager::queueRemove() in AsteriskManager.php
215 |
Remove a handset from the given queue
216 |
217 |
218 | 219 |
220 |
s
221 | 222 |
223 |
224 |
225 |
226 | $server 227 |
228 |
229 |
Net_AsteriskManager::$server in AsteriskManager.php
230 |
The Asterisk server which will recieve the manager commands
231 |
232 |
233 | startMonitor 234 |
235 |
236 | 237 |
Monitor(record) a channel to given file in given format
238 |
239 |
240 | stopMonitor 241 |
242 |
243 |
Net_AsteriskManager::stopMonitor() in AsteriskManager.php
244 |
Stop monitoring a channel
245 |
246 |
247 | 248 |
249 | a 250 | c 251 | g 252 | l 253 | n 254 | o 255 | p 256 | q 257 | s 258 | _ 259 |
260 | -------------------------------------------------------------------------------- /docs/html/errors.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | phpDocumentor Parser Errors and Warnings 7 | 8 | 9 | 10 | 11 | Post-parsing
12 | 13 |

AsteriskManager.php

14 |

Warnings:


15 | Warning on line 44 - package default is already in category default, will now replace with category Net
16 |

17 | Documentation generated on Mon, 24 Mar 2008 13:20:33 +0000 by phpDocumentor 1.4.1 18 |

19 | 20 | -------------------------------------------------------------------------------- /docs/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | Generated Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | <H2>Frame Alert</H2> 20 | <P>This document is designed to be viewed using the frames feature. 21 | If you see this message, you are using a non-frame-capable web client.</P> 22 | 23 | 24 | -------------------------------------------------------------------------------- /docs/html/li_Net_AsteriskManager.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
Net_AsteriskManager
12 |
13 | 14 |
15 | 16 |
Description
17 |
18 | Class trees
19 | Index of elements
20 |
21 | 22 | 23 | 24 |
Classes
25 |
Net_AsteriskManager
26 |
Files
27 |
AsteriskManager.php
28 | 29 | 30 |
31 |
32 |

phpDocumentor v 1.4.1

33 | 34 | -------------------------------------------------------------------------------- /docs/html/media/banner.css: -------------------------------------------------------------------------------- 1 | body 2 | { 3 | background-color: #CCCCFF; 4 | margin: 0px; 5 | padding: 0px; 6 | } 7 | 8 | /* Banner (top bar) classes */ 9 | 10 | .banner { } 11 | 12 | .banner-menu 13 | { 14 | clear: both; 15 | padding: .5em; 16 | border-top: 2px solid #6666AA; 17 | } 18 | 19 | .banner-title 20 | { 21 | text-align: right; 22 | font-size: 20pt; 23 | font-weight: bold; 24 | margin: .2em; 25 | } 26 | 27 | .package-selector 28 | { 29 | background-color: #AAAADD; 30 | border: 1px solid black; 31 | color: yellow; 32 | } 33 | -------------------------------------------------------------------------------- /docs/html/media/stylesheet.css: -------------------------------------------------------------------------------- 1 | a { color: #336699; text-decoration: none; } 2 | a:hover { color: #6699CC; text-decoration: underline; } 3 | a:active { color: #6699CC; text-decoration: underline; } 4 | 5 | body { background : #FFFFFF; } 6 | body, table { font-family: Georgia, Times New Roman, Times, serif; font-size: 10pt } 7 | p, li { line-height: 140% } 8 | a img { border: 0px; } 9 | dd { margin-left: 0px; padding-left: 1em; } 10 | 11 | /* Page layout/boxes */ 12 | 13 | .info-box {} 14 | .info-box-title { margin: 1em 0em 0em 0em; padding: .25em; font-weight: normal; font-size: 14pt; border: 2px solid #999999; background-color: #CCCCFF } 15 | .info-box-body { border: 1px solid #999999; padding: .5em; } 16 | .nav-bar { font-size: 8pt; white-space: nowrap; text-align: right; padding: .2em; margin: 0em 0em 1em 0em; } 17 | 18 | .oddrow { background-color: #F8F8F8; border: 1px solid #AAAAAA; padding: .5em; margin-bottom: 1em} 19 | .evenrow { border: 1px solid #AAAAAA; padding: .5em; margin-bottom: 1em} 20 | 21 | .page-body { max-width: 800px; margin: auto; } 22 | .tree dl { margin: 0px } 23 | 24 | /* Index formatting classes */ 25 | 26 | .index-item-body { margin-top: .5em; margin-bottom: .5em} 27 | .index-item-description { margin-top: .25em } 28 | .index-item-details { font-weight: normal; font-style: italic; font-size: 8pt } 29 | .index-letter-section { background-color: #EEEEEE; border: 1px dotted #999999; padding: .5em; margin-bottom: 1em} 30 | .index-letter-title { font-size: 12pt; font-weight: bold } 31 | .index-letter-menu { text-align: center; margin: 1em } 32 | .index-letter { font-size: 12pt } 33 | 34 | /* Docbook classes */ 35 | 36 | .description {} 37 | .short-description { font-weight: bold; color: #666666; } 38 | .tags { padding-left: 0em; margin-left: 3em; color: #666666; list-style-type: square; } 39 | .parameters { padding-left: 0em; margin-left: 3em; font-style: italic; list-style-type: square; } 40 | .redefinitions { font-size: 8pt; padding-left: 0em; margin-left: 2em; } 41 | .package { } 42 | .package-title { font-weight: bold; font-size: 14pt; border-bottom: 1px solid black } 43 | .package-details { font-size: 85%; } 44 | .sub-package { font-weight: bold; font-size: 120% } 45 | .tutorial { border-width: thin; border-color: #0066ff } 46 | .tutorial-nav-box { width: 100%; border: 1px solid #999999; background-color: #F8F8F8; } 47 | .nav-button-disabled { color: #999999; } 48 | .nav-button:active, 49 | .nav-button:focus, 50 | .nav-button:hover { background-color: #DDDDDD; outline: 1px solid #999999; text-decoration: none } 51 | .folder-title { font-style: italic } 52 | 53 | /* Generic formatting */ 54 | 55 | .field { font-weight: bold; } 56 | .detail { font-size: 8pt; } 57 | .notes { font-style: italic; font-size: 8pt; } 58 | .separator { background-color: #999999; height: 2px; } 59 | .warning { color: #FF6600; } 60 | .disabled { font-style: italic; color: #999999; } 61 | 62 | /* Code elements */ 63 | 64 | .line-number { } 65 | 66 | .class-table { width: 100%; } 67 | .class-table-header { border-bottom: 1px dotted #666666; text-align: left} 68 | .class-name { color: #000000; font-weight: bold; } 69 | 70 | .method-summary { padding-left: 1em; font-size: 8pt } 71 | .method-header { } 72 | .method-definition { margin-bottom: .3em } 73 | .method-title { font-weight: bold; } 74 | .method-name { font-weight: bold; } 75 | .method-signature { font-size: 85%; color: #666666; margin: .5em 0em } 76 | .method-result { font-style: italic; } 77 | 78 | .var-summary { padding-left: 1em; font-size: 8pt; } 79 | .var-header { } 80 | .var-title { margin-bottom: .3em } 81 | .var-type { font-style: italic; } 82 | .var-name { font-weight: bold; } 83 | .var-default {} 84 | .var-description { font-weight: normal; color: #000000; } 85 | 86 | .include-title { } 87 | .include-type { font-style: italic; } 88 | .include-name { font-weight: bold; } 89 | 90 | .const-title { } 91 | .const-name { font-weight: bold; } 92 | 93 | /* Syntax highlighting */ 94 | 95 | .src-code { border: 1px solid #336699; padding: 1em; background-color: #EEEEEE; } 96 | .src-line { font-family: 'Courier New', Courier, monospace; font-weight: normal; } 97 | 98 | .src-comm { color: green; } 99 | .src-id { } 100 | .src-inc { color: #0000FF; } 101 | .src-key { color: #0000FF; } 102 | .src-num { color: #CC0000; } 103 | .src-str { color: #66cccc; } 104 | .src-sym { font-weight: bold; } 105 | .src-var { } 106 | 107 | .src-php { font-weight: bold; } 108 | 109 | .src-doc { color: #009999 } 110 | .src-doc-close-template { color: #0000FF } 111 | .src-doc-coretag { color: #0099FF; font-weight: bold } 112 | .src-doc-inlinetag { color: #0099FF } 113 | .src-doc-internal { color: #6699cc } 114 | .src-doc-tag { color: #0080CC } 115 | .src-doc-template { color: #0000FF } 116 | .src-doc-type { font-style: italic } 117 | .src-doc-var { font-style: italic } 118 | 119 | .tute-tag { color: #009999 } 120 | .tute-attribute-name { color: #0000FF } 121 | .tute-attribute-value { color: #0099FF } 122 | .tute-entity { font-weight: bold; } 123 | .tute-comment { font-style: italic } 124 | .tute-inline-tag { color: #636311; font-weight: bold } 125 | 126 | /* tutorial */ 127 | 128 | .authors { } 129 | .author { font-style: italic; font-weight: bold } 130 | .author-blurb { margin: .5em 0em .5em 2em; font-size: 85%; font-weight: normal; font-style: normal } 131 | .example { border: 1px dashed #999999; background-color: #EEEEEE; padding: .5em; } 132 | *[class="example"] { line-height : 0.5em } 133 | .listing { border: 1px dashed #999999; background-color: #EEEEEE; padding: .5em; white-space: nowrap; } 134 | *[class="listing"] { line-height : 0.5em } 135 | .release-info { font-size: 85%; font-style: italic; margin: 1em 0em } 136 | .ref-title-box { } 137 | .ref-title { } 138 | .ref-purpose { font-style: italic; color: #666666 } 139 | .ref-synopsis { } 140 | .title { font-weight: bold; margin: 1em 0em 0em 0em; padding: .25em; border: 2px solid #999999; background-color: #CCCCFF } 141 | .cmd-synopsis { margin: 1em 0em } 142 | .cmd-title { font-weight: bold } 143 | .toc { margin-left: 2em; padding-left: 0em } 144 | 145 | -------------------------------------------------------------------------------- /docs/html/packages.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 26 | 27 | -------------------------------------------------------------------------------- /package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | AsteriskManager 4 | pear.php.net 5 | Asterisk Manager PHP API 6 | Enables a PHP developer to control a remote Asterisk PBX server using the in-built manager interface. 7 | 8 | Doug Bromley 9 | ashiro 10 | doug@tintophat.com 11 | yes 12 | 13 | 2008-05-10 14 | 15 | 16 | 0.0.3 17 | 0.0.1 18 | 19 | 20 | alpha 21 | alpha 22 | 23 | New BSD License 24 | Initial release for PEAR proposal. 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 5.1.0 48 | 49 | 50 | 1.4.0b1 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | --------------------------------------------------------------------------------