Пример #1
0
        bool tryCall(string name, bool isVideo)
        {
            if (!startSkype())
            {
                return(false);
            }
            Call call = skype.PlaceCall(name);

            do
            {
                if (call.Status == TCallStatus.clsBusy ||
                    call.Status == TCallStatus.clsCancelled ||
                    call.Status == TCallStatus.clsFailed ||
                    call.Status == TCallStatus.clsMissed ||
                    call.Status == TCallStatus.clsRefused)
                {
                    return(false);
                }

                Thread.Sleep(10);
            } while (call.Status != TCallStatus.clsInProgress);

            if (isVideo == true)
            {
                call.StartVideoSend();
            }

            return(true);
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            SKYPE4COMLib.Skype skype = new Skype();

            try
            {
                skype.Attach();
                var usr = skype.CurrentUser;
                skype.CallStatus += Skype_CallStatus;

                var currentCall = skype.PlaceCall("echo123");//Indtast caller id her (har indtastet skypes ekko service for test)
                label1.Text = "Started: " + currentCall.Timestamp.ToString() + "";
                label2.Text = "Ended: " + currentCall.Timestamp.ToString() + "";
                Thread.Sleep(4000);

                currentCall.Finish();
                label2.Text = "Ended: " + DateTime.Now.ToString() + "";

                label3.Text = "Duration: " + (DateTime.Now - currentCall.Timestamp).TotalSeconds;
            }
            catch (COMException come)
            {
                throw;
            }
        }
Пример #3
0
        static void Main(string[] args)
        {
            Skype _skype = new Skype();

            try
            {
                _skype.Attach(5, false);
                Console.Write("Connectie succesvol");
                if (!_skype.Client.IsRunning)
                {
                    _skype.Client.Start(false, true);
                }

                System.Threading.Thread.Sleep(5000);

                if (_skype.Client.IsRunning == true)
                {
                    string line;

                    string path = string.Join(Directory.GetCurrentDirectory(), "./config.txt");

                    StreamReader file =
                        new StreamReader(path);

                    line = file.ReadLine();

                    Call call = _skype.PlaceCall(line);
                }
            }
            catch
            {
                Console.Write("Connectie onsuccesvol");
            }
        }
Пример #4
0
        private void CallSignalThread()
        {
            string tel = GetNumberPhone();//получим номер телефона

            while (true)
            {
                if (Stopclick == true)
                {
                    break;
                }
                NewJabberMessageWindowSignal.WaitOne(); //ждем сигнала от потока мониторинга нового сообщения .
                while (true)
                {
                    if (Stopclick == true)
                    {
                        break;
                    }
                    Call call = _skype.PlaceCall(tel); //Вызываем по телефону (на счету должны быть деньги)
                    if (call.Status == TCallStatus.clsRefused)
                    {
                        break;
                    }
                    if (call.Status == TCallStatus.clsBusy)
                    {
                        break;
                    }
                    if (call.Status == TCallStatus.clsRouting)
                    {
                        break;
                    }
                    GlobalStopEvent.WaitOne(20000);
                }
            }
        }
Пример #5
0
        public Result Call(string partialUsername)
        {
            UserCollection users = SearchUser(partialUsername);

            if (users == null)
            {
                return(Result.Failed);
            }
            if (users.Count == 0)
            {
                return(Result.NoUserFound);
            }
            if (users.Count > 1)
            {
                return(Result.MoreThanOneUser);
            }

            try
            {
                Call result = new Call();
                foreach (User user in users)
                {
                    result = skype.PlaceCall(user.Handle);
                }

                while (result.Status != TCallStatus.clsInProgress)
                {
                    switch (result.Status)
                    {
                    case TCallStatus.clsBusy:
                        return(Result.Busy);

                    case TCallStatus.clsCancelled:
                        return(Result.Canceled);

                    case TCallStatus.clsFailed:
                        return(Result.Failed);

                    case TCallStatus.clsFinished:
                        return(Result.Finished);

                    case TCallStatus.clsRefused:
                        return(Result.Refused);
                    }
                }
                return(Result.Successful);
            }
            catch
            {
                return(Result.Failed);
            }
        }
Пример #6
0
        private string ProcessCommand(string str)
        {
            string result;

            switch (str)
            {
            case "hello":
                result = "Hello!";
                break;

            case "call":
                result = "Calling now!" +
                         skype.PlaceCall(textBox2.Text);
                break;

            default:
                result = "Sorry, I do not recognize your command. Yu dun goofd";
                break;
            }

            return(result);
        }
Пример #7
0
 void call()
 {
     try
     {
         Console.WriteLine("Placing Call");
         if (callers[0] != "")
         {
             oSkype.PlaceCall(callers[0], callers[1], callers[2], callers[3]);
         }
         Console.WriteLine("Call Placed");
     }
     catch (Exception e)
     {
         Console.WriteLine("Exception during call: " + e.Message);
         Console.WriteLine(callers[0] + " " + callers[1] + " " + callers[2] + " " + callers[3]);
         callers.Clear();
         Connect("", "", "");
         pop3.Delete(0);
         pop3.Close();
         CheckMail.Enabled = true;
     }
 }
Пример #8
0
 private void CallSpam()
 {
     call = skype.PlaceCall(cbAutoCallBack.Text, "", "", "");
     timer3.Start();
     id = call.Id;
 }
Пример #9
0
        private int StartVideoCall(string username, Skype skype)
        {
            TUserStatus prevUserStatus = TUserStatus.cusUnknown;
            Call CurrentCall = null;
            try
            {
                CurrentCall = skype.PlaceCall(username);
                prevUserStatus = skype.CurrentUserStatus;
            }

            catch (System.Runtime.InteropServices.COMException e)
            {
                if (String.Compare(e.Message.Trim(), "Not online") == 0)
                {
                    MessageBox.Show("Error: Not online");
                }
                else
                {
                    MessageBox.Show("Unhandled Error: " + e.Message.Trim());
                }

                return 0;
            }

            System.Diagnostics.Stopwatch CallTimer = new System.Diagnostics.Stopwatch();

            do
            {
                System.Threading.Thread.Sleep(1000);
            } while (CurrentCall.Status != TCallStatus.clsInProgress && CheckStatus(CurrentCall));

            if (CheckStatus(CurrentCall))
            {
                try
                {
                    CallTimer.Start();
                    CurrentCall.StartVideoSend();
                    skype.CurrentUserStatus = TUserStatus.cusDoNotDisturb;
                }

                catch (System.Runtime.InteropServices.COMException e)
                {
                    if (String.Compare(e.Message.Trim(), "CALL: Action failed") == 0)
                    {
                        if (DEBUG)
                        {
                            MessageBox.Show("Error: Video not supported");
                        }
                    }
                }
            }

            do
            {
                System.Threading.Thread.Sleep(1000);
            } while (CheckStatus(CurrentCall));

            CallTimer.Stop();
            skype.CurrentUserStatus = prevUserStatus;

            return CallTimer.Elapsed.Minutes;
        }
Пример #10
0
 private void startToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SkypeAPI.PlaceCall(listView1.FocusedItem.SubItems[1].Text, "", "", "");
 }
Пример #11
0
        static void Main(string[] args)
        {
            Boolean confirm = true;
            Console.ForegroundColor = ConsoleColor.Green;
            Console.Title = "SkypeChat";
            Skype skype = new Skype();
            if (!skype.Client.IsRunning)
            {
                skype.Client.Start(true, true);
            }
            // Utilisation de la version 7 de Skype
            skype.Attach(7, false);
            write("Conversation ou discussion privée? [C/D]");
            string choix = Console.ReadLine();
            choix = choix.ToUpper();
            switch (choix)
            {
                case "D":
                    DiscuPrivée:
                    Console.Clear();
                    write("Veuillez entrer un pseudonyme: ");
            string username = Console.ReadLine();
            foreach (User user in skype.SearchForUsers(username))
            {
                write(user.FullName);
            }
            Console.Clear();
            write("La conversation avec votre contact a été lancé \n chaque message sera suivi sur Skype d'un \" - Envoyé avec SkypeChat \". \n Pour voir les commandes disponibles, tapez juste \"#menu\".");
            Chat:
            string message = Console.ReadLine();

            if (confirm == true)
            {
                write("Veuillez appuyer sur Entrée pour confirmer l'envoi de la commande ou du message.");
                Console.ReadKey();
            }
            write("[POUR] " + username + " : " + message);
                    switch (message)
                    {
                        default:
                            // MESSAGE
                            if (message.Contains("#"))
                            {

                            }
                            else
                            {
                                write("[ENVOYÉ] " + username + " : " + message);
                            }

                        case "#menu":
                            // COMMANDES
                            write("#clear        : Nettoyer le CMD.");
                            write("#menu         : Affiche ce menu.");
                            write("#leave        : Fermer la conversation.");
                            write("#exit         : Fermer le logiciel.");
                            write("#call         : Appeler l'utilisateur cible.");
                            write("#confirm      : Désactive/Active la vérification d'envoi de message. (Actuel : " + confirm + ")");
                            write("#conversation : Créer une conversation via SkypeChat avec l'utilisateur cible.");
                            write("#sendfile     : Envoyer un fichier dans la discussion");
                            MessageBox.Show("La commande #confirm ne fonctionne pas pour le moment, mais elle devrait être mis à jour pour la 2.03", "Error");

                            goto Chat;
                        case "#clear":

                            Console.Clear();
                            goto Chat;

                        case "#leave":
                            Console.Clear();
                            goto DiscuPrivée;

                        case "":
                            write("Vous ne pouvez pas envoyer un message vide.");
                            goto Chat;

                        case "#exit":
                            Environment.Exit(1);
                            break;

                        case "#call":
                            skype.PlaceCall(username);
                            write("Veuillez appuyer sur Entrée à la fin de votre appel.");
                            Console.ReadKey();
                            write("Retour au mode texte en cours..");
                            goto Chat;

                        case "#conversation":
                            skype.CreateGroup("Conversation créer par SkypeChat");
                            goto Chat;

                        case "#sendfile":
                            skype.Client.OpenFileTransferDialog(username, "C:\\");
                            goto Chat;

                        case "#confirm":
                            if (confirm == true)
                            {
                                confirm = false;
                                write("Demande de confirmation: Désactivée !");
                            }
                            goto Chat;
                            if (confirm == false)
                            {
                                confirm = true;
                                write("Demande de confirmation: Activée !");

                            }
                            goto Chat;
                    }
                    break;

                case "C":
                    MessageBox.Show("Le mode conversation n'est pas encore prêt, passage automatique en mode discussion privée","Erreur");
                    goto DiscuPrivée;
            }
        }
Пример #12
0
 private void btnCall_Click(object sender, EventArgs e)
 {
     try
     {
         btnCall.Enabled = false;
         skype = new SKYPE4COMLib.Skype();
         skype.CallStatus += new _ISkypeEvents_CallStatusEventHandler(ChangeCallStatus);
         Call call = skype.PlaceCall(txtPhNo.Text);
         //Call call = skype.PlaceCall("echo123");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Call Customer");
     }
 }
Пример #13
0
        private void Skype_CallStatus(Call aCall, TCallStatus aStatus)
        {
            switch (aStatus)
            {
            case TCallStatus.clsRinging:
                // A call is ringing, see if it is us calling or
                // someone calling us
                if (aCall.Type == TCallType.cltIncomingP2P || aCall.Type == TCallType.cltIncomingPSTN)
                {
                    // Make sure this isn't a SkypeOut call request
                    if (aCall.PartnerHandle.Equals(_strMobileUser))
                    {
                        WriteToLog("SkypeOut call from " + _strMobileUser);
                        WriteToLog("Allowing call to be forwarded by Skype");
                        return;
                    }
                    // Incoming call, we need to initiate forwarding
                    WriteToLog("Answering call from " + aCall.PartnerHandle);
                    aCall.Answer();
                    this._intIncomingCallId = aCall.Id;
                    aCall.set_InputDevice(TCallIoDeviceType.callIoDeviceTypeSoundcard, "default");
                    aCall.set_InputDevice(TCallIoDeviceType.callIoDeviceTypePort, "1");
                    string strWavPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\PleaseWait.wav";
                    aCall.set_InputDevice(TCallIoDeviceType.callIoDeviceTypeFile, strWavPath);
                    System.Threading.Thread.Sleep(8000);
                    aCall.set_InputDevice(TCallIoDeviceType.callIoDeviceTypeFile, "");
                    WriteToLog("Placing call on hold");
                    aCall.Hold();

                    // Check to see if we need to foward this to
                    // a configured SkypeIn mapping
                    string strTargetNumber;
                    if (this._colSkypeInMappings.ContainsKey(aCall.TargetIdentity))
                    {
                        // Yes set the target to the configured value
                        strTargetNumber = this._colSkypeInMappings[aCall.TargetIdentity];
                        WriteToLog("Calling SkypeIn forwarding number " + strTargetNumber);
                    }
                    else
                    {
                        // No, use the mobile user
                        strTargetNumber = this._strMobileUser;
                        WriteToLog("Calling mobile user");
                    }

                    System.Threading.Thread.Sleep(500);
                    try
                    {
                        Call oCall = _objSkype.PlaceCall(strTargetNumber, null, null, null);
                        this._intOutgoingCallId = oCall.Id;
                    }
                    catch (Exception ex)
                    {
                        WriteToLog("Error trying to call target: " + ex.Message);
                    }
                }
                break;

            case TCallStatus.clsInProgress:
                // We have a new call opened. Make sure it's our outgoing call
                if (aCall.Id == this._intOutgoingCallId)
                {
                    // Yes, the target user has answered.
                    WriteToLog("Target user has answered, attempting to join calls");
                    foreach (Call objCall in _objSkype.ActiveCalls)
                    {
                        if (objCall.Id == this._intIncomingCallId)
                        {
                            WriteToLog("Joining the calls...");
                            objCall.Join(aCall.Id);
                            WriteToLog("Taking incoming call off hold");
                            objCall.Resume();
                        }
                    }
                }
                break;

            case TCallStatus.clsFinished:
                // Someone has hung up, end the call
                WriteToLog("Someone has hung up. Attempting to end the conference");
                foreach (Conference objConf in _objSkype.Conferences)
                {
                    foreach (Call objCall in objConf.Calls)
                    {
                        if (objCall.Id == this._intIncomingCallId || objCall.Id == this._intOutgoingCallId)
                        {
                            System.Threading.Thread.Sleep(500);
                            try
                            {
                                objCall.Finish();
                            }
                            catch (Exception) { }
                            try
                            {
                                objConf.Finish();
                            }
                            catch (Exception) { }
                        }
                    }
                }
                break;

            default:
                // Something else?
                if ((aCall.Type == TCallType.cltOutgoingP2P || aCall.Type == TCallType.cltOutgoingPSTN) && (
                        aCall.Status == TCallStatus.clsCancelled ||
                        aCall.Status == TCallStatus.clsFailed ||
                        aCall.Status == TCallStatus.clsMissed ||
                        aCall.Status == TCallStatus.clsRefused ||
                        aCall.Status == TCallStatus.clsVoicemailPlayingGreeting ||
                        aCall.Status == TCallStatus.clsVoicemailRecording
                        )
                    )
                {
                    WriteToLog("Error calling target user: "******"Redirecting to voicemail");
                    // End the other call
                    foreach (Call objCall in _objSkype.ActiveCalls)
                    {
                        if (objCall.Id == this._intOutgoingCallId)
                        {
                            try
                            {
                                objCall.Finish();
                            }
                            catch (Exception ex)
                            {
                                WriteToLog("Error trying to end voicemail call: " + ex.Message);
                            }
                        }
                    }
                    // Now redirect the incoming call
                    foreach (Call objCall in _objSkype.ActiveCalls)
                    {
                        if (objCall.Id == this._intIncomingCallId)
                        {
                            System.Threading.Thread.Sleep(500);
                            try
                            {
                                //objCall.Resume();
                                objCall.RedirectToVoicemail();
                                objCall.Finish();
                                //objCall.Status = TCallStatus.clsFinished;
                            }
                            catch (Exception ex)
                            {
                                WriteToLog("Error trying to divert to voicemail: " + ex.Message);
                                objCall.Finish();
                            }
                        }
                    }
                }
                break;
            }
        }
Пример #14
0
 public CallProxy callTo(string target)
 {
     logger.Info("Call to " + target);
     return(new CallProxy(skype, skype.PlaceCall(target)));
 }
Пример #15
0
        private void btnCall_Click(object sender, EventArgs e)
        {
            try
            {
                Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                if (config.AppSettings.Settings["localVoiceRecordsPath"].Value != null && config.AppSettings.Settings["ServerVoiceRecordsPath"].Value != null)
                {
                    if (config.AppSettings.Settings["localVoiceRecordsPath"].Value.Trim() != "" && config.AppSettings.Settings["ServerVoiceRecordsPath"].Value.Trim() != "")
                    {
                        if (txtPhNo.Text.Trim() != "")
                        {
                            btnCall.Enabled = false;
                            skype = new SKYPE4COMLib.Skype();
                            skype.CallStatus += new _ISkypeEvents_CallStatusEventHandler(ChangeCallStatus);
                            Call call = skype.PlaceCall(txtPhNo.Text);
                            //Call call = skype.PlaceCall("echo123");

                        }
                    }
                    else
                    {
                        MessageBox.Show("Sound file save location not found");
                    }
                }
                else
                {
                    MessageBox.Show("Sound file save location not found");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Call Customer");
            }
        }
Пример #16
0
        void engine_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            switch (e.Result.Text)
            {
            case ("cooling on"):
                richTextBox1.Text        += e.Result.Text + "\n";
                label6.Text               = "Cooling ---> On";
                pictureBox5.ImageLocation = "C:/Bharat/Masters Material/SER 516/SpeechRecognition/co.png";
                break;

            case ("cooling off"):
                richTextBox1.Text        += e.Result.Text + "\n";
                label6.Text               = "Cooling ---> Off";
                pictureBox5.ImageLocation = "C:/Bharat/Masters Material/SER 516/SpeechRecognition/cooff.png";
                break;

            case ("turn bluetooth on"):
                richTextBox1.Text        += "Turn Bluetooth On\n";
                label2.Text               = "Bluetooth ---> On";
                pictureBox1.ImageLocation = "C:/Bharat/Masters Material/SER 516/SpeechRecognition/bt.png";
                break;

            case ("turn bluetooth off"):
                richTextBox1.Text        += "turn Bluetooth off\n";
                label2.Text               = "Bluetooth ---> Off";
                pictureBox1.ImageLocation = "C:/Bharat/Masters Material/SER 516/SpeechRecognition/btoff.png";
                break;

            case ("play some music"):
                richTextBox1.Text += e.Result.Text + "\n";
                label3.Text        = "Music ---> On";
                if (myMusic == null)
                {
                    myMusic = Process.Start("wmplayer.exe", "C:/Users/Bharat/Downloads/Music/firestone.mp3");
                }
                pictureBox2.ImageLocation = "C:/Bharat/Masters Material/SER 516/SpeechRecognition/ms.png";
                break;

            case ("stop music"):
                richTextBox1.Text += e.Result.Text + "\n";
                label3.Text        = "Music ---> Off";
                if (myMusic != null)
                {
                    myMusic.CloseMainWindow();
                    myMusic.Close();
                    myMusic = null;
                }
                pictureBox2.ImageLocation = "C:/Bharat/Masters Material/SER 516/SpeechRecognition/msoff.png";
                break;

            case ("stop navigation"):
                richTextBox1.Text += e.Result.Text + "\n";
                if (myMap != null)
                {
                    myMap.CloseMainWindow();
                    myMap.Close();
                    myMap = null;
                }
                navInProgress             = false;
                label4.Text               = "Navigation ---> Off";
                pictureBox3.ImageLocation = "C:/Bharat/Masters Material/SER 516/SpeechRecognition/nvoff.png";
                break;

            case ("end call"):
                if (call != null)
                {
                    call.Finish();
                    call = null;
                    richTextBox1.Text += "End Call\n";
                }
                callInProgress            = false;
                label5.Text               = "Call ---> Off";
                pictureBox4.ImageLocation = "C:/Bharat/Masters Material/SER 516/SpeechRecognition/cloff.png";
                break;

            default:
                if (!callInProgress && e.Result.Text.Contains("call"))
                {
                    richTextBox1.Text += e.Result.Text + "\n";
                    string name   = e.Result.Semantics["person"].Value.ToString();
                    User   caller = contacts.Where(user => user.FullName.ToLower().IndexOf(name.ToLower()) > -1).
                                    Select(user => new User
                    {
                        Handle = user.Handle
                    }).FirstOrDefault();
                    if (caller != null)
                    {
                        call = skype.PlaceCall(caller.Handle);
                        synthesizer.SpeakAsync("Calling " + name);
                        richTextBox1.Text        += "Call processed\n";
                        callInProgress            = true;
                        label5.Text               = "Call ---> On";
                        pictureBox4.ImageLocation = "C:/Bharat/Masters Material/SER 516/SpeechRecognition/cl.png";
                    }
                    else
                    {
                        synthesizer.SpeakAsync("Contact Not Found");
                    }
                    // richTextBox1.Text += "\nDefault in";
                }
                else if (!navInProgress && e.Result.Text.Contains("navigate to"))
                {
                    richTextBox1.Text += e.Result.Text + "\n";
                    string destination = e.Result.Semantics["city"].Value.ToString();
                    myMap                     = Process.Start("https://www.google.com/maps/dir/Mesa/" + destination);
                    navInProgress             = true;
                    label4.Text               = "Navigation ---> On";
                    pictureBox3.ImageLocation = "C:/Bharat/Masters Material/SER 516/SpeechRecognition/nv.png";
                }

                break;
            }
        }
Пример #17
0
        public void placeBlockedCall(string Sender)
        {
            Console.WriteLine("Placing Blocked Call");
            Settings1 settings = new Settings1();

            settings.Reload();

            if (calls == null)
            {
                calls = new ArrayList();
            }
            else
            {
                calls.Clear();
            }

            Console.WriteLine("Created call array");

            if (settings.chain)
            {
                if (m_callers.Count > 0)
                {
                    Console.WriteLine("Calling first caller in chain");
                    Command command = new Command();
                    command.Command = "call " + m_callers[0].ToString();
                    m_skype.SendCommand(command);
                }
            }
            else
            {
                Console.WriteLine("Calling list of callers at once");
                if (m_callers.Count < 4)
                {
                    m_callers.Add("");
                    m_callers.Add("");
                    m_callers.Add("");
                    m_callers.Add("");
                }
                try
                {
                    Call   call     = m_skype.PlaceCall(m_callers[0].ToString(), m_callers[1].ToString(), m_callers[2].ToString(), m_callers[3].ToString());
                    string filename = "C:/users/Robert/skype/" + call.Id.ToString() + ".wav";
                    call.set_OutputDevice(TCallIoDeviceType.callIoDeviceTypeFile, filename);
                    incall = true;
                    m_recordings.Add(filename);
                }
                catch (Exception ex)
                {
                    incall    = false;
                    emailsent = false;
                    Console.WriteLine("Error with call");
                    string body = "Error with call to the following numbers: \r\n";
                    foreach (string number in m_callers)
                    {
                        body += number + "\r\n";
                    }
                    body += "From email address: " + Sender;
                    Smtp.Net.EmailSender.Send("*****@*****.**", "*****@*****.**", "call error report", body);
                }
            }

            ((ISkype)m_skype).Mute = true;
        }