[RESOLVED] [2005] Modems -- TAPI required?
I'm a novice and after toying with some basic ideas on how to talk to a modem with VB.net, I think there may be much more to it than I realize. (?)
I know my modem is fine, I can use hyperterminal to call out on it with no problem.
So, how involved is it to talk to a modem?
My initial thinking was that I could simply talk to it via a serial port using AT commands sent and rcvd as a string. (?)
My modem is set up with COM2 9600 8n1.
I've setup a serial port with the same parameters in my code.
Now what?
* Forget about it (there's a lot more to it than this....TAPI?)
* Send an AT command via serialport.write (" ") to initialize the modem and listen for a dial tone.
And, for step one, I would like to accomplish just that.....assuming I'm good to go, what is that AT command?
THANKS.
Re: [2005] Modems -- TAPI required?
Also, I do know that each modem has it's own initialization code etc but I don't how crazy that is these days.
Whether certain generic AT commands can work or not and whether any progress has been made in that area.
I know it used to be hell.
But even if I have to do my code for a specific modem or two that is fine with me.
Re: [2005] Modems -- TAPI required?
ATZ - modem reset - every modem i have worked with
ATDT - dial - every modem i have worked with
ATH - hangup - every modem i have worked with
+++ - escape sequence - every modem i have worked with
what do you want to do once the modem is dialed? if you dial a number and do nothing else, the modem will try to communicate with, what it assumes to be, another modem.
here is a reference to some standard commands
http://support.microsoft.com/default.aspx/kb/164660
Re: [2005] Modems -- TAPI required?
Thanks D, my friend.
I started messing with this today, working with what you've given me so far.
I'll post my code tomorrow....I simply put up a button to call my cell number but had no luck and like I say, I can use hyperterminal and I know the modem is fine.
Ultimately, what I want to do is call out a number the user has input through a text box and stored as a variable....dial it.....and inject the appropriate wav audio sound into the telephone line.
Good news is, I suppose, I will be able to get it done with just the serialport and modem and not something more advanced.
I'll get a fresh start in the morning.
Re: [2005] Modems -- TAPI required?
you should be able to get it to dial the number, BUT when the cell phone answers the modem is going to start the init sequence with the cell phone(that noise you hear), which is not what you want.
Re: [2005] Modems -- TAPI required?
Ok.
I know you're the guy as I've seen so many posts where you're the one with the answers on serial communication and especially modems.
So, I really want to start at ground zero with this.
Believe it or not, I have more of an electronics background than programming but my retention is very poor and I only tend to remember things that I NEED.
So...
I know you're talking about handshaking and maybe I'm not going to be able to do what I want as really, the modem is intended for digital data. (?)
(But I've seen "voice/data" modems as well?).
I'll look into this and do a modems 101 on the web somewhere for starters.
I want to connect to the com port, send it commands through VB.NET and audio (through the sound card somehow?). Anyway -- let me study and I'll come back with some very BASIC and specific questions.
Need to put on my thinking cap.
By the way, it's amazing how little info there is regarding VB.NET and modems....even a google search comes up with very little.
Re: [2005] Modems -- TAPI required?
Another little tidbit that may be a problem?
I have a Motorola SM56 modem.....a "softmodem".....that I'm reading might be trouble.
A software intensive modem that uses Windows rather than on board hardware?
Re: [2005] Modems -- TAPI required?
How about this -- (maybe simpler?)
Why can't I just set up hyperterminal with the numbers I want to call.
The user could do this on their own and save each session as filename that would work within my program....then in a procedure, I wait for the event that calls out, and it brings up hyperterminal and executes the appropriate session automatically?
Is that possible?
I know that some voice modems can also play audio from the sound card or I can supply a little interface to put the sound card audio onto the phone line as well.
I think I'm in over my head trying to code this myself besides, I like the reliability factor of hyperterminal.
Re: [2005] Modems -- TAPI required?
And here's the code that I can't get anywhere on --
It's weird because I always get a "com3 doesn't exist", yet my modem works fine with hyperterminal and it's on com3.
I've used other com ports and same thing, fine with hyperterminal but "doesn't exist" with this code.
Code:
Imports System
Imports System.io
Imports system.io.ports
Public Class Form1
Dim txtxt As String
Dim WithEvents serport2 As New IO.Ports.SerialPort
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CheckForIllegalCrossThreadCalls = False
With serport2
.PortName = "com3"
.BaudRate = 19200
.Parity = IO.Ports.Parity.None
.DataBits = 8
.StopBits = IO.Ports.StopBits.One
.Handshake = Handshake.None
.ReceivedBytesThreshold = 35
.ReadTimeout = 3000
End With
serport2.DtrEnable = True
serport2.RtsEnable = True
serport2.Open()
End Sub
Private Sub CALLOUT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CALLOUT.Click
txtxt = "atdt13172198539"
serport2.Write(txtxt)
'TextBox1.Text = (serport2.ReadTo("!%"))
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
End Class
Re: [2005] Modems -- TAPI required?
have you tried COM3? i have never had an issue and it so happens that my modem is on COM3.
i tried this
Code:
Dim s As New SerialPort
s.PortName = "com3"
s.Open()
Stop
and it worked.
Re: [2005] Modems -- TAPI required?
Not getting that error now -- don't ask me why. I did reinstall the modem.
But still nothing, don't hear the modem engage or dialtone and still everything fine with hyperterminal (on all com ports).
Currently, the modem is on com3 and here is the code...
when I press the CALL button it should call that number, right?
(You can see also that I was toying with PROCESS.START which is a nifty command...I may go that route and have some questions about it).
But, as a lesson -- would sure like to know what I'm doing wrong here...
Code:
Imports System
Imports System.Diagnostics
Imports System.io
Imports system.io.ports
Public Class Form1
Dim WithEvents serport2 As New IO.Ports.SerialPort
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CheckForIllegalCrossThreadCalls = False
With serport2
.PortName = "com3"
.BaudRate = 19200
.Parity = IO.Ports.Parity.None
.DataBits = 8
.StopBits = IO.Ports.StopBits.One
.Handshake = Handshake.None
.ReceivedBytesThreshold = 5
.ReadTimeout = 3000
End With
serport2.Open()
serport2.DtrEnable = True
serport2.RtsEnable = True
End Sub
Private Sub CALLOUT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CALLOUT.Click
Dim makecall As String
makecall = ("ATDT13172198539")
serport2.Write(makecall)
'Process.Start("hypertrm.exe")
'TextBox1.Text = (serport2.ReadTo("!%"))
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
End Class
Re: [2005] Modems -- TAPI required?
Code:
Dim MakeCall As String
MakeCall = "ATDT13172198539" & ControlChars.Cr 'most modems want to see CR not CRLF
serport2.Write(MakeCall)
is this 317-219-8539 your phone number? i might just call ;)
Re: [2005] Modems -- TAPI required?
I COULD KISS YA !
That is cool.
So far for step one -- now I'll try and look for RING and all the other good stuff and try to make things happen.
I don't think this is a voice modem (although it does say "speakerphone", I think that's a different animal).
Now, if I have a voice modem, I could theoretically tap into my soundcard, right?
Awesome D.
THANKS.
Re: [2005] Modems -- TAPI required?
I just saw your note about calling -- thought I heard my phone.
You know, another thing I want to do is compare all of this to actually using process.start and hyperterminal.
That would have it's advantages as the user could input everything right there and it sure pops up nicely.
One thing though --
How do I bring up a stored session? (*.ht file).
I tried different paths but didn't have any luck.
Can I bring up a stored session with process.start and dial it......or do I bring up hyperterminal first and then start the session? -- but how?