I'm using PHP to connect to a TAPI phone.
To create a call, I do the following (it works fine):
Expand|Select|Wrap|Line Numbers
- $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();
First, I created the following class:
Expand|Select|Wrap|Line Numbers
- class ITTAPIEventNotification
- {
- var $terminated = false;
- function Event($TapiEvent, $pEvent)
- {
- print "ITTAPIEventNotification::Event CALLED!\n";
- $this->terminated = true;
- }
- }
Expand|Select|Wrap|Line Numbers
- $events = new ITTAPIEventNotification();
- $res = com_event_sink($tapi, $events, "Event");
- $tapi->EventFilter = 0x1FFFF; // all events
Expand|Select|Wrap|Line Numbers
- while(!$events->terminated)
- {
- print ".";
- com_message_pump(4000);
- }
Thanks