问题
I’m using FreePBX with Asterisk’s Java API. For the moment, I’m able to display all my SIP peers with their respective states:
public void onManagerEvent(ManagerEvent event)
{
// Look if the event is a IP phone (Peer entry)
if(event instanceof PeerEntryEvent)
{
PeerEntryEvent ev = (PeerEntryEvent)event;
// Get the user extension
peer = ev.getObjectName();
// Add to the array
peersName.add(peer);
}
}
I’m able to display the phone number and name of both callers when a channel is open:
private String GetExtensionPeer(String extension)
{
for (AsteriskChannel e : channels)
if (e.number.equals(extension) && e.bridge != null )
for (AsteriskChannel channel : channels)
if (z.channel.equals(e.bridge))
return " with " + channel.number + " - " + channel.name;
return "";
}
But now, I would like to display the name of my extensions without a channel connection.
In FreePBX's panel, it's look like :
回答1:
In freepbx you can get list of extensions from asterisk db. To see info, do
asterisk -rx "database show"
To get info use manager action "command" with DBGET.
Other option - got that info from freepbx's mysql db.
来源:https://stackoverflow.com/questions/15513364/how-can-i-get-the-name-associated-with-an-extension-peer-without-having-an-opene