How to run scripts

hello
i want to create database for sip.conf and extentions.conf file and i create database asterisk and tables by using sql:

CREATE TABLE sip (
id INT(11) DEFAULT -1 NOT NULL,
keyword VARCHAR(20) NOT NULL,
data VARCHAR(50) NOT NULL,
flags INT(1) DEFAULT 0 NOT NULL,
PRIMARY KEY (id,keyword)
);

CREATE TABLE extensions (
context CHAR(20) DEFAULT ‘default’ NOT NULL,
extension CHAR(20) NOT NULL,
priority INT(2) DEFAULT ‘1’ NOT NULL,
application CHAR(20) NOT NULL,
args CHAR(50),
descr TEXT,
flags INT(1) DEFAULT ‘0’ NOT NULL,
PRIMARY KEY(context, extension, priority)
);

CREATE TABLE globals (
variable CHAR(20) NOT NULL,
value CHAR(50) NOT NULL,
PRIMARY KEY(variable, value)
);
how to run these scripts to get data in these tables.
retrieve_extensions_from_mysql.pl
retrieve_sip_conf_from_mysql.pl

i follow this link voip-info.org/wiki/view/Asterisk … from+mysql to create these tables.

please help me to get solutions
regards
anita

Have not tested, but I guess that there is two ways of executing such a pearl script:

a. from she console or remote shell: type the name of the file with the full path name /directory/subdirectory/script.pl

b. from a web browser if the script is in the web server root area ip-number/pearlscript.pl

It might be required to change the user rights for the script to make it execute, something like chmod 777 pearlscript.pl

By the way, why do you want to make such a database ? Is it to make a dynamic asterisk installation that does not use static text based configuration files. I’m courious about this, because I don’t know how to do this. Please leave some links or some info. Could try to help if I am able to.

Sorry … incorrect from the console/remoteshell.

For testing I made this perl script and named it “perlscript.pl”:

print “Hello world\n”

Ant to execute from shell/console:

“perl perlscript.pl

Also tested in web browser:

10.0.0.44/perlscript.pl

Worked ok.

Please post any info about dynamic configuration of Asterisk (Would like to try that :smiley: )

hello arne22
i am new in asterisk and i want to make database for asterisk . so i just make the table as given above and i thought that the retrieve_sip_conf_from_mysql.pl will retrive all the sip client to my database.
Actually i don’t know about these script so sorry for that but want favour from u .
how to add sip client in sip table and extension table? we have to insert data manually fro our database or how…
i am just doing right now , is two connected two pc by using two soft phone as x-lite softphone.
so can u please help me for database as i said in above problem?

regards
anita

Excuse me I did not read your question well enough.

As far as I can see your script will do nothing else than just create the database (If it works like it should.)

Then there is the question how to transfer the datas to the database tables.

I am looking into a A@H installation just now. Actually this have a script
retrieve_extensions_from_mysql.pl already by default, and I also guess it has the other one.

Which Asterisk distro are you using ?

As I now understand it it should be possible to run these two scripts that is part of the distro to get the requiered transfer of datas.

I have two testinstallations in my home that I might be able to check this out on. (Asterisk@home and Astlinux).

You can find the two perl scripts via the command “locate retrieve_extensions_from_mysql.pl” and then also the name for the other file. If locate command does not work, run first command “updatedb”.

If you find the scripts you could try to execute them:

“perl retrieve_extensions_from_mysql.pl”

BUT – WHICH WAY WILL THESE DATAS FLOW FROM THE CONFIG FILES TO THE DATABASE, OR THE OTHER WAY ? I THINK IT IS A RISK FOR MESSING THINGS UP; SO IT SHOULD BE DONE ONLY ON A TEST INSTALLATION.

Please leave a few words if you find out anything …

The voip-info is a bit difficult to read:

  • quote:

There is a script in contrib/scripts called:
retrieve_extensions_from_mysql.pl

This can be used to write a file to be used to write out extensions.conf

  • unquote

I think that the last sentence can be understod in a 2-3 ways - so it should be only to run the scripts and to se what happens … (in a safe environment).

Arne.

Hi anita,
If you want to run scripts you can use the asterisk management interface . I have created a database for storing my phone numbers and I succeeded to make call to the numbers using AGI. For this I wrote a pgm in PHP. If you want more info you can PM me . My mail id is :
iijb007@yahoo.com

Regards
ijb