static CMSessionParams fromSessionInit(
            final AbstractBody req,
            final AbstractBody resp)
    throws BOSHException {
        AttrAck aAck = AttrAck.createFromString(
                resp.getAttribute(Attributes.ACK));
        String rid = req.getAttribute(Attributes.RID);
        boolean acking = (aAck != null && aAck.getValue().equals(rid));

        IntegerAttr aDisableEmptyRequests = IntegerAttr.createFromString(
                resp.getAttribute(Attributes.DISABLE_EMPTY_MESSAGES, "0"), 0);
        boolean disableEmptyRequests = (aDisableEmptyRequests.getValue() != 0);

        return new CMSessionParams(
            AttrSessionID.createFromString(getRequiredAttribute(resp, Attributes.SID)),
            AttrWait.createFromString(getRequiredAttribute(resp, Attributes.WAIT)),
            AttrVersion.createFromString(resp.getAttribute(Attributes.VER)),
            AttrPolling.createFromString(resp.getAttribute(Attributes.POLLING)),
            AttrInactivity.createFromString(resp.getAttribute(Attributes.INACTIVITY)),
            AttrRequests.createFromString(resp.getAttribute(Attributes.REQUESTS)),
            // hold is only a SHOULD, and the spec doesn't specify what to do if it's omitted.
            AttrHold.createFromString(resp.getAttribute(Attributes.HOLD, "1")),
            AttrAccept.createFromString(resp.getAttribute(Attributes.ACCEPT)),
            AttrMaxPause.createFromString(resp.getAttribute(Attributes.MAXPAUSE)),
            aAck,
            AttrCharsets.createFromString(resp.getAttribute(Attributes.CHARSETS)),
            acking,
            disableEmptyRequests
            );
    }