Auto create 2000 sip extensions

Hello all,

is there any way to auto-create 2000 sip extensions ?

Thanks,

thanks for your replies and sorry for my late answer.

@mousepad:
I fill the asterisk-DB in the same way like you, but I don’t want to click the “Apply”-Bar manually, it should be done automatically after writing the database by PHP-script.

btw. the “Apply”-bar only appears, when I made changes in FreePBX- webinterface manually.

@bubba:
I called the retrieve_conf out of my script, but it hadn’t the desired effect.
I also found a “retrieve_sip_conf_from_mysql.pl” in the same directory, but execution has the same effect as well.

Is there missing anything further or is it totally wrong.

Thanks for reply,

Robert

Yes, FreePBX retrieve the information from the asterisk database and then, rebuild the configuration files _additionnal.conf and then send the command reload to asterisk. That’s why you should write the sips to your database.

[code:1]

$sip_ext = 2000;

until ($sip_ext == 4000) {

info for the devices table

insert into devices values (’$sip_ext’,‘sip’,‘SIP/$sip_ext’,‘fixed’,’$sip_ext’,‘description’,’’,‘en’)

sip database structure: id, keyword, data, flags

here you do all the inserts for the sip table

here is the structure used by freepbx

#±----±------------±--------------±------+
#| id | keyword | data | flags |
#±----±------------±--------------±------+
#| 229 | account | $sip-ext | 0 |
#| 229 | accountcode | | 0 |
#| 229 | allow | | 0 |
#| 229 | callerid | Steve <229> | 0 |
#| 229 | callgroup | | 0 |
#| 229 | canreinvite | no | 0 |
#| 229 | context | from-internal | 0 |
#| 229 | disallow | | 0 |
#| 229 | dtmfmode | rfc2833 | 0 |
#| 229 | host | dynamic | 0 |
#| 229 | language | fr | 0 |
#| 229 | mailbox | 229@device | 0 |
#| 229 | nat | yes | 0 |
#| 229 | pickupgroup | | 0 |
#| 229 | port | 5060 | 0 |
#| 229 | qualify | yes | 0 |
#| 229 | record_in | Never | 0 |
#| 229 | record_out | Never | 0 |
#| 229 | secret | 1234| 0 |
#| 229 | type | friend | 0 |
#| 229 | username | 229 | 0 |
#±----±------------±--------------±------+

insert into sip values (’$sip_ext’,account,’$sip-ext’,‘0’)
insert into sip values (’$sip_ext’,‘accountcode’,’’,‘0’)
insert into sip values (’$sip_ext’,‘allow’,’’,‘0’)
insert into sip values (’$sip_ext’,‘callerid’,‘Name <$sip_ext>’,‘0’)
insert into sip values (’$sip_ext’,‘callgroup’,’’,‘0’)
insert into sip values (’$sip_ext’,‘canreinvite’,‘no’,‘0’)
insert into sip values (’$sip_ext’,‘context’,‘from-internal’,‘0’)
insert into sip values (’$sip_ext’,‘disallow’,’’,‘0’)
insert into sip values (’$sip_ext’,‘dtmfmode’,‘rfc2833’,‘0’)
insert into sip values (’$sip_ext’,‘host’,‘dynamic’,‘0’)
insert into sip values (’$sip_ext’,‘language’,‘fr’,‘0’)
insert into sip values (’$sip_ext’,‘mailbox’,’$sip_ext@device’,‘0’)
insert into sip values (’$sip_ext’,‘nat’,‘yes’,‘0’)
insert into sip values (’$sip_ext’,‘pickupgroup’,’’,‘0’)
insert into sip values (’$sip_ext’,‘port’,‘5060’,‘0’)
insert into sip values (’$sip_ext’,‘qualify’,‘yes’,‘0’)
insert into sip values (’$sip_ext’,‘record_in’,‘Never’,‘0’)
insert into sip values (’$sip_ext’,‘record_out’,‘Never’,‘0’)
insert into sip values (’$sip_ext’,‘secret’,‘1234’,‘0’)
insert into sip values (’$sip_ext’,‘type’,‘friend’,‘0’)
insert into sip values (’$sip_ext’,‘username’,’$sip_ext’,‘0’)

$sip_ext++;

}

[/code:1]

then you reload with the red bar in the admin, and freepbx will rebuild the config files.

hope that help

Steve
mousepad99 at gmail.com

well off the top of my head

I would say you need to add data to devices / sip or iax / and users table…

i think by calling
/var/lib/asterisk/bin/retrieve_conf
you will not need to click the red bar

It could be, that the problem is me ^^.
I just work with this stuff for a short time, so mistakes are more then possible. That’s why I search for help here.

I don’t want to write my own new interface, I just want to automate the creation of sip extensions.
I will be glad, when freepbx is able to help me
(I put the data in the db, and freepbx is doing the rest)

btw: I corrected ‘from_internal’ to ‘from-internal’ and noticed that ‘type’ is missing in every second extension.

But I don’t know, which further table or field is missing?!
Perhaps this is necessary, that freepbx is writing the extensions automatically in sip_additional.conf?

Thankful for help and response,

Robert

The GUI (freepbx) is what it is designed to do.
If you want to write your interface then do not use Freepbx.

If what you have here is a copy and paste then stop and read what you posted.

context=from_internal is not the same as context=from-internal
Plus I think you left out a table or field…

you add CUSTOM code to _custom files… sometimes youedt .conf but NEVER _additional.conf those belong to freepbx…hands (editors off)

STOP open the .sample files READ THEM they offer LOTS of info

After adding new data into the DB by script, it doesn’t work, when clicking apply bar. Perhaps it isn’t sufficient, to fill the sip, users and devices table?
I read in another thread (http://www.freepbx.org/forums/viewtopic.php?t=696&highlight=apply),
that you can create your own file (sip_extensions.conf) and include this in extension_custom.conf.
Doesn’t work.
After this I included the sip_extensions.conf in sip.conf.
Now, the new extensions written in sip_extensions.conf will be put in sip_additional.conf.
So far, so good.
But if there happen changes in freePBX - webinterface (clicking apply bar)
this cause unwanted chages in sip_additional.conf.
Look like this:

[quote]
[] [color=red]<<< missing[/color]
username=10
secret=73598
qualify=no
port=5060
nat=yes
mailbox=10@device
host=dynamic
dtmfmode=rfc2833
context=from_internal
careinvite=no
callerid=user<10>

[15]
username=15
type=friend
secret=90956
record_out=Adhoc
record_in=Adhoc
qualify=no
port=5060
nat=none
mailbox=15@device
host=dynamic
dtmfmode=rfc2833
context=from_internal
callerid=user <15>

[445]
username=445
type=friend
secret=98765
record_out=Adhoc
record_in=Adhoc
qualify=no
port=5060
nat=never
mailbox=445@device
host=dynamic
dtmfmode=rfc2833
context=from-internal
canreinvite=no
callerid=test22e <445>[/quote]

extensions 10 and 15 were created by script, 445 by webinterface.
Just for testing.

Best regards,
Robert

What I would try after populating the SIP related tables in MySQL
database, would be to set the need_reload to true in the admin table.
This should force the “Apply” bar in the web interface to appear.


Andre Courchesne
Concepteur Logiciel - Software Developper
[email protected]

PrivalODC Inc.
426 Victoria, bureau 12
St-Lambert, QC
J4P 2H9

Web.: http://www.prival.ca
Tel.: (450) 761-9973 poste 635
1-866-761-9973
Fax.: (450) 761-9842

Ce message e’lectronique ainsi que tous les documents annexe’s s’adressent
exclusivement ala personne ou a l’entite’ inscrite
dans la rubrique destinataire ; il peut contenir des
renseignements de nature confidentielle ou privile’gie’e aux
termes des lois applicables. Nulle autre personne ne doit y
avoir acces. Si vous n'e^tes pas le destinataire convenu, nous vous avisons par la pre'sente qu'il est strictement interdit d'en divulguer le contenu, de le distribuer, le copier ou l'utiliser. Veuillez aviser l'expe'diteur imme'diatement par retour de courrier e'lectronique et supprimer ce message de votre systeme. Toute diffusion ou reproduction de ce document
ainsi que tout mesure prise a` l’e’gard de la pre’sente sont
formellement interdites .

rmueller wrote:

[quote] Hi,

I also write such a script, but I don’t want to go the long way round via FreePBX - webinterface by clicking the apply bar (by the way it is also not working). I try to write the extensions in sip_additional.conf. Now I read, that FreePBX is overwriting this file when clicking apply bar. In which file the extensions have to be written to get found by asterisk. I also write the new data in the tables sip, users and devices of the asterisk DB.

Regards

Robert


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


Amportal-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amportal-users

[/quote]

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


Amportal-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amportal-users

Post generated using Mail2Forum (http://www.mail2forum.com)

Thanks Alex,

i will look at this.

Hi,

I also write such a script, but I don’t want to go the long way round via FreePBX - webinterface by clicking the apply bar (by the way it is also not working). I try to write the extensions in sip_additional.conf. Now I read, that FreePBX is overwriting this file when clicking apply bar. In which file the extensions have to be written to get found by asterisk. I also write the new data in the tables sip, users and devices of the asterisk DB.

Regards

Robert

FreePBX stores all it’s information in a MySQL database. If you look at the database for the format the extensions are stored in, you should be able to write a script that will insert data into the DB for you. Then refresh your FreePBX page, hit the red “apply” bar, and the extensions will have been created.

Alex

On 11/3/06, esofron <[email protected] ([email protected])> wrote:[quote] Hello all,

is there any way to auto-create 2000 sip extensions ?

Thanks,

-------------------- m2f --------------------

Sent using Mail2Forum (http://www.mail2forum.com).

Read this topic online here:
http://www.freepbx.org/forums/viewtopic.php?p=2092#2092

-------------------- m2f --------------------


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


Amportal-users mailing list
[email protected] ([email protected])
https://lists.sourceforge.net/lists/listinfo/amportal-users
[/quote]


Alex Robar
[email protected] ([email protected])

Post generated using Mail2Forum (http://www.mail2forum.com)

You write that freepbx retrieves the information from the asterisk database, and then rebuilds the conf files. i thought freepbx uses his own database…

I think in my asterisk or freepbx database there is a corruption. I have a couple of route’s programmed in the freepbx. But only the last one works, the other’s don’t appear in the conf files. but when i close freepbx and open it again then they are there. So has freepbx his own database or…

and how can i check corruption?

MySQL (or Postgres, or…) is where most of the information exists. The name of the database inside MySQL (or alternative) is ‘asterisk’. It’s not Asterisk’s AsteriskDB.

You can look at the incoming table of the asterisk database in phpmyadmin or use the command line mysql tool.

take a look at new module submission tickets on the Development Site (or search this forum). Someone submitted a module that will bulk load extensions from a file. We have not had a chance to look it over as we are still recovering from 2.3 and all the work on the new website. That is your best bet. Just loading the extensions into the sql table is not adequate - it will not result in the internal astdb structures being created properly.

Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx

???