Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • TAPI events in PHP

    Hi all,

    I'm using PHP to connect to TAPI.
    To create a call, I do the following (it works fine):
    PHP Code:
    $tapi = new COM("TAPI.TAPI.1");
    $res $tapi->Initialize();
    $objCollAddresses $tapi->Addresses;
    for(
    $i 1$i <= $objCollAddresses->Count$i++)
    {
        if(
    strpos($objCrtAddress->AddressNameIP_OFFICE_PHONE) !== false)
        {
            
    $gobjAddress $objCollAddresses->Item($i);
        }
    }
    if(
    $gobjAddress != null)
    {
         
    $NewCall $gobjAddress->CreateCall("xxxxxxxxx"
              
    LINEADDRESSTYPE_PHONENUMBER
              
    LINEMEDIAMODE_INTERACTIVEVOICE);
         
    $NewCall->connect(false);
         
    sleep(50);
         
    $NewCall->Disconnect(DC_NORMAL);
    }
    $res $tapi->Shutdown(); 
    Now, I'm trying to receive events.

    First, I created the following class:
    PHP Code:
    class ITTAPIEventNotification
    {
        var 
    $terminated false;
        function 
    Event($TapiEvent$pEvent)
        {
            print 
    "ITTAPIEventNotification::Event CALLED!\n";
            
    $this->terminated true;
        }

    Then I do the following:
    PHP Code:
    $events = new ITTAPIEventNotification();
    $res com_event_sink($tapi$events"Event");
    $tapi->EventFilter 0x1FFFF// all events 
    And then I add the following at the end of my script:
    PHP Code:
    while(!$events->terminated)
    {
        print 
    ".";
        
    com_message_pump(4000);

    But I'm not receiving any event. I'm doing anything wrong? Can someone point me in the rigth direction?
    BTW, the parameter sinkinterface in com_event_sink that I should use is "Event"?

    Thanks

  • #2
    I'm not familiar with the TAPI COM object, but I'll guess:

    1. Do you need to open the line first?
    2. Are you hitting the PHP execution timeout before any events arrive?

    Comment


    • #3
      Originally posted by Palitto Consulting View Post
      1. Do you need to open the line first?
      What do you mean by open the line?
      Originally posted by Palitto Consulting View Post
      2. Are you hitting the PHP execution timeout before any events arrive?
      No. This is PHP CLI.

      Comment


      • #4
        See this page: ITTAPI::RegisterCallNotifications Method (Windows)

        Comment

        Working...
        X