Jump to content

Active Call Monitoring


Arian

Recommended Posts

Hello fellow SwyxWare Users and Devs,

 

I have some questions regarding the real time monitoring of active calls in SwyxWare.

My company (a small enviroment with 10-20 clients) wants to monitor all active calls on a designated screen in the office, alongside with seperate (non-SwyxWare) information. For this we are using Dashing. However, getting the information about the active calls out of SwyxWare remains to be a big hurdle.

 

What I have done so far:

1) Reading the logfiles (aka "cdr... .txt" in \ProgramData\Swyx\) is not fit for real time monitoring.

2) I have not yet found any line of code in PowerShell that is able to get the active calls with their details. Iterating over the active calls in the phonebook I can only get the state of users, but not, for example, the number of the party on the other end, the duration of the call, etc. The information I would like to have is generally the information displayed in the "Active Calls" view of my SwyxWare Administration Interface.

3) From extensive search in the forums, I came to the conclusion, that I will have to access the CDS in order to get the information I want. However, I cannot get the provided C++/CLI-Sample of the SDK to compile.

 

If anyone has a running setup for real time call monitoring or can point me in the direction of the right setup / further documentation / sample code this would be greatly apprecianted!

In my desperation I now went so far as to run the SwyxWare Administration Interface and directly read the programms memory from RAM in order to get my desired information. However, this is a nasty workaround I am not willing to accept as a final solution, so I hope for some guidance of the community.

 

Best Regards ;)

Link to comment
Share on other sites


  • Most Valued User

Hello Arian,

 

an Active Call view is available via Powershell and via the ConfigDataStore API:

Powershell

# Connect to the local server via Windows Authentication
Connect-IpPbx

# Get the active calls list
Get-IpPbxCall

# Cleanup
Disconnect-IpPbx



ConfigDataStore API

// Create and configure new LibManager object
// Use AuthenticationMode "SProxyObject.AuthenticationMode.Trusted"
// for WindowsAuthentication
var libManager = new LibManager()
{
    BaseProtocol = SProxyObject.BaseProtocol.TCP,
    Username = "TestUser",
    Password = "TestPassword",
    WSBaseUrl = "127.0.0.1",
    AuthenticationMode = SProxyObject.AuthenticationMode.UsernamePassword
};

// Get Admin Facade
var adminFacade = this.libManager.GetAdminFacade();

// Get Calls
var callList = adminFacade.GetActiveCallsView().CreateSortableFilterCollection()

// Output call list....
  
// Cleanup
adminFacade.FreeForReuse();
libManager.FreeForReuse();
adminFacade = null;
libManager = null;

 

Link to comment
Share on other sites


Thanks for the incredibly fast anwser!

 

Regarding the PowerShell sample, "Get-IpPbxCall" seems to do the trick pretty much. I was looking at code like this and felt well over my hat. But this is pretty much good enough for me as of now, so I thank you once again! If I come up with any more problems or have some sample code to share for the implementation with Dashing, I will post it here ;)

Link to comment
Share on other sites


As mentioned in my previous post I have had some great success with the provided PS sample (here an example). However, two problems still remain:

 

1) I now fetch and store my data as shown in the code below:

# Get the active calls list
Get-IpPbxCall > active_calls.txt

This produces a file like this (0s inserted for anonymity):


CallId  Origination               Called                    Destination        
------  -----------               ------                    -----------        
121256  Sample Name 1 (00... +0000014279110            70                 
121260  Sample Name 6195 (+... +0000014279114            85                 
121262  +000001649260             +0000064509918            +0000064509918     
121264  Sample Name 3062 (+... +0000014279114            80                 

As you might see, the "Destination"-Number is not resolved properly (name not propperly written). Any suggestions on how to do that?

Additional points if I can somehow get the duration of the call, but it is no so important.

 

2) Additionally, there is the general problem, that I even have to write to file. Currently I invoke the PS code by calling the PS script from Python and then read the file with Python. Optimally, I would like to have PS to simply return the data into std_out or write to shell, etc so I can fetch it directly.

 

Any suggestions are as always deeply appreciated!

Link to comment
Share on other sites


  • Most Valued User

Hi Arian,

 

regarding point 2) I highly recommand to use the Config Data Store API SDK (have a look here). In combination with ASP.NET WebAPI you could represent your data by a simple URI, so your dashboard/frontend can consume data easily.

 

For Duration have a look on:

Get-IpPbxCall | ForEach-Object { "{0:HH:mm:ss,fff}" -f ([datetime](([TimeSpan]::FromMilliseconds($_.Duration).Ticks) / 10000)) }

 

Link to comment
Share on other sites


Thanks for the reply!

 

I already have had a long look at the linked SDK samples, but to my shame I have had great trouble getting them to run (one of the reasons I asked for help in the first place). I simply lack the background in .NET / Windows / C development. Anyway, I am pretty happy as of now, especially since you have shown me this neat way to get the call duration. If possible, can you elaborate where I can find more examples like this or an documentation of the properties I can access? Also are there any suggestions for crossrefrencing the "Destination"-Number with the Phonebook? I will keep searching on my end and thank all of you for your help.

Link to comment
Share on other sites


  • Most Valued User

Hi Arian,

 

a good way to work with Windows PowerShell is the ISE.

I.e. you are able to use Intellisense and the Command-Overview-Box on the right site, where you get a list of all Cmdlets. "import-modules ippbx" and just choose this Module and you will have a great overview about Parameters, Properties, Description and so on.

 

In this Example Get-IpPbxCall gives you an Object (ActiveCallEntry) with some Properties. Just put it an Variable and typing this Variable with a dot, so Intellisense will show up its properties.

 

Have a look here ("More Cool Intellisense").

Link to comment
Share on other sites


Hi ogoettlich,

 

this is great!

However it does not really work for me, since (as you might have seen in the dump of Get-IpPbxCall above) my $_.DestinationNumber could for example be "85". Doing the search with "-SearchNumber" then finds all numbers containing "85", e.g. 00000008500. Also, when no entry is found, I want to actually display the number. Sorry if I was very impresice in my question. But you proppeled me in the right direction. Since I lack the expertise my code looks very cluncky and is not yet 100% doing what he's supposed to, but will do so eventually but atleast does what I want:

 

Import-Module IpPbx

# Connect to the local server via Windows Authentication
Connect-IpPbx -ServerName 000.000.000.000 # Server address replaced for anonymity

$base_nummer = "00000000" # Telefon number replaced for anonymity

do
{

    ForEach ($item in Get-IpPbxCall)
    {
        
        if ($item.DestinationNumber.ToString().Length -eq 2) {
            $full_number = $base_nummer + $item.DestinationNumber.ToString().Replace('+','')
        } 
        else {
            $full_number = $item.DestinationNumber.ToString().Replace('+','')
        }
 
        $entry_found = $FALSE
        ForEach ($entry in Get-IpPbxPhonebookEntry -GlobalPhoneBook) {
            if ($entry.Number -match $full_number) {
                $full_number, $entry.Name
                $entry_found = $TRUE
                break
            }
        }
        
        if (-Not $entry_found) {
           $full_number
        }
    }
}
while($TRUE)
Link to comment
Share on other sites


  • Most Valued User

Hello Arian,

 

it seems that your SwyxWare is not correctly configured otherwise you would not get numbers like "+00000...".
What kind of trunks do you use and how they are configured?
It seems that the number format configuration of your trunks / trunk groups is wrong.

Kind regards

Sebastian Dreier

Link to comment
Share on other sites


Hey Sebastian,

 

thanks for your awnser! I think everythings fine with my setup since,

Quote

This produces a file like this (0s inserted for anonymity):

Quote

$base_nummer = "00000000" # Telefon number replaced for anonymity

I simply used some zeros to mask the real numbers. Or perhaps can you rephrase your question, if I might not understand you correctly?

Also I am quite happy how every thing turned out right now. I need to fiddle little bit more, but due to the help of all of you, I am positiv to have all I want soon. Will update the code sample as reference then. However, thanks so far! ;)

Link to comment
Share on other sites


Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.