Solved(ish): SNG7 endpointman (OSS)

I just installed SNG7 and migrated over from a 2.11 based PIAF install. I’m confused as to the state of endpointman.

It does not show up in the GUI.

fwconsole ma listonline shows:
| endpointman | | Not Installed (Available online: 13.0.7.18) | GPLv2+ |

[[email protected] ~]# fwconsole ma install endpointman
Unable to install module endpointman:

I see a couple releases in 14.x on github, but not sure how to get them.

Go to the GUI module admin. Turn on unsupported and extended repos

Wouldn’t it be
fwconsole ma downloadinstall endpointman ?

1 Like

I tried what Andrew suggested before and it didn’t work.

I got it to load by “uploading” the ZIP file from github and it worked. That said, I removed it to test and NOW it says it’s available online.

shrugs

Yes. Excellent point. You can’t install something that doesnt exist. Youd have to either download or downloadinstall.

2 Likes

Okay, that problem is solved, but now I have a new one.


Importing CVS file devices_list.csv … Error: We support only CVS and TXT files, type file devices_list.csv no support!

Shouldn’t that be CSV and shouldn’t it accept the CSV I exported from another version?

Talk to the maintainer. cc @mitterhuemer

Hi,

i never worked with the export/import feature until now.
Anyway there needs to be developed something more because the IPEI field i added some weeks ago is also not included at the moment (i have forgotten to have an eye on the export feature.).

Hi @mhammett, @tm1000

The Export with IPEI is fixed and works, (pull request will be made when import works).

The import Feature does not work because FreePBX tells me about an Undefined Object.

The called add_device function is in functions.inc file.

    function add_device($mac, $model, $ext, $template=NULL, $line=NULL, $displayname=NULL) {
	$ipei = $_REQUEST['ipei'];
    $mac = $this->mac_check_clean($mac);
    if ($mac) {
        if (empty($model)) {
            $this->error['add_device'] = _("You Must Select A Model From the Drop Down") . "!";
            return(FALSE);
        } elseif (empty($ext)) {
            $this->error['add_device'] = _("You Must Select an Extension/Device From the Drop Down") . "!";
            return(FALSE);
        } else {
            if ($this->sync_model($model)) {
                $sql = "SELECT id,template_id FROM endpointman_mac_list WHERE mac = '" . $mac . "'";
                $dup = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC);

                if ($dup) {
                    if (!isset($template)) {
                        $template = $dup['template_id'];
                    }

                    $sql = "UPDATE endpointman_mac_list SET model = " . $model . ", template_id =  " . $template . " WHERE id = " . $dup['id'];
                    $this->eda->sql($sql);
                    $return = $this->add_line($dup['id'], $line, $ext);
                    if ($return) {
                        return($return);
                    } else {
                        return(FALSE);
                    }
                } else {
                    if (!isset($template)) {
                        $template = 0;
                    }

                    $sql = "SELECT mac_id FROM endpointman_line_list WHERE ext = " . $ext;
                    $used = $this->eda->sql($sql, 'getOne');

                    if (($used) AND (!$this->global_cfg['show_all_registrations'])) {
                        $this->error['add_device'] = "You can't assign the same user to multiple devices!";
                        return(FALSE);
                    }

                    if (!isset($displayname)) {
                        $sql = 'SELECT description FROM devices WHERE id = ' . $ext;
                        $name = & $this->eda->sql($sql, 'getOne');
                    } else {
                        $name = $displayname;
                    }

                    $sql = 'SELECT endpointman_product_list. * , endpointman_model_list.template_data, endpointman_brand_list.directory FROM endpointman_model_list, endpointman_brand_list, endpointman_product_list WHERE endpointman_model_list.id =  \'' . $model . '\' AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id';

                    $row = & $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC);

                    $sql = "INSERT INTO `endpointman_mac_list` (`mac`, `model`, `template_id`) VALUES ('" . $mac . "', '" . $model . "', '" . $template . "')";
                    $this->eda->sql($sql);

                    $sql = 'SELECT last_insert_id()';
                    $ext_id = & $this->eda->sql($sql, 'getOne');

                    if (empty($line)) {
                        $line = 1;
                    }

                    $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ipei`, `ext`, `line`, `description`) VALUES ('" . $ext_id . "', '" . $ipei . "', '" . $ext . "', '" . $line . "', '" . addslashes($name) . "')";
                    $this->eda->sql($sql);

                    $this->message['add_device'][] = "Added " . $name . " to line " . $line;
                    return($ext_id);
                }
            } else {
                $this->error['Sync_Model'] = _("Invalid Model Selected, Can't Sync System") . "!";
                return(FALSE);
            }
        }
    } else {
        $this->error['add_device'] = _("Invalid MAC Address") . "!";
        return(FALSE);
    }
}

The import function is in Endpointman_Advanced.class.php (author is not @tm1000 it is @vsc55

public function epm_advanced_iedl_import()
...
...   
//TODO: PENDIENTE ASIGNAR OBJ
    FreePBX::Endpointman()->add_device($mac, $model_id, $ext, 0, $line_id, $description); 
...
...

I dont know why FreePBX does not find this function when adding it. Maybe someone can help me fixing this.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.