Jump to content

How to make Skype Code work in php?


cougsmtl

Recommended Posts

Hi everyone one, im new to php. I have found code via another site, i have try to use it

on my contact_us.php page but when the page goes live, all the CODE turns to CODE lol

instead of showing a skype button.

 

Has anyone any ideas for this problem..

I am trying to use this code for a cre loaded site.

 

 Event sink:
class _ISkypeEvents {
  
  function AttachmentStatus($status) {
   echo ">Attachment status $status\n";
  }
  function CallStatus($call, $status) {
   echo ">Call $call->id status $status\n";
  }
}

Create a Skype4COM object:
$skype = new COM("Skype4COM.Skype");

Create a sink object:
$sink =& new _ISkypeEvents ();
$sink->convert = $skype->convert();

Connect to the sink:
com_event_sink($skype, $sink, "_ISkypeEvents");

Create a conversion object:
$convert = $skype->convert;
$convert->language = "en";

Start the Skype client, minimized and with no splash screen:
if (!$skype->client()->isRunning()) {
  $skype->client()->start(true, true);
}

If the user status is not "online", change user status to "offline":
if ($skype->currentUserStatus() == $convert->textToUserStatus("OFFLINE")) {  
  $skype->changeUserStatus($convert->textToUserStatus("ONLINE"));
}

Create a user object
$user = $skype->user("echo123");
echo "User " . $user->user name . " online status is " . $convert->onlineStatusToText($user->onlineStatus) . "\n";

Place a call
$call = $skype->PlaceCall($user->user name);

Wait for the call to be "in progress" and report an error if:
while ($call->status <> $convert->textToCallStatus("INPROGRESS")) {
  if ($call->status == $convert->textToCallStatus("FAILED") || 
    $call->status == $convert->textToCallStatus("REFUSED") || 
    $call->status == $convert->textToCallStatus("CANCELLED") || 
    $call->status == $convert->textToCallStatus("FINISHED") || 
    $call->status == $convert->textToCallStatus("BUSY"))
    die ("Call status " . $convert->callStatusToText($call->status));
  else
    com_message_pump (500);       
}

Send dtmf tones:
com_message_pump (10000);
if ($call->status == $convert->textToCallStatus("INPROGRESS")) $call->dtmf = "0";
com_message_pump (500);
if ($call->status == $convert->textToCallStatus("INPROGRESS")) $call->dtmf = "1";
com_message_pump (500);
if ($call->status == $convert->textToCallStatus("INPROGRESS")) $call->dtmf = "2";
com_message_pump (500);
if ($call->status == $convert->textToCallStatus("INPROGRESS")) $call->dtmf = "3";
com_message_pump (500);
if ($call->status == $convert->textToCallStatus("INPROGRESS")) $call->dtmf = "4";
com_message_pump (500);
if ($call->status == $convert->textToCallStatus("INPROGRESS")) $call->dtmf = "5";
com_message_pump (500);
if ($call->status == $convert->textToCallStatus("INPROGRESS")) $call->dtmf = "6";
com_message_pump (500);
if ($call->status == $convert->textToCallStatus("INPROGRESS")) $call->dtmf = "7";
com_message_pump (500);
if ($call->status == $convert->textToCallStatus("INPROGRESS")) $call->dtmf = "8";
com_message_pump (500);
if ($call->status == $convert->textToCallStatus("INPROGRESS")) $call->dtmf = "9";
com_message_pump (500);
if ($call->status == $convert->textToCallStatus("INPROGRESS")) $call->dtmf = "#";
com_message_pump (500);
if ($call->status == $convert->textToCallStatus("INPROGRESS")) $call->dtmf = "*";

Finish the call: 
if ($call->status <> $convert->textToCallStatus("FINISHED")) $call->finish();

Sleep:
com_message_pump (1000);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.