Saludos. Quisiera saber si me puedes ayudar a resolver el problema de realizar una llamada telefónica desde Access a través del modem. El problema es que necesito CONTROLAR la llamada en su totalidad: - Necesito detectar si la línea está ocupada para notificar al usuario. - Necesito que el usuario pueda colgar en cualquier momento, inclusive si tiene el auricular levantado, ya que comúnmente es el modem el que cuelga, pero la línea sigue activa.
- Necesito detectar si una llamada se realizó con éxito para tomar el tiempo de su duración, por lo tanto, necesito también saber cuando la otra persona cuelga. Como puedes ver, no es un problema sencillo y estaré completamente agradecido por toda la ayuda que me puedas proporcionar. ME URGE! GRACIAS.
Como bien dices, el problema no parece sencillo. La unica documentación que he podido encontrar esta en inglés y es del KB para access 7.0 INF: How to Dial a Phone Number Using MS Access 7.0/97 Article ID: Q148857: 1. Abrir el ejemplo Northwind.mdb (tambien sirve Neptuno.mdb). 2. Crear un modulo and type the following line in the Declarations section: NOTE: You may have some Microsoft Windows API functions defined in an existing Microsoft Access library; therefore, your declarations may be duplicates. If you receive a duplicate procedure name error message, remove or comment out the declarations statement in your code. NOTE: All Declare statements must be typed exactly as shown, including capitalization, because Win32 names are case-sensitive. To help eliminate errors by you or others who use your Declare statements, create Alias clauses for Declare statements that do not have an existing Alias. As long as the Alias is correctly spelled and capitalized, it doesn't matter how the function name is capitalized. Option Explicit Declare Function WriteFile& Lib "kernel32" _ (ByVal hFile As Long, lpBuffer As Any, _ ByVal nNumberOfBytesToWrite&, _ lpNumberOfBytesWritten&, ByVal lpOverlapped&) Declare Function CreateFile& Lib "kernel32" Alias "CreateFileA" _ (ByVal lpFileName$, ByVal dwDesiredAccess&, _ ByVal dwShareMode&, ByVal lpSecurityAttributes&, _ ByVal dwCreationDisposition&, ByVal dwFlagsAndAttributes&, _ ByVal hTemplateFile&) Declare Function CloseHandle& Lib "kernel32" (ByVal hObject&) Declare Function FlushFileBuffers& Lib "kernel32" (ByVal hFile&) ' The number of seconds to wait for the modem to dial before ' .. resetting the modem. If the phone hangs up prematurely ' .. try increasing this value by small increments. Public Const WAITSECONDS = 4 Public Const ID_CANCEL = 2 Public Const MB_OKCANCEL = 1 Public Const MB_ICONSTOP = 16, MB_ICONINFORMATION = 64 3. Type the following procedure: Function DialNumber(PhoneNumber, CommPort As String) ' PURPOSE: To dial a telephone number using the computer's modem ' ARGUMENTS: ' PhoneNumber: The telephone number to dial ' CommPort: The communications port the modem is connected ' To. Typically, modems are found on COM2, however, ' they can be configured for any COM port. ' ' EXAMPLE: ' Type the following in the Immediate window using a modem ' Connected to the COM2 port: ' '? DialNumber("555-1212", "COM2") ' ' *********************************************************** Dim Msg As String, MsgBoxType As Integer, MsgBoxTitle As String Dim bModemCommand(256) As Byte, ModemCommand As String Dim OpenPort As Long Dim RetVal As Long, RetBytes as Long, i as integer Dim StartTime ' Ask the user to pick up the phone. Msg = "Please pickup the phone and choose OK to dial " _ & PhoneNumber MsgBoxType = MB_ICONINFORMATION + MB_OKCANCEL MsgBoxTitle = "Dial Number" If MsgBox(Msg, MsgBoxType, MsgBoxTitle) = ID_CANCEL Then Exit Function End If ' Open the communications port for read/write (&HC0000000). ' Must specify existing file (3). OpenPort = CreateFile(CommPort, &HC0000000, 0, 0, 3, 0, 0) If OpenPort = -1 Then Msg = "Unable to open communication port " & CommPort GoTo Err_DialNumber End If ' Send the telephone number to the modem. ModemCommand = "ATDT" & PhoneNumber & vbCrLf ' Pack the string in a Byte array. For i = 0 To Len(ModemCommand) - 1 bModemCommand(i) = Asc(Mid(ModemCommand, i + 1, 1)) Next ' Write the string to the Com port. RetVal = WriteFile(OpenPort, bModemCommand(0), _ Len(ModemCommand), RetBytes, 0) If RetVal = 0 Then Msg = "Unable to dial number " & PhoneNumber GoTo Err_DialNumber End If ' Flush the buffer to make sure it actually wrote RetVal = FlushFileBuffers(OpenPort) ' Wait WAITSECONDS seconds for the phone to dial. StartTime = Timer While Timer < StartTime + WAITSECONDS DoEvents Wend ' Reset the modem and take it off line. ModemCommand = "ATH0" & vbCrLf ' Pack the byte array again. For i = 0 To Len(ModemCommand) - 1 bModemCommand (i) = Asc(Mid(ModemCommand, i + 1, 1)) Next RetVal = WriteFile(OpenPort, bModemCommand(0), _ Len(ModemCommand), RetBytes, 0) 'Flush the buffer again. RetVal = FlushFileBuffers(OpenPort) ' Close the communications port. RetVal = CloseHandle(OpenPort) Exit Function Err_DialNumber: 'This is not an On Error routine. Msg = Msg & vbCr & vbCr & _ "Make sure no other devices are using Com port " & CommPort MsgBoxType = MB_ICONSTOP MsgBoxTitle = "Dial Number Error" MsgBox Msg, MsgBoxType, MsgBoxTitle End Function 4. Open the Employees form in Design view. 5. Add a command button next to the Home Phone field and set the following properties: Command Button: Name: btnDialPhone Caption: Dial OnClick: =DialNumber([HomePhone], "COM2") 6. View the form in Form view. To dial an employee's home phone number, click the Dial button. References ========== For information about how to dial a phone number in Microsoft Access 1.x and 2.0, please see the following article in the Microsoft Knowledge Base: ARTICLE-ID: Q93696 TITLE : INF: How to Dial a Phone Number in Microsoft Access (1.x, 2.0) KBCategory: kbprg kbhowto KBSubcategory: PgmApi Additional reference words: 7.00 97 8.00 mapi NOTA: el ejemplo no lo he desarrollado por cuanto mi conexion es por cable.
Gracias Raul, de hecho ese artículo ya lo había revisado antes, pero como tal vez te darás cuenta en el código, el modem hace la llamada y después pasa el control al usuario (teléfono), por lo que no puede controlarse la llamada de principio a fin. De cualquier forma, agradezco tu atención a mi pregunta. Hasta luego.
Pues la verdad es que no tengo ni idea de cómo resolver todos los problemas que tienes. Lo siento. El único control que he utilizado alguna vez para realizar conexiones en red a través de Visual Basic ha sido el WinSock, pero éste no controla el estado de la llamada, sino el estado de la conexión en general y en función de las respuestas del servidor al que accede. Es decir, el WinSock establece Sockets (canales de comunicación entre diferentes puntos, uno de ellos a la escucha y el otro en transmisión de datos) pero presupone que el canal de comunicación (la llamada telefónica) está abierto. Ya te digo que no tengo ni idea de cómo resolver el problema que me planteas, porque en la vida me había encontrado con él, pero se me ocurre (y lo más probable es que te esté recomendado matar moscas a cañonazos) que podrías abrir la conexión utilizando la función ShellExecute de la API de Windows (o el propio Shell) para llamar a una conexión telefónica a redes. Ahora, con esto simplemente la tendríamos abierta, pero no tendríamos el control de la misma. En cualquier caso, estoy convencido que hay algo en la API de Windows que debe funcionar para lo que necesitas. Si lo encuentras.
Lo lamento pero no puedo ayudarte... Creo que sería necesario utilizar algún control ActiveX de Visual Basic e implementarlo en tu base de datos.. Pero esto requiere grandes dosis de conocimientos informáticos y no es posible (al menos para mí) resolvértelo a través de este medio... De todos modos, prueba a visitar la página guille.costasol.net Saludos. Jordi Pérez i Madern. Mataró (Barcelona)