Telephony Event Notifications of Polycom Phones Using PHP

All current Polycom phones like the Polycom SoundPoint IP, the Polycom VVX 500/1500 or the Polycom SpectraLink series support event notifications. This is a great feature where the phone is sending a POST request to a previously defined URL for various telephony events.

While developing a PHP server application that should handle some of these events, I came across the problem that there is no data in the PHP array $_POST although the script is called by the Polycom phone correctly.

After doing some investigation I found out that the data is not sent (for whatever reason) as “normal” POST key value pair, but just as raw POST data. Obviously PHP is therefore not able to add this raw POST data to the array $_POST.

Here is the way you can get the raw POST data anyway:

// Make sure that there really is some raw POST data available
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
	// Now we can read the raw POST data from PHP standard input
	$rawPostData = trim(file_get_contents('php://input'));
}

As a result you have the XML data that was sent by the Polycom phone in the variable $rawPostData.

Did you also have problems receiving Polycom event data?

This post is also available in Deutsch.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>