[Asterisk-Users] SIP peers in MySQL Database

Matthew Boehm mboehm at cytelcom.com
Tue Oct 12 07:25:47 MST 2004


Yes you are wrong. You seem to be combining two different methods of getting
SIP info out of a database. Pick 1. I use the perl script right now so here
is how to do that:

In order to use the perl script which can support 'ALL' sip abilities, use
this table:

  CREATE TABLE sip_perl (
        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)
  );

Then, insert a new row for each sip parameter keeping the 'id' the same for
each phone:

INSERT INTO `sip_perl` (`id`, `keyword`, `DATA`, `flags`) VALUES (3038,
'account', '3038', 0);
INSERT INTO `sip_perl` (`id`, `keyword`, `DATA`, `flags`) VALUES (3038,
'callerid', '"Cytel" <2814494000>', 1);
INSERT INTO `sip_perl` (`id`, `keyword`, `DATA`, `flags`) VALUES (3038,
'nat', 'yes', 0);
INSERT INTO `sip_perl` (`id`, `keyword`, `DATA`, `flags`) VALUES (3038,
'context', 'cytel-internal', 0);
INSERT INTO `sip_perl` (`id`, `keyword`, `DATA`, `flags`) VALUES (3038,
'type', 'friend', 0);
INSERT INTO `sip_perl` (`id`, `keyword`, `DATA`, `flags`) VALUES (3038,
'mailbox', '3038 at cytel', 0);
INSERT INTO `sip_perl` (`id`, `keyword`, `DATA`, `flags`) VALUES (3038,
'secret', '3038joshdana', 0);
INSERT INTO `sip_perl` (`id`, `keyword`, `DATA`, `flags`) VALUES (3038,
'host', 'dynamic', 0);

Edit the perl script to match. Then run the perl script. It should
create/overwrite whatever file you set in it and produce a new .conf

Go into sip.conf and add a #include line for this new file.

Matthew

----- Original Message ----- 
From: "harry gaillac" <gaillacharry at yahoo.fr>
To: "Asterisk Users Mailing List - Non-Commercial Discussion"
<asterisk-users at lists.digium.com>
Sent: Monday, October 11, 2004 6:42 PM
Subject: Re: [Asterisk-Users] SIP peers in MySQL Database


> I read the perl script.
> here is table structure for table `sipfriends`
>
> CREATE TABLE `sipfriends` (
>   `name` varchar(40) NOT NULL default '',
>   `secret` varchar(40) NOT NULL default '',
>   `context` varchar(40) NOT NULL default '',
>   `username` varchar(40) default '',
>   `ipaddr` varchar(20) NOT NULL default '',
>   `port` int(6) NOT NULL default '0',
>   `regseconds` int(11) NOT NULL default '0',
>   PRIMARY KEY  (`name`)
> ) TYPE=MyISAM;
>
> I would like asterisk retrieve all sipfriends
> variables
> from database.
>
> I wish to add other variables for each sip clients
> like qualify, nat, ... in sipfriends table but sip
> code channel don't seem to be able to support others
> variables.
> may be i'm wrong ?
>
> best regards
> harry
>
>  --- Matthew Boehm <mboehm at cytelcom.com> a écrit :
> > It is possible to use 1 database for many asterisk
> > boxes. You can do this
> > with the retreive script I mentioned. By adding
> > another column to the
> > database to indicate which * server that phone
> > belongs to, you can easialy
> > change the script on a per machine basis.
> >
> > Matthew
> >
> > ----- Original Message ----- 
> > From: "harry gaillac" <gaillacharry at yahoo.fr>
> > To: "Asterisk Users Mailing List - Non-Commercial
> > Discussion"
> > <asterisk-users at lists.digium.com>
> > Sent: Monday, October 11, 2004 12:00 PM
> > Subject: Re: [Asterisk-Users] SIP peers in MySQL
> > Database
> >
> >
> > > I agree you users from asterisk list don't have to
> > > give  me "FREE SUPPORT" the day after I posted a
> > > question .
> > >
> > > I was thinking many users are used to register sip
> > > clients in sql database not one sip.conf per
> > Asterisk
> > > pbx box .
> > >
> > > harry
> > >
> > >
> > >  --- Matthew Boehm <mboehm at cytelcom.com> a écrit :
> > > > You have obviously never posted to any kind of
> > > > mailing list before.
> > > > Sometimes you may have to wait a few days for
> > > > someone to answer you.
> > > > Sometimes people just don't know. Griping to the
> > > > owners of the list about
> > > > the people who take time out of their day to
> > give
> > > > you FREE support isn't
> > > > going to make things better nor will it make you
> > > > popular nor will you get a
> > > > faster response (if any).
> > > >
> > > > As long as the database can be accessed by the
> > > > asterisk server, then you can
> > > > store sip info into that database. You should
> > not
> > > > need to use autocreate. If
> > > > you don't need immediate, uptodate, realtime sip
> > > > configuration, look in
> > > > <ASTERISK SOURCE ROOT>/contrib/scripts/  for
> > > > something called
> > > > retreive_sip_from_mysql.pl  or something like
> > that.
> > > > That is what I use.
> > > >
> > > > Or you can be patient and the new RealTime
> > method
> > > > should be in stable form
> > > > in a week or two.
> > > >
> > > > Matthew
> > > >
> > > > ----- Original Message ----- 
> > > > From: "harry gaillac" <gaillacharry at yahoo.fr>
> > > > To: <support at digium.com>
> > > > Cc: <asterisk-users at lists.digium.com>
> > > > Sent: Monday, October 11, 2004 10:01 AM
> > > > Subject: [Asterisk-Users] SIP peers in MySQL
> > > > Database
> > > >
> > > >
> > > > > hello,
> > > > >
> > > > > I wrote to asterisk-users at lists.digium.com in
> > > > order to
> > > > > someone help me without reply ?????
> > > > >
> > > > > May be you could help me
> > > > >
> > > > > Here is my problem.Two smalls offices with sip
> > > > clients
> > > > >
> > > > > + Asterisk, one offices with Asterisk and
> > mysql
> > > > > database.
> > > > > I would like to define all sip peers in mysql
> > > > database
> > > > > so Asterisk from small office could read sip
> > peers
> > > > > configuration from database office.
> > > > >
> > > > > May I use autocreatepeer in all asterisk
> > sip.conf
> > > > file
> > > > > with nat=yes in general option ?
> > > > >
> > > > > Regards
> > > > > Harry
> > > > >
> > > > > [general]
> > > > > dbname= Name of database in your Mysql server
> > > > > dbhost= Hostname of server
> > > > > dbuser= Username in MySQL
> > > > > dbpass= Password for user in MySQL
> > > > > autocreatepeer=yes
> > > > > nat=yes
> > > > > ....
> > > > > -----------   ------------------
> > > > > |Asterisk |-- |nat/firewall box |
> > > > > -----------   ------------------
> > > > >                     |
> > > > >                     |
> > > > >            ------------   ------------------
> > > > >            | Internet |-- |nat/firewall
> > > > box|-Asterisk
> > > > >
> > > > >            ------------   ------------------ 
> > > > +
> > > > >                     |
> > SIPpeers
> > > > in
> > > > >                     |                   mysql
> > > > database
> > > > >
> > > > > -----------   ------------------
> > > > > |Asterisk |-- |nat/firewall box |
> > > > > -----------   ------------------
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Vous manquez d'espace pour stocker vos mails ?
> > > > > Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
> > > > > Créez votre Yahoo! Mail sur
> > > > http://fr.benefits.yahoo.com/
> > > > >
> > > > > Le nouveau Yahoo! Messenger est arrivé !
> > Découvrez
> > > > toutes les nouveautés
> > > > pour dialoguer instantanément avec vos amis. A
> > > > télécharger gratuitement sur
> > > > http://fr.messenger.yahoo.com
> > > > >
> > _______________________________________________
> > > > > Asterisk-Users mailing list
> > > > > Asterisk-Users at lists.digium.com
> > > > >
> > > >
> > >
> >
> http://lists.digium.com/mailman/listinfo/asterisk-users
> > > > > To UNSUBSCRIBE or update options visit:
> > > > >
> > > >
> > >
> >
> http://lists.digium.com/mailman/listinfo/asterisk-users
> > > >
> > > > _______________________________________________
> > > > Asterisk-Users mailing list
> > > > Asterisk-Users at lists.digium.com
> > > >
> > >
> >
> http://lists.digium.com/mailman/listinfo/asterisk-users
> > > > To UNSUBSCRIBE or update options visit:
> > > >
> > > >
> > >
> >
> http://lists.digium.com/mailman/listinfo/asterisk-users
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Vous manquez d'espace pour stocker vos mails ?
> > > Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
> > > Créez votre Yahoo! Mail sur
> > http://fr.benefits.yahoo.com/
> > >
> > > Le nouveau Yahoo! Messenger est arrivé ! Découvrez
> > toutes les nouveautés
> > pour dialoguer instantanément avec vos amis. A
> > télécharger gratuitement sur
> > http://fr.messenger.yahoo.com
> > > _______________________________________________
> > > Asterisk-Users mailing list
> > > Asterisk-Users at lists.digium.com
> > >
> >
> http://lists.digium.com/mailman/listinfo/asterisk-users
> > > To UNSUBSCRIBE or update options visit:
> > >
> >
> http://lists.digium.com/mailman/listinfo/asterisk-users
> >
> > _______________________________________________
> > Asterisk-Users mailing list
> >
> === message truncated ===
>
>
>
>
>
>
> Vous manquez d'espace pour stocker vos mails ?
> Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
> Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/
>
> Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés
pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur
http://fr.messenger.yahoo.com
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users




More information about the asterisk-users mailing list