Jump to content

Recommended Posts

I need to create config files for IP based phones.  There are several different models from the same manufacturer.  The file structure is pretty simple for all models, just some differences in how many buttons, etc.  IE:

 

Button6 = BLF

Button6value = 103

 

etc.

 

I want to start out with a template of ALL the different settings an use PHP to change the variables.  I also need to inject a username & password into the file for each specific phone with the name of the file being the MAC address of the phone.  I know some PHP, but this is beyone my skill set.  Can anyone provide a simple example of how I can do this ?

 

What I have to work with is a LAMP system based on Centos6.

 

Thanks in advance for any help

Have no idea what you are doing.

 

Have you ever designed a project before? Answered all the questions that can come up and design alternatives for them? Designed a db?

 

As for the db - think about the data items you want. Organize them. Design a record layout that collects the unique attributes of a "thing" and creates a logical "set" of data for it. Any attribute that can occur multiple times for a single thing should not be in this record, but be part of a related table that will hold multiple records for each "thing" in the primary table. For instance if a phone has multiple buttons that you want to keep info on, the primary record should point ot a 'button' table that will contain at least two fields/columns - one being the name/id of the button and the second being the attribute of that button. You may have multiple attributes but each of these button records will be connected to the primary record by something you define as the 'phone id', with that value stored in the primary record and in each of the secondary recs. This is how you design a db.

 

Coming up with your db design is the first course of action. Once you have that picture of things it can then be easier to see how you want to manipulate and that is where the coding exercise begins.

 

Are you an experienced IT person? Learning proper db design is a good thing - do seme reading on proper normalization of databases. Are you a programmer? If not you definitely need to do some reading up on php and how it works. Will save you an immense amount of time if you start by learning and not by coding.

  • Like 1

ginerjm,

 

I do have some limited experience in setting up a dB and some PHP writing.  I will take your comments to heart and start on the process of designing it and then implementing it.  I was looking for some guidance for just manipulating and editing a text file.  But clearly that is getting the cart before the horse.  

 

Thank you

I have not explained the ful scope of my project.  What I need is to create these config files for the phones on a LAMP based VoIP phone system.  the installer needs to be able to "create" the templates and then assign them to the phone files.  ALL the programming for the phone system is done from a webserver on the phone system itself.  The phones when they boot up look for a TFTP server and query it for the file based on the MAC address of the phone.  The phone then downloads the file and is configured by that file.  

I assume the TFTP server is the CentOS6 server on which you will also host the PHP code?

 

You can write files with:

file_put_contents

 

You can read the file with:

file use explode to separate Button6 and BLF, and Button6value and 103.

 

At this point you have the data from the file in an array and you can generate an interface for the user to change the function of each button.

Ginerjm

Thank you for all your help in guiding me toward my goal. I do not believe I asked for anyone to do this for me.

 

Ignace

Yes the tftp server is on the same server as the PHP code. I will check out those functions.

 

Thanks

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.