How can I get the name associated with an extension/peer without having an opened channel with the Asterisk's Java API?

非 Y 不嫁゛ 提交于 2019-12-11 11:44:29

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!