FreePBX | Register | Issues | Wiki | Portal | Support

Sccp/skinny support in freepbx 12


(Dave Burgess) #21

I wrote that originally to convert a working file-based system to a real-time database view. It should create a reasonably close table set in your MySQL database.


#22

Ok, Dave, I worked at little spots over it and now all is up&running with my 7961+7914 and 7960.
I leaved a SIP cisco working on the PBX in order to compare functionalities and, YES, sccp can use the phones at 100%, SIP not. I.e. BLF are working in different ways from sccp to sip. WIth SIP I can see a busy phone only when it places a call, with sccp I can see it busy when it opens the line.

The work I have to do now is to convert the config to mysql and use the web based sccp_manager.
About that I have a question: how can I, if needed, roll back to the “text file” way?

Let me say and tell me if I’m right:

  1. delete “sccpdevice => mysql,asterisk,sccpdevice” from extconfig.conf
  2. delete “sccpline => mysql,asterisk,sccpline” from extconfig.conf
  3. delete a table (which one?) from the mysql asterisk DB

Thank you!


(Dave Burgess) #23

Converting “back” should be as simple as removing the database definitions from the sccp.conf file and removing the extconfig entries.

I’ve been thinking about how to convert the sccp.conf to realtime. I’m sure the conversion can be done. The config file is just name=value pairs, so making that work is simple enough. Getting the real-time engine to recognize the database table (in preference over the sccp.conf file) is the only part I’m not completely clear on. Note that I mean JUST the sccp.conf file - converting the rest to real-time is trivial.

If you check in the “extra” ("contrib, maybe?) directories in the chan_sccp_b distribution, there should be a script that converts all of the sccp.conf files to database tables. I wrote it before I got started on the FreePBX module.


(Gavin Smith) #24

Can I ask how you got this working.
I have just installed freePBX from the latest distro, and being totally new to it, I’m not even 100% I have a realtime database running though I think it is.

I have installed chan_sccp2 correctly and can connect a cisco 7960G manually via the sccp.conf file and successfully make and receive calls.

But I would really like to be able to set the phones up through the FreePBX web GUI.

From what I can tell I am having the same problem you were having:

6. Exception
/­var/­www/­html/­admin/­libraries/­utility.functions.php 205
5. die_freepbx
/­var/­www/­html/­admin/­modules/­sccp_manager/­install.php 36
4. include_once
/­var/­www/­html/­admin/­libraries/­modulefunctions.class.php 2418
3. module_functions _doinclude
/­var/­www/­html/­admin/­libraries/­modulefunctions.class.php 2370
2. module_functions _runscripts
/­var/­www/­html/­admin/­libraries/­modulefunctions.class.php 1926
1. module_functions install
/­var/­www/­html/­admin/­page.modules.php 284
0. include
/­var/­www/­html/­admin/­config.php 389
Exception
HELP
Can not REPLACE defaults into sccpdevmodel table ::
/var/www/html/admin/libraries/utility.functions.php
	1		if(is_object($extended_text) && method_exists($extended_text,"getMessage")) {
	2			$e = $extended_text;
	3			$extended_text = htmlentities($e->getMessage());
	4			$code = $e->getCode();
	5			throw new \Exception($text . "::" . $extended_text,$code,$e);
	6		} else {
	7			$extended_text = htmlentities($extended_text);
	8			throw new \Exception($text . "::" . $extended_text);
	9		}
	10	}

Server/Request Data`

Please, if you can help I’d appreciate it.


(Dave Burgess) #25

If you’re not using the sccp databases, you can’t modify the sccpdevmodel table. There are no config files for this - it is a database-only feature.


(Gavin Smith) #26

Ok so how do I use or setup the sccp databases?


(Dave Burgess) #27

Rather than trying to retype all of the stuff from the Wiki, here’s the link to the top level.

Setting up chan-sccp-b Wiki Pages

Most of this applies to Asterisk (more than it does FreePBX). I also have a new version of the FreePBX management software that I need to upload to Github and send to Lorne.

None of this has been tested with Chan-SCCP2, so your mileage may vary.


(Dave Burgess) #28

Those requirements still apply. Note that I have made a few changes to the management software since I released it.

These were also the MINIMUM requirements. The management software is designed to work as a supplement to FreePBX - it manages all of the files and databases outside of the work that FreePBX does. For example, it doesn’t (yet) include the hooks to update the Asteriskinfo program to show SCCP phones connections. It also doesn’t include hooks for the Firewall (allowing port 2000 on the internal network).

The requirement for the /tftpboot directory running on the PBX Is to manage all of the phone files. There are a couple of weird cases in the TFTP stuff that doesn’t work reliably (creating new files is kind of fraught with peril, for example).


(Gavin Smith) #29

I have followed those instructions and got the chan-sccp-b working correctly, I can manually set up the sccp.conf files, etc and make & receive calls

The only part I can’t seem to get working is the installation of the sccp manager


(Dave Burgess) #30

If you used the 1.1 version from the FreePBX website, there are a few errors in there. I’ve got an updated version on GitHub, and will be releasing a new version as soon as I figure out how to connect to the “hooks” in the firewall and asteriskinfo programs.

On Github, just look for my name. The program should be pretty easy to find. If you have any more trouble, you can contact me via PM or you can send me a message through GitHub.


(Gavin Smith) #31

Ok sorry to be a pain but I manually installed the tables into the asterisk db and the manager installed correctly.

Now I’m having one last (hopefully) problem…

ErrorException (E_WARNING)
mysql_fetch_row() expects parameter 1 to be resource, boolean given
/­sccp_manager/­functions.inc.php on line 880

$res = mysql_query("SELECT loadinformationid,loadimage 
		FROM sccpdevmodel
		$where
		ORDER BY loadinformationid");    
 
while ($row = mysql_fetch_row($res)) {
	if (strtoupper($model) == 'DEFAULT') {
	    $loadlist[$row[0]] = $row[1];

also line 466

 global $db;

    $res = mysql_query("SELECT model, dns, buttons, loadimage
			FROM sccpdevmodel
			WHERE dns > 0
			ORDER BY model ");
			
    while ($row = mysql_fetch_row($res)) {
	$modelData['model'][] = $row[0];
	$modelData['dns'][] = $row[1];

Thanks


(Dave Burgess) #32

Thre’s no data in your table, or the table’s read permissions aren’t set up for the Asterisk database user for that table.


(Andrew Nagy) #33

This is why you should use the standard database abstraction layers of FreePBX. Using functions like mysql_query are not only deprecated but are bad practice and they share the global resource without any regard for the abstraction layer. Furthermore these functions themselves were removed in PHP 7.0.


(Rob Thomas) #34

Ah. There aren’t any. That’s still to be done. Sorry. So for the moment, you’ll just have to manually add a service on install and remove it on uninstall.

However:

Woah there, that’s not right, how is that even working? Everything needs to be done with PDO now, so you’d be doing something like…

$query = \FreePBX::Database()->query('SELECT ...')
$res = $query->fetchAll();
foreach ($res as $row) { 
    ... stuff
}

You should jump into the FreePBX Dev IRC channel and we can probably make your life a lot easier 8)

Edit: Oh, I’m a big fan of the inbuilt kvstore too. The documentation is here:

http://wiki.freepbx.org/display/FOP/BMO+DB_Helper


(Dave Burgess) #35

When I originally wrote this (three or four years ago?) we didn’t have PDO. Sorry, but I’ve been busy with other things since then - updating the SCCP Manager hasn’t made it to the top of my list in a while. I hate it when real life gets in the way of doing stuff I like.


(Gavin Smith) #36

Ok so I changed

function sccp_get_model_data(){
    global $db;
	
$res = mysql_query("SELECT model, dns, buttons, loadimage
			FROM sccpdevmodel
			WHERE dns > 0
			ORDER BY model ");
			
while ($row = mysql_fetch_row($res)) {
	$modelData['model'][] = $row[0];
	$modelData['dns'][] = $row[1];
	$modelData['buttons'][] = $row[2];
	$modelData['loadimage'][] = $row[3];
}
return $modelData;
}

to

$query = \FreePBX::Database()->query('SELECT model, dns, buttons, loadimage
			FROM sccpdevmodel
			WHERE dns > 0
			ORDER BY model');

$res = $query->fetchAll();
foreach ($res as $row) { 
    $modelData['model'][] = $row[0];
	$modelData['dns'][] = $row[1];
	$modelData['buttons'][] = $row[2];
	$modelData['loadimage'][] = $row[3];
}
return $modelData;

Now I am getting Call to undefined function sccp_get_model_data()

<?php
    $modelData = sccp_get_model_data();
    $numModels = count($modelData['model']);
    $addonData = sccp_get_addon_data();
    $numAddons = count($addonData['model']);

?>

Any advice?


(Dave Burgess) #37

I’ll try to get to it this weekend.


(Dave Burgess) #38

A quick aside - you know that this module has nothing to do with actually getting the phones working, right?

Once you’ve installed the chan_sccp_b module and included in the modules.conf ( or enabled it through the module manager interface) and updated the sccp.conf file to match your phones, the module will read the config file and the phones should just work.


(Gavin Smith) #39

Yes I know that thanks.

I just think it’s a great module and want to help get it fixed up (there’s a few errors I’ve fixed in the install.php if you want them?)


(Dave Burgess) #40

If you have branched off the Github source, you should find that lots of the errors from the FreePBX website version have been fixed there already.

If you are still finding errors from the latest GitHub version, I’d really like to know that - I don’t have a system set up where I don’t already have everything installed, so everything just works for me.