I am new to FreeSWITCH/Skypopen. I need to get the the status of a buddy using the skypopen module and PHP.
I am using the following PHP script to get the status.
<?php
$output = array();
$returnVar = "";
$result = exec('fs_cli -x "skypopen interface1 GET USER skypeusername ONLINESTATUS"', $returnVar, $output);
var_dump($result, $returnVar, $output);
?>
After executing the PHP file, I get the following response:
string(0) ""
array(2) {
[0]=>
string(68) "Using interface: globals.SKYPOPEN_INTERFACES[18].name=|||interface1|||"
[1]=>
string(0) ""
}
int(0)
It only returns Using interface: globals.SKYPOPEN_INTERFACES[18].name=|||interface1|||
, not the online status of "skypeusername".
But if I execute the command skypopen interface1 GET USER skypeusername ONLINESTATUS
in FreeSWITCH CLI, it returns the following:
freeswitch@internal> skypopen interface1 GET USER skypeusername ONLINESTATUS
Using interface: globals.SKYPOPEN_INTERFACES[18].name=|||interface1|||
2013-06-04 04:06:35.778928 [DEBUG] skypopen_protocol.c:1771 [1a3a11f|3d6ed64] [DEBUG_SKYPE 1771 ][interface1 ][IDLE,IDLE] SENDING: |||GET USER skypeusername ONLINESTATUS||||
2013-06-04 04:06:35.778928 [DEBUG] skypopen_protocol.c:209 [1a3a11f|3d6ed64] [DEBUG_SKYPE 209 ][interface1 ][IDLE,IDLE] READING: |||USER skypeusername ONLINESTATUS ONLINE|||
After doing some search in Google, I found that the skypopen module sends the result to its log file as DEBUG log.
Is there a way to get that response as result to the PHP script?
I don't have this module loaded, but judging by the source code of the skypopen_function in mod_skypopen.c, it seems that the skypopen API calls never really return anything except for the interfaces line that you mentioned.
On the other hand, it looks like the module fires a skypopen::incoming_raw
event every time it receives data from the Skype API, so you could try opening an ESL connection from PHP and listening for these.
You should first try it directly on fs_cli:
freeswitch@internal> /event plain CUSTOM skypopen::incoming_raw
Then:
freeswitch@internal> skypopen interface1 GET USER skypeusername ONLINESTATUS