0

I have done all call dialling part and it works. Now I need to play recorded sound or microphone in put sound through phone.I just need to know how can I pass the audio to the dongle and send it through the call.

this is my working code for dialling phone number

SerialPort port = new SerialPort();
port.Open();
string t = port.ReadExisting();
Thread.Sleep(100);

string cmd = "ATD";
string phoneNumber = "071********";
port.WriteLine(cmd + phoneNumber + ";\r");


port.Close();
Liam
  • 27,717
  • 28
  • 128
  • 190
  • Have you tried the [voice mode commands](http://en.wikipedia.org/wiki/Voice_modem_command_set#Entering_voice_mode)? – Rup Jul 03 '13 at 12:32
  • 1
    I'm guessing here because I can't find any documentation, but I don't believe you would be sending audio down that virtual COM port; it's probably for commands only. Look in device manager and you'll probably see audio devices that are part of the dongles. If I'm right, you'll need to open those audio devices to send/receive audio. And it looks like .Net's audio api is lacking, so you can try using [NAudio](http://channel9.msdn.com/coding4fun/articles/NET-Voice-Recorder). – antiduh Jul 03 '13 at 12:47
  • I have completed the call dialing part and it works.but I can't get or send voice to the dongle.there is two COM ports.I pass all the AT commands to the COM14 and write a SerialDataReceivedEvent to the COM12 port. When I answer to the call the COM12 port reader reads some thing when I convert what itreads to string It is like this "\r\n^ORIG:1,0\r\n\r\n^CONF:1\r\n\r\n^CONN:1,0\r\n\r\n^CEND:1,8,104,16\r\n" I think that this is the second port that dongle use to send and receive voice data.Can anyone tell me how to get audio stream from that port COM12 and send my mic input to that port. – Sajith Dushmantha Samarathunga Jul 04 '13 at 17:13
  • How does COM12 show up in the Windows Device Manager? Does it show as an audio device? – user1725145 Jul 05 '13 at 08:06
  • here is a screenshot of my device manager http://share.cx.com/Q8qhsy – Sajith Dushmantha Samarathunga Jul 05 '13 at 17:33

1 Answers1

8

For your modem, you have 3 COM port available. One is for sending AT command, the second one is for sending data (voice data), and the last one is for monitoring the asynchronous status change.

When you place a call (with ATD), you'll have to wait for "^CONN: 1, 0" on the monitoring port.

Then you need a sound source with 8KHz, 16 bit signed, 1 channel. Write 320 bytes of this source on the data port, each 20ms.

You'll also read 320 bytes of data from this port, each 20ms for the other side speaking.

When you get "^CEND: ...", then the call is terminated.

Beware of few catch however. You'll get "^CONN: 1, 0" even if the other side rejected you call. So, try to read data from the data port first to check if the other side is still there after a ^CONN message.

xryl669
  • 3,376
  • 24
  • 47
  • @xryl669 - Please tell me, how did you derive these figures? I have a post here: http://stackoverflow.com/questions/37449498/calculating-the-frame-rate-and-size-for-a-timed-stream-of-a-byte-array – Rusty Nail May 26 '16 at 03:13
  • 2
    @Chris: First, you can record the data stream as raw and then try SOX to interpret the audio stream. Therefore, 320 bytes every 20ms gives 16KiB = 8000 samples * 2 (16 bits) per second. Your could vary if µLaw encoded. – xryl669 May 30 '16 at 12:41