Exemple #1
0
        /**
         * Conference with at least two other participants.
         * <ol>
         *   <li>Obtain the list of available playback and recording devices.</li>
         *   <li>Set the current devices (input, output, notification) to the first device
         *   	 in their respective list, and display their names.</li>
         *   <li>Create a conference conversation.</li>
         *   <li>Add each of the specified call targets (Skype Names) to the conversation as consumers.</li>
         *   <li>Obtain the resultant list of conversation participants, which will include
         * 		 the conference creator.</li>
         *   <li>Attempt to call each participant <em>except the conference creator</em>,
         *   	 and wait for them to answer.</li>
         *   <li>Wait until the call finishes.</li>
         * </ol>
         *
         * @param mySession
         *	Populated session object
         * @param myCallTargets
         * 	The Skype Names of the people to conference with.
         *
         * @since 1.0
         */
        static void doMakeConferenceCall(MySession mySession, String[] myCallTargets)
        {
            // Get available playback/recording devices; choose first of each
            if (mySession.setupAudioDevices(0, 0))
            {
                MySession.myConsole.printf("%s: Audio device set-up completed!%n", mySession.myTutorialTag);
            }
            else
            {
                MySession.myConsole.printf("%s: Audio device set-up failed - exiting!%n", mySession.myTutorialTag);
                return;
            }

            Conversation myConversation = (Conversation)mySession.mySkype.createConference();

            // *** DEBUG ***
            for (int m = 0; m < myCallTargets.Length; m++)
            {
                MySession.myConsole.printf("\tCall target name %d: %s%n", m, myCallTargets[m]);
            }

            myConversation.addConsumers(myCallTargets);

            Participant[] convParticipantList =
                myConversation.getParticipants(Conversation.ParticipantFilter.ALL);

            mySession.callActive = false;
            String partIdentity;
            int i;
            int j = convParticipantList.Length;
            int k = 0;
            for (i = 0; i < j; i++)
            {
                partIdentity = convParticipantList[i].getIdentity();

                if (partIdentity != mySession.myAccountName)
                {
                    k++;
                    MySession.myConsole.printf("Calling %s%n", partIdentity);
                    convParticipantList[i].ring(partIdentity, false, 1, 40, false,
                                                mySession.myAccount.getSkypeName());
                    int m = 0;
                    while ((m < SignInMgr.DELAY_CNT) && (!isRinging(convParticipantList[i])))
                    {
                        try
                        {
                            Thread.Sleep(SignInMgr.DELAY_INTERVAL);
                        }
                        catch (java.lang.InterruptedException e)
                        {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                        MySession.myConsole.printf("\t%d...%n", m++);
                    }

                    if (m >= SignInMgr.DELAY_CNT)
                    {
                        MySession.myConsole.printf("%s: Ring timed out for %s; skipping!%n",
                                MY_CLASS_TAG, convParticipantList[i]);
                        continue;
                    }
                    mySession.callActive = true;
                }
            }

            if (k == 0)
            {
                MySession.myConsole.println("No one (except maybe ourselves) to conference in ?!?");
                return;
            }

            while (!mySession.callActive)
            {
                try
                {
                    Thread.Sleep(SignInMgr.DELAY_INTERVAL);
                }
                catch (java.lang.InterruptedException e)
                {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                    return;
                }
            }
        }
Exemple #2
0
        /**
         * Call someone in your Contacts.
         * <ol>
         *   <li>Obtain the list of available playback and recording devices.</li>
         *   <li>Set the current devices (input, output, notification) to the first device
         *   	 in their respective list, and display their names.</li>
         *   <li>Obtain the list of my Contacts, and find the target caller in it.
         *   	 If not found, display an appropriate message and return.</li>
         *   <li>Attempt to call that Contact.</li>
         *   <li>Wait until the call finishes</li>
         * </ol>
         *
         * @param mySession
         *	Populated session object
         * @param myCallTarget
         * 	The Skype Name of the person to call.
         *
         * @since 1.0
         */
        static void doMakeCall(MySession mySession, String myCallTarget)
        {
            // Get available playback/recording devices; choose first of each
            if (mySession.setupAudioDevices(0, 0))
            {
                MySession.myConsole.printf("%s: Audio device set-up completed!%n", mySession.myTutorialTag);
            }
            else
            {
                MySession.myConsole.printf("%s: Audio device set-up failed - exiting!%n", mySession.myTutorialTag);
                return;
            }

            String[] callTargets = { myCallTarget }; // Create & initialize the array in one step...
            Conversation myConversation =
                (Conversation)mySession.mySkype.getConversationByParticipants(callTargets, true, true);

            Participant[] convParticipantList = myConversation.getParticipants(Conversation.ParticipantFilter.ALL);

            int i;
            int j = convParticipantList.Length;
            bool callTargetFound = false;
            for (i = 0; i < j; i++)
            {
                if (convParticipantList[i].getIdentity().Equals(myCallTarget))
                {
                    callTargetFound = true;
                    break;
                }
            }

            if (!callTargetFound)
            {
                MySession.myConsole.printf("Could not find call target  %s%n", myCallTarget);
                return;
            }

            MySession.myConsole.printf("Calling %s%n", myCallTarget);	// Initiate the call
            mySession.callActive = true;
            convParticipantList[i].ring(myCallTarget, false, 0, 10, false,
                                        mySession.myAccount.getSkypeName());

            // Loop until the call finishes
            while (mySession.callActive)
            {
                try
                {
                    Thread.Sleep(SignInMgr.DELAY_INTERVAL);
                }
                catch (java.lang.InterruptedException e)
                {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                    return;
                }
            }
        }
Exemple #3
0
        /**
         * Find available input/output devices, then wait for incoming calls..
         * <ol>
         *   <li>List the available playback and recording devices.</li>
         *   <li>Set the current devices (input, output, notification) to the first device in their respective list.</li>
         *   <li>Initialize the speaker volume level.</li>
         *   <li>Wait for in-coming calls.</li>
         * </ol>
         *
         * @param mySession
         *	Populated session object
         *
         * @since 1.0
         */
        static void doAcceptCalls(MySession mySession)
        {
            int i;
            int j;

            Skype.GetAvailableOutputDevicesResponse outputDevices = mySession.mySkype.getAvailableOutputDevices();
            Skype.GetAvailableRecordingDevicesResponse inputDevices = mySession.mySkype.getAvailableRecordingDevices();

            // Getting a list of audio output devices.
            MySession.myConsole.println("** Playback devices:");
            j = outputDevices.handleList.Length;
            for (i = 0; i < j; i++)
            {
                MySession.myConsole.printf("\t%d. %s (%s)%n", i, outputDevices.nameList[i], outputDevices.productIdList[i]);
            }
            MySession.myConsole.println("");

            // Getting a list of audio input devices.
            MySession.myConsole.println("** Recording devices:");
            j = inputDevices.handleList.Length;
            for (i = 0; i < j; i++)
            {
                MySession.myConsole.printf("\t%d. %s (%s)%n", i, inputDevices.nameList[i], inputDevices.productIdList[i]);
            }
            MySession.myConsole.println("");

            // Currently setting the sound devices to the first input/output device.
            // The output and notification are routed through the same device. If you want more control,
            // don't invoke SetupAudioDevices -- instead invoke:
            // 	mySession.mySkype.SelectSoundDevices(inputDevices.handleList[0],
            //											outputDevices.handleList[0],
            //											outputDevices.handleList[0]);
            //	mySession.mySkype.SetSpeakerVolume(100);
            //
            // If your microphone or speakers fail to work, you might want
            // to change these values.

            if (mySession.setupAudioDevices(0, 0))
            {
                MySession.myConsole.printf("%s: Audio device set-up completed!%n", mySession.myTutorialTag);
            }
            else
            {
                MySession.myConsole.printf("%s: Audio device set-up failed - exiting!%n", mySession.myTutorialTag);
                return;
            }

            MySession.myConsole.printf("%s: Now accepting incoming calls...%nPress Enter to quit.%n%n", mySession.myTutorialTag);
            try
            {
                while (true)
                {
                    int keyboardChar = (int)System.Console.ReadKey().KeyChar;
                    // Some platforms think ENTER is 0x0D; others think it's 0x0A...
                    if ((keyboardChar == 0x0D) || (keyboardChar == 0x0A))
                    {
                        break;
                    }
                }
            }
            catch (IOException e)
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return;
            }

            MySession.myConsole.println("");
        }