This section exposes the data structures which contains the information about the currently connected system.

Systems Objects

The AMI_Client collects and maintains information on the elements and status of the connected system in objects Lists that are accessible as read only properties.

These list are built either automatically after connection, by setting the AutoGetConfig to true or by sending individual AMI commands using the AMI_Client methods. The status is updated in realtime as status messages are received from the connected system and parsed by the AMI_Client.

The AMIgo ListViews and DataGridView controls display these lists in real time.

  • AstUsersObjectsList: This property gives read only access to the Users Objects List. This is a list of AstUsersObject which contains the SIP / IAX / Zap/DAHDI peers, users and registrations defined on the connected system and allows to get the real time status of the object.
  • AstChannelsList: This is a list of AstChannel which contains the currently active channels and their status.
  • AstCallsList: This is a list of AstCall which contains the currently active calls and their status.
  • AstQueuesList: This is a list of AstQueue which contains the queues defined on the connected system and and statistics.
  • AstQueuesMembersList: This is a list of AstQueueMember which reflects the queue members, that is agents that have been added as queue memebers.
  • AstQueuesEntriesList: This is a list of AstQueueEntry which contains the calls that are currently waiting in the queues.
  • AstConferencesList: This is a list of AstConference which contains the conferences defined on the connected system.
  • AstConferenceUsersList: This is a list of AstConferenceUser which contains the currently active conferences users.

Extensions Status and configuration

Asterisk can report real time status for SIP and IAX2 types extensions, but some configuration is needed. In order for Asterisk to report the status of SIP or IAX2 extensions, a 'hint' priority must be set in the dialplan. For example, this line in the 'default' context define a hint priority for extension 200 and specify a SIP extension type.

CopyC#
1[default]
2exten => 200,hint,SIP/200
Note

If your system define the users in 'users.conf' the 'hints' are set dynamically by asterisk at startup

"In Asterisk 1.4 the inner workings of the hint functionality have slightly changed. It is now imperative that you set a call-limit (even if it's an arbitrarily-high value like 100) and/or the new limitonpeers value in sip.conf."

CopyC#
1In sip.conf
2
3[general]
4limitonpeers = yes
5
6[200]
7call-limit = 100

Using the objects Lists

You can use these List as with any other generic lists :
CopyC#
1foreach (AstAgent agent in AstAgentsList)
2{
3  if (agent.Status == "0") // Test if agent busy
4  {
5    string ph_no = GetNextPhoneNo(); // Get next no (From db ..., list etc )
6    // Originate a call from agent extension to phone number
7    AMI_Client1.OriginateExtension(agent.Agent, "default", 9 + ph_no, "1", "");
8  }
9}