One of the fields of the "ccxml.loaded" event is "parent":
"The identifier of the session which issued the createccxml
to start this document. If this document was started directly by the
CCXML platform, the identifier is 0."
The session variable "session.parentid" has a different definition:
"In the case the current session has no parent, the value of the
variable will be ECMAScript undefined."
I think that these definitions for the case when the session has no parent
should be equal: either 0 in both cases, or undefined in both cases.