Difference between revisions of "AlphaCom SDK Stentofon.AlphaCom.Example.CallRequests.exe"
From Zenitel Wiki
(11 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{A}} | ||
+ | {{stub}} | ||
+ | |||
== AlphaCom SDK Stentofon.AlphaCom - Call Reqeuest Handling == | == AlphaCom SDK Stentofon.AlphaCom - Call Reqeuest Handling == | ||
=== About the application === | === About the application === | ||
+ | |||
[[Image:AlphaComSDK_ExampleAppConfig.JPG|thumb|200px]] | [[Image:AlphaComSDK_ExampleAppConfig.JPG|thumb|200px]] | ||
− | [[Image: | + | [[Image:AlphaComSDK ExampleApp CallRequests.JPG|thumb|300px]] |
==== Config ==== | ==== Config ==== | ||
Line 16: | Line 20: | ||
==== Application Initialisation ==== | ==== Application Initialisation ==== | ||
+ | |||
The '''AlphaNetClient''' object is initialized with the '''AlphaNetClientConfig''' object containing the IP address etc. The '''AutoDiscoverAllNodes''', '''AutoGetStationState ''' and '''AutoSyncCallRequests''' properties is also set to get all StationState objects, and sync Call Requests: | The '''AlphaNetClient''' object is initialized with the '''AlphaNetClientConfig''' object containing the IP address etc. The '''AutoDiscoverAllNodes''', '''AutoGetStationState ''' and '''AutoSyncCallRequests''' properties is also set to get all StationState objects, and sync Call Requests: | ||
Line 37: | Line 42: | ||
_client.OnStationConnect += HandleStationConnect;<br/> | _client.OnStationConnect += HandleStationConnect;<br/> | ||
_client.OnStationDisconnect += HandleStationDisconnect;<br/> | _client.OnStationDisconnect += HandleStationDisconnect;<br/> | ||
+ | _client.OnCallRequest += HandleCallRequestReceived;<br/> | ||
+ | _client.OnCallRequestRemoved += HandleCallRequestRemoved;<br/> | ||
... | ... | ||
</code> | </code> | ||
Line 52: | Line 59: | ||
</code> | </code> | ||
− | ==== Storing | + | ==== Storing State info ==== |
Adding or updating on a StationState messages: | Adding or updating on a StationState messages: | ||
Line 69: | Line 76: | ||
</code> | </code> | ||
− | ==== | + | Add a CallRequest: |
+ | <code> | ||
+ | _stateStorage.AddCallRequest(cr); | ||
+ | </code> | ||
+ | |||
+ | Remove a CallRequest: | ||
+ | <code> | ||
+ | _stateStorage.RemoveCallRequest(cr); | ||
+ | </code> | ||
+ | |||
+ | ==== Retrieving StationState and CallRequest objects ==== | ||
Get a list of StationStates objects matching the Display Text or Directory number (if string is numeric): | Get a list of StationStates objects matching the Display Text or Directory number (if string is numeric): | ||
Line 76: | Line 93: | ||
var stList = GetStationList(textBoxStationSearch.Text); | var stList = GetStationList(textBoxStationSearch.Text); | ||
</code> | </code> | ||
+ | |||
+ | Get a list of CallRequest objects on Directory number: | ||
+ | |||
+ | <code> | ||
+ | var callRequestList = _stateStorage.GetCallRequestListOnReceivingStation(_selectedStation.DirectoryNumber); | ||
+ | </code> | ||
+ | |||
+ | [[Category:SDK]] |
Latest revision as of 09:53, 8 September 2017
Contents
AlphaCom SDK Stentofon.AlphaCom - Call Reqeuest Handling
About the application
Config
The application is a Windows Forms project with two Forms, the Main Window and Config window for inserting the IP address of the AlphaCom. The application config file is the default config file for the Stentofon.AlphaCom.AlphaNet.dll named Stentofon.AlphaCom.AlphaNet.xml defined in the namespace Stentofon.AlphaCom.AlphaNet.Config.
If no config file at startup the application will open the config window. The config window can also be opened by clicking the 'Config' button in the Main Window.
Application Initialisation
The AlphaNetClient object is initialized with the AlphaNetClientConfig object containing the IP address etc. The AutoDiscoverAllNodes, AutoGetStationState and AutoSyncCallRequests properties is also set to get all StationState objects, and sync Call Requests:
_client = new AlphaNetClient(_formConfig.ClientConfig) { AutoDiscoverAllNodes = true, AutoGetStationState = true, AutoSyncCallRequests = trus };
All The StationState objects will be stored in InMemory structure using the Stentofon.AlphaCom.Data.dll:
_stateStorage = new AlphaComState(AlphaComStateStorages.IN_MEMORY);
Handlers For TCP Up/Down, Node Connection Up/down, StationState, StationBusy/StationFree, StationConnect/StationDisconnect is registered:
_client.OnTCPConnectionUp += HandleTCPUp;
_client.OnTCPConnectionDown += HandleTCPDown;
_client.OnNodeConnectionUp += HandleNodeUp;
_client.OnNodeConnectionDown += HandleNodeDown;
_client.OnStationStateReceived += HandleStationState;
_client.OnStationBusyReceived += HandleStationBusy;
_client.OnStationFreeReceived += HandleStationFree;
_client.OnStationConnect += HandleStationConnect;
_client.OnStationDisconnect += HandleStationDisconnect;
_client.OnCallRequest += HandleCallRequestReceived;
_client.OnCallRequestRemoved += HandleCallRequestRemoved;
...
Do the connection:
try{
_client.StartListening();
_client.StartMonitorThread();
}
catch (Exception ex){
connected = false;
}
Storing State info
Adding or updating on a StationState messages:
if (_stateStorage.UpdateStation(st) > 0) // If added
_registeredStationCounter++;
Update the station busy flag in the state storage on StationFree Message received:
var station = _stateStorage.GetStationState(sf.Station);
if (station != null)
station.SetBusyState(false); // Update the state storage object
Add a CallRequest:
_stateStorage.AddCallRequest(cr);
Remove a CallRequest:
_stateStorage.RemoveCallRequest(cr);
Retrieving StationState and CallRequest objects
Get a list of StationStates objects matching the Display Text or Directory number (if string is numeric):
var stList = GetStationList(textBoxStationSearch.Text);
Get a list of CallRequest objects on Directory number:
var callRequestList = _stateStorage.GetCallRequestListOnReceivingStation(_selectedStation.DirectoryNumber);