CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Jan 2001
    Posts
    12

    TAPI Programming

    How to develop an application that can receive
    messages from PBX System using TAPI !
    Urgent !


  2. #2
    Join Date
    Jan 2001
    Posts
    60

    Re: TAPI Programming

    If your PBX supports TAPI 3.0, your application can communicate with the PBX by using the TAPI 3.0 Call object. Otherwise, your application must use the programming interface supported by your PBX.

    The TAPI object is the application's entry point to TAPI 3.0. This object represents all telephony resources to which the local computer has access, allowing an application to enumerate all local and remote addresses.

    The TAPI Addresses collection contains all of the currently available Address objects. Each Address object represents an entity that can make or receive calls. An application uses this object to get and set information concerning the address, such as whether it has caller ID support. Capabilities can be retrieved from an Address object, such as media and terminal support. An application can wait for a call on an Address object, or can create an outgoing call object from an Address object.

    To retrieve the TAPI object and Addresses collection

    Retrieve an instance of the DispatchMapper object.
    1. Use the DispatchMapper.QueryDispatchInterface method to retrieve an instance of the CallInfo object. When calling QueryDispatchInterface, you must specify the GUID of the CallInfo object and a reference to the ITBasicCallControl object.
    2. Use the CallInfo.Address property to retrieve an instance of the Address object.
    3. Use the Address.TAPIObject property to get an instance of the TAPI object.
    4. Use the TAPI.Addresses property to access the Addresses collection.

    VBScript to get the TAPI object and TAPI Addresses collection:


    IIDCallInfo = "{350F85D1-1227-11D3-83D4-00C04FB6809F}"
    Set myDispMapper = CreateObject("DispatchMapper.DispatchMapper.1")
    Set myBasicCallControl = window.external.ITBasicCallControl
    Set myCallInfo = myDispMapper.QueryDispatchInterface(IIDCallInfo, myBasicCallControl)
    Set myAddress = myCallInfo.Address
    Set myTAPI = myAddress.TAPIObject
    Set myAllAddresses = myTAPI.Addresses
    For Each pITAddress in myAllAddresses
    stringOutput = "AdressName " & pITAddress.AddressName &
    "Dial. Addr " & pITAddress.DialableAddress
    MsgBox stringOutput
    window.external.LogCustomField.DefaultValue = stringOutput
    window.external.log()
    window.external.LogCustomField.DefaultValue = ""
    Next
    [/ccode/

    JScript to get the TAPI object and TAPI Addresses collection:
    [ccode]

    IIDCallInfo = "{350F85D1-1227-11D3-83D4-00C04FB6809F}";
    IIDTapi = "{B1EFC382-9355-11d0-835C-00AA003CCABD}";
    myDispMapper = new ActiveXObject("DispatchMapper.DispatchMapper.1");
    myBasicCallControl = window.external.ITBasicCallControl;
    myCallInfo = myDispMapper.QueryDispatchInterface(IIDCallInfo, myBasicCallControl);
    myAddress = myCallInfo.Address;
    myTAPI = myAddress.TAPIObject;
    myAllAddresses = myTAPI.Addresses;
    for(i = 1; i <= myAllAddresses.Count; i++) {
    pITAddress = myAllAddresses.Item(i);
    stringOutput = "AdressName " + pITAddress.AddressName +
    "Dial. Addr " + pITAddress.DialableAddress;
    window.external.LogCustomField.DefaultValue = stringOutput;
    window.external.log();
    window.external.LogCustomField.DefaultValue = "";
    }




    The scripting code here suppose an application receives a call that has come through a PBX to a voice board. Using a table, the application determines that the voice board received the call on port 3, and that the call came from extension 105 on the PBX. Using the code described in the previous examples, the application creates an object for the address number 105 on the PBX. The application also obtains the called ID of the current call and stores the ID in a global session variable.

    At this point the application can perform several telephony operations. For example, a call center or T1-based application can use the PBX rather than the voice board to transfer the call to an agent, if necessary. After the call is disconnected, the application can use its post-call page to keep track of the call as it moves through the PBX from one agent to another.

    The application calls the "Abandon" method only when the call finally leaves the PBX.

    After Web telephony or an application answers a call, the call continues until one of the following disconnection events occurs:

    1. The caller hangs up the phone.
    2. The caller navigates to an application page that causes the call to disconnect. The page either contains a script that calls the Disconnect method on the ITBasicCallControl object, or the engine reaches the end of the HTML content and there is nothing more for the engine to render.
    3. The call is transferred either by a script that calls a method on the ITBasicCallControl object, or by the caller pressing the operator key.
    4. An error occurs that causes Web telephony to disconnect. For example, the application tries to navigate to a file that does not exist.

    When the call is disconnected for whatever reason, Web telephony navigates to the post-call page of the application. At this point, the phone line and other telephony resources allocated for the call are freed and made available for new incoming calls. However, the resources that Web telephony allocated for the application, including the Session object, remain available.

    The WTE application should use its post-call page to perform any necessary post-call processing on the information gathered from the caller or stored in the Session object. For example, your post-call page can use the LastVisitedPage and LastVisitedTagID properties of the Session object to identify the last HTML page and element that the caller visited before the call was disconnected. You can use this information in a program that processes the post-call page according to the caller's location in the WTE application when the disconnection occurred.

    An application should use its post-call page to perform any lengthy processing operations that would otherwise tie up the line or keep the caller waiting.

    When no post-call page is specified, a default post-call page is rendered. This page calls the Abandon method and nothing more.

    When the post-call-page processing is finished, the application must call the Abandon method. Calling Abandon causes Web telephony to end the session, destroy the Session object, and free all other resources that it allocated for the call.

    To call the Abandon method:
    <script language=vbscript>
    external.abandon
    </script>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured