简体   繁体   中英

How to end an active call in skype

I am using the Skype API for video calling. Now I have a button to end the call. I wrote the following code on button's click:

if (skype.ActiveCalls.Count > 0)
{
    skype.ActiveCalls[0].Finish();

    //conference calls
    //for (int i = 0; i < skype.ActiveCalls.Count; i++)
    //{
        //if (skype.ActiveCalls[i + 1].ConferenceId > 0)
        //{
            //skype.ActiveCalls[i + 1].Finish();
            //call = skype.;
        //}
    //}
}

but it is throwing exception:

Value does not fall within the expected range.

How to end an active call?

Well my guess from the commented code

//conference calls 
//for (int i = 0; i < skype.ActiveCalls.Count; i++) 
//{ 
    //if (skype.ActiveCalls[i + 1].ConferenceId > 0) 
    //{ 
        //skype.ActiveCalls[i + 1].Finish(); 
        //call = skype.; 
    //} 
//}

is that the ActiveCalls arrays is not zero based, and starts from 1,

so you should change

skype.ActiveCalls[0].Finish();

to

skype.ActiveCalls[1].Finish(); 

Juat a guess

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM