[asterisk-commits] tilghman: trunk r217916 - in /trunk: channels/ contrib/scripts/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Sep 10 18:12:20 CDT 2009
Author: tilghman
Date: Thu Sep 10 18:12:16 2009
New Revision: 217916
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=217916
Log:
Make calltoken support work with realtime users and peers.
Modified:
trunk/channels/chan_iax2.c
trunk/channels/chan_sip.c
trunk/contrib/scripts/iax-friends.sql
Modified: trunk/channels/chan_iax2.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=217916&r1=217915&r2=217916
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Thu Sep 10 18:12:16 2009
@@ -952,6 +952,7 @@
static void reg_source_db(struct iax2_peer *p);
static struct iax2_peer *realtime_peer(const char *peername, struct sockaddr_in *sin);
+static struct iax2_user *realtime_user(const char *username, struct sockaddr_in *sin);
static int ast_cli_netstats(struct mansession *s, int fd, int limit_fmt);
static char *complete_iax2_peers(const char *line, const char *word, int pos, int state, uint64_t flags);
@@ -2033,7 +2034,11 @@
/* ----- Case 2 ----- */
if ((subclass == IAX_COMMAND_NEW) && (user = find_user(find))) {
calltoken_required = user->calltoken_required;
- } else if ((subclass != IAX_COMMAND_NEW) && (peer = find_peer(find, 1))) {
+ } else if ((subclass == IAX_COMMAND_NEW) && (user = realtime_user(find, sin))) {
+ calltoken_required = user->calltoken_required;
+ } else if ((subclass != IAX_COMMAND_NEW) && (peer = find_peer(find, 0))) {
+ calltoken_required = peer->calltoken_required;
+ } else if ((subclass != IAX_COMMAND_NEW) && (peer = realtime_peer(find, sin))) {
calltoken_required = peer->calltoken_required;
}
@@ -4140,7 +4145,7 @@
if (!strcasecmp(tmp->name, "host")) {
struct ast_hostent ahp;
struct hostent *hp;
- if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(&hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) {
+ if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) {
/* No match */
ast_variables_destroy(var);
var = NULL;
@@ -4252,7 +4257,7 @@
if (!strcasecmp(tmp->name, "host")) {
struct ast_hostent ahp;
struct hostent *hp;
- if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(&hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) {
+ if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) {
/* No match */
ast_variables_destroy(var);
var = NULL;
Modified: trunk/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=217916&r1=217915&r2=217916
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Sep 10 18:12:16 2009
@@ -4757,7 +4757,7 @@
if (!strcasecmp(tmp->name, "host")) {
struct hostent *hp;
struct ast_hostent ahp;
- if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(&hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) {
+ if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) {
/* No match */
ast_variables_destroy(var);
var = NULL;
Modified: trunk/contrib/scripts/iax-friends.sql
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/contrib/scripts/iax-friends.sql?view=diff&rev=217916&r1=217915&r2=217916
==============================================================================
--- trunk/contrib/scripts/iax-friends.sql (original)
+++ trunk/contrib/scripts/iax-friends.sql Thu Sep 10 18:12:16 2009
@@ -4,51 +4,54 @@
CREATE TABLE `iaxfriends` (
`name` varchar(40) NOT NULL default '',
- `username` varchar(40) NOT NULL default '',
- `secret` varchar(40) NOT NULL default '',
- `dbsecret` varchar(40) NOT NULL default '',
- `context` varchar(40) NOT NULL default '',
- `regcontext` varchar(40) NOT NULL default '',
- `host` varchar(40) NOT NULL default 'dynamic',
- `ipaddr` varchar(20) NOT NULL default '',
- `port` int(6) NOT NULL default '0',
- `defaultip` varchar(20) NOT NULL default '',
- `sourceaddress` varchar(20) NOT NULL default '',
- `mask` varchar(20) NOT NULL default '',
- `regexten` varchar(40) NOT NULL default '',
- `regseconds` int(11) NOT NULL default '0',
- `accountcode` varchar(20) NOT NULL default '',
- `mohinterpret` varchar(20) NOT NULL default '',
- `mohsuggest` varchar(20) NOT NULL default '',
- `inkeys` varchar(40) NOT NULL default '',
- `outkey` varchar(40) NOT NULL default '',
- `language` varchar(10) NOT NULL default '',
- `callerid` varchar(40) NOT NULL default '',
- `cid_number` varchar(40) NOT NULL default '',
- `sendani` varchar(10) NOT NULL default '',
- `fullname` varchar(40) NOT NULL default '',
- `trunk` varchar(10) NOT NULL default '',
- `auth` varchar(20) NOT NULL default '',
- `maxauthreq` varchar(15) NOT NULL default '',
- `encryption` varchar(20) NOT NULL default '',
- `transfer` varchar(10) NOT NULL default '',
- `jitterbuffer` varchar(10) NOT NULL default '',
- `forcejitterbuffer` varchar(10) NOT NULL default '',
- `disallow` varchar(40) NOT NULL default 'all',
- `allow` varchar(40) NOT NULL default '',
- `codecpriority` varchar(40) NOT NULL default '',
- `qualify` varchar(10) NOT NULL default '',
- `qualifysmoothing` varchar(10) NOT NULL default '',
- `qualifyfreqok` varchar(10) NOT NULL default '',
- `qualifyfreqnotok` varchar(10) NOT NULL default '',
- `timezone` varchar(20) NOT NULL default '',
- `adsi` varchar(10) NOT NULL default '',
- `amaflags` varchar(20) NOT NULL default '',
- `setvar` varchar(200) NOT NULL default '',
+ `type` varchar(10) NOT NULL default 'friend', -- friend/user/peer
+ `username` varchar(40) NULL, -- username to send as peer
+ `mailbox` varchar(40) NULL, -- mailbox at context
+ `secret` varchar(40) NULL,
+ `dbsecret` varchar(40) NULL, -- In AstDB, location to store/retrieve secret
+ `context` varchar(40) NULL,
+ `regcontext` varchar(40) NULL,
+ `host` varchar(40) NULL default 'dynamic',
+ `ipaddr` varchar(20) NULL, -- Must be updateable by Asterisk user
+ `port` int(5) NULL, -- Must be updateable by Asterisk user
+ `defaultip` varchar(20) NULL,
+ `sourceaddress` varchar(20) NULL,
+ `mask` varchar(20) NULL,
+ `regexten` varchar(40) NULL,
+ `regseconds` int(11) NULL, -- Must be updateable by Asterisk user
+ `accountcode` varchar(20) NULL,
+ `mohinterpret` varchar(20) NULL,
+ `mohsuggest` varchar(20) NULL,
+ `inkeys` varchar(40) NULL,
+ `outkey` varchar(40) NULL,
+ `language` varchar(10) NULL,
+ `callerid` varchar(100) NULL, -- The whole callerid string, or broken down in the next 3 fields
+ `cid_number` varchar(40) NULL, -- The number portion of the callerid
+ `sendani` varchar(10) NULL, -- yes/no
+ `fullname` varchar(40) NULL, -- The name portion of the callerid
+ `trunk` varchar(3) NULL, -- Yes/no
+ `auth` varchar(20) NULL, -- RSA/md5/plaintext
+ `maxauthreq` varchar(5) NULL, -- Maximum outstanding AUTHREQ calls {1-32767}
+ `requirecalltoken` varchar(4) NULL, -- yes/no/auto
+ `encryption` varchar(20) NULL, -- aes128/yes/no
+ `transfer` varchar(10) NULL, -- mediaonly/yes/no
+ `jitterbuffer` varchar(3) NULL, -- yes/no
+ `forcejitterbuffer` varchar(3) NULL, -- yes/no
+ `disallow` varchar(40) NULL, -- all/{list-of-codecs}
+ `allow` varchar(40) NULL, -- all/{list-of-codecs}
+ `codecpriority` varchar(40) NULL,
+ `qualify` varchar(10) NULL, -- yes/no/{number of milliseconds}
+ `qualifysmoothing` varchar(10) NULL, -- yes/no
+ `qualifyfreqok` varchar(10) NULL, -- {number of milliseconds}|60000
+ `qualifyfreqnotok` varchar(10) NULL, -- {number of milliseconds}|10000
+ `timezone` varchar(20) NULL,
+ `adsi` varchar(10) NULL, -- yes/no
+ `amaflags` varchar(20) NULL,
+ `setvar` varchar(200) NULL,
PRIMARY KEY (`name`),
INDEX name (name, host),
INDEX name2 (name, ipaddr, port),
INDEX ipaddr (ipaddr, port),
- INDEX host (host, port),
-) TYPE=MyISAM;
+ INDEX host (host, port)
+);
More information about the asterisk-commits
mailing list