using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ModemLib.SMS;
using ModemLib.Voice;
namespace QM.Exchange.Adapters.SMS
{
///
/// 短信猫适配器
///
public class SMSAdapter
{
//com口名称
private string _portName = "";
public SMSAdapter(string portName)
{
_portName = portName;
}
///
/// 发送手机短信
///
/// 手机号码
/// 短信
public void SendMsg(string telephoneNumber, string msg)
{
using (SMSHelper sms = new SMSHelper(_portName))
{
sms.Send(telephoneNumber, msg);//发送
}
}
///
/// 拨打电话播放语音
///
/// 电话号码
/// 文字
public void Speak(string telephoneNumber, string msg)
{
using (PhoneHelper phone = new PhoneHelper(_portName))
{
phone.VoiceName = "Microsoft Lili";//语音包名称
if (!phone.DialUp(telephoneNumber)) return;//拨打电话
phone.Speak(msg);//发送语音
phone.HangUp();//挂断电话
}
}
}
}