[asterisk-commits] dvossel: branch group/v6-new r266285 - in /team/group/v6-new: ./ apps/ channe...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri May 28 11:35:05 CDT 2010
Author: dvossel
Date: Fri May 28 11:35:03 2010
New Revision: 266285
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=266285
Log:
fixes conflict in chan_sip and merges updates
Modified:
team/group/v6-new/ (props changed)
team/group/v6-new/CHANGES
team/group/v6-new/apps/app_dial.c
team/group/v6-new/channels/chan_sip.c
team/group/v6-new/channels/sip/config_parser.c
team/group/v6-new/channels/sip/include/sip.h
team/group/v6-new/main/app.c
team/group/v6-new/main/asterisk.c
team/group/v6-new/main/channel.c
team/group/v6-new/main/logger.c
team/group/v6-new/pbx/pbx_realtime.c
team/group/v6-new/utils/extconf.c
Propchange: team/group/v6-new/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/group/v6-new/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri May 28 11:35:03 2010
@@ -1,1 +1,1 @@
-/trunk:1-266018
+/trunk:1-266284
Modified: team/group/v6-new/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/group/v6-new/CHANGES?view=diff&rev=266285&r1=266284&r2=266285
==============================================================================
--- team/group/v6-new/CHANGES (original)
+++ team/group/v6-new/CHANGES Fri May 28 11:35:03 2010
@@ -446,6 +446,8 @@
of dynamic parkinglots.
* chan_dahdi now supports reporting alarms over AMI either by channel or span via
the reportalarms config option.
+ * The Realtime dialplan switch now caches entries for 1 second. This provides a
+ significant increase in performance (about 3X) for installations using this switchtype.
CLI Changes
-----------
Modified: team/group/v6-new/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/group/v6-new/apps/app_dial.c?view=diff&rev=266285&r1=266284&r2=266285
==============================================================================
--- team/group/v6-new/apps/app_dial.c (original)
+++ team/group/v6-new/apps/app_dial.c Fri May 28 11:35:03 2010
@@ -661,7 +661,6 @@
/* This is for the channel drivers */
outgoing->chan->hangupcause = AST_CAUSE_ANSWERED_ELSEWHERE;
}
- ast_party_connected_line_free(&outgoing->connected);
ast_hangup(outgoing->chan);
}
oo = outgoing;
Modified: team/group/v6-new/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/v6-new/channels/chan_sip.c?view=diff&rev=266285&r1=266284&r2=266285
==============================================================================
--- team/group/v6-new/channels/chan_sip.c (original)
+++ team/group/v6-new/channels/chan_sip.c Fri May 28 11:35:03 2010
@@ -719,6 +719,7 @@
static char default_callerid[AST_MAX_EXTENSION]; /*!< Default caller ID for sip messages */
static char default_mwi_from[80]; /*!< Default caller ID for MWI updates */
static char default_fromdomain[AST_MAX_EXTENSION]; /*!< Default domain on outound messages */
+static int default_fromdomainport; /*!< Default domain port on outbound messages */
static char default_notifymime[AST_MAX_EXTENSION]; /*!< Default MIME media type for MWI notify messages */
static char default_vmexten[AST_MAX_EXTENSION]; /*!< Default From Username on MWI updates */
static int default_qualify; /*!< Default Qualify= setting */
@@ -4828,8 +4829,9 @@
ast_set_flag(&dialog->flags[0], SIP_CALL_LIMIT);
if (!dialog->portinuri)
dialog->portinuri = peer->portinuri;
-
dialog->chanvars = copy_vars(peer->chanvars);
+ if (peer->fromdomainport)
+ dialog->fromdomainport = peer->fromdomainport;
return 0;
}
@@ -6279,11 +6281,7 @@
if (title) {
my_name = title;
} else {
- char *port = NULL;
my_name = ast_strdupa(i->fromdomain);
- if ((port = strchr(i->fromdomain, ':'))) {
- *port = '\0';
- }
}
sip_pvt_unlock(i);
@@ -6912,8 +6910,10 @@
do_setnat(p);
}
- if (p->method != SIP_REGISTER)
+ if (p->method != SIP_REGISTER) {
ast_string_field_set(p, fromdomain, default_fromdomain);
+ p->fromdomainport = default_fromdomainport;
+ }
build_via(p);
if (!callid)
build_callid_pvt(p);
@@ -9229,6 +9229,7 @@
}
ast_string_field_set(p, fromdomain, default_fromdomain);
+ p->fromdomainport = default_fromdomainport;
build_via(p);
ast_string_field_set(p, callid, callid);
@@ -10513,8 +10514,8 @@
l = tmp_l;
}
- ourport = ast_sockaddr_port(&p->ourip);
- if (!sip_standard_port(p->socket.type, ourport) && ast_strlen_zero(p->fromdomain))
+ ourport = (p->fromdomainport) ? p->fromdomainport : ast_sockaddr_port(&p->ourip);
+ if (!sip_standard_port(p->socket.type, ourport))
snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s:%d>;tag=%s", n, l, d, ourport, p->tag);
else
snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s>;tag=%s", n, l, d, p->tag);
@@ -11229,7 +11230,8 @@
{
struct sip_request req;
struct ast_str *out = ast_str_alloca(500);
- int ourport = ast_sockaddr_port(&p->ourip);
+ int ourport = (p->fromdomainport) ? p->fromdomainport : ast_sockaddr_port(&p->ourip);
+ const char *domain = S_OR(p->fromdomain, ast_sockaddr_stringify_host(&p->ourip));
const char *exten = S_OR(vmexten, default_vmexten);
initreqprep(&req, p, SIP_NOTIFY, NULL);
@@ -11237,23 +11239,18 @@
add_header(&req, "Content-Type", default_notifymime);
ast_str_append(&out, 0, "Messages-Waiting: %s\r\n", newmsgs ? "yes" : "no");
- if (!ast_strlen_zero(p->fromdomain)) {
- ast_str_append(&out, 0, "Message-Account: sip:%s@%s\r\n", exten, p->fromdomain);
- } else if (!sip_standard_port(p->socket.type, ourport)) {
+
+ if (!sip_standard_port(p->socket.type, ourport)) {
if (p->socket.type == SIP_TRANSPORT_UDP) {
- ast_str_append(&out, 0, "Message-Account: sip:%s@%s\r\n", exten,
- ast_sockaddr_stringify(&p->ourip));
+ ast_str_append(&out, 0, "Message-Account: sip:%s@%s:%d\r\n", exten, domain, ourport);
} else {
- ast_str_append(&out, 0, "Message-Account: sip:%s@%s;transport=%s\r\n", exten,
- ast_sockaddr_stringify(&p->ourip), get_transport(p->socket.type));
+ ast_str_append(&out, 0, "Message-Account: sip:%s@%s:%d;transport=%s\r\n", exten, domain, ourport, get_transport(p->socket.type));
}
} else {
if (p->socket.type == SIP_TRANSPORT_UDP) {
- ast_str_append(&out, 0, "Message-Account: sip:%s@%s\r\n", exten,
- ast_sockaddr_stringify_host(&p->ourip));
+ ast_str_append(&out, 0, "Message-Account: sip:%s@%s\r\n", exten, domain);
} else {
- ast_str_append(&out, 0, "Message-Account: sip:%s@%s;transport=%s\r\n", exten,
- ast_sockaddr_stringify(&p->ourip), get_transport(p->socket.type));
+ ast_str_append(&out, 0, "Message-Account: sip:%s@%s;transport=%s\r\n", exten, domain, get_transport(p->socket.type));
}
}
/* Cisco has a bug in the SIP stack where it can't accept the
@@ -11564,8 +11561,7 @@
struct sip_pvt *p;
struct sip_peer *peer = NULL;
int res;
- char *fromdomain;
- char *domainport = NULL;
+ int portno = 0;
/* exit if we are already in process with this registrar ?*/
if (r == NULL || ((auth == NULL) && (r->regstate == REG_STATE_REGSENT || r->regstate == REG_STATE_AUTHSENT))) {
@@ -11635,12 +11631,19 @@
/* Copy back Call-ID in case create_addr changed it */
ast_string_field_set(r, callid, p->callid);
+
if (!r->dnsmgr && r->portno) {
ast_sockaddr_set_port(&p->sa, r->portno);
ast_sockaddr_set_port(&p->recv, r->portno);
- } else { /* Set registry port to the port set from the peer definition/srv or default */
- r->portno = ast_sockaddr_port(&p->sa);
- }
+ }
+ if (!ast_strlen_zero(p->fromdomain)) {
+ portno = (p->fromdomainport) ? p->fromdomainport : STANDARD_SIP_PORT;
+ } else if (!ast_strlen_zero(r->regdomain)) {
+ portno = (r->regdomainport) ? r->regdomainport : STANDARD_SIP_PORT;
+ } else {
+ portno = ast_sockaddr_port(&p->sa);
+ }
+
ast_set_flag(&p->flags[0], SIP_OUTGOING); /* Registration is outgoing call */
r->call = dialog_ref(p, "copying dialog into registry r->call"); /* Save pointer to SIP dialog */
p->registry = registry_addref(r, "transmit_register: addref to p->registry in transmit_register"); /* Add pointer to registry in packet */
@@ -11692,55 +11695,21 @@
ast_debug(1, "Scheduled a registration timeout for %s id #%d \n", r->hostname, r->timeout);
}
- if ((fromdomain = strchr(r->username, '@'))) {
- /* the domain name is just behind '@' */
- fromdomain++ ;
- /* We have a domain in the username for registration */
- snprintf(from, sizeof(from), "<sip:%s>;tag=%s", r->username, p->tag);
- if (!ast_strlen_zero(p->theirtag))
- snprintf(to, sizeof(to), "<sip:%s>;tag=%s", r->username, p->theirtag);
- else
- snprintf(to, sizeof(to), "<sip:%s>", r->username);
-
- /* If the registration username contains '@', then the domain should be used as
- the equivalent of "fromdomain" for the registration */
- if (ast_strlen_zero(p->fromdomain)) {
- ast_string_field_set(p, fromdomain, fromdomain);
- }
+ snprintf(from, sizeof(from), "<sip:%s@%s>;tag=%s", r->username, S_OR(r->regdomain,p->tohost), p->tag);
+ if (!ast_strlen_zero(p->theirtag)) {
+ snprintf(to, sizeof(to), "<sip:%s@%s>;tag=%s", r->username, S_OR(r->regdomain,p->tohost), p->theirtag);
} else {
- snprintf(from, sizeof(from), "<sip:%s@%s>;tag=%s", r->username, p->tohost, p->tag);
- if (!ast_strlen_zero(p->theirtag))
- snprintf(to, sizeof(to), "<sip:%s@%s>;tag=%s", r->username, p->tohost, p->theirtag);
- else
- snprintf(to, sizeof(to), "<sip:%s@%s>", r->username, p->tohost);
+ snprintf(to, sizeof(to), "<sip:%s@%s>", r->username, S_OR(r->regdomain,p->tohost));
}
/* Fromdomain is what we are registering to, regardless of actual
host name from SRV */
- if (!ast_strlen_zero(p->fromdomain)) {
- domainport = strrchr(p->fromdomain, ':');
- if (domainport) {
- *domainport++ = '\0'; /* trim off domainport from p->fromdomain */
- if (ast_strlen_zero(domainport))
- domainport = NULL;
- }
- if (domainport) {
- if (atoi(domainport) != STANDARD_SIP_PORT)
- snprintf(addr, sizeof(addr), "sip:%s:%s", p->fromdomain, domainport);
- else
- snprintf(addr, sizeof(addr), "sip:%s", p->fromdomain);
- } else {
- if (r->portno && r->portno != STANDARD_SIP_PORT)
- snprintf(addr, sizeof(addr), "sip:%s:%d", p->fromdomain, r->portno);
- else
- snprintf(addr, sizeof(addr), "sip:%s", p->fromdomain);
- }
+ if (portno && portno != STANDARD_SIP_PORT) {
+ snprintf(addr, sizeof(addr), "sip:%s:%d", S_OR(p->fromdomain,S_OR(r->regdomain,r->hostname)), portno);
} else {
- if (r->portno && r->portno != STANDARD_SIP_PORT)
- snprintf(addr, sizeof(addr), "sip:%s:%d", r->hostname, r->portno);
- else
- snprintf(addr, sizeof(addr), "sip:%s", r->hostname);
- }
+ snprintf(addr, sizeof(addr), "sip:%s", S_OR(p->fromdomain,S_OR(r->regdomain,r->hostname)));
+ }
+
ast_string_field_set(p, uri, addr);
p->branch ^= ast_random();
@@ -11775,7 +11744,7 @@
ast_debug(1, " >>> Re-using Auth data for %s@%s\n", r->username, r->hostname);
ast_string_field_set(p, realm, r->realm);
ast_string_field_set(p, nonce, r->nonce);
- ast_string_field_set(p, domain, r->domain);
+ ast_string_field_set(p, domain, r->authdomain);
ast_string_field_set(p, opaque, r->opaque);
ast_string_field_set(p, qop, r->qop);
p->noncecount = ++r->noncecount;
@@ -14656,11 +14625,21 @@
"Host: %s\r\n"
"Port: %d\r\n"
"Username: %s\r\n"
+ "Domain: %s\r\n"
+ "DomainPort: %d\r\n"
"Refresh: %d\r\n"
"State: %s\r\n"
"RegistrationTime: %ld\r\n"
- "\r\n", idtext, iterator->hostname, iterator->portno ? iterator->portno : STANDARD_SIP_PORT,
- iterator->username, iterator->refresh, regstate2str(iterator->regstate), (long) iterator->regtime.tv_sec);
+ "\r\n",
+ idtext,
+ iterator->hostname,
+ iterator->portno ? iterator->portno : STANDARD_SIP_PORT,
+ iterator->username,
+ S_OR(iterator->regdomain,iterator->hostname),
+ iterator->regdomainport ? iterator->regdomainport : STANDARD_SIP_PORT,
+ iterator->refresh,
+ regstate2str(iterator->regstate),
+ (long) iterator->regtime.tv_sec);
ASTOBJ_UNLOCK(iterator);
total++;
} while(0));
@@ -15477,7 +15456,7 @@
if (!ast_strlen_zero(peer->fromuser))
ast_cli(fd, " FromUser : %s\n", peer->fromuser);
if (!ast_strlen_zero(peer->fromdomain))
- ast_cli(fd, " FromDomain : %s\n", peer->fromdomain);
+ ast_cli(fd, " FromDomain : %s Port %d\n", peer->fromdomain, (peer->fromdomainport) ? peer->fromdomainport : STANDARD_SIP_PORT);
ast_cli(fd, " Callgroup : ");
print_group(fd, peer->callgroup, 0);
ast_cli(fd, " Pickupgroup : ");
@@ -15595,7 +15574,7 @@
if (!ast_strlen_zero(peer->fromuser))
astman_append(s, "SIP-FromUser: %s\r\n", peer->fromuser);
if (!ast_strlen_zero(peer->fromdomain))
- astman_append(s, "SIP-FromDomain: %s\r\n", peer->fromdomain);
+ astman_append(s, "SIP-FromDomain: %s\r\nSip-FromDomain-Port: %d\r\n", peer->fromdomain, (peer->fromdomainport) ? peer->fromdomainport : STANDARD_SIP_PORT);
astman_append(s, "Callgroup: ");
astman_append(s, "%s\r\n", ast_print_group(buffer, sizeof(buffer), peer->callgroup));
astman_append(s, "Pickupgroup: ");
@@ -15837,6 +15816,7 @@
#define FORMAT2 "%-30.30s %-6.6s %-12.12s %8.8s %-20.20s %-25.25s\n"
#define FORMAT "%-30.30s %-6.6s %-12.12s %8d %-20.20s %-25.25s\n"
char host[80];
+ char user[80];
char tmpdat[256];
struct ast_tm tm;
int counter = 0;
@@ -15859,12 +15839,19 @@
ASTOBJ_CONTAINER_TRAVERSE(®l, 1, do {
ASTOBJ_RDLOCK(iterator);
snprintf(host, sizeof(host), "%s:%d", iterator->hostname, iterator->portno ? iterator->portno : STANDARD_SIP_PORT);
+ snprintf(user, sizeof(user), "%s", iterator->username);
+ if (!ast_strlen_zero(iterator->regdomain)) {
+ snprintf(tmpdat, sizeof(tmpdat), "%s", user);
+ snprintf(user, sizeof(user), "%s@%s", tmpdat, iterator->regdomain);}
+ if (iterator->regdomainport) {
+ snprintf(tmpdat, sizeof(tmpdat), "%s", user);
+ snprintf(user, sizeof(user), "%s:%d", tmpdat, iterator->regdomainport);}
if (iterator->regtime.tv_sec) {
ast_localtime(&iterator->regtime, &tm, NULL);
ast_strftime(tmpdat, sizeof(tmpdat), "%a, %d %b %Y %T", &tm);
} else
tmpdat[0] = '\0';
- ast_cli(a->fd, FORMAT, host, (iterator->dnsmgr) ? "Y" : "N", iterator->username, iterator->refresh, regstate2str(iterator->regstate), tmpdat);
+ ast_cli(a->fd, FORMAT, host, (iterator->dnsmgr) ? "Y" : "N", user, iterator->refresh, regstate2str(iterator->regstate), tmpdat);
ASTOBJ_UNLOCK(iterator);
counter++;
} while(0));
@@ -16051,7 +16038,7 @@
ast_cli(a->fd, " Use domains as realms: %s\n", AST_CLI_YESNO(sip_cfg.domainsasrealm));
ast_cli(a->fd, " Call to non-local dom.: %s\n", AST_CLI_YESNO(sip_cfg.allow_external_domains));
ast_cli(a->fd, " URI user is phone no: %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[0], SIP_USEREQPHONE)));
- ast_cli(a->fd, " Always auth rejects: %s\n", AST_CLI_YESNO(sip_cfg.alwaysauthreject));
+ ast_cli(a->fd, " Always auth rejects: %s\n", AST_CLI_YESNO(sip_cfg.alwaysauthreject));
ast_cli(a->fd, " Direct RTP setup: %s\n", AST_CLI_YESNO(sip_cfg.directrtpsetup));
ast_cli(a->fd, " User Agent: %s\n", global_useragent);
ast_cli(a->fd, " SDP Session Name: %s\n", ast_strlen_zero(global_sdpsession) ? "-" : global_sdpsession);
@@ -16059,7 +16046,11 @@
ast_cli(a->fd, " Reg. context: %s\n", S_OR(sip_cfg.regcontext, "(not set)"));
ast_cli(a->fd, " Regexten on Qualify: %s\n", AST_CLI_YESNO(sip_cfg.regextenonqualify));
ast_cli(a->fd, " Caller ID: %s\n", default_callerid);
- ast_cli(a->fd, " From: Domain: %s\n", default_fromdomain);
+ if ((default_fromdomainport) && (default_fromdomainport != STANDARD_SIP_PORT)) {
+ ast_cli(a->fd, " From: Domain: %s:%d\n", default_fromdomain, default_fromdomainport);
+ } else {
+ ast_cli(a->fd, " From: Domain: %s\n", default_fromdomain);
+ }
ast_cli(a->fd, " Record SIP history: %s\n", AST_CLI_ONOFF(recordhistory));
ast_cli(a->fd, " Call Events: %s\n", AST_CLI_ONOFF(sip_cfg.callevents));
ast_cli(a->fd, " Auth. Failure Events: %s\n", AST_CLI_ONOFF(global_authfailureevents));
@@ -17173,7 +17164,7 @@
if (strcmp(r->nonce, p->nonce)) {
ast_string_field_set(r, realm, p->realm);
ast_string_field_set(r, nonce, p->nonce);
- ast_string_field_set(r, domain, p->domain);
+ ast_string_field_set(r, authdomain, p->domain);
ast_string_field_set(r, opaque, p->opaque);
ast_string_field_set(r, qop, p->qop);
r->noncecount = 0;
@@ -24993,7 +24984,16 @@
} else if (!strcasecmp(v->name, "subscribecontext")) {
ast_string_field_set(peer, subscribecontext, v->value);
} else if (!strcasecmp(v->name, "fromdomain")) {
+ char *fromdomainport;
ast_string_field_set(peer, fromdomain, v->value);
+ if ((fromdomainport = strchr(peer->fromdomain, ':'))) {
+ *fromdomainport++ = '\0';
+ if (!(peer->fromdomainport = port_str2int(fromdomainport, 0))) {
+ ast_log(LOG_NOTICE, "'%s' is not a valid port number for fromdomain.\n",fromdomainport);
+ }
+ } else {
+ peer->fromdomainport = STANDARD_SIP_PORT;
+ }
} else if (!strcasecmp(v->name, "usereqphone")) {
ast_set2_flag(&peer->flags[0], ast_true(v->value), SIP_USEREQPHONE);
} else if (!strcasecmp(v->name, "fromuser")) {
@@ -25636,6 +25636,7 @@
sip_cfg.default_subscribecontext[0] = '\0';
default_language[0] = '\0';
default_fromdomain[0] = '\0';
+ default_fromdomainport = 0;
default_qualify = DEFAULT_QUALIFY;
default_maxcallbitrate = DEFAULT_MAX_CALL_BITRATE;
ast_copy_string(default_mohinterpret, DEFAULT_MOHINTERPRET, sizeof(default_mohinterpret));
@@ -25844,7 +25845,16 @@
} else if (!strcasecmp(v->name, "mwi_from")) {
ast_copy_string(default_mwi_from, v->value, sizeof(default_mwi_from));
} else if (!strcasecmp(v->name, "fromdomain")) {
+ char *fromdomainport;
ast_copy_string(default_fromdomain, v->value, sizeof(default_fromdomain));
+ if ((fromdomainport = strchr(default_fromdomain, ':'))) {
+ *fromdomainport++ = '\0';
+ if (!(default_fromdomainport = port_str2int(fromdomainport, 0))) {
+ ast_log(LOG_NOTICE, "'%s' is not a valid port number for fromdomain.\n",fromdomainport);
+ }
+ } else {
+ default_fromdomainport = STANDARD_SIP_PORT;
+ }
} else if (!strcasecmp(v->name, "outboundproxy")) {
int portnum;
char *tok, *proxyname;
Modified: team/group/v6-new/channels/sip/config_parser.c
URL: http://svnview.digium.com/svn/asterisk/team/group/v6-new/channels/sip/config_parser.c?view=diff&rev=266285&r1=266284&r2=266285
==============================================================================
--- team/group/v6-new/channels/sip/config_parser.c (original)
+++ team/group/v6-new/channels/sip/config_parser.c Fri May 28 11:35:03 2010
@@ -35,6 +35,7 @@
int sip_parse_register_line(struct sip_registry *reg, int default_expiry, const char *value, int lineno)
{
int portnum = 0;
+ int domainport = 0;
enum sip_transport transport = SIP_TRANSPORT_UDP;
char buf[256] = "";
char *userpart = NULL, *hostpart = NULL;
@@ -53,6 +54,14 @@
AST_APP_ARG(secret);
AST_APP_ARG(authuser);
);
+ AST_DECLARE_APP_ARGS(user2,
+ AST_APP_ARG(user);
+ AST_APP_ARG(domain);
+ );
+ AST_DECLARE_APP_ARGS(user3,
+ AST_APP_ARG(authuser);
+ AST_APP_ARG(domainport);
+ );
AST_DECLARE_APP_ARGS(host1,
AST_APP_ARG(hostpart);
AST_APP_ARG(expiry);
@@ -166,9 +175,52 @@
*/
AST_NONSTANDARD_RAW_ARGS(host3, host2.hostpart, ':');
+ /*!
+ * pre1.peer => peer
+ * pre2.transport = transport
+ * user2.user => user
+ * user2.domain => domain
+ * user1.secret => secret
+ * user1.authuser => authuser
+ * host3.host => host
+ * host3.port => port
+ * host2.extension => extension
+ * host1.expiry => expiry
+ */
+ AST_NONSTANDARD_RAW_ARGS(user2, user1.userpart, '@');
+
+ /*!
+ * pre1.peer => peer
+ * pre2.transport = transport
+ * user2.user => user
+ * user2.domain => domain
+ * user1.secret => secret
+ * user3.authuser => authuser
+ * user3.domainport => domainport
+ * host3.host => host
+ * host3.port => port
+ * host2.extension => extension
+ * host1.expiry => expiry
+ */
+ AST_NONSTANDARD_RAW_ARGS(user3, user1.authuser, ':');
+
+ /* Reordering needed due to fields being [(:secret[:username])|(:regdomainport:secret:username)]
+ but parsing being [secret[:username[:regdomainport]]] */
+ if (user3.argc == 2) {
+ char *reorder = user3.domainport;
+ user3.domainport = user1.secret;
+ user1.secret = user3.authuser;
+ user3.authuser = reorder;
+ }
+
if (host3.port) {
if (!(portnum = port_str2int(host3.port, 0))) {
ast_log(LOG_NOTICE, "'%s' is not a valid port number on line %d of sip.conf. using default.\n", host3.port, lineno);
+ }
+ }
+ if (user3.domainport) {
+ if (!(domainport = port_str2int(user3.domainport, 0))) {
+ ast_log(LOG_NOTICE, "'%s' is not a valid domain port number on line %d of sip.conf. using default.\n", user3.domainport, lineno);
}
}
@@ -197,15 +249,17 @@
/* copy into sip_registry object */
ast_string_field_set(reg, callback, ast_strip_quoted(S_OR(host2.extension, "s"), "\"", "\""));
- ast_string_field_set(reg, username, ast_strip_quoted(S_OR(user1.userpart, ""), "\"", "\""));
+ ast_string_field_set(reg, username, ast_strip_quoted(S_OR(user2.user, ""), "\"", "\""));
ast_string_field_set(reg, hostname, ast_strip_quoted(S_OR(host3.host, ""), "\"", "\""));
- ast_string_field_set(reg, authuser, ast_strip_quoted(S_OR(user1.authuser, ""), "\"", "\""));
+ ast_string_field_set(reg, authuser, ast_strip_quoted(S_OR(user3.authuser, ""), "\"", "\""));
ast_string_field_set(reg, secret, ast_strip_quoted(S_OR(user1.secret, ""), "\"", "\""));
ast_string_field_set(reg, peername, ast_strip_quoted(S_OR(pre1.peer, ""), "\"", "\""));
+ ast_string_field_set(reg, regdomain, ast_strip_quoted(S_OR(user2.domain, ""), "\"", "\""));
reg->transport = transport;
reg->timeout = reg->expire = -1;
reg->portno = portnum;
+ reg->regdomainport = domainport;
reg->callid_valid = FALSE;
reg->ocseq = INITIAL_CSEQ;
reg->refresh = reg->expiry = reg->configured_expiry = (host1.expiry ? atoi(ast_strip_quoted(host1.expiry, "\"", "\"")) : default_expiry);
@@ -228,6 +282,8 @@
const char *reg8 = "peer?name at namedomain:pass:authuser at domain:1234/extension~111";
const char *reg9 = "peer?name:pass:authuser:1234/extension~111";
const char *reg10 = "@domin:1234";
+ const char *reg12 = "name at namedomain:4321:pass:authuser at domain";
+ const char *reg13 = "name at namedomain:4321::@domain";
switch (cmd) {
case TEST_INIT:
@@ -249,6 +305,7 @@
sip_parse_register_line(reg, default_expiry, reg1, 1) ||
strcmp(reg->callback, "s") ||
strcmp(reg->username, "name") ||
+ strcmp(reg->regdomain, "") ||
strcmp(reg->hostname, "domain") ||
strcmp(reg->authuser, "") ||
strcmp(reg->secret, "") ||
@@ -260,6 +317,7 @@
reg->expiry != default_expiry ||
reg->configured_expiry != default_expiry ||
reg->portno != STANDARD_SIP_PORT ||
+ (reg->regdomainport) ||
reg->callid_valid != FALSE ||
reg->ocseq != INITIAL_CSEQ) {
@@ -276,6 +334,7 @@
sip_parse_register_line(reg, default_expiry, reg2, 1) ||
strcmp(reg->callback, "s") ||
strcmp(reg->username, "name") ||
+ strcmp(reg->regdomain, "") ||
strcmp(reg->hostname, "domain") ||
strcmp(reg->authuser, "") ||
strcmp(reg->secret, "pass") ||
@@ -287,6 +346,7 @@
reg->expiry != default_expiry ||
reg->configured_expiry != default_expiry ||
reg->portno != STANDARD_SIP_PORT ||
+ (reg->regdomainport) ||
reg->callid_valid != FALSE ||
reg->ocseq != INITIAL_CSEQ) {
@@ -302,7 +362,8 @@
} else if (
sip_parse_register_line(reg, default_expiry, reg3, 1) ||
strcmp(reg->callback, "s") ||
- strcmp(reg->username, "name at namedomain") ||
+ strcmp(reg->username, "name") ||
+ strcmp(reg->regdomain, "namedomain") ||
strcmp(reg->hostname, "domain") ||
strcmp(reg->authuser, "authuser") ||
strcmp(reg->secret, "pass") ||
@@ -314,6 +375,7 @@
reg->expiry != default_expiry ||
reg->configured_expiry != default_expiry ||
reg->portno != STANDARD_SIP_PORT ||
+ (reg->regdomainport) ||
reg->callid_valid != FALSE ||
reg->ocseq != INITIAL_CSEQ) {
@@ -329,7 +391,8 @@
} else if (
sip_parse_register_line(reg, default_expiry, reg4, 1) ||
strcmp(reg->callback, "extension") ||
- strcmp(reg->username, "name at namedomain") ||
+ strcmp(reg->username, "name") ||
+ strcmp(reg->regdomain, "namedomain") ||
strcmp(reg->hostname, "domain") ||
strcmp(reg->authuser, "authuser") ||
strcmp(reg->secret, "pass") ||
@@ -341,6 +404,7 @@
reg->expiry != default_expiry ||
reg->configured_expiry != default_expiry ||
reg->portno != STANDARD_SIP_PORT ||
+ (reg->regdomainport) ||
reg->callid_valid != FALSE ||
reg->ocseq != INITIAL_CSEQ) {
@@ -356,7 +420,8 @@
} else if (
sip_parse_register_line(reg, default_expiry, reg5, 1) ||
strcmp(reg->callback, "extension") ||
- strcmp(reg->username, "name at namedomain") ||
+ strcmp(reg->username, "name") ||
+ strcmp(reg->regdomain, "namedomain") ||
strcmp(reg->hostname, "domain") ||
strcmp(reg->authuser, "authuser") ||
strcmp(reg->secret, "pass") ||
@@ -368,6 +433,7 @@
reg->expiry != default_expiry ||
reg->configured_expiry != default_expiry ||
reg->portno != STANDARD_SIP_PORT ||
+ (reg->regdomainport) ||
reg->callid_valid != FALSE ||
reg->ocseq != INITIAL_CSEQ) {
@@ -383,7 +449,8 @@
} else if (
sip_parse_register_line(reg, default_expiry, reg6, 1) ||
strcmp(reg->callback, "extension") ||
- strcmp(reg->username, "name at namedomain") ||
+ strcmp(reg->username, "name") ||
+ strcmp(reg->regdomain, "namedomain") ||
strcmp(reg->hostname, "domain") ||
strcmp(reg->authuser, "authuser") ||
strcmp(reg->secret, "pass") ||
@@ -395,6 +462,7 @@
reg->expiry != 111 ||
reg->configured_expiry != 111 ||
reg->portno != STANDARD_TLS_PORT ||
+ (reg->regdomainport) ||
reg->callid_valid != FALSE ||
reg->ocseq != INITIAL_CSEQ) {
@@ -410,7 +478,8 @@
} else if (
sip_parse_register_line(reg, default_expiry, reg7, 1) ||
strcmp(reg->callback, "extension") ||
- strcmp(reg->username, "name at namedomain") ||
+ strcmp(reg->username, "name") ||
+ strcmp(reg->regdomain, "namedomain") ||
strcmp(reg->hostname, "domain") ||
strcmp(reg->authuser, "authuser") ||
strcmp(reg->secret, "pass") ||
@@ -422,6 +491,7 @@
reg->expiry != 111 ||
reg->configured_expiry != 111 ||
reg->portno != 1234 ||
+ (reg->regdomainport) ||
reg->callid_valid != FALSE ||
reg->ocseq != INITIAL_CSEQ) {
@@ -437,7 +507,8 @@
} else if (
sip_parse_register_line(reg, default_expiry, reg8, 1) ||
strcmp(reg->callback, "extension") ||
- strcmp(reg->username, "name at namedomain") ||
+ strcmp(reg->username, "name") ||
+ strcmp(reg->regdomain, "namedomain") ||
strcmp(reg->hostname, "domain") ||
strcmp(reg->authuser, "authuser") ||
strcmp(reg->secret, "pass") ||
@@ -449,6 +520,7 @@
reg->expiry != 111 ||
reg->configured_expiry != 111 ||
reg->portno != 1234 ||
+ (reg->regdomainport) ||
reg->callid_valid != FALSE ||
reg->ocseq != INITIAL_CSEQ) {
@@ -457,6 +529,60 @@
}
ast_string_field_free_memory(reg);
ast_free(reg);
+
+ /* ---Test reg12, add domain port --- */
+ if (!(reg = ast_calloc_with_stringfields(1, struct sip_registry, 256))) {
+ goto alloc_fail;
+ } else if (
+ sip_parse_register_line(reg, default_expiry, reg12, 1) ||
+ strcmp(reg->callback, "s") ||
+ strcmp(reg->username, "name") ||
+ strcmp(reg->regdomain, "namedomain") ||
+ strcmp(reg->hostname, "domain") ||
+ strcmp(reg->authuser, "authuser") ||
+ strcmp(reg->secret, "pass") ||
+ strcmp(reg->peername, "") ||
+ reg->transport != SIP_TRANSPORT_UDP ||
+ reg->timeout != -1 ||
+ reg->expire != -1 ||
+ reg->refresh != default_expiry ||
+ reg->expiry != default_expiry ||
+ reg->configured_expiry != default_expiry ||
+ reg->portno != STANDARD_SIP_PORT ||
+ reg->regdomainport != 4321 ||
+ reg->callid_valid != FALSE ||
+ reg->ocseq != INITIAL_CSEQ) {
+
+ ast_test_status_update(test, "Test 12, add domain port failed.\n");
+ res = AST_TEST_FAIL;
+ }
+
+ /* ---Test reg13, domain port without secret --- */
+ if (!(reg = ast_calloc_with_stringfields(1, struct sip_registry, 256))) {
+ goto alloc_fail;
+ } else if (
+ sip_parse_register_line(reg, default_expiry, reg13, 1) ||
+ strcmp(reg->callback, "s") ||
+ strcmp(reg->username, "name") ||
+ strcmp(reg->regdomain, "namedomain") ||
+ strcmp(reg->hostname, "domain") ||
+ strcmp(reg->authuser, "") ||
+ strcmp(reg->secret, "") ||
+ strcmp(reg->peername, "") ||
+ reg->transport != SIP_TRANSPORT_UDP ||
+ reg->timeout != -1 ||
+ reg->expire != -1 ||
+ reg->refresh != default_expiry ||
+ reg->expiry != default_expiry ||
+ reg->configured_expiry != default_expiry ||
+ reg->portno != STANDARD_SIP_PORT ||
+ reg->regdomainport != 4321 ||
+ reg->callid_valid != FALSE ||
+ reg->ocseq != INITIAL_CSEQ) {
+
+ ast_test_status_update(test, "Test 13, domain port without secret failed.\n");
+ res = AST_TEST_FAIL;
+}
/* ---Test reg 9, missing domain, expected to fail --- */
if (!(reg = ast_calloc_with_stringfields(1, struct sip_registry, 256))) {
@@ -483,7 +609,7 @@
/* ---Test reg 11, no registry object, expected to fail--- */
if (!sip_parse_register_line(NULL, default_expiry, reg1, 1)) {
ast_test_status_update(test,
- "Test 11, no registery object, expected to fail but did not.\n");
+ "Test 11, no registry object, expected to fail but did not.\n");
res = AST_TEST_FAIL;
}
Modified: team/group/v6-new/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/team/group/v6-new/channels/sip/include/sip.h?view=diff&rev=266285&r1=266284&r2=266285
==============================================================================
--- team/group/v6-new/channels/sip/include/sip.h (original)
+++ team/group/v6-new/channels/sip/include/sip.h Fri May 28 11:35:03 2010
@@ -1074,6 +1074,7 @@
struct offered_media offered_media[OFFERED_MEDIA_COUNT];
struct ast_cc_config_params *cc_params;
struct sip_epa_entry *epa_entry;
+ int fromdomainport; /*!< Domain port to show in from field */
};
/*! \brief sip packet - raw format for outbound packets that are sent or scheduled for transmission
@@ -1203,6 +1204,7 @@
struct sip_st_cfg stimer; /*!< SIP Session-Timers */
int timer_t1; /*!< The maximum T1 value for the peer */
int timer_b; /*!< The maximum timer B (transaction timeouts) */
+ int fromdomainport; /*!< The From: domain port */
/*XXX Seems like we suddenly have two flags with the same content. Why? To be continued... */
enum sip_peer_type type; /*!< Distinguish between "user" and "peer" types. This is used solely for CLI and manager commands */
@@ -1227,22 +1229,24 @@
struct sip_registry {
ASTOBJ_COMPONENTS_FULL(struct sip_registry,1,1);
AST_DECLARE_STRING_FIELDS(
- AST_STRING_FIELD(callid); /*!< Global Call-ID */
- AST_STRING_FIELD(realm); /*!< Authorization realm */
- AST_STRING_FIELD(nonce); /*!< Authorization nonce */
- AST_STRING_FIELD(opaque); /*!< Opaque nonsense */
- AST_STRING_FIELD(qop); /*!< Quality of Protection, since SIP wasn't complicated enough yet. */
- AST_STRING_FIELD(domain); /*!< Authorization domain */
- AST_STRING_FIELD(username); /*!< Who we are registering as */
- AST_STRING_FIELD(authuser); /*!< Who we *authenticate* as */
- AST_STRING_FIELD(hostname); /*!< Domain or host we register to */
- AST_STRING_FIELD(secret); /*!< Password in clear text */
- AST_STRING_FIELD(md5secret);/*!< Password in md5 */
- AST_STRING_FIELD(callback); /*!< Contact extension */
- AST_STRING_FIELD(peername); /*!< Peer registering to */
+ AST_STRING_FIELD(callid); /*!< Global Call-ID */
+ AST_STRING_FIELD(realm); /*!< Authorization realm */
+ AST_STRING_FIELD(nonce); /*!< Authorization nonce */
+ AST_STRING_FIELD(opaque); /*!< Opaque nonsense */
+ AST_STRING_FIELD(qop); /*!< Quality of Protection, since SIP wasn't complicated enough yet. */
+ AST_STRING_FIELD(authdomain); /*!< Authorization domain */
+ AST_STRING_FIELD(regdomain); /*!< Registration doamin */
+ AST_STRING_FIELD(username); /*!< Who we are registering as */
+ AST_STRING_FIELD(authuser); /*!< Who we *authenticate* as */
+ AST_STRING_FIELD(hostname); /*!< Domain or host we register to */
+ AST_STRING_FIELD(secret); /*!< Password in clear text */
+ AST_STRING_FIELD(md5secret); /*!< Password in md5 */
+ AST_STRING_FIELD(callback); /*!< Contact extension */
+ AST_STRING_FIELD(peername); /*!< Peer registering to */
);
enum sip_transport transport; /*!< Transport for this registration UDP, TCP or TLS */
- int portno; /*!< Optional port override */
+ int portno; /*!< Optional port override */
+ int regdomainport; /*!< Port override for domainport */
int expire; /*!< Sched ID of expiration */
int configured_expiry; /*!< Configured value to use for the Expires header */
int expiry; /*!< Negotiated value used for the Expires header */
Modified: team/group/v6-new/main/app.c
URL: http://svnview.digium.com/svn/asterisk/team/group/v6-new/main/app.c?view=diff&rev=266285&r1=266284&r2=266285
==============================================================================
--- team/group/v6-new/main/app.c (original)
+++ team/group/v6-new/main/app.c Fri May 28 11:35:03 2010
@@ -1192,11 +1192,15 @@
char *scan, *wasdelim = NULL;
int paren = 0, quote = 0;
- if (!buf || !array || !arraylen) {
+ if (!array || !arraylen) {
return 0;
}
memset(array, 0, arraylen * sizeof(*array));
+
+ if (!buf) {
+ return 0;
+ }
scan = buf;
Modified: team/group/v6-new/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/group/v6-new/main/asterisk.c?view=diff&rev=266285&r1=266284&r2=266285
==============================================================================
--- team/group/v6-new/main/asterisk.c (original)
+++ team/group/v6-new/main/asterisk.c Fri May 28 11:35:03 2010
@@ -970,16 +970,24 @@
}
/*! \brief NULL handler so we can collect the child exit status */
-static void null_sig_handler(int sig)
-{
-
-}
+static void _null_sig_handler(int sig)
+{
+
+}
+
+static struct sigaction null_sig_handler = {
+ .sa_handler = _null_sig_handler,
+};
+
+static struct sigaction ignore_sig_handler = {
+ .sa_handler = SIG_IGN,
+};
AST_MUTEX_DEFINE_STATIC(safe_system_lock);
/*! \brief Keep track of how many threads are currently trying to wait*() on
* a child process */
static unsigned int safe_system_level = 0;
-static void *safe_system_prev_handler;
+static struct sigaction safe_system_prev_handler;
void ast_replace_sigchld(void)
{
@@ -989,8 +997,9 @@
level = safe_system_level++;
/* only replace the handler if it has not already been done */
- if (level == 0)
- safe_system_prev_handler = signal(SIGCHLD, null_sig_handler);
+ if (level == 0) {
+ sigaction(SIGCHLD, &null_sig_handler, &safe_system_prev_handler);
+ }
ast_mutex_unlock(&safe_system_lock);
}
@@ -1003,8 +1012,9 @@
level = --safe_system_level;
/* only restore the handler if we are the last one */
- if (level == 0)
- signal(SIGCHLD, safe_system_prev_handler);
+ if (level == 0) {
+ sigaction(SIGCHLD, &safe_system_prev_handler, NULL);
+ }
ast_mutex_unlock(&safe_system_lock);
}
@@ -1437,13 +1447,16 @@
system call. We don't actually need to do anything though.
Remember: Cannot EVER ast_log from within a signal handler
*/
-static void urg_handler(int num)
-{
- signal(num, urg_handler);
+static void _urg_handler(int num)
+{
return;
}
-static void hup_handler(int num)
+static struct sigaction urg_handler = {
+ .sa_handler = _urg_handler,
+};
+
+static void _hup_handler(int num)
{
int a = 0;
if (option_verbose > 1)
@@ -1456,10 +1469,13 @@
fprintf(stderr, "hup_handler: write() failed: %s\n", strerror(errno));
}
}
- signal(num, hup_handler);
-}
-
-static void child_handler(int sig)
+}
+
+static struct sigaction hup_handler = {
+ .sa_handler = _hup_handler,
+};
+
+static void _child_handler(int sig)
{
/* Must not ever ast_log or ast_verbose within signal handler */
int n, status;
@@ -1471,8 +1487,11 @@
;
if (n == 0 && option_debug)
printf("Huh? Child handler, but nobody there?\n");
- signal(sig, child_handler);
-}
+}
+
+static struct sigaction child_handler = {
+ .sa_handler = _child_handler,
+};
/*! \brief Set maximum open files */
static void set_ulimit(int value)
@@ -1672,7 +1691,7 @@
sig_flags.need_quit = 1;
if (sig_alert_pipe[1] != -1) {
if (write(sig_alert_pipe[1], &a, sizeof(a)) < 0) {
- fprintf(stderr, "hup_handler: write() failed: %s\n", strerror(errno));
+ fprintf(stderr, "quit_handler: write() failed: %s\n", strerror(errno));
}
}
/* There is no need to restore the signal handler here, since the app
@@ -3322,7 +3341,7 @@
/* Must install this signal handler up here to ensure that if the canary
* fails to execute that it doesn't kill the Asterisk process.
*/
- signal(SIGCHLD, child_handler);
+ sigaction(SIGCHLD, &child_handler, NULL);
/* It's common on some platforms to clear /var/run at boot. Create the
* socket file directory before we drop privileges. */
@@ -3521,7 +3540,7 @@
snprintf(canary_filename, sizeof(canary_filename), "%s/alt.asterisk.canary.tweet.tweet.tweet", ast_config_AST_RUN_DIR);
/* Don't let the canary child kill Asterisk, if it dies immediately */
- signal(SIGPIPE, SIG_IGN);
+ sigaction(SIGPIPE, &ignore_sig_handler, NULL);
canary_pid = fork();
if (canary_pid == 0) {
@@ -3575,11 +3594,11 @@
sigaddset(&sigs, SIGPIPE);
sigaddset(&sigs, SIGWINCH);
pthread_sigmask(SIG_BLOCK, &sigs, NULL);
- signal(SIGURG, urg_handler);
+ sigaction(SIGURG, &urg_handler, NULL);
signal(SIGINT, __quit_handler);
signal(SIGTERM, __quit_handler);
- signal(SIGHUP, hup_handler);
- signal(SIGPIPE, SIG_IGN);
+ sigaction(SIGHUP, &hup_handler, NULL);
+ sigaction(SIGPIPE, &ignore_sig_handler, NULL);
/* ensure that the random number generators are seeded with a different value every time
Asterisk is started
Modified: team/group/v6-new/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/group/v6-new/main/channel.c?view=diff&rev=266285&r1=266284&r2=266285
==============================================================================
--- team/group/v6-new/main/channel.c (original)
+++ team/group/v6-new/main/channel.c Fri May 28 11:35:03 2010
@@ -7882,7 +7882,7 @@
? "CONNECTED_LINE_CALLER_SEND_MACRO" : "CONNECTED_LINE_CALLEE_SEND_MACRO");
macro = ast_strdupa(S_OR(macro, ""));
macro_args = pbx_builtin_getvar_helper(macro_chan, is_caller
- ? "CONNECTED_LINE_CALLER_SEND_MACRO_ARSG" : "CONNECTED_LINE_CALLEE_SEND_MACRO_ARGS");
[... 284 lines stripped ...]
More information about the asterisk-commits
mailing list