excaliburpartners / polycomphones

FreePBX module for provisioning Polycom phones running UC software

Home Page:www.excalibur-partners.com/56-polycomphones-freepbx-module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FreePBX 14 Compatibility

ScorchedHands opened this issue · comments

module doesn't populate extensions dropdown when adding a line to a phone in FreePBX 14.

The issue seems to be that the SQL in functions.inc.php/polycomphones_dropdown_lines only selects devices/users of "tech" type "sip". FreePBX 14 encourages you to use pjsip as the default. updating the SQL as follows fixes this issue.

original code:

	$results = sql("SELECT devices.id, devices.description, users.extension, users.name FROM devices 
		LEFT OUTER JOIN users on devices.user = users.extension
		WHERE tech = 'sip' ORDER BY devices.id",'getAll',DB_FETCHMODE_ASSOC);

modified code

	$results = sql("SELECT devices.id, devices.description, users.extension, users.name FROM devices 
		LEFT OUTER JOIN users on devices.user = users.extension
		WHERE tech IN ('sip','pjsip') ORDER BY devices.id",'getAll',DB_FETCHMODE_ASSOC);

I'd make a pull request, but I'm in the middle of rebuilding a pbx that has to go live in a few hours and do not have the time right now.

I will update this issue if i find any side effects or other incompatibilities.

Found another issue with using pjsip on newer FreePBX. you cannot reboot the phones since the code uses the chan_sip command instead of the pjsip command. Can be updated to the following:

function polycomphones_checkconfig($id = null)
{
	global $db, $astman;

	$id = polycomphones_array_escape($id);

	$results = sql("SELECT MIN(deviceid) AS deviceid FROM `polycom_device_lines`
		WHERE deviceid IS NOT NULL " . (count($id) > 0 ? "AND id IN ('".implode("','", $id)."')" : "") . "
		GROUP BY id",'getAll',DB_FETCHMODE_ASSOC);
	
	foreach($results as $result)
	{
		$astman->send_request('Command', array('Command' => 'sip notify polycom-check-cfg '.$result['deviceid']));
		$astman->send_request('Command', array('Command' => 'pjsip send notify polycom-check-cfg endpoint '.$result['deviceid']));
	}
}

Thanks for the report! This should be resolved in the latest release.