public static function createRegistrationFromRegisterMessage(Session $session, RegisterMessage $msg)
    {
        $registration = new self($session, $msg->getProcedureName());
        $options      = $msg->getOptions();

        if (isset($options->disclose_caller) && $options->disclose_caller === true) {
            $registration->setDiscloseCaller(true);
        }

        if (isset($options->invoke)) {
            $registration->setInvokeType($options->invoke);
        } else {
            if (isset($options->thruway_multiregister) && $options->thruway_multiregister === true) {
                $registration->setInvokeType(self::THRUWAY_REGISTRATION);
            } else {
                $registration->setInvokeType(self::SINGLE_REGISTRATION);
            }
        }

        return $registration;
    }