[Home]

Summary:ASTERISK-02283: [patch] chan_iax2.c Flexibility in MYSQL access
Reporter:eltorio (eltorio)Labels:
Date Opened:2004-08-27 10:07:30Date Closed:2004-10-06 20:40:38
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Channels/chan_iax2
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) chan_iax2b.c
( 1) patch.channels.chan_iax2.c.diff
( 2) patch.v1.2.channels.chan_iax2.c.diff
Description:The bug tracker is the appropriate location for information like this.
Thanks!

Mark

On Fri, 27 Aug 2004, Ronan LE MEILLAT wrote:

> Dear mark,
>
> I use Asterisk and I love it!
> I use chan_sip2.c from oej for testing and discovered the mysql
> storage .....
>
> I decide to modify your chan_iax2.c for getting it mor flexible in the
> mysql access, now you can specify the table, the name of the fields on
> wich you wqant to look,
>
> The advantage is I can without an SQL view query the information where
> I want and have a unique information source for IAX2, SIP and Sip
> Express Router.
> If you are interesting this my mods.
>
> Ronan LE MEILLAT
>
> ----------------------------------------------------------------------
> --
> This is my IAX.CONF config
>
> [general]
> dbname=asterisk
> dbpass=asterisk
> dbhost=localhost
> dbuser=asterisk
> dbtable= voipfriends
> dbfield_user=username
> dbfield_secret=secret
> dbfield_ipaddr=iaxipaddr
> dbfield_port=iaxport
> dbfield_regseconds=regseconds
> dbfield_context=context
> dbfield_accountcode=accountcode
>
> ----------------------------------------------------------------------
> ---
> This my mysql table
> CREATE TABLE `voipfriends` (
>  `auth` varchar(100) default '',
>  `name` varchar(40) NOT NULL default '',  `username` varchar(40)
> default '',  `secret` varchar(40) NOT NULL default '',  `accountcode`
> varchar(20) NOT NULL default '',  `context` varchar(40) NOT NULL
> default '',  `ipaddr` varchar(20) NOT NULL default '',  `port` int(6)
> NOT NULL default '0',  `regseconds` int(11) NOT NULL default '0',  
> `iaxipaddr` varchar(50) default NULL,  `iaxport` varchar(10) default
> NULL,  PRIMARY KEY  (`name`)
> ) TYPE=MyISAM;
> #
> # Contenu de la table ` voipfriends `
> #
>
> INSERT INTO ` voipfriends ` VALUES ('4199:blah4199@lesmuids.com',
> 'TEST', '4199', 'blah4199', '', 'lesmuids', '', 0, 0, NULL, NULL);
>
>
Comments:By: Mark Spencer (markster) 2004-08-27 10:35:16

You will need to have a "cvs diff -u" not a whole C file.  Please read the instructions for leaving bugs if you have any questions.

By: eltorio (eltorio) 2004-08-27 11:24:09

sorry this is the patch

By: eltorio (eltorio) 2004-08-30 16:09:53

I've change some bugs and upgrade the fields definition here a sample [general] section
[general]
dbname=asterisk
dbpass=asterisk
dbhost=localhost
dbuser=asterisk
dbtable=sipfriends
dbfield_user=username
dbfield_name=name
dbfield_secret=secret
dbfield_ipaddr=iaxipaddr
dbfield_port=iaxport
dbfield_regseconds=iaxregseconds
dbfield_context=context
dbfield_accountcode=accountcode

here the table definition

CREATE TABLE `sipfriends` (
 `auth` varchar(100) default '',
 `name` varchar(40) NOT NULL default '',
 `username` varchar(40) default '',
 `secret` varchar(40) NOT NULL default '',
 `accountcode` varchar(20) NOT NULL default '',
 `context` varchar(40) NOT NULL default '',
 `sipipaddr` varchar(20) NOT NULL default '',
 `sipport` int(6) NOT NULL default '0',
 `iaxregseconds` int(11) NOT NULL default '0',
 `iaxipaddr` varchar(50) default NULL,
 `iaxport` varchar(10) default NULL,
 `sipregseconds` varchar(10) default NULL,
 PRIMARY KEY  (`name`)
) TYPE=MyISAM;

here a sample value
INSERT INTO `sipfriends` VALUES ('4199:blah4199@lesmuids.com', '4199', 'TEST', 'blah4199', '', 'lesmuids', '', 0, 0, NULL, NULL, NULL);

You can see my compatible sip channel version here
http://bugs.digium.com/bug_view_page.php?bug_id=0002313

By: Mark Spencer (markster) 2004-10-06 19:47:11

We have decided to create the realtime interface in Asterisk in CVS head to standardize how database connectivity can be done, so we won't end up using this specific patch.  Please feel free to review and discuss the new structure on IRC (#asterisk, irc.freenode.net)