public function getInvocationMessage()
{
if ($this->invocationMessage === null) {
// try to create one
if ($this->registration === null) {
throw new \Exception("You must set the registration prior to calling getInvocationMessage");
}
if ($this->callMessage === null) {
throw new \Exception("You must set the CallMessage prior to calling getInvocationMessage");
}
$invocationMessage = InvocationMessage::createMessageFrom($this->getCallMessage(), $this->getRegistration());
$invocationMessage->setRequestId($this->getInvocationRequestId());
$details = [];
if ($this->getRegistration()->getDiscloseCaller() === true && $this->getCallerSession()->getAuthenticationDetails()) {
$authenticationDetails = $this->getCallerSession()->getAuthenticationDetails();
$details = ["caller" => $this->getCallerSession()->getSessionId(), "authid" => $authenticationDetails->getAuthId(), "authrole" => $authenticationDetails->getAuthRole(), "authroles" => $authenticationDetails->getAuthRoles(), "authmethod" => $authenticationDetails->getAuthMethod()];
if ($authenticationDetails->getAuthExtra() !== null) {
$details["_thruway_authextra"] = $authenticationDetails->getAuthExtra();
}
}
// TODO: check to see if callee supports progressive call
$callOptions = $this->getCallMessage()->getOptions();
$isProgressive = false;
if (is_object($callOptions) && isset($callOptions->receive_progress) && $callOptions->receive_progress) {
$details = array_merge($details, ["receive_progress" => true]);
$isProgressive = true;
}
// if nothing was added to details - change ot stdClass so it will serialize correctly
if (count($details) == 0) {
$details = new \stdClass();
}
$invocationMessage->setDetails($details);
$this->setIsProgressive($isProgressive);
$this->setInvocationMessage($invocationMessage);
}
return $this->invocationMessage;
}