|Summary:||ASTERISK-01790: [patch] DB implementation of SIP "type=user"|
|Date Opened:||2004-06-09 21:10:36||Date Closed:||2008-01-15 15:00:27.000-0600|
|Environment:||Attachments:||( 0) patch_chan_sip.txt|
( 1) patch_chan_sip3.txt
( 2) patch.chan_sip.c
|Description:||MYSQL_SIP_FRIENDS only implements the peer portion|
of SIP.CONF, and doesn't implement the user portion.
This is fine for single line phones but doesn't work
for multi-line-appearance on same-ip/port phones
(e.g. cisco 79xx).
Additionally, peers don't have the option of setting
caller ID, but users do. This is important in some
setups for CLID-based call routing.
In other words, it would be nice if the *complete*
functionality of SIP.CONF entries was available
through dynamic SQL tables.
****** ADDITIONAL INFORMATION ******
Enclosed is a patch to chan_sip.c that adds this
functionality based on a table sipusers. sipusers
can be created from sipfriends through the process below.
[assumes MYSQL_SIP_FRIENDS or MYSQL_FRIENDS are
defined, and that the db parameters in the global
sip.conf section are correct]
patch < patch.chan_sip.c
CREATE TABLE sipusers AS SELECT * FROM sipfriends;
ALTER TABLE sipusers ADD COLUMN callerid varchar(20);
|Comments:||By: Olle Johansson (oej) 2004-06-10 10:31:14|
* Please explain more, so I understand why it doesn't work on multi-line-apperance on same IP phones. Do they have multiple user account?
* Why can't we use the same table, it's called MYSQL_FRIENDS - a friend is both a user and a peer
* You allocate a lot of structures here, that doesn't get de-allocated the way we de-allocate Mysql Peers.
By: ehud (ehud) 2004-06-10 10:54:32
1. Multiple user accounts are used for the multi-line appearances. If we use "peers" instead of "users", the match is on IP address and first match used.
1b. Different CLIDs are often used on different line appearances, and this functionality requires type=user for the callerid=x to be looked at. (e.g. it's
not in the sip_peer structure).
2. We can use any table. This is a first-cut working version posted for peer review. The changes explicitly use a separate table so that it can be destroyed
and recreated easily from and without changing the existing tables.
2b. My first cut actually added callerid to the structure and used it for both,
but I took it out for "public" posting to make it cleaner. In reality
users and peers should be separate structures.
3. Uh oh. If you can point me to the peer deallocation trigger, I'll quickly
add it to the "user" code. (or help me out and fix my code ;)
Thanks for the feedback!
Cisco 7960 setup uses n users (where 1<=n<=6) each one having a
specific username and secret. Each line appearance therefore
uses the settings of that user. The IP address and port of all
of these are *the same*. The only way to distinguish them is the
original user registration. Searching the peer structures for
matching IP address does not allow distringuishing -- and hence
all calls would come from line appearance 1.
By: Olle Johansson (oej) 2004-06-10 11:01:11
OK, let me take a look at this for a while.
Thank you for taking your time to explain a bit more!
By: Olle Johansson (oej) 2004-06-13 15:25:31
Ok, I want this to be using the same database table and possibly the same function. Let's make mysql_peer a mysql_friend. I do not want another table. We can add caller id and restrictcid to the current table and use that. That way, the table will be a FRIENDs table.
Ehud, please mail me or find me on IRC if you have any questions.
By: ehud (ehud) 2004-06-14 11:48:17
You're not on IRC now, and I don't have your email.
Feel free to email me. gavron at wetwork dot net.
By: ehud (ehud) 2004-06-14 14:31:10
The newest patch puts it all back into one table
alter table sipfriends add column callerid varchar(20);
alter table sipfriends add column restrictcid int(1);
I have faxed the disclaimer to Digium prior to opening
By: ehud (ehud) 2004-06-15 11:58:32
patch_chan_sip3.txt is the latest patch which incorporates
OEJ's suggestions. It now frees the structure in check_user()
when (u->temponly) just as it does for peers.
By: Mark Spencer (markster) 2004-06-24 00:22:39
Fixed it up a little and made it based on "MYSQL_USERS" so it wouldn't affect things, also fixed a potential segfault.
By: Digium Subversion (svnbot) 2008-01-15 15:00:27.000-0600
r3294 | markster | 2008-01-15 15:00:27 -0600 (Tue, 15 Jan 2008) | 2 lines
Merge Ehud's MySQL users support (bug ASTERISK-1790)