Jump to content

new VoiceBox entries


ItsAMeMario
 Share


Go to solution Solved by ItsAMeMario,

Recommended Posts

Hi all,

 

in advance sorry for my bad English and wrong technical terms.

I'm trying to get the new Voice Box List in my external program via the SDK. It's a shame that the SDK doesn't get further updates.
You have to work with undocumented DLLs.

I don't know how to get the enumeration of the messages.

There are classes SWConfigDataClientLib.Proxies.VoiceMessage and SWConfigDataClientLib.Proxies.VoiceMessageList but where are the entries?

 

A couple of users have the problem since 13.27 (now 13.28) that the red new voicemail count badge is displayed but there are no unread voicemails.

The users deleted the voice box messages without playing them first.
On my user the badge is removed or counted down on playing and on deletion. But with some users that does not work.

The Proxies.Users.UserEntryBase.NewVoicemail property is always 0 in that case. I don't know what the property is for.

 

My workaround for removing the badges/counter is to connect to the SQL database and do something like this.

UPDATE [VoiceMessage] SET ViewedAt = CURRENT_TIMESTAMP, ViewedBy = 'FIXED' WHERE ViewedAt IS NULL -- AND UserID = 123 -- AND CallId = 1234567

But that is a pain in the a**.

 

Is there a possibility to disable the new voice box feature?

Nearly all users in my company work on a RDServer and they cannot play audio with SwyxIt in the session.
To switch to the local PCs SwyxIt! is to "much work".
The voice messages via E-Mail are totally fine. The new stuff is only distracting and unnessesary.

 

If there isn't a way to disable it. Than i have to resort to my "maintenance tool" to fix every single: "Can you remove the annoying badge for me!"-call. 🤣

 

One final special question. A bit unrelated to the problem but within the topic.

Is there a possibility to play the voice box message via the SDK?

I can get the files via SQL-Tables (VoiceMessage -> Files -> FileData).

 

Thanks for all help in advance.

Mario
 

Link to comment
Share on other sites


  • 3 weeks later...
  • Solution

Never leave a question unanswered!

 

 

A little search in the object browser led to success.

It's not very fancy code. Only a proof of concept and it might help somebody to get started.

I wish there would be a better solution for fixing our problem other than this shitty workaround.
But I'll take what I can.

 

kind regards

Mario

 

Imports SWConfigDataClientLib
Imports SWConfigDataClientLib.Proxies
Imports SWConfigDataClientLib.Proxies.Files
Imports System.IO

Module Swyx
    Public SwyxServerName As String = "FQDNorIP"
  
  	' connect to SwyxServer
    Private Function Connect(swyxServer As String) As LibManager
        Dim LibManager = New LibManager
        With LibManager
            .AuthenticationMode = SProxyObject.AuthenticationMode.TrustedLocal
            .BaseProtocol = SProxyObject.BaseProtocol.TCP
            .WSBaseUrl = swyxServer
        End With
        Return LibManager
    End Function
  
      ' Voice Box / VoiceBox / VoiceMessageList
    Public Sub ShowVoiceMessageList(username As String)
        Dim LibManager = Connect(SwyxServerName)
        Dim phoneClientFacade As PhoneClient.PhoneClientFacade = LibManager.GetPhoneClientFacade
        'Dim serverFacade As IppbxServer.IppbxServerFacade = LibManager.GetIppbxServerFacade

        Dim userEnum As Users.UserEnum = LibManager.GetUserEnum()
        userEnum.ExecuteNameFilter(username, New Data.OrderByList)
        Dim userId As Integer = userEnum.PrimaryCollection(0).UserID
        Dim voiceMessageList As VoiceMessageList = phoneClientFacade.GetVoiceMessages(userId) 'serverFacade.GetUserVoiceMessages(userId)

        For Each voiceMessage As VoiceMessage In voiceMessageList
            Try
                With voiceMessage
                    Dim viewedAt As Date = Nothing
                    If .ViewedAt IsNot Nothing Then
                        viewedAt = Format(CDate(.ViewedAt).ToLocalTime, "ddd, dd.MM.yyyy, HH:mm:ss")
                    End If
                    Dim allProps As New List(Of Object)(New Object() _
                                    {"Rufnummer/URI", .CallingNumber,
                                     "Name", .CallingName,
                                     "Datum / Zeit", Format(.StartTimeLocal.DateTime, "ddd, dd.MM.yyyy, HH:mm:ss"),
                                     "Ruf für", String.Format("{0}, {1}", .CalledNumber, .CalledName),
                                     "Verbunden mit", .ConnectedName,
                                     "Anrufdauer", Format(New DateTime(TimeSpan.FromSeconds(.Seconds).Ticks), "mm:ss"),
                                     "Abgespielt von", .ViewedBy,
                                     "ViewedAt", viewedAt,
                                     "Viewed", .Viewed,
                                     "UserId", .UserId,
                                     "CallId", .CallId,
                                     "FileId", .FileId})
                    Console.WriteLine(String.Join(Environment.NewLine, allProps.Select(Function(x) x.ToString()).ToArray()))
                End With
            Catch ex As Exception
            End Try
        Next
        LibManager.FreeForReuse()
        LibManager.Dispose()
    End Sub

    ' sets a voicemessage as viewed
    Public Sub SetUserVoiceMessageViewedAt(callId As Integer, viewed As Boolean, viewedByUserId As Integer, viewedByFallback As String)
        Dim LibManager = Connect(SwyxServerName)
        Dim serverFacade As IppbxServer.IppbxServerFacade = LibManager.GetIppbxServerFacade
        Try
            serverFacade.SetVoiceMessageViewedAt(callId, viewed, viewedByUserId, viewedByFallback)
        Catch ex As Exception
        End Try
        LibManager.FreeForReuse()
        LibManager.Dispose()
    End Sub

    ' saves a voicemessage locally and plays the wav file
    Public Sub PlayVoiceMessage(FileId As String, localFilePath As String)
        If Not Directory.Exists(localFilePath) Then
            Directory.CreateDirectory(localFilePath)
        End If

        Dim LibManager = Connect(SwyxServerName)
        Dim filesFacade As FilesFacade = LibManager.GetFilesFacade
        Try
            Dim fle As FileListEntry = filesFacade.GetFileListEntryByFileID(New Guid(FileId))
            Dim localFileName As String = Path.Combine(localFilePath, fle.Name)
            filesFacade.GetIpPbxFileCopy(fle, localFileName, True)

            My.Computer.Audio.Play(localFileName)
        Catch ex As Exception
        End Try
        LibManager.FreeForReuse()
        LibManager.Dispose()
    End Sub

    ' delete a voicemessage
    Public Sub DeleteVoiceMessage(callId As Integer)
        Dim LibManager = Connect(SwyxServerName)
        Dim serverFacade As IppbxServer.IppbxServerFacade = LibManager.GetIppbxServerFacade
        Try
            serverFacade.DeleteVoiceMessage(callId)
        Catch ex As Exception
        End Try
        LibManager.FreeForReuse()
        LibManager.Dispose()
    End Sub
End Module

 

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×
×
  • 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.