예제 #1
0
        public string Pickup()
        {
            try
            {
                for (int i = 0; i < this.lyncClient.ConversationManager.Conversations.Count; i++)
                {
                    mslm.Conversation.Conversation c = this.lyncClient.ConversationManager.Conversations[i];
                    if (c != null)
                    {
                        Console.WriteLine("state: {0}".xFormat(c.State.ToString()));
                        switch (c.State)
                        {
                        case mslm.Conversation.ConversationState.Inactive:
                            c.AddParticipant(c.SelfParticipant.Contact);
                            break;

                        case mslm.Conversation.ConversationState.Active:
                            c.AddParticipant(c.SelfParticipant.Contact);
                            //c.AddParticipant(c.SelfParticipant.Contact.CreateContactEndpoint())
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
            catch (Exception x)
            {
                /* {"Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"} */
                Debug.WriteLine(x.ToString());
            }

            return("");
        }
예제 #2
0
 public void Dial(string uri)
 {
     this.UpdateStatusFile(0, "n/m", "Dial", uri);
     Console.WriteLine("\tdialing: {0}".xFormat(uri));
     /* switch modes */
     this.lyncClient.ConversationManager.ConversationAdded -= this.IncomingConversationAdded;
     this.lyncClient.ConversationManager.ConversationAdded += this.OutgoingConversationAdded;
     mslm.Conversation.Conversation conv = this.lyncClient.ConversationManager.AddConversation();
 }
예제 #3
0
        private void ProcessConversation(mslm.Conversation.Conversation c)
        {
            mslm.Conversation.Participant p = c.Participants.Single(i => !i.IsSelf);
            this.currentIcomingUri = p.Contact.Uri;
            Console.WriteLine("incoming uri: {0}".xFormat(this.currentIcomingUri));
            string inuri  = this.IncomingUri(c.Participants);
            string guid   = Guid.NewGuid().ToString();
            string telnum = this.currentIcomingUri.Replace("tel:", "");

            this.FireEvent("Ringing", "Inbound", telnum, this.tenfoldExt, guid);
        }
예제 #4
0
        public string Hangup(string num = null)
        {
            num = num ?? "CurrentConversation";
            this.UpdateStatusFile(0, "n/m", "Hangup", num);
            /* wierd it seems there are multiple convs */
            for (int i = 0; i < this.lyncClient.ConversationManager.Conversations.Count; i++)
            {
                mslm.Conversation.Conversation c = this.lyncClient.ConversationManager.Conversations[i];
                if (c != null)
                {
                    c.End();
                }
            }

            num = num ?? this.currentIcomingUri;
            return(this.FireEvent("Hangup", "Inbound", num, this.tenfoldExt, Guid.NewGuid().ToString()));
        }
예제 #5
0
        private void Conversation_PropertyChanged(object sender,
                                                  mslm.Conversation.ConversationPropertyChangedEventArgs e)
        {
            Console.WriteLine("\n--- Conversation_PropertyChanged ---");
            mslm.Conversation.Conversation c = (mslm.Conversation.Conversation)sender;
            string msg = "p: {0}  /  v: {1} / s: {2}".xFormat(e.Property.ToString(), e.Value?.ToString(), c.State.ToString());

            this.eventBag.Add(msg);
            Console.WriteLine(msg);
            /* - - */
            /* inviter is self here */
            if (e.Property.ToString().Contains("Inviter"))
            {
                mslm.Contact contact = (e.Value as mslm.Contact);
                Console.WriteLine(" -> InviterUri: {0}".xFormat(contact.Uri));
            }
        }
예제 #6
0
 private void SetUserNameUserSIP(mslm.Conversation.Conversation c)
 {
     mslm.Conversation.ParticipantProperty name = mslm.Conversation.ParticipantProperty.Name;
     this.currentUserName = (string)c.SelfParticipant.Properties[name];
     this.currentUserSIP  = c.SelfParticipant.Contact.Uri;
 }