Where is the updated documentation on using the astman functionality?


(Jared Busch) #1

This old documentation is all I can find. But it does not list anything about PJSIP.
https://wiki.freepbx.org/display/FOP/Asterisk+Manager+Class

If I list the commands, it shows PJSIP commands.

But I cannot make them all execute. Here is what I get trying PJSIPShowContacts

But PJSIPShowEndpoints and PJSIPShowEndpoint both work.

My ami.php file for testing:

<?php

// Load FreePBX bootstrap environment
require_once('/etc/freepbx.conf');

// Load AMI
global $astman;

// $test = $astman->ConfbridgeListRooms(); // works
// $test = $astman->ConfbridgeList("198"); // works

// $test = $astman->PJSIPShowAors(); // does not work
// $test = $astman->PJSIPShowContacts(); // does not work
// $test = $astman->PJSIPShowEndpoints(); // works
// $test = $astman->PJSIPShowEndpoint("103"); // works

$test = $astman->ListCommands($actionid=NULL); //works

echo "DUMP AMI RESULT BEGIN<br />\r\n<pre>\r\n";
echo var_dump($test);
echo "\r\n</pre>\r\nDUMP AMI END<br />\r\n";

?>

(Lorne Gaetz) #2

The $astman method ListCommands invokes the Asterisk AMI command ListCommands,

58448910*CLI> manager show command ListCommands
[Syntax]
Action: ListCommands
[ActionID:] <value>

[Synopsis]
List available manager commands.

which returns acceptable asterisk AMI commands, not $astman class methods. The confusion arises because the class methods have identical names to the AMI commands. To date only a few pjsip methods have been added to the class which you can see by using this line in your script:

$test = get_class_methods($astman);

[root@58448910 tmp]# php ami.php  | grep -i pj
  string(18) "PJSIPShowEndpoints"
  string(43) "PJSIPShowRegistrationInboundContactStatuses"
  string(17) "PJSIPShowEndpoint"

(system) closed #3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.