TAPI events in PHP – PHP

  php

Q(Question):

Hi all,

I’m using PHP to connect to a TAPI phone.
To create a call, I do the following (it works fine):

$tapi = new COM("TAPI.TAPI.1");
$res = $tapi->Initialize();
$objCollAddresses = $tapi->Addresses;
for($i = 1; $i <= $objCollAddresses->Count; $i++)
{
if(strpos($objCrtAddress->AddressName, IP_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:

class ITTAPIEventNotification
{
var $terminated = false;
function Event($TapiEvent, $pEvent)
{
print "ITTAPIEventNotification::Event CALLED!\n";
$this->terminated = true;
}
}

Then I do the following:

$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:

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?

Thanks

A(Answer):

Anyone knows if the parameter sinkinterface in com_event_sink that I should use is "Event"?

A(Answer):

Did you ever work this out? I am trying to do the same, and haven’t got any further.

A(Answer):

Hi mpcaddy, sorry to inform you, but my conclusion back in 2010 was that this is impossible to do in PHP. I had to switch to C++ and implement everything using TAPI3.
By the way, TAPI&TAPI3 is a outdated microsoft technology, a complete nightmare! Run away from this if you can!

A(Answer):

@lgrave

Yeah I wanted to run away from it, the only problem being is the phone system I want to interface with (Samsung OfficeServ 7200) the only way for receiving the information is through TAPI provided via their OpenTSP driver through their OfficeServ Link software. So I am kind of stuck with it unfortunately.

A(Answer):

@mpcaddy

Enjoy 🙂 https://github.com/lgrave/TapiAdapter

A(Answer):

Hello @lgrave,
First off, I would like to say thank you for making your hard work open source. But am yet to enjoy it tho :), I just can’t seem to get the TapiAdapter.exe to run. It just exits everytime I run it. Is there something I need to do before running TapiAdapter.exe. It took me a while to get it to compile, but now frustration is setting in. Am hoping its something little am missing.
Any help is greatly appreciated.
Thanks!

LEAVE A COMMENT