Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do I use a modem to call a phone and play a wave file over it
Posted

1 solution

Hi,

Please check the below code.

System.IO.Ports.SerialPort comPort;
comPort = new System.IO.Ports.SerialPort("Com2", 115200, System.IO.Ports.Parity.None, 8, StopBits.One);
comPort.DtrEnable = true;
//Switch to Voice Mode
comPort.Write("AT+FCLASS=8" + System.Convert.ToChar(13).ToString());
//Call Number
comPort.Write("ATDT1231234" + System.Convert.ToChar(13).ToString());
//Enter Voice-Transmission Mode
comPort.Write("AT+VTX" + System.Convert.ToChar(13).ToString());
bool MSwitch = false;
byte[] buffer = new byte[20000];
FileStream strm = new FileStream(@"C:\Users\Master\Desktop\Prmpt445.wav", System.IO.FileMode.Open);
MemoryStream ms = new MemoryStream();
int count = ms.Read(buffer, 44, buffer.Length-44);
BinaryReader rdr = new BinaryReader(strm);
while (!MSwitch)
{
byte[] bt = new byte[1024];
bt = rdr.ReadBytes(1024);
if (bt.Length == 0)
{
MSwitch = true;
break;
}
comPort.Write(bt, 0, bt.Length);
}
strm.Close();
strm.Dispose();


Hope this helps.

Regards,
Anand Subramanian.
 
Share this answer
 
Comments
Md Jamaluddin Saiyed 25-Jun-14 2:43am    
Thanks for help sir ! I will try this code !!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900