Skip to content

Commit

Permalink
refactor(wip): updates ParseAuthenticationResponse
Browse files Browse the repository at this point in the history
Refactored ParseAuthenticationResponse method to resolve
an issue where the Host and Guest entry was not processed
and updating the bridge to indicate Host or Guest has
connected the call.
  • Loading branch information
jkdevito committed Jun 18, 2024
1 parent bd9851f commit 3a32b06
Showing 1 changed file with 84 additions and 36 deletions.
120 changes: 84 additions & 36 deletions src/WebexPinRequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,13 @@ private void ParseAuthenticationType(AuthenticationRequestResponseCall authReque

public void ParseAuthenticationResponse(JToken token)
{
var request = token.ToObject<AuthenticationResponseObject>();
if (request.Call == null || request.Call.AuthenticationResponse == null)
var response = token.ToObject<AuthenticationResponseObject>();
if (response.Call == null || response.Call.AuthenticationResponse == null)
return;

Debug.Console(1, _parent, "Parsing Auth Response object: {0}", JsonConvert.SerializeObject(request));

var pinError = request.Call.AuthenticationResponse.PinError;
Debug.Console(1, _parent, "Parsing Auth Response object: {0}", JsonConvert.SerializeObject(response));

var pinError = response.Call.AuthenticationResponse.PinError;
if (pinError != null)
{
PinIncorrect.Start();
Expand All @@ -235,37 +234,86 @@ public void ParseAuthenticationResponse(JToken token)
return;
}

var pinEntered = request.Call.AuthenticationResponse.PinEntered;

if (pinEntered != null && pinEntered.AuthenticatingPin.Value == "False")
{
var role = request.Call.AuthenticationResponse.PinEntered.ParticipantRole.Value;

if (!String.IsNullOrEmpty(role) && role == "Guest")
{
JoinedAsGuest.Start();
JoinedAsAttendee.Start();
_pin = string.Empty;
Debug.Console(1, _parent, "Joined as {0}", role);
return;
}

if (!String.IsNullOrEmpty(role) && role == "Host")
{
JoinedAsHost.Start();
_pin = string.Empty;
Debug.Console(1, _parent, "Joined as {0}", role);
return;
}

if (!String.IsNullOrEmpty(role) && role == "Panelist")
{
JoinedAsPanelist.Start();
_pin = string.Empty;
Debug.Console(1, _parent, "Joined as {0}", role);
return;
}
}
// TODO [ ] Review refactor, additional updates may be required to handle Webex Webinars
// - below resolves issues preventing Host/Guests to connect in standard calls
var pinEntered = response.Call.AuthenticationResponse.PinEntered;
if (pinEntered == null)
{
Debug.Console(1, _parent, "Pin Entered: null");
return;
}

var role = response.Call.AuthenticationResponse.PinEntered.ParticipantRole.Value;
if (string.IsNullOrEmpty(role))
{
Debug.Console(1, _parent, "Participant Role: null");
return;
}

Debug.Console(1, _parent, "Pin Entered: {0}", pinEntered);
Debug.Console(1, _parent, "Authenticating Pin Value: {0}", pinEntered.AuthenticatingPin.Value);

Debug.Console(1, _parent, "Joining as {0}", role);

switch (role)
{
case("Guest"):
{
JoinedAsGuest.Start();
JoinedAsAttendee.Start();
_pin = string.Empty;
break;
}
case("Host"):
{
JoinedAsHost.Start();
_pin = string.Empty;
break;
}
case("Panelist"):
{
JoinedAsPanelist.Start();
_pin = string.Empty;
break;
}
default:
{
Debug.Console(1, _parent, "Unhandled role: {0}", role);
break;
}
}

Debug.Console(1, _parent, "Joined as {0}", role);

//if (pinEntered != null && pinEntered.AuthenticatingPin.Value == "False")
//{
// var role = request.Call.AuthenticationResponse.PinEntered.ParticipantRole.Value;

// if (!String.IsNullOrEmpty(role) && role == "Guest")
// {
// JoinedAsGuest.Start();
// JoinedAsAttendee.Start();
// _pin = string.Empty;
// Debug.Console(1, _parent, "Joined as {0}", role);
// return;
// }

// if (!String.IsNullOrEmpty(role) && role == "Host")
// {
// JoinedAsHost.Start();
// _pin = string.Empty;
// Debug.Console(1, _parent, "Joined as {0}", role);
// return;
// }

// if (!String.IsNullOrEmpty(role) && role == "Panelist")
// {
// JoinedAsPanelist.Start();
// _pin = string.Empty;
// Debug.Console(1, _parent, "Joined as {0}", role);
// return;
// }
//}
}

public void JoinAsGuest()
Expand Down

0 comments on commit 3a32b06

Please sign in to comment.