Trying to change user presence, at first I was trying to just use the below snippet from the RC Developer API (tweaking what I wanted to use, and adding all of my API information to it)
https://developers.ringcentral.com/api-reference/Presence/updateUserPresenceStatus
// https://developers.ringcentral.com/my-account.html#/applications
// Find your credentials at the above url, set them as environment variables, or enter them below
// PATH PARAMETERS
string extensionId = "<ENTER VALUE>";
string accountId = "<ENTER VALUE>";
// POST BODY
PresenceInfoResource presenceInfoResource = new PresenceInfoResource {
userStatus = 'Offline',
dndStatus = 'TakeAllCalls',
message = "<ENTER VALUE>",
allowSeeMyPresence = true,
ringOnMonitoredCall = true,
pickUpCallsOnHold = true,
activeCalls = new[] {
new ActiveCallInfo {
id = "<ENTER VALUE>",
direction = 'Inbound',
from = "<ENTER VALUE>",
fromName = "<ENTER VALUE>",
to = "<ENTER VALUE>",
toName = "<ENTER VALUE>",
startTime = "<ENTER VALUE>",
telephonyStatus = "<ENTER VALUE>",
sipData = new DetailedCallInfo {
callId = "<ENTER VALUE>",
toTag = "<ENTER VALUE>",
fromTag = "<ENTER VALUE>",
remoteUri = "<ENTER VALUE>",
localUri = "<ENTER VALUE>",
rcSessionId = "<ENTER VALUE>"
},
sessionId = "<ENTER VALUE>",
terminationType = "<ENTER VALUE>"
},
}
};
RestClient rc = new RestClient(
Environment.GetEnvironmentVariable("clientId"),
Environment.GetEnvironmentVariable("clientSecret"),
false
);
await rc.Authorize(
Environment.GetEnvironmentVariable("username"),
Environment.GetEnvironmentVariable("extension"),
Environment.GetEnvironmentVariable("password")
);
var r = await rc.Restapi().Account(accountId).Extension(extensionId).Presence().Put(presenceInfoResource);
// PROCESS RESPONSE
Once setting everything up for what I want to use, C# is giving an error that "PresenceInfoResource" does not exist inside RingCentral's SDK. After digging through, I've found that it really doesn't exist in the SDK as far as I can see? Is the documentation for this call out of date?
https://github.com/ringcentral/RingCentral.Net/tree/master/RingCentral.Net/Definitions
Here is what it should be if it's truly out of date:
// https://developers.ringcentral.com/my-account.html#/applications
// Find your credentials at the above url, set them as environment variables, or enter them below
// PATH PARAMETERS
string extensionId = "<ENTER VALUE>";
string accountId = "<ENTER VALUE>";
// POST BODY
PresenceInfoRequest presenceInfoRequest = new PresenceInfoRequest
{
userStatus = 'Offline',
dndStatus = 'TakeAllCalls',
message = "<ENTER VALUE>",
allowSeeMyPresence = true,
ringOnMonitoredCall = true,
pickUpCallsOnHold = true
};
RestClient rc = new RestClient(
Environment.GetEnvironmentVariable("clientId"),
Environment.GetEnvironmentVariable("clientSecret"),
false
);
await rc.Authorize(
Environment.GetEnvironmentVariable("username"),
Environment.GetEnvironmentVariable("extension"),
Environment.GetEnvironmentVariable("password")
);
var r = await rc.Restapi().Account(accountId).Extension(extensionId).Presence().Put(presenceInfoRequest);
// PROCESS RESPONSE