GET | /portal/active-sessions |
---|
<?php namespace dtos;
use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};
class EntityInfo implements JsonSerializable
{
public function __construct(
/** @description The ID of the object */
// @ApiMember(Description="The ID of the object")
/** @var string|null */
public ?string $id=null,
/** @description The date the object was created */
// @ApiMember(Description="The date the object was created")
/** @var string|null */
public ?string $dateCreated=null,
/** @description The date the object was last modified */
// @ApiMember(Description="The date the object was last modified")
/** @var string|null */
public ?string $dateLastModified=null,
/** @description The user that created this object */
// @ApiMember(Description="The user that created this object")
/** @var string|null */
public ?string $createdBy=null,
/** @description The user that last modified this object */
// @ApiMember(Description="The user that last modified this object")
/** @var string|null */
public ?string $lastModifiedBy=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['dateCreated'])) $this->dateCreated = $o['dateCreated'];
if (isset($o['dateLastModified'])) $this->dateLastModified = $o['dateLastModified'];
if (isset($o['createdBy'])) $this->createdBy = $o['createdBy'];
if (isset($o['lastModifiedBy'])) $this->lastModifiedBy = $o['lastModifiedBy'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->dateCreated)) $o['dateCreated'] = $this->dateCreated;
if (isset($this->dateLastModified)) $o['dateLastModified'] = $this->dateLastModified;
if (isset($this->createdBy)) $o['createdBy'] = $this->createdBy;
if (isset($this->lastModifiedBy)) $o['lastModifiedBy'] = $this->lastModifiedBy;
return empty($o) ? new class(){} : $o;
}
}
enum SessionDialState : string
{
case None = 'None';
case Active = 'Active';
}
enum SessionCallState : string
{
case Disconnected = 'Disconnected';
case Ringing = 'Ringing';
case Connected = 'Connected';
case Hold = 'Hold';
case Passive = 'Passive';
}
enum SessionQueueStates : string
{
case None = 'None';
case Queued = 'Queued';
case Ringing = 'Ringing';
case Connected = 'Connected';
case Hold = 'Hold';
case Disconnected = 'Disconnected';
}
class CustomerBreadcrumb implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $id=null,
/** @var string|null */
public ?string $name=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['name'])) $this->name = $o['name'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->name)) $o['name'] = $this->name;
return empty($o) ? new class(){} : $o;
}
}
enum FlowChannels : string
{
case Voice = 'Voice';
case Chat = 'Chat';
case Fax = 'Fax';
}
enum SessionHoldReasons : string
{
case None = 'None';
case Transferring = 'Transferring';
}
class SessionLogInfo implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $date=null,
/** @var string|null */
public ?string $message=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['date'])) $this->date = $o['date'];
if (isset($o['message'])) $this->message = $o['message'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->date)) $o['date'] = $this->date;
if (isset($this->message)) $o['message'] = $this->message;
return empty($o) ? new class(){} : $o;
}
}
enum SessionMemberCallState : string
{
case None = 'None';
case Ringing = 'Ringing';
case Connected = 'Connected';
case Hold = 'Hold';
}
enum SessionMemberRoles : string
{
case None = 'None';
case Caller = 'Caller';
case Agent = 'Agent';
case Transfer = 'Transfer';
}
class SessionMemberInfo implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $identity=null,
/** @var string|null */
public ?string $endpointId=null,
/** @var string|null */
public ?string $displayName=null,
/** @var bool|null */
public ?bool $isOriginalMember=null,
/** @var string|null */
public ?string $avatarUrl=null,
/** @var array<string,string>|null */
public ?array $applicationData=null,
/** @var SessionMemberCallState|null */
public ?SessionMemberCallState $callState=null,
/** @var SessionMemberRoles|null */
public ?SessionMemberRoles $role=null,
/** @var string|null */
public ?string $callSid=null,
/** @var bool|null */
public ?bool $muted=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['identity'])) $this->identity = $o['identity'];
if (isset($o['endpointId'])) $this->endpointId = $o['endpointId'];
if (isset($o['displayName'])) $this->displayName = $o['displayName'];
if (isset($o['isOriginalMember'])) $this->isOriginalMember = $o['isOriginalMember'];
if (isset($o['avatarUrl'])) $this->avatarUrl = $o['avatarUrl'];
if (isset($o['applicationData'])) $this->applicationData = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['applicationData']);
if (isset($o['callState'])) $this->callState = JsonConverters::from('SessionMemberCallState', $o['callState']);
if (isset($o['role'])) $this->role = JsonConverters::from('SessionMemberRoles', $o['role']);
if (isset($o['callSid'])) $this->callSid = $o['callSid'];
if (isset($o['muted'])) $this->muted = $o['muted'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->identity)) $o['identity'] = $this->identity;
if (isset($this->endpointId)) $o['endpointId'] = $this->endpointId;
if (isset($this->displayName)) $o['displayName'] = $this->displayName;
if (isset($this->isOriginalMember)) $o['isOriginalMember'] = $this->isOriginalMember;
if (isset($this->avatarUrl)) $o['avatarUrl'] = $this->avatarUrl;
if (isset($this->applicationData)) $o['applicationData'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->applicationData);
if (isset($this->callState)) $o['callState'] = JsonConverters::to('SessionMemberCallState', $this->callState);
if (isset($this->role)) $o['role'] = JsonConverters::to('SessionMemberRoles', $this->role);
if (isset($this->callSid)) $o['callSid'] = $this->callSid;
if (isset($this->muted)) $o['muted'] = $this->muted;
return empty($o) ? new class(){} : $o;
}
}
enum SessionDirections : string
{
case Incoming = 'Incoming';
case Outgoing = 'Outgoing';
}
class SessionInfo extends EntityInfo implements JsonSerializable
{
/**
* @param string|null $id
* @param string|null $dateCreated
* @param string|null $dateLastModified
* @param string|null $createdBy
* @param string|null $lastModifiedBy
*/
public function __construct(
?string $id=null,
?string $dateCreated=null,
?string $dateLastModified=null,
?string $createdBy=null,
?string $lastModifiedBy=null,
/** @description The state of the session */
// @ApiMember(Description="The state of the session")
/** @var SessionDialState|null */
public ?SessionDialState $dialState=null,
/** @description The call state of the session */
// @ApiMember(Description="The call state of the session")
/** @var SessionCallState|null */
public ?SessionCallState $callState=null,
/** @description The queue state of the session */
// @ApiMember(Description="The queue state of the session")
/** @var SessionQueueStates|null */
public ?SessionQueueStates $queueState=null,
/** @description The ID of the account associated with the flow */
// @ApiMember(Description="The ID of the account associated with the flow")
/** @var string|null */
public ?string $accountId=null,
/** @description The name of the account associated with the session */
// @ApiMember(Description="The name of the account associated with the session")
/** @var string|null */
public ?string $accountName=null,
/** @description The ID of the customer this session is associated with */
// @ApiMember(Description="The ID of the customer this session is associated with")
/** @var string|null */
public ?string $customerId=null,
/** @description The customer breadcrumb this session is associated with */
// @ApiMember(Description="The customer breadcrumb this session is associated with")
/** @var array<CustomerBreadcrumb>|null */
public ?array $customerBreadcrumb=null,
/** @description The name of the customer this session is associated with */
// @ApiMember(Description="The name of the customer this session is associated with")
/** @var string|null */
public ?string $customerName=null,
/** @description The ID of the endpoint associated with this session */
// @ApiMember(Description="The ID of the endpoint associated with this session")
/** @var string|null */
public ?string $endpointId=null,
/** @description The name of the endpoint associated with this session */
// @ApiMember(Description="The name of the endpoint associated with this session")
/** @var string|null */
public ?string $endpointName=null,
/** @description The date the call completed */
// @ApiMember(Description="The date the call completed")
/** @var string|null */
public ?string $dateCompleted=null,
/** @description The destination of the session (e.g. what was entered into the Dial box) */
// @ApiMember(Description="The destination of the session (e.g. what was entered into the Dial box)")
/** @var string|null */
public ?string $destination=null,
/** @description The to address if any */
// @ApiMember(Description="The to address if any")
/** @var string|null */
public ?string $toAddress=null,
/** @description The from address if any */
// @ApiMember(Description="The from address if any")
/** @var string|null */
public ?string $fromAddress=null,
/** @description The from name if any */
// @ApiMember(Description="The from name if any")
/** @var string|null */
public ?string $fromName=null,
/** @description Answered by name (if any) */
// @ApiMember(Description="Answered by name (if any)")
/** @var string|null */
public ?string $answeredByName=null,
/** @description The ID of the queue member assigned to this call */
// @ApiMember(Description="The ID of the queue member assigned to this call")
/** @var string|null */
public ?string $queueMemberId=null,
/** @description The flow channel */
// @ApiMember(Description="The flow channel")
/** @var FlowChannels|null */
public ?FlowChannels $channel=null,
/** @description Has the session ended */
// @ApiMember(Description="Has the session ended")
/** @var bool|null */
public ?bool $ended=null,
/** @description The outcome of the call */
// @ApiMember(Description="The outcome of the call")
/** @var string|null */
public ?string $outcome=null,
/** @description The twilio Call SID of this session */
// @ApiMember(Description="The twilio Call SID of this session")
/** @var string|null */
public ?string $callSid=null,
/** @description Any console data for this session */
// @ApiMember(Description="Any console data for this session")
/** @var string|null */
public ?string $consoleData=null,
/** @description The name of the hold queue for this call */
// @ApiMember(Description="The name of the hold queue for this call")
/** @var string|null */
public ?string $holdQueueName=null,
/** @description The user ID who put this call on hold */
// @ApiMember(Description="The user ID who put this call on hold")
/** @var string|null */
public ?string $heldByUserId=null,
/** @description The reason for the hold */
// @ApiMember(Description="The reason for the hold")
/** @var SessionHoldReasons|null */
public ?SessionHoldReasons $holdReason=null,
/** @description The SID of the conference if in a conference call */
// @ApiMember(Description="The SID of the conference if in a conference call")
/** @var string|null */
public ?string $conferenceSid=null,
/** @description The display name for this session */
// @ApiMember(Description="The display name for this session")
/** @var string|null */
public ?string $displayName=null,
/** @description The log entries for this session */
// @ApiMember(Description="The log entries for this session")
/** @var array<SessionLogInfo>|null */
public ?array $log=null,
/** @description The members of this session */
// @ApiMember(Description="The members of this session")
/** @var array<SessionMemberInfo>|null */
public ?array $members=null,
/** @description The callback number (typically used for SIP to User calls) */
// @ApiMember(Description="The callback number (typically used for SIP to User calls)")
/** @var string|null */
public ?string $callbackNumber=null,
/** @description The ID of the endpoint that answered */
// @ApiMember(Description="The ID of the endpoint that answered")
/** @var string|null */
public ?string $answeredById=null,
/** @description Is this session incoming or outgoing? */
// @ApiMember(Description="Is this session incoming or outgoing?")
/** @var SessionDirections|null */
public ?SessionDirections $direction=null,
/** @description The phone number that this session is coming from (used with SMS chats) */
// @ApiMember(Description="The phone number that this session is coming from (used with SMS chats)")
/** @var string|null */
public ?string $fromPhoneNumber=null,
/** @description The Call SID of the most recently added conference participant */
// @ApiMember(Description="The Call SID of the most recently added conference participant")
/** @var string|null */
public ?string $mostRecentParticipantCallSid=null,
/** @description Was this session missed? */
// @ApiMember(Description="Was this session missed?")
/** @var bool|null */
public ?bool $wasMissed=null,
/** @description The ring queue that the call is currently in */
// @ApiMember(Description="The ring queue that the call is currently in")
/** @var string|null */
public ?string $ringQueueId=null
) {
parent::__construct($id,$dateCreated,$dateLastModified,$createdBy,$lastModifiedBy);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['dialState'])) $this->dialState = JsonConverters::from('SessionDialState', $o['dialState']);
if (isset($o['callState'])) $this->callState = JsonConverters::from('SessionCallState', $o['callState']);
if (isset($o['queueState'])) $this->queueState = JsonConverters::from('SessionQueueStates', $o['queueState']);
if (isset($o['accountId'])) $this->accountId = $o['accountId'];
if (isset($o['accountName'])) $this->accountName = $o['accountName'];
if (isset($o['customerId'])) $this->customerId = $o['customerId'];
if (isset($o['customerBreadcrumb'])) $this->customerBreadcrumb = JsonConverters::fromArray('CustomerBreadcrumb', $o['customerBreadcrumb']);
if (isset($o['customerName'])) $this->customerName = $o['customerName'];
if (isset($o['endpointId'])) $this->endpointId = $o['endpointId'];
if (isset($o['endpointName'])) $this->endpointName = $o['endpointName'];
if (isset($o['dateCompleted'])) $this->dateCompleted = $o['dateCompleted'];
if (isset($o['destination'])) $this->destination = $o['destination'];
if (isset($o['toAddress'])) $this->toAddress = $o['toAddress'];
if (isset($o['fromAddress'])) $this->fromAddress = $o['fromAddress'];
if (isset($o['fromName'])) $this->fromName = $o['fromName'];
if (isset($o['answeredByName'])) $this->answeredByName = $o['answeredByName'];
if (isset($o['queueMemberId'])) $this->queueMemberId = $o['queueMemberId'];
if (isset($o['channel'])) $this->channel = JsonConverters::from('FlowChannels', $o['channel']);
if (isset($o['ended'])) $this->ended = $o['ended'];
if (isset($o['outcome'])) $this->outcome = $o['outcome'];
if (isset($o['callSid'])) $this->callSid = $o['callSid'];
if (isset($o['consoleData'])) $this->consoleData = $o['consoleData'];
if (isset($o['holdQueueName'])) $this->holdQueueName = $o['holdQueueName'];
if (isset($o['heldByUserId'])) $this->heldByUserId = $o['heldByUserId'];
if (isset($o['holdReason'])) $this->holdReason = JsonConverters::from('SessionHoldReasons', $o['holdReason']);
if (isset($o['conferenceSid'])) $this->conferenceSid = $o['conferenceSid'];
if (isset($o['displayName'])) $this->displayName = $o['displayName'];
if (isset($o['log'])) $this->log = JsonConverters::fromArray('SessionLogInfo', $o['log']);
if (isset($o['members'])) $this->members = JsonConverters::fromArray('SessionMemberInfo', $o['members']);
if (isset($o['callbackNumber'])) $this->callbackNumber = $o['callbackNumber'];
if (isset($o['answeredById'])) $this->answeredById = $o['answeredById'];
if (isset($o['direction'])) $this->direction = JsonConverters::from('SessionDirections', $o['direction']);
if (isset($o['fromPhoneNumber'])) $this->fromPhoneNumber = $o['fromPhoneNumber'];
if (isset($o['mostRecentParticipantCallSid'])) $this->mostRecentParticipantCallSid = $o['mostRecentParticipantCallSid'];
if (isset($o['wasMissed'])) $this->wasMissed = $o['wasMissed'];
if (isset($o['ringQueueId'])) $this->ringQueueId = $o['ringQueueId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->dialState)) $o['dialState'] = JsonConverters::to('SessionDialState', $this->dialState);
if (isset($this->callState)) $o['callState'] = JsonConverters::to('SessionCallState', $this->callState);
if (isset($this->queueState)) $o['queueState'] = JsonConverters::to('SessionQueueStates', $this->queueState);
if (isset($this->accountId)) $o['accountId'] = $this->accountId;
if (isset($this->accountName)) $o['accountName'] = $this->accountName;
if (isset($this->customerId)) $o['customerId'] = $this->customerId;
if (isset($this->customerBreadcrumb)) $o['customerBreadcrumb'] = JsonConverters::toArray('CustomerBreadcrumb', $this->customerBreadcrumb);
if (isset($this->customerName)) $o['customerName'] = $this->customerName;
if (isset($this->endpointId)) $o['endpointId'] = $this->endpointId;
if (isset($this->endpointName)) $o['endpointName'] = $this->endpointName;
if (isset($this->dateCompleted)) $o['dateCompleted'] = $this->dateCompleted;
if (isset($this->destination)) $o['destination'] = $this->destination;
if (isset($this->toAddress)) $o['toAddress'] = $this->toAddress;
if (isset($this->fromAddress)) $o['fromAddress'] = $this->fromAddress;
if (isset($this->fromName)) $o['fromName'] = $this->fromName;
if (isset($this->answeredByName)) $o['answeredByName'] = $this->answeredByName;
if (isset($this->queueMemberId)) $o['queueMemberId'] = $this->queueMemberId;
if (isset($this->channel)) $o['channel'] = JsonConverters::to('FlowChannels', $this->channel);
if (isset($this->ended)) $o['ended'] = $this->ended;
if (isset($this->outcome)) $o['outcome'] = $this->outcome;
if (isset($this->callSid)) $o['callSid'] = $this->callSid;
if (isset($this->consoleData)) $o['consoleData'] = $this->consoleData;
if (isset($this->holdQueueName)) $o['holdQueueName'] = $this->holdQueueName;
if (isset($this->heldByUserId)) $o['heldByUserId'] = $this->heldByUserId;
if (isset($this->holdReason)) $o['holdReason'] = JsonConverters::to('SessionHoldReasons', $this->holdReason);
if (isset($this->conferenceSid)) $o['conferenceSid'] = $this->conferenceSid;
if (isset($this->displayName)) $o['displayName'] = $this->displayName;
if (isset($this->log)) $o['log'] = JsonConverters::toArray('SessionLogInfo', $this->log);
if (isset($this->members)) $o['members'] = JsonConverters::toArray('SessionMemberInfo', $this->members);
if (isset($this->callbackNumber)) $o['callbackNumber'] = $this->callbackNumber;
if (isset($this->answeredById)) $o['answeredById'] = $this->answeredById;
if (isset($this->direction)) $o['direction'] = JsonConverters::to('SessionDirections', $this->direction);
if (isset($this->fromPhoneNumber)) $o['fromPhoneNumber'] = $this->fromPhoneNumber;
if (isset($this->mostRecentParticipantCallSid)) $o['mostRecentParticipantCallSid'] = $this->mostRecentParticipantCallSid;
if (isset($this->wasMissed)) $o['wasMissed'] = $this->wasMissed;
if (isset($this->ringQueueId)) $o['ringQueueId'] = $this->ringQueueId;
return empty($o) ? new class(){} : $o;
}
}
class AppGetActiveSessionsResult implements JsonSerializable
{
public function __construct(
/** @var array<SessionInfo>|null */
public ?array $sessions=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['sessions'])) $this->sessions = JsonConverters::fromArray('SessionInfo', $o['sessions']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->sessions)) $o['sessions'] = JsonConverters::toArray('SessionInfo', $this->sessions);
return empty($o) ? new class(){} : $o;
}
}
class AppGetActiveSessions implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $accountId=null,
/** @var string|null */
public ?string $customerId=null,
/** @var string|null */
public ?string $startDate=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['accountId'])) $this->accountId = $o['accountId'];
if (isset($o['customerId'])) $this->customerId = $o['customerId'];
if (isset($o['startDate'])) $this->startDate = $o['startDate'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->accountId)) $o['accountId'] = $this->accountId;
if (isset($this->customerId)) $o['customerId'] = $this->customerId;
if (isset($this->startDate)) $o['startDate'] = $this->startDate;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /portal/active-sessions HTTP/1.1 Host: team.evovoice.io Accept: text/jsv
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { sessions: [ { dialState: None, callState: Disconnected, queueState: None, accountId: String, accountName: String, customerId: String, customerBreadcrumb: [ { id: String, name: String } ], customerName: String, endpointId: String, endpointName: String, dateCompleted: String, destination: String, toAddress: String, fromAddress: String, fromName: String, answeredByName: String, queueMemberId: String, channel: Voice, ended: False, outcome: String, callSid: String, consoleData: String, holdQueueName: String, heldByUserId: String, holdReason: None, conferenceSid: String, displayName: String, log: [ { date: String, message: String } ], members: [ { identity: String, endpointId: String, displayName: String, isOriginalMember: False, avatarUrl: String, applicationData: { String: String }, callState: None, role: None, callSid: String, muted: False } ], callbackNumber: String, answeredById: String, direction: Incoming, fromPhoneNumber: String, mostRecentParticipantCallSid: String, wasMissed: False, ringQueueId: String, id: String, dateCreated: String, dateLastModified: String, createdBy: String, lastModifiedBy: String } ] }