basically i m making a phone dialer, whose work is to dial a phone number using pabx in .net. i hv made it and its working properly when i dial a number in local network. but when i dial a number through pabx(using prefix #1) nothing is happened.i also provide my code following. plz help me to solve this problem.
Imports
MSCommLib
Imports
System.Windows.Forms
Public
Class Form1
Dim MSComm1 As New MSComm
Dim CancelFlag
Dim a As Application
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dial(TextBox1.Text)
End Sub
Private Sub Dial(ByVal Number As String)
Try
Dim DialString As String, FromModem As String, dummy As String
' AT is the Hayes compatible ATTENTION command and is required to send commands to the modem.
' DT means "Dial Tone." The Dial command uses touch tones, as opposed to pulse (DP = Dial Pulse).
' Numbers is the phone number being dialed.
' A semicolon tells the modem to return to command mode after dialing (important).
' A carriage return, vbCr, is required when sending commands to the modem.
DialString =
"ATDT" + Number + ";" + vbCr
' Communications port settings.
' Assuming that a mouse is attached to COM1, CommPort is set to 2
MSComm1.CommPort = 1
MSComm1.Settings =
"9600,N,8,1"
' Open the communications port.
Try
MSComm1.PortOpen =
True
Catch ex As Exception
MsgBox(
"COM" & MSComm1.CommPort & ": not available. Change the CommPort property to another port.")
Exit Sub
End Try
' Flush the input buffer.
MSComm1.InBufferCount = 0
' Dial the number.
MSComm1.Output = DialString
' Wait for "OK" to come back from the modem.
Do
'dummy = a.DoEvents()
' If there is data in the buffer, then read it.
If MSComm1.InBufferCount Then
FromModem = FromModem + MSComm1.Input
' Check for "OK".
If InStr(FromModem, "OK") Then
' Notify the user to pick up the phone.
Beep()
MsgBox(
"Please pick up the phone and either press Enter or click OK")
Exit Do
End If
End If
' Did the user choose Cancel?
If CancelFlag Then
CancelFlag =
False
Exit Do
End If
Loop
' Disconnect the modem.
MSComm1.Output =
"ATH" + vbCr
' Close the port.
MSComm1.PortOpen =
False
Catch ex As Exception
End Try
End Sub
End
Class