@chunsiong.zoom
Hi , I’ll add a code snippet from the authorization until the join meeting and the logs :
Authenticte();
[HandleProcessCorruptedStateExceptions]
private void Authenticte()
{
string prefix = "[Authenticte]";
m_logger.Debug($"{prefix} , Try to authenticte");
try
{
InitParam param = new InitParam();
param.web_domain = "https://zoom.us";
param.brand_name = "SDK";
param.enable_log = true;
SDKError err = CZoomSDKeDotNetWrap.Instance.Initialize(param);
if (SDKError.SDKERR_SUCCESS == err)
{
m_logger.Debug($"{prefix} , Success in initializing...");
AuthorizeZoom();
}
else
{
m_logger.Debug(err);
m_logger.Debug($"{prefix} , Failed to initialize");
CZoomSDKeDotNetWrap.Instance.CleanUp();//clean up sdk
}
}
catch (Exception ex)
{
m_logger.Error($"{prefix} , Failed to authenticate " + ex);
}
}
[HandleProcessCorruptedStateExceptions]
private void AuthorizeZoom()
{
string prefix = “[AuthorizeZoom]”;
try
{
m_logger.Debug($“{prefix} , Adding onAuthenticationReturn callback”);
CZoomSDKeDotNetWrap.Instance.GetAuthServiceWrap().Add_CB_onAuthenticationReturn(onAuthenticationReturn);
AuthContext authParam = new AuthContext();
authParam.jwt_token = GetSignature(_sdkKey, _sdkSecret, 0); // Pass in your Meeting SDK JWT
CZoomSDKeDotNetWrap.Instance.GetAuthServiceWrap().SDKAuth(authParam);
}
catch (Exception e)
{
m_logger.Error($"{prefix} , Failed to authorize " + e);
}
}
public static string GetSignature(string sdkKey, string sdkSecret, int roleId)
{
DateTime now = DateTime.UtcNow;
int iat = (int)(now.Subtract(new DateTime(1970, 1, 1))).TotalSeconds - 30;
int exp = iat + 60 * 60 * 2;
var payload = new Dictionary<string, object>()
{
{ "appKey", sdkKey },
{ "sdkKey", sdkKey },
{ "role", roleId },
{ "iat", iat },
{ "exp", exp },
{ "tokenExp", exp },
};
return JWT.Encode(payload, Encoding.UTF8.GetBytes(sdkSecret), JwsAlgorithm.HS256);
}
public void onAuthenticationReturn(AuthResult ret)
{
string prefix = "[onAuthenticationReturn]";
m_logger.Debug($"{prefix} , OnAuthentication callback function " + ret.ToString());
try
{
if (AuthResult.AUTHRET_SUCCESS == ret)
{
m_logger.Debug($"{prefix} , Joining meeting");
RegisterCallBack();
JoinMeeting(_meetingId, _psw);
}
else
{
m_logger.Debug($"{prefix} , Failed to authenticate...");
// Notify the server side for removing the meeting from the static meetings list
m_logger.Debug($"{prefix} , Notify the server to remove the meeitng from the list");
NotifyServer();
m_logger.Debug($"{prefix} , Finished deleting , closing process");
if (_cancellationTokenSource != null)
{
_cancellationTokenSource.Cancel();
_cancellationTokenSource.Dispose();
}
Environment.Exit(0);
}
}
catch (Exception e)
{
m_logger.Error($"{prefix} , Failed on authentication callback " + e);
}
}
private void RegisterCallBack()
{
ZOOM_SDK_DOTNET_WRAP.CZoomSDKeDotNetWrap.Instance.GetMeetingServiceWrap().Add_CB_onMeetingStatusChanged(onMeetingStatusChanged);
CZoomSDKeDotNetWrap.Instance.GetMeetingServiceWrap().
GetMeetingParticipantsController().Add_CB_onUserJoin(onUserJoin);
CZoomSDKeDotNetWrap.Instance.GetMeetingServiceWrap().
GetMeetingParticipantsController().Add_CB_onUserLeft(onUserLeft);
CZoomSDKeDotNetWrap.Instance.GetMeetingServiceWrap().
GetMeetingRecordingController().Add_CB_onCloudRecordingStatus(onRecordingStatusChanged);
}
private void JoinMeeting(long meetingId, string psw)
{
string prefix = "[JoinMeeting]";
m_logger.Debug($"{prefix} , Trying to join meeitng");
try
{
JoinParam param = new JoinParam();
param.userType = SDKUserType.SDK_UT_WITHOUT_LOGIN;
JoinParam4WithoutLogin join_api_param = new JoinParam4WithoutLogin();
join_api_param.meetingNumber = (ulong)meetingId;
join_api_param.userName = "PG Notetaker";
if (psw != "NoPSW")
{
join_api_param.psw = psw;
}
else
{
m_logger.Debug($"{prefix} Meeting password is empty");
join_api_param.psw = "";
}
m_logger.Debug($"{prefix} Param: UserType={param.userType}, MeetingNumber={join_api_param.meetingNumber}, UserName={join_api_param.userName}, Password={join_api_param.psw}");
param.withoutloginJoin = join_api_param;
SDKError err = CZoomSDKeDotNetWrap.Instance.GetMeetingServiceWrap().Join(param);
m_logger.Debug(err);
if (SDKError.SDKERR_SUCCESS == err)
{
m_logger.Debug($"{prefix} , Successfully PG Notetaker joined");
}
else//error handle
{
m_logger.Debug($"{prefix} , Wasn't able joining to the meeting");
}
}
catch (Exception e)
{
m_logger.Error($"{prefix} , Failed on PG Notetaker joining to meeting " + e);
}
}
You can see in the log file immediately after the joining meeting log , the onMeetingStatusChanged is triggered somehow and nothing happens.
The user started the meeting is eladw@agatsoftware.com with user id : vNc3pu7WRAiAsFpPtpV8EA
The account id is : C__I_sqMQ5-Zbp36cJpkIw
Meeting SDK client id : dftSoQp6T4i77r5CTNgD_w