{"id":13405018,"url":"https://github.com/marcelog/PAMI","last_synced_at":"2025-03-14T09:32:15.271Z","repository":{"id":1278427,"uuid":"1217815","full_name":"marcelog/PAMI","owner":"marcelog","description":"PHP Asterisk Manager Interface ( AMI ) supports synchronous command ( action )/ responses and asynchronous events using the pattern observer-listener. Supports commands with responses with multiple events. Very suitable for development of operator consoles and / or asterisk / channels / peers monitoring through SOA, etc","archived":false,"fork":false,"pushed_at":"2023-12-11T13:16:21.000Z","size":6488,"stargazers_count":404,"open_issues_count":73,"forks_count":281,"subscribers_count":52,"default_branch":"master","last_synced_at":"2024-10-12T04:32:07.516Z","etag":null,"topics":["ami","asterisk","php"],"latest_commit_sha":null,"homepage":"http://marcelog.github.com/PAMI","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcelog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-01-03T22:34:02.000Z","updated_at":"2024-10-11T11:13:47.000Z","dependencies_parsed_at":"2023-02-14T09:00:47.293Z","dependency_job_id":"1ea722bc-641d-4524-a877-66983b6ecbca","html_url":"https://github.com/marcelog/PAMI","commit_stats":{"total_commits":371,"total_committers":21,"mean_commits":"17.666666666666668","dds":"0.19946091644204855","last_synced_commit":"db4b2278e2f15362a176e79ae96a0fa3b2e66dd1"},"previous_names":[],"tags_count":64,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelog%2FPAMI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelog%2FPAMI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelog%2FPAMI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelog%2FPAMI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcelog","download_url":"https://codeload.github.com/marcelog/PAMI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221203632,"owners_count":16775797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ami","asterisk","php"],"created_at":"2024-07-30T19:01:54.604Z","updated_at":"2024-10-25T19:31:33.590Z","avatar_url":"https://github.com/marcelog.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"[![License](https://poser.pugx.org/marcelog/PAMI/license)](https://packagist.org/packages/marcelog/PAMI)\n[![Latest Stable Version](https://poser.pugx.org/marcelog/PAMI/v/stable)](https://packagist.org/packages/marcelog/PAMI)\n[![Documentation Status](https://readthedocs.org/projects/pami/badge/?version=latest)](http://pami.readthedocs.org/en/latest/?badge=latest)\n\n[![Build Status](https://travis-ci.org/marcelog/PAMI.svg)](https://travis-ci.org/marcelog/PAMI)\n[![Coverage Status](https://coveralls.io/repos/marcelog/PAMI/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/marcelog/PAMI?branch=master)\n[![Code Climate](https://codeclimate.com/github/marcelog/PAMI/badges/gpa.svg)](https://codeclimate.com/github/marcelog/PAMI)\n[![Issue Count](https://codeclimate.com/github/marcelog/PAMI/badges/issue_count.svg)](https://codeclimate.com/github/marcelog/PAMI)\n\n[![Click here to lend your support to: PAMI and make a donation at pledgie.com !](https://pledgie.com/campaigns/30944.png?skin_name=chrome' border='0')](https://pledgie.com/campaigns/30944)\n\n# Introduction\n\nPAMI means PHP Asterisk Manager Interface. As its name suggests its just a\nset of php classes that will let you issue commands to an ami and/or receive\nevents, using an observer-listener pattern.\n\nThe idea behind this, is to easily implement operator consoles, monitors, etc.\neither via SOA or ajax.\n\nA port for nodejs is available at: http://marcelog.github.com/Nami\nA port for erlang is available at: https://github.com/marcelog/erlami\n\n# Resources\n\n * [API](http://pami.readthedocs.org/en/latest/ApiIndex/)\n * [Complete PAGI/PAMI talk for the PHP Conference Argentina 2013](http://www.slideshare.net/mgornstein/phpconf-2013). Check the slide notes for the complete text :)\n\n# PHP Versions\n\nNote: PAMI Requires PHP 5.3+. PHP versions 5.3.9 and 5.3.10 WILL NOT WORK due\nto a bug introduced in stream_get_line() in 5.3.9. Please use 5.3.11+ or up\nto 5.3.8 (see README.PHP-5.3.9-and-5.3.10).\n\n# Installing\nAdd this library to your [Composer](https://packagist.org/) configuration. In\ncomposer.json:\n```json\n  \"require\": {\n    \"marcelog/pami\": \"2.*\"\n  }\n```\n\n# QuickStart\n\nFor an in-depth tutorial: http://marcelog.github.com/articles/pami_introduction_tutorial_how_to_install.html\n\n```php\n// Make sure you include the composer autoload.\nrequire __DIR__ . '/vendor/autoload.php';\n\n$options = array(\n    'host' =\u003e '2.3.4.5',\n    'scheme' =\u003e 'tcp://',\n    'port' =\u003e 9999,\n    'username' =\u003e 'asd',\n    'secret' =\u003e 'asd',\n    'connect_timeout' =\u003e 10,\n    'read_timeout' =\u003e 10\n);\n$client = new \\PAMI\\Client\\Impl\\ClientImpl($options);\n\n// Registering a closure\n$client-\u003eregisterEventListener(function ($event) {\n});\n\n// Register a specific method of an object for event listening\n$client-\u003eregisterEventListener(array($listener, 'handle'));\n\n// Register an IEventListener:\n$client-\u003eregisterEventListener($listener);\n```\n\n# Using Predicates\nA second (optional) argument can be used when registering the event listener: a\nclosure that will be evaluated before calling the callback. The callback will\nbe called only if this predicate returns true:\n\n```php\nuse PAMI\\Message\\Event\\DialEvent;\n\n$client-\u003eregisterEventListener(\n    array($listener, 'handleDialStart'),\n    function ($event) {\n        return $event instanceof DialEvent \u0026\u0026 $event-\u003egetSubEvent() == 'Begin';\n    })\n);\n```\n\n# Example\n\nPlease see docs/examples/quickstart/example.php for a very basic example.\n\nAsterTrace is a full application: https://github.com/marcelog/AsterTrace.\n\nAlso, you might want to look at this article: http://marcelog.github.com/articles/php_asterisk_listener_example_using_pami_and_ding.html\n\nFor an example of using asynchronous AGI with PAMI, see docs/examples/asyncagi\n\nThe [march edition](http://sdjournal.org/a-practical-introduction-to-functional-programming-with-php-sdj-issue-released/) of [Software Developer Journal](http://sdjournal.org/) features a complete article about writing telephony applications with PAMI and PAGI.\n\n# Currently Supported Events\n\nMore events will be added with time. I can only add the ones I can test for and\nuse, so your contributions may make the difference! ;)\n\nUnknown (not yet implemented) events will be reported as UnknownEvent, so you\ncan still catch them. If you catch one of these, please report it!\n\n* AgentsComplete\n* AgentConnect\n* Agentlogin\n* Agentlogoff\n* AGIExec\n* AsyncAGI\n* Bridge\n* BridgeInfoChannel\n* BridgeInfoComplete\n* CEL\n* ChannelUpdate\n* ConfbridgeEnd\n* ConfbridgeJoin\n* ConfbridgeLeave\n* ConfbridgeList\n* ConfbridgeListComplete\n* ConfbridgeMute\n* ConfbridgeStart\n* ConfbridgeTalking\n* ConfbridgeUnmute\n* CoreShowChannel\n* CoreShowChannelComplete\n* DAHDIShowChannel\n* DAHDIShowChannelsComplete\n* FullyBooted\n* DongleSMSStatus\n* DongleUSSDStatus\n* DongleNewUSSD\n* DongleNewUSSDBase64\n* DongleNewCUSD\n* DongleStatus\n* DongleDeviceEntry\n* DongleShowDevicesComplete\n* DBGetResponse\n* Dial\n* DTMF\n* Extension\n* Hangup\n* Hold\n* JabberEvent\n* Join\n* Leave\n* Link\n* ListDialplan\n* Masquerade\n* MessageWaiting\n* MusicOnHold\n* NewAccountCode\n* NewCallerid\n* Newchannel\n* Newexten\n* Newstate\n* OriginateResponse\n* ParkedCall\n* ParkedCallsComplete\n* PeerEntry\n* PeerlistComplete\n* PeerStatus\n* QueueMember\n* QueueMemberAdded\n* QueueMemberRemoved\n* QueueMemberPause\n* QueueMemberStatus\n* QueueParams\n* QueueStatusComplete\n* QueueSummaryComplete\n* RegistrationsComplete\n* Registry\n* Rename\n* RTCPReceived\n* RTCPReceiver\n* RTCPSent\n* RTPReceiverStat\n* RTPSenderStat\n* ShowDialPlanComplete\n* Status\n* StatusComplete\n* Transfer\n* Unlink\n* UnParkedCall\n* UserEvent\n* VarSet\n* vgsm_me_state\n* vgsm_net_state\n* vgsm_sms_rx\n* VoicemailUserEntry\n* VoicemailUserEntryComplete\n\n# Currently Supported Actions\n\n* AbsoluteTimeout\n* AGI\n* Agents\n* AgentLogoff\n* Atxfer (asterisk 1.8?)\n* Bridge\n* BridgeInfo\n* ChangeMonitor\n* Command\n* ConfbridgeList\n* ConfbridgeMute\n* ConfbridgeUnmute\n* CoreSettings\n* CoreShowChannels\n* CoreStatus\n* DAHDIDialOffHookAction\n* DAHDIHangup\n* DAHDIRestart\n* DAHDIShowChannels\n* DAHDIDNDOn\n* DAHDIDNDOff\n* DBGet\n* DBPut\n* DBDel\n* DBDelTree\n* DongleSendSMS\n* DongleSendUSSD\n* DongleSendPDU\n* DongleReload\n* DongleStop\n* DongleStart\n* DongleRestart\n* DongleReset\n* DongleShowDevices\n* ExtensionState\n* CreateConfig\n* GetConfig\n* GetConfigJSON\n* GetVar\n* Hangup\n* JabberSend\n* LocalOptimizeAway\n* Login\n* Logoff\n* ListCategories\n* ListCommands\n* MailboxCount\n* MailboxStatus\n* MeetmeList\n* MeetmeMute\n* MeetmeUnmute\n* MixMonitor\n* ModuleCheck\n* ModuleLoad (split in ModuleLoad, ModuleUnload, and ModuleReload)\n* Monitor\n* Originate\n* ParkedCalls\n* PauseMonitor\n* Ping\n* PlayDTMF\n* Queues\n* QueueAdd\n* Queue\n* QueueLog\n* QueuePause\n* QueuePenalty\n* QueueReload\n* QueueRemove\n* QueueReset\n* QueueRule\n* QueueSummary\n* QueueStatus\n* QueueUnpause\n* Redirect\n* Reload\n* SendText\n* SetVar\n* ShowDialPlan\n* Sipnotify\n* Sippeers\n* Sipqualifypeer\n* Sipshowpeer\n* Sipshowregistry\n* Status\n* StopMixMonitor\n* StopMonitor\n* UnpauseMonitor\n* VGSM_SMS_TX\n* VoicemailUsersList\n\n\n\n## Debugging, logging\n\nYou can optionally set a [PSR-3](http://www.php-fig.org/psr/psr-3/) compatible logger:\n```php\n$pami-\u003esetLogger($logger);\n```\n\nBy default, the client will use the [NullLogger](http://www.php-fig.org/psr/psr-3/#1-4-helper-classes-and-interfaces).\n\n# Developers\nThis project uses [phing](https://www.phing.info/). Current tasks include:\n * test: Runs [PHPUnit](https://phpunit.de/).\n * cs: Runs [CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).\n * doc: Runs [PhpDocumentor](http://www.phpdoc.org/).\n * md: runs [PHPMD](http://phpmd.org/).\n * build: This is the default task, and will run all the other tasks.\n\n## Running a phing task\nTo run a task, just do:\n\n```sh\nvendor/bin/phing build\n```\n\n## Contributing\nTo contribute:\n * Make sure you open a **concise** and **short** pull request.\n * Throw in any needed unit tests to accomodate the new code or the\n changes involved.\n * Run `phing` and make sure everything is ok before submitting the pull\n request (make phpmd and CodeSniffer happy, also make sure that phpDocumentor\n does not throw any warnings, since all our documentation is automatically\n generated).\n * Your code must comply with [PSR-2](http://www.php-fig.org/psr/psr-2/),\n CodeSniffer should take care of that.\n\nLICENSE\n=======\nCopyright 2016 Marcelo Gornstein \u003cmarcelog@gmail.com\u003e\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n# Thanks To\n\n* Jason Blank \u003crumpled at github\u003e for helping in the debugging of the queue\nfunctionality and some other ami inconsistencies.\n\n* Francesco Usseglio Gaudi, for help in debugging the Originate action.\n\n* Matías Barletta, for the vgms support.\n\n* Eli Hunter, for helping in bringing in tls compatibility.\n\n* Freddy dafredmail at googlemail, for his help and testing environment to add\ndongle support.\n\n* Joshua Elson for his help in trying and debugging in loaded asterisk servers.\n\n* Jacob Kiers for his help in bringing in and testing async agi functionality,\nand CEL event\nsupport.\n\n* Richard Baar for noticing the lack of eof support when reading from socket,\nthe JabberEvent, and the ScreenName in JabberAction.\n\n* Scot Opell for helping in debugging stream_get_line() in 5.3.9 and 5.3.10\n\n* Brian (wormling) for trying and fixing bugs on asyncagi\n\n* Henning Bragge for helping with newstate event and queues.\n\n* mbonneau for ParkedCall and UnParkedCall events.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcelog%2FPAMI","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcelog%2FPAMI","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcelog%2FPAMI/lists"}