公司有呼叫中心,闲来无事。看看SKPYE有没有API,竟然真有。
做了个调用API的例子
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using SKYPE4COMLib; public partial class _Default : System.Web.UI.Page { SKYPE4COMLib.Skype oSkype = new SKYPE4COMLib.Skype(); protected void Page_Load(object sender, EventArgs e) { UserCollection tFriends = oSkype.Friends; foreach (User tUser in oSkype.Friends) { if(tUser.FullName.Trim() != "") ListBox1.Items.Add(tUser.FullName+"--"+tUser.OnlineStatus); } } protected void Button1_Click(object sender, EventArgs e) { SKYPE4COMLib.SkypeClass skype = new SkypeClass(); skype.SmsTargetStatusChanged += new _ISkypeEvents_SmsTargetStatusChangedEventHandler(skype_SmsTargetStatusChanged); skype.SmsMessageStatusChanged += new _ISkypeEvents_SmsMessageStatusChangedEventHandler(skype_SmsMessageStatusChanged); SmsMessage message = skype.CreateSms(TSmsMessageType.smsMessageTypeOutgoing, "*18611295575"); message.Body = "測試內容"; message.Send(); } void skype_SmsMessageStatusChanged(SmsMessage pMessage, TSmsMessageStatus Status) { switch (Status) { case TSmsMessageStatus.smsMessageStatusComposing: break; case TSmsMessageStatus.smsMessageStatusDelivered: break; case TSmsMessageStatus.smsMessageStatusFailed: break; case TSmsMessageStatus.smsMessageStatusRead: break; case TSmsMessageStatus.smsMessageStatusReceived: break; case TSmsMessageStatus.smsMessageStatusSendingToServer: break; case TSmsMessageStatus.smsMessageStatusSentToServer: break; case TSmsMessageStatus.smsMessageStatusSomeTargetsFailed: break; case TSmsMessageStatus.smsMessageStatusUnknown: break; default: break; } } void skype_SmsTargetStatusChanged(SmsTarget pTarget, TSmsTargetStatus Status) { switch (Status) { case TSmsTargetStatus.smsTargetStatusAcceptable: break; case TSmsTargetStatus.smsTargetStatusAnalyzing: break; case TSmsTargetStatus.smsTargetStatusDeliveryFailed: break; case TSmsTargetStatus.smsTargetStatusDeliveryPending: break; case TSmsTargetStatus.smsTargetStatusDeliverySuccessful: break; case TSmsTargetStatus.smsTargetStatusNotRoutable: break; case TSmsTargetStatus.smsTargetStatusUndefined: break; case TSmsTargetStatus.smsTargetStatusUnknown: break; default: break; } } protected void Button2_Click(object sender, EventArgs e) { Call call = oSkype.Call; SkypeClass skype = new SkypeClass(); CommandClass cmd = new CommandClass(); //skype._ISkypeEvents_Event_Command += new _ISkypeEvents_CommandEventHandler(skype__ISkypeEvents_Event_Command); cmd.Command = "OPEN IM " + "*186********"; //skype.SendCommand(cmd); cmd.Command = "CALL " + "*186********"; //skype.SendCommand(cmd); } void skype__ISkypeEvents_Event_Command(Command pCommand) { } }