public void OurCallStatus(Call call, TCallStatus status)
        {
            try
            {
                if (call.VideoSendStatus == TCallVideoSendStatus.vssAvailable)
                {
                    call.StartVideoSend();
                }
            }
            catch
            {
            }


            // Always use try/catch with ANY Skype calls.
            try
            {
                if (status == TCallStatus.clsRinging)
                {
                    if (numCalls == 0)
                    {
                        call.Answer();


                        callID = call.Id;
                        numCalls++;
                    }

                    else if (numCalls == 1 && callID != call.Id)
                    {
                        try
                        {
                            this.BeginInvoke((Action)(() =>
                            {
                                call.Finish();
                            }));
                        }
                        catch (InvalidCastException e)
                        {
                        }
                    }
                }
                // If this call is from a SkypeIn/Online number, show which one.
                else if (call.Type == TCallType.cltIncomingP2P && status == TCallStatus.clsInProgress && call.Id == callID)
                {
                    selectedSkypeChatUser = call.PartnerHandle.ToString();

                    this.BeginInvoke((Action)(() =>
                    {
                        skype.SendMessage(selectedSkypeChatUser, Properties.Settings.Default.controllerMessage);
                    }));

                    chatUserSelected = true;

                    user_combobox.ResetText();
                    user_combobox.SelectedText = call.PartnerHandle.ToString();

                    if (!skypeUserTabs.Contains(new SkypeUserTab(call.PartnerHandle)))
                    {
                        user_combobox.Items.Add(call.PartnerHandle);
                        var newTabUser = new SkypeUserTab(call.PartnerHandle);
                        skypeUserTabs.Add(newTabUser);
                        tabUsers.Controls.Add(newTabUser.tabPage);
                    }
                }

                else if (status == TCallStatus.clsFinished && call.Id == callID)
                {
                    numCalls--;
                    callID = 0;
                }
            }
            catch (Exception e)
            {
            }
        }
        public void skype_MessageStatus(ChatMessage pMessage, TChatMessageStatus Status)
        {
            if (Status == TChatMessageStatus.cmsReceived)
            {
                if (pMessage.Body == "Available?")
                {
                    if (numCalls == 0)
                    {
                        pMessage.Chat.SendMessage("Yes");
                    }
                    else
                    {
                        pMessage.Chat.SendMessage("No");
                    }
                }
                else
                {
                    if (!skypeUserTabs.Contains(new SkypeUserTab(pMessage.Sender.Handle)))
                    {
                        user_combobox.Items.Add(pMessage.Sender.Handle);
                        var newTabUser = new SkypeUserTab(pMessage.Sender.Handle);
                        skypeUserTabs.Add(newTabUser);
                        tabUsers.Controls.Add(newTabUser.tabPage);
                        pMessage.Chat.SendMessage(Properties.Settings.Default.welcomeMessage);
                    }

                    if (pMessage.Body.Length == 1)
                    {
                        SkypeUserTab selected = skypeUserTabs.First(delegate(SkypeUserTab value) { return(value.skypeChatUser == pMessage.Sender.Handle); });
                        selected.textBox.Text += string.Format("{0} \r\n", pMessage.Body);

                        if (selected.skypeChatUser == selectedSkypeChatUser)
                        {
                            if (serialPort.IsOpen)
                            {
                                if (pMessage.Body.Contains('3'))
                                {
                                    controlState = 3;
                                }
                                else if (pMessage.Body.Contains('2'))
                                {
                                    controlState = 2;
                                }
                                else if (pMessage.Body.Contains('1'))
                                {
                                    controlState = 1;
                                }

                                serialPort.Write(pMessage.Body.ToCharArray(), 0, 1);
                                msg_listbox.Paste(string.Format("S: {0} \r\n", pMessage.Body));
                            }
                            else
                            {
                                msg_listbox.Text += string.Format("Failed to Send: {0} \r\n", pMessage.Body);
                                pMessage.Chat.SendMessage(Properties.Settings.Default.failedToSendMessage);
                            }
                        }
                        else
                        {
                            pMessage.Chat.SendMessage(Properties.Settings.Default.waitMessage);
                        }
                    }
                }
            }
        }