Reputation: 145
I wrote the following code inside a function which returns status. It was working fine, but now it sets the status as soon as the Skype call is made. So, the status is set as "Routing" for every call instead of "refused", "cancelled", "finished" etc. I want to get the final status of the call. Furthermore, how do I make the rest of the code until the call is finished. I would also like to get the duration of call, but right now it sets it to zero, because the next lines of code get executed as soon as the call is placed. I am using Skype4COM Lib. Here's the code:
Private Function placeSkypeCall(ByVal number As String, ByRef status As String)
Dim oSkype = skype
If Not oSkype.Client.IsRunning Then
oSkype.Client.Start()
System.Threading.Thread.Sleep(20000)
End If
''Setting Necessary Constant Variables to interact with Skype object
Dim cUserStatus_Offline = oSkype.Convert.TextToUserStatus("OFFLINE")
Dim cUserStatus_Online = oSkype.Convert.TextToUserStatus("ONLINE")
'Setting the user as online
If cUserStatus_Offline = oSkype.CurrentUserStatus Then
oSkype.ChangeUserStatus(cUserStatus_Online)
End If
'Setting an end user
Dim oUser = oSkype.User(number)
'placing the call
Dim oCall = oSkype.PlaceCall(oUser.Handle)
status = oSkype.Convert.CallStatusToText(oCall.Status)
If status.ToString() = "Finished" Then
status = "Success"
ElseIf status.ToString() = "Refused" Then
status = "Declined"
ElseIf status.ToString() = "Cancelled" Then
status = "Unanswered"
End If
Return status
End Function
Upvotes: 0
Views: 99