AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Comunicación / Funciones de teléfono
  • Principle
  • Steps to follow
  • Example
  • Example used to manage the incoming calls in the main thread
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Principle
The management of the incoming calls is performed in a specific "thread". When an incoming call is detected, the procedure associated with the thread is run. The management of the call is performed in this procedure.
Steps to follow
To manage the incoming calls in a WINDEV or WINDEV Mobile application:
  1. Define (if necessary) the TAPI device on which the calls must be detected. Use the functions:
    tapiCapabilityReturns the characteristics of a telephony device.
    tapiDeviceSelecciona el dispositivo TAPI que se utilizará durante las siguientes operaciones de telefonía:
    tapiDeviceListEnumera los dispositivos compatibles con TAPI 2.0 y TAPI 3.1 instalados en el ordenador actual.
  2. Start the detection of incoming calls with tapiListen. This function runs a specific WLanguage procedure. This procedure will be automatically run when an incoming call is detected.
  3. In this procedure, you can:
    • find out the status of the call via the following constants:
      • telLigneOccupée: Line is currently busy.
      • telLigneDécrochée: The line is connected.
      • telLineNumber: Dialing in progress.
      • telLigneTonalité: Line receives dial tone
      • telLigneRaccrochée: The correspondent has hung up
      • telLineAttendAnswer: The call is dialed: search for the correspondent
      • telLigneSonnerie: Ringing tone in progress at the correspondent's address
      • telNewCall New call detected waiting to be answered or rejected.
      • telInformationAppel: Additional information (number presentation) is available at. In most cases, this information will be available after the fist ring.
    • manage the call via the following functions:
      • finding out the characteristics of the incoming call:
        tapiCallDuringDevuelve la duración de la llamada (diferencia entre la fecha y hora de inicio de la llamada y la fecha y hora de finalización de la llamada).
        tapiCallEndDevuelve la fecha y hora de fin de llamada.
        tapiCallerIDSirve para averiguar el número de teléfono llamante (el que llama).
        tapiCallIsOverPermite saber si la llamada entrante o saliente ha finalizado.
        tapiCallStartDevuelve la fecha y la hora del inicio de la llamada (llamada entrante o saliente).
      • perform specific operations:
        tapiAnswerCallResponde a una llamada entrante detectada.
        tapiKeyPressedReturns the history of the keys pressed on the phone keypad since the last call to tapiKeyPressed.
        tapiPlayPlays a sound file (.WAV) for the specified line.
        tapiRecordGraba la comunicación actual como archivo ".WAV".
        tapiSendKeyPermite simular el uso de las teclas del teléfono.
        tapiStopDetiene la lectura de un mensaje pregrabado (tapiPlay).

        Caution:
        This WLanguage procedure being run in a thread, all the constraints of the threads must be complied with (no window opening, no timer management, no event management, ...). For more details, see Managing threads with WINDEV.
        We recommend that you limit the number of processes performed in this procedure. Indeed, during the duration of the call, the detection of the other calls (as well as all the telephony events) is frozen. If long processes must be performed, we advise you to process the call in the main thread of the application (see the example below).
  4. To end the session for detecting the incoming calls, use tapiStopCallDetection.
Example

Example used to manage the incoming calls in the main thread

  • Code for declaring the global variables of the window used for call detection. The different events used to manage the calls in the main thread of the application are declared in this code.
    GLOBAL 
    gnEventID is int 
    // Implement an event to manage the incoming calls in popup 
    IF Event("DetectedCall", "*.*", "PhoneCall") = 0 THEN 
    	Error("Unable to manage the popup for call detection", ErrorInfo()) 
    END 
    IF Event("EndDetectedCall", "*.*", "EndPhoneCall") = 0 THEN 
    	Error("Unable to manage the popup for call detection", ErrorInfo()) 
    END 
    IF Event("DetectedCallIdentifier", "*.*", "PhoneCallInfo") = 0 THEN 
    	Error("Unable to manage the popup for call detection", ErrorInfo()) 
    END
  • Window initialization code: this code starts the call detection procedure.
    // Start the service for call detection 
    IF tapiListen("IncomingCall", tapiOptionMediaModeFax, "CallDetection") THEN 
    	// The service for call detection is started 
    	Message("Call detection enabled") 
    ELSE 
    	// The service for call detection is not started 
    	 Error("Unable to start the call detection" + CR + ...
    			"Error details:"+ CR + ErrorInfo(errMessage)) 
    END
  • Procedure for call detection:
    This procedure is used to detect the incoming calls.
    For each incoming call, the characteristics of the call are transmitted to the main thread by PostMessage.
    PROCEDURE CallDetection(nServiceID, nCallID, nStatus) 
    // WARNING: 
    // The processes performed by this procedure are called from a thread 
    // The display should be done via the main thread
    // (this is why PostMessage is used) 
    // The "Trace" function must be used to debug this process 
    // detection of incoming calls 
    SWITCH nStatus 
    	// Detect a new call: 
    	// Note: More information will be available after at least one ring 
    	CASE tapiNewCall: 
    	  // Signal to the main window that a new call is arriving 
    	  // to open a popup 
    	  PostMessage(Handle(Window_Call), "PhoneCall", nCallID, nStatus) 
    	  // Information about the call is available 
    	CASE tapiCallInformation: 
    	  // Signal to the main window that a new call is arriving 
    	  // to open a popup 
    	  PostMessage(Handle(Window_Call), "PhoneCallInfo", nCallID, nStatus) 
    	  // The line was hung up 
    	CASE tapiLineDisconnected: 
    	  // Signal to the main window that a new call is arriving 
    	  // to open a popup 
    	  PostMessage(Handle(Window_Call), "PhoneCallEnd", nCallID, nStatus) 
    END
Versión mínima requerida
  • Versión 9
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local