Ejemplo n.º 1
0
        static public agentType Convert(Agent agent, ConversationParticipant participant)
        {
            agentType agentT = new agentType();

            if (null != participant)
            {
                agentT.displayname = participant.DisplayName;
                agentT.uri         = participant.Uri;

                int numberOfActiveModalities = participant.GetActiveMediaTypes().Count;

                if (numberOfActiveModalities != 0)
                {
                    agentT.mediatypes = new string[numberOfActiveModalities];

                    int i = 0;
                    foreach (String mediaType in participant.GetActiveMediaTypes())
                    {
                        agentT.mediatypes[i++] = mediaType;
                    }
                }
            }
            else
            {
                agentT.displayname = new SipUriParser(agent.SignInAddress).User;
                agentT.uri         = agent.SignInAddress;
            }
            KeyValuePair <DateTime, bool> allocated = agent.GetWhetherAllocated();

            agentT.status            = allocated.Value ? "Active" : "Idle";
            agentT.statuschangedtime = allocated.Key.Ticks.ToString();

            return(agentT);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Retrieves the properties for the specified Conversation Participant.
        /// </summary>
        /// <param name="currentParticipant">The participant who's properties
        /// are to be retrieved.</param>
        /// <returns>A string of the retrieved properties.</returns>
        private string RetrieveParticipantProperties(ConversationParticipant currentParticipant)
        {
            StringBuilder participantPropertiesSB = new StringBuilder();

            participantPropertiesSB.AppendLine("Properties for the participant with Uri = "
                                               + currentParticipant.Uri);
            if (0 < currentParticipant.GetActiveMediaTypes().Count)
            {
                participantPropertiesSB.Append("\tActiveMediaTypes = ");
                Collection <string> activeMediaTypes = currentParticipant.GetActiveMediaTypes();
                foreach (var activeMediaType in activeMediaTypes)
                {
                    participantPropertiesSB.Append(string.Format("'{0}' ", activeMediaType));
                }
                participantPropertiesSB.AppendLine();
            }

            if (!string.IsNullOrEmpty(currentParticipant.DisplayName))
            {
                participantPropertiesSB.AppendLine("\t DisplayName = " + currentParticipant.DisplayName);
            }

            if (!string.IsNullOrEmpty(currentParticipant.OtherPhoneUri))
            {
                participantPropertiesSB.AppendLine("\t OtherPhoneUri = " + currentParticipant.OtherPhoneUri);
            }

            if (!string.IsNullOrEmpty(currentParticipant.PhoneUri))
            {
                participantPropertiesSB.AppendLine("\t PhoneUri = " + currentParticipant.PhoneUri);
            }
            participantPropertiesSB.AppendLine("\t Role = " + currentParticipant.Role);
            participantPropertiesSB.AppendLine("\t RosterVisibility = "
                                               + currentParticipant.RosterVisibility);
            if (!string.IsNullOrEmpty(currentParticipant.UserAtHost))
            {
                participantPropertiesSB.AppendLine("\t UserAtHost = " + currentParticipant.UserAtHost);
            }
            return(participantPropertiesSB.ToString());
        }