zoukankan      html  css  js  c++  java
  • .net调用skypeAPI

    公司有呼叫中心,闲来无事。看看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)
        {
    
        }
    }
  • 相关阅读:
    jxl导入/导出excel
    iText导出pdf、word、图片
    Java CSV操作(导出和导入)
    Spring3.0+Hibernate+Atomikos集成构建JTA的分布式事务--解决多数据源跨库事务
    jQuery插件:跨浏览器复制jQuery-zclip
    微信小程序之表单提交
    微信小程序只之全局存储
    微信小程序之工具js封装与使用
    重构的艺术 深入认识
    重构的素养
  • 原文地址:https://www.cnblogs.com/iverson3/p/2664823.html
Copyright © 2011-2022 走看看