you can use the following code
Entity mEntity = (Entity)context.InputParameters["Target"];
var mPhoneCallDirectionCode = mEntity.GetAttributeValue<Boolean>("directioncode");
var mSender = mEntity.GetAttributeValue<EntityCollection>("from");
var mSubject = mEntity.GetAttributeValue<string>("subject");
var mPhoneNumber = mEntity.GetAttributeValue<string>("phonenumber");
var mContactTemp = mEntity.GetAttributeValue<EntityCollection>("to");
var mContact = mContactTemp.Entities[0].GetAttributeValue<EntityReference>("partyid");
Abe Saldana