mirror of
https://github.com/asterisk/asterisk.git
synced 2025-08-22 13:38:18 +00:00
Compare commits
28 Commits
10.11.0-rc
...
10.0.0
Author | SHA1 | Date | |
---|---|---|---|
|
847f753c4e | ||
|
adb030a737 | ||
|
f36d582ed0 | ||
|
ceb12a35e2 | ||
|
5a0e40fe2f | ||
|
3f2f5a937c | ||
|
45849eb528 | ||
|
5b13b1fc42 | ||
|
4b68462707 | ||
|
bd3620bfa9 | ||
|
39c1945702 | ||
|
e6a8fb20ac | ||
|
630fa7a94b | ||
|
8ae283533e | ||
|
59a9542a66 | ||
|
26bbbc62a9 | ||
|
c7f2d271fb | ||
|
7a25aaf5ae | ||
|
089a1d4eda | ||
|
ff91e82776 | ||
|
4401c5206d | ||
|
ae10bd24a5 | ||
|
0fdf14a260 | ||
|
2a57c8681e | ||
|
572748e5bc | ||
|
54e7a014e8 | ||
|
e357c7af5c | ||
|
fa47558077 |
3
.lastclean
Normal file
3
.lastclean
Normal file
@@ -0,0 +1,3 @@
|
||||
39
|
||||
|
||||
|
5
CHANGES
5
CHANGES
@@ -258,6 +258,11 @@ PBX Core
|
||||
|
||||
SIP Changes
|
||||
-----------
|
||||
* Due to potential username discovery vulnerabilities, the 'nat' setting in sip.conf
|
||||
now defaults to force_rport. It is very important that phones requiring nat=no be
|
||||
specifically set as such instead of relying on the default setting. If at all
|
||||
possible, all devices should have nat settings configured in the general section as
|
||||
opposed to configuring nat per-device.
|
||||
* Added preferred_codec_only option in sip.conf. This feature limits the joint
|
||||
codecs sent in response to an INVITE to the single most preferred codec.
|
||||
* Added SIP_CODEC_OUTBOUND dialplan variable which can be used to set the codec
|
||||
|
4
Makefile
4
Makefile
@@ -40,6 +40,8 @@ export ASTERISKVERSIONNUM
|
||||
# DESTDIR is the staging (or final) directory where files are copied
|
||||
# during the install process. Define it before 'export', otherwise
|
||||
# export will set it to the empty string making ?= fail.
|
||||
# Trying to run asterisk from the DESTDIR is completely unsupported
|
||||
# behavior.
|
||||
# WARNING: do not put spaces or comments after the value.
|
||||
DESTDIR?=$(INSTALL_PATH)
|
||||
export DESTDIR
|
||||
@@ -405,7 +407,7 @@ $(MOD_SUBDIRS):
|
||||
$(OTHER_SUBDIRS):
|
||||
+@_ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(_ASTCFLAGS)" ASTCFLAGS="$(ASTCFLAGS)" _ASTLDFLAGS="$(_ASTLDFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" $(SUBMAKE) --no-builtin-rules -C $@ SUBDIR=$@ all
|
||||
|
||||
defaults.h: makeopts
|
||||
defaults.h: makeopts build_tools/make_defaults_h
|
||||
@build_tools/make_defaults_h > $@.tmp
|
||||
@cmp -s $@.tmp $@ || mv $@.tmp $@
|
||||
@rm -f $@.tmp
|
||||
|
@@ -28,7 +28,7 @@
|
||||
/*** MODULEINFO
|
||||
<support_level>core</support_level>
|
||||
<replacement>app_stack (GoSub)</replacement>
|
||||
*/
|
||||
***/
|
||||
|
||||
#include "asterisk.h"
|
||||
|
||||
|
5476
asterisk-10.0.0-summary.html
Normal file
5476
asterisk-10.0.0-summary.html
Normal file
File diff suppressed because it is too large
Load Diff
7709
asterisk-10.0.0-summary.txt
Normal file
7709
asterisk-10.0.0-summary.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -25,4 +25,5 @@ cat << END
|
||||
#define DEFAULT_SPOOL_DIR "${INSTALL_PATH}${ASTSPOOLDIR}"
|
||||
#define DEFAULT_TMP_DIR "${INSTALL_PATH}${ASTSPOOLDIR}/tmp"
|
||||
|
||||
#define DEFAULT_SBIN_DIR "${INSTALL_PATH}${ASTSBINDIR}"
|
||||
END
|
||||
|
@@ -18994,11 +18994,18 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req)
|
||||
per device. I don't want incoming callers to record calls in my
|
||||
pbx.
|
||||
*/
|
||||
/* first, get the feature string, if it exists */
|
||||
|
||||
struct ast_call_feature *feat;
|
||||
int j;
|
||||
struct ast_frame f = { AST_FRAME_DTMF, };
|
||||
|
||||
if (!p->owner) { /* not a PBX call */
|
||||
transmit_response(p, "481 Call leg/transaction does not exist", req);
|
||||
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
|
||||
return;
|
||||
}
|
||||
|
||||
/* first, get the feature string, if it exists */
|
||||
ast_rdlock_call_features();
|
||||
feat = ast_find_call_feature("automon");
|
||||
if (!feat || ast_strlen_zero(feat->exten)) {
|
||||
@@ -24142,20 +24149,17 @@ static int sip_msg_send(const struct ast_msg *msg, const char *to, const char *f
|
||||
{
|
||||
struct sip_pvt *pvt;
|
||||
int res;
|
||||
char *peer;
|
||||
char *to_uri, *to_host, *to_user;
|
||||
struct sip_peer *peer_ptr;
|
||||
|
||||
if (!(pvt = sip_alloc(NULL, NULL, 0, SIP_MESSAGE, NULL))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
peer = ast_strdupa(to);
|
||||
if (strchr(peer, '@')) {
|
||||
strsep(&peer, "@");
|
||||
} else {
|
||||
strsep(&peer, ":");
|
||||
}
|
||||
if (ast_strlen_zero(peer)) {
|
||||
to_uri = ast_strdupa(to);
|
||||
parse_uri(to_uri, "sip:,sips:", &to_user, NULL, &to_host, NULL);
|
||||
|
||||
if (ast_strlen_zero(to_host)) {
|
||||
ast_log(LOG_WARNING, "MESSAGE(to) is invalid for SIP - '%s'\n", to);
|
||||
dialog_unlink_all(pvt);
|
||||
dialog_unref(pvt, "MESSAGE(to) is invalid for SIP");
|
||||
@@ -24188,12 +24192,17 @@ static int sip_msg_send(const struct ast_msg *msg, const char *to, const char *f
|
||||
|
||||
sip_pvt_lock(pvt);
|
||||
|
||||
if (create_addr(pvt, peer, NULL, TRUE, NULL)) {
|
||||
/* Look up the host to contact */
|
||||
if (create_addr(pvt, to_host, NULL, TRUE, NULL)) {
|
||||
sip_pvt_unlock(pvt);
|
||||
dialog_unlink_all(pvt);
|
||||
dialog_unref(pvt, "create_addr failed sending a MESSAGE");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!ast_strlen_zero(to_user)) {
|
||||
ast_string_field_set(pvt, username, to_user);
|
||||
}
|
||||
ast_sip_ouraddrfor(&pvt->sa, &pvt->ourip, pvt);
|
||||
ast_set_flag(&pvt->flags[0], SIP_OUTGOING);
|
||||
|
||||
@@ -24714,11 +24723,21 @@ static int handle_request_publish(struct sip_pvt *p, struct sip_request *req, st
|
||||
return handler_result;
|
||||
}
|
||||
|
||||
/*! \internal \brief Subscribe to MWI events for the specified peer
|
||||
* \note The peer cannot be locked during this method. sip_send_mwi_peer will
|
||||
* attempt to lock the peer after the event subscription lock is held; if the peer is locked during
|
||||
* this method then we will attempt to lock the event subscription lock but after the peer, creating
|
||||
* a locking inversion.
|
||||
*/
|
||||
static void add_peer_mwi_subs(struct sip_peer *peer)
|
||||
{
|
||||
struct sip_mailbox *mailbox;
|
||||
|
||||
AST_LIST_TRAVERSE(&peer->mailboxes, mailbox, entry) {
|
||||
if (mailbox->event_sub) {
|
||||
ast_event_unsubscribe(mailbox->event_sub);
|
||||
}
|
||||
|
||||
mailbox->event_sub = ast_event_subscribe(AST_EVENT_MWI, mwi_event_cb, "SIP mbox event", peer,
|
||||
AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox->mailbox,
|
||||
AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, S_OR(mailbox->context, "default"),
|
||||
@@ -24872,7 +24891,7 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
|
||||
/* if an authentication response was sent, we are done here */
|
||||
if (res == AUTH_CHALLENGE_SENT) /* authpeer = NULL here */
|
||||
return 0;
|
||||
if (res < 0) {
|
||||
if (res != AUTH_SUCCESSFUL) {
|
||||
if (res == AUTH_FAKE_AUTH) {
|
||||
ast_log(LOG_NOTICE, "Sending fake auth rejection for device %s\n", sip_get_header(req, "From"));
|
||||
transmit_fake_auth_response(p, SIP_SUBSCRIBE, req, XMIT_UNRELIABLE);
|
||||
@@ -24886,17 +24905,17 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
|
||||
}
|
||||
}
|
||||
|
||||
/* At this point, authpeer cannot be NULL. Remember we hold a reference,
|
||||
* so we must release it when done.
|
||||
* XXX must remove all the checks for authpeer == NULL.
|
||||
/* At this point, we hold a reference to authpeer (if not NULL). It
|
||||
* must be released when done.
|
||||
*/
|
||||
|
||||
/* Check if this device is allowed to subscribe at all */
|
||||
if (!ast_test_flag(&p->flags[1], SIP_PAGE2_ALLOWSUBSCRIBE)) {
|
||||
transmit_response(p, "403 Forbidden (policy)", req);
|
||||
pvt_set_needdestroy(p, "subscription not allowed");
|
||||
if (authpeer)
|
||||
if (authpeer) {
|
||||
sip_unref_peer(authpeer, "sip_unref_peer, from handle_request_subscribe (authpeer 1)");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -24916,8 +24935,9 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
|
||||
transmit_response(p, "404 Not Found", req);
|
||||
}
|
||||
pvt_set_needdestroy(p, "subscription target not found");
|
||||
if (authpeer)
|
||||
if (authpeer) {
|
||||
sip_unref_peer(authpeer, "sip_unref_peer, from handle_request_subscribe (authpeer 2)");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -24932,9 +24952,6 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
|
||||
enum subscriptiontype subscribed = NONE;
|
||||
const char *unknown_acceptheader = NULL;
|
||||
|
||||
if (authpeer) /* We do not need the authpeer any more */
|
||||
authpeer = sip_unref_peer(authpeer, "sip_unref_peer, from handle_request_subscribe (authpeer 2)");
|
||||
|
||||
/* Header from Xten Eye-beam Accept: multipart/related, application/rlmi+xml, application/pidf+xml, application/xpidf+xml */
|
||||
accept = __get_header(req, "Accept", &start);
|
||||
while ((subscribed == NONE) && !ast_strlen_zero(accept)) {
|
||||
@@ -24972,6 +24989,9 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
|
||||
p->subscribecontext,
|
||||
p->subscribeuri);
|
||||
pvt_set_needdestroy(p, "no Accept header");
|
||||
if (authpeer) {
|
||||
sip_unref_peer(authpeer, "sip_unref_peer, from handle_request_subscribe (authpeer 2)");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* if p->subscribed is non-zero, then accept is not obligatory; according to rfc 3265 section 3.1.3, at least.
|
||||
@@ -24996,6 +25016,9 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
|
||||
p->subscribecontext,
|
||||
p->subscribeuri);
|
||||
pvt_set_needdestroy(p, "unrecognized format");
|
||||
if (authpeer) {
|
||||
sip_unref_peer(authpeer, "sip_unref_peer, from handle_request_subscribe (authpeer 2)");
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
p->subscribed = subscribed;
|
||||
@@ -25018,8 +25041,9 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
|
||||
transmit_response(p, "406 Not Acceptable", req);
|
||||
ast_debug(2, "Received SIP mailbox subscription for unknown format: %s\n", acceptheader);
|
||||
pvt_set_needdestroy(p, "unknown format");
|
||||
if (authpeer)
|
||||
if (authpeer) {
|
||||
sip_unref_peer(authpeer, "sip_unref_peer, from handle_request_subscribe (authpeer 3)");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* Looks like they actually want a mailbox status
|
||||
@@ -25028,11 +25052,17 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
|
||||
In most devices, this is configurable to the voicemailmain extension you use
|
||||
*/
|
||||
if (!authpeer || AST_LIST_EMPTY(&authpeer->mailboxes)) {
|
||||
transmit_response(p, "404 Not found (no mailbox)", req);
|
||||
if (!authpeer) {
|
||||
transmit_response(p, "404 Not found", req);
|
||||
} else {
|
||||
transmit_response(p, "404 Not found (no mailbox)", req);
|
||||
ast_log(LOG_NOTICE, "Received SIP subscribe for peer without mailbox: %s\n", S_OR(authpeer->name, ""));
|
||||
}
|
||||
pvt_set_needdestroy(p, "received 404 response");
|
||||
ast_log(LOG_NOTICE, "Received SIP subscribe for peer without mailbox: %s\n", S_OR(authpeer->name, ""));
|
||||
if (authpeer)
|
||||
sip_unref_peer(authpeer, "sip_unref_peer, from handle_request_subscribe (authpeer 4)");
|
||||
|
||||
if (authpeer) {
|
||||
sip_unref_peer(authpeer, "sip_unref_peer, from handle_request_subscribe (authpeer 3)");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -25042,18 +25072,21 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
|
||||
add_peer_mwi_subs(authpeer);
|
||||
ao2_lock(p);
|
||||
}
|
||||
if (authpeer->mwipvt && authpeer->mwipvt != p) { /* Destroy old PVT if this is a new one */
|
||||
if (authpeer->mwipvt != p) { /* Destroy old PVT if this is a new one */
|
||||
/* We only allow one subscription per peer */
|
||||
dialog_unlink_all(authpeer->mwipvt);
|
||||
authpeer->mwipvt = dialog_unref(authpeer->mwipvt, "unref dialog authpeer->mwipvt");
|
||||
/* sip_destroy(authpeer->mwipvt); */
|
||||
if (authpeer->mwipvt) {
|
||||
dialog_unlink_all(authpeer->mwipvt);
|
||||
authpeer->mwipvt = dialog_unref(authpeer->mwipvt, "unref dialog authpeer->mwipvt");
|
||||
}
|
||||
authpeer->mwipvt = dialog_ref(p, "setting peers' mwipvt to p");
|
||||
}
|
||||
|
||||
if (p->relatedpeer != authpeer) {
|
||||
if (p->relatedpeer) {
|
||||
sip_unref_peer(p->relatedpeer, "Unref previously stored relatedpeer ptr");
|
||||
}
|
||||
p->relatedpeer = sip_ref_peer(authpeer, "setting dialog's relatedpeer pointer");
|
||||
}
|
||||
if (authpeer->mwipvt)
|
||||
dialog_unref(authpeer->mwipvt, "Unref previously stored mwipvt dialog pointer");
|
||||
authpeer->mwipvt = dialog_ref(p, "setting peers' mwipvt to p"); /* Link from peer to pvt UH- should this be dialog_ref()? */
|
||||
if (p->relatedpeer)
|
||||
sip_unref_peer(p->relatedpeer, "Unref previously stored relatedpeer ptr");
|
||||
p->relatedpeer = sip_ref_peer(authpeer, "setting dialog's relatedpeer pointer"); /* already refcounted...Link from pvt to peer UH- should this be dialog_ref()? */
|
||||
/* Do not release authpeer here */
|
||||
} else if (!strcmp(event, "call-completion")) {
|
||||
handle_cc_subscribe(p, req);
|
||||
@@ -25061,16 +25094,12 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
|
||||
transmit_response(p, "489 Bad Event", req);
|
||||
ast_debug(2, "Received SIP subscribe for unknown event package: %s\n", event);
|
||||
pvt_set_needdestroy(p, "unknown event package");
|
||||
if (authpeer)
|
||||
if (authpeer) {
|
||||
sip_unref_peer(authpeer, "sip_unref_peer, from handle_request_subscribe (authpeer 5)");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* At this point, if we have an authpeer we should unref it. */
|
||||
if (authpeer) {
|
||||
authpeer = sip_unref_peer(authpeer, "unref pointer into (*authpeer)");
|
||||
}
|
||||
|
||||
/* Add subscription for extension state from the PBX core */
|
||||
if (p->subscribed != MWI_NOTIFICATION && p->subscribed != CALL_COMPLETION && !resubscribe) {
|
||||
if (p->stateid > -1) {
|
||||
@@ -25095,6 +25124,9 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
|
||||
"with Expire header less that 'minexpire' limit. Received \"Expire: %d\" min is %d\n",
|
||||
p->exten, p->context, p->expiry, min_expiry);
|
||||
pvt_set_needdestroy(p, "Expires is less that the min expires allowed.");
|
||||
if (authpeer) {
|
||||
sip_unref_peer(authpeer, "sip_unref_peer, from handle_request_subscribe (authpeer 6)");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -25130,6 +25162,9 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
|
||||
ast_log(LOG_NOTICE, "Got SUBSCRIBE for extension %s@%s from %s, but there is no hint for that extension.\n", p->exten, p->context, ast_sockaddr_stringify(&p->sa));
|
||||
transmit_response(p, "404 Not found", req);
|
||||
pvt_set_needdestroy(p, "no extension for SUBSCRIBE");
|
||||
if (authpeer) {
|
||||
sip_unref_peer(authpeer, "sip_unref_peer, from handle_request_subscribe (authpeer 6)");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
ast_set_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
|
||||
@@ -25145,6 +25180,10 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
|
||||
pvt_set_needdestroy(p, "forcing expiration");
|
||||
}
|
||||
}
|
||||
|
||||
if (authpeer) {
|
||||
sip_unref_peer(authpeer, "unref pointer into (*authpeer)");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -25862,14 +25901,16 @@ static int get_cached_mwi(struct sip_peer *peer, int *new, int *old)
|
||||
*/
|
||||
static int sip_send_mwi_to_peer(struct sip_peer *peer, int cache_only)
|
||||
{
|
||||
/* Called with peerl lock, but releases it */
|
||||
/* Called with peer lock, but releases it */
|
||||
struct sip_pvt *p;
|
||||
int newmsgs = 0, oldmsgs = 0;
|
||||
const char *vmexten;
|
||||
const char *vmexten = NULL;
|
||||
|
||||
ao2_lock(peer);
|
||||
|
||||
vmexten = ast_strdupa(peer->vmexten);
|
||||
if (peer->vmexten) {
|
||||
vmexten = ast_strdupa(peer->vmexten);
|
||||
}
|
||||
|
||||
if (ast_test_flag((&peer->flags[1]), SIP_PAGE2_SUBSCRIBEMWIONLY) && !peer->mwipvt) {
|
||||
ao2_unlock(peer);
|
||||
@@ -27016,12 +27057,11 @@ static int handle_common_options(struct ast_flags *flags, struct ast_flags *mask
|
||||
}
|
||||
} else if (!strcasecmp(v->name, "nat")) {
|
||||
ast_set_flag(&mask[0], SIP_NAT_FORCE_RPORT);
|
||||
ast_set_flag(&flags[0], SIP_NAT_FORCE_RPORT); /* Default to "force_rport" */
|
||||
if (!strcasecmp(v->value, "no")) {
|
||||
ast_clear_flag(&flags[0], SIP_NAT_FORCE_RPORT);
|
||||
} else if (!strcasecmp(v->value, "force_rport")) {
|
||||
ast_set_flag(&flags[0], SIP_NAT_FORCE_RPORT);
|
||||
} else if (!strcasecmp(v->value, "yes")) {
|
||||
ast_set_flag(&flags[0], SIP_NAT_FORCE_RPORT);
|
||||
/* We've already defaulted to force_rport */
|
||||
ast_set_flag(&mask[1], SIP_PAGE2_SYMMETRICRTP);
|
||||
ast_set_flag(&flags[1], SIP_PAGE2_SYMMETRICRTP);
|
||||
} else if (!strcasecmp(v->value, "comedia")) {
|
||||
@@ -28159,6 +28199,18 @@ static void sip_set_default_format_capabilities(struct ast_format_cap *cap)
|
||||
ast_format_cap_add(cap, ast_format_set(&tmp_fmt, AST_FORMAT_H263, 0));
|
||||
}
|
||||
|
||||
static void display_nat_warning(const char *cat, int reason, struct ast_flags *flags) {
|
||||
int global_nat, specific_nat;
|
||||
|
||||
if (reason == CHANNEL_MODULE_LOAD && (specific_nat = ast_test_flag(&flags[0], SIP_NAT_FORCE_RPORT)) != (global_nat = ast_test_flag(&global_flags[0], SIP_NAT_FORCE_RPORT))) {
|
||||
ast_log(LOG_WARNING, "!!! PLEASE NOTE: Setting 'nat' for a peer/user that differs from the global setting can make\n");
|
||||
ast_log(LOG_WARNING, "!!! the name of that peer/user discoverable by an attacker. Replies for non-existent peers/users\n");
|
||||
ast_log(LOG_WARNING, "!!! will be sent to a different port than replies for an existing peer/user. If at all possible,\n");
|
||||
ast_log(LOG_WARNING, "!!! use the global 'nat' setting and do not set 'nat' per peer/user.\n");
|
||||
ast_log(LOG_WARNING, "!!! (config category='%s' global force_rport='%s' peer/user force_rport='%s')\n", cat, AST_CLI_YESNO(global_nat), AST_CLI_YESNO(specific_nat));
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief Re-read SIP.conf config file
|
||||
\note This function reloads all config data, except for
|
||||
active peers (with registrations). They will only
|
||||
@@ -28384,8 +28436,9 @@ static int reload_config(enum channelreloadreason reason)
|
||||
ast_copy_string(default_mohinterpret, DEFAULT_MOHINTERPRET, sizeof(default_mohinterpret));
|
||||
ast_copy_string(default_mohsuggest, DEFAULT_MOHSUGGEST, sizeof(default_mohsuggest));
|
||||
ast_copy_string(default_vmexten, DEFAULT_VMEXTEN, sizeof(default_vmexten));
|
||||
ast_set_flag(&global_flags[0], SIP_DTMF_RFC2833); /*!< Default DTMF setting: RFC2833 */
|
||||
ast_set_flag(&global_flags[0], SIP_DIRECT_MEDIA); /*!< Allow re-invites */
|
||||
ast_set_flag(&global_flags[0], SIP_DTMF_RFC2833); /*!< Default DTMF setting: RFC2833 */
|
||||
ast_set_flag(&global_flags[0], SIP_DIRECT_MEDIA); /*!< Allow re-invites */
|
||||
ast_set_flag(&global_flags[0], SIP_NAT_FORCE_RPORT); /*!< Default to nat=force_rport */
|
||||
ast_copy_string(default_engine, DEFAULT_ENGINE, sizeof(default_engine));
|
||||
ast_copy_string(default_parkinglot, DEFAULT_PARKINGLOT, sizeof(default_parkinglot));
|
||||
|
||||
@@ -29162,6 +29215,7 @@ static int reload_config(enum channelreloadreason reason)
|
||||
}
|
||||
peer = build_peer(cat, ast_variable_browse(cfg, cat), NULL, 0, 0);
|
||||
if (peer) {
|
||||
display_nat_warning(cat, reason, &peer->flags[0]);
|
||||
ao2_t_link(peers, peer, "link peer into peers table");
|
||||
if ((peer->type & SIP_TYPE_PEER) && !ast_sockaddr_isnull(&peer->addr)) {
|
||||
ao2_t_link(peers_by_ip, peer, "link peer into peers_by_ip table");
|
||||
|
@@ -9,6 +9,7 @@ astagidir => /var/lib/asterisk/agi-bin
|
||||
astspooldir => /var/spool/asterisk
|
||||
astrundir => /var/run/asterisk
|
||||
astlogdir => /var/log/asterisk
|
||||
astsbindir => /usr/sbin
|
||||
|
||||
[options]
|
||||
;verbose = 3
|
||||
|
@@ -814,6 +814,14 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls
|
||||
; for their media streams is not actual port number that will be used on the nearer
|
||||
; side of the NAT.
|
||||
;
|
||||
; IT IS IMPORTANT TO NOTE that if the nat setting in the general section differs from
|
||||
; the nat setting in a peer definition, then the peer username will be discoverable
|
||||
; by outside parties as Asterisk will respond to different ports for defined and
|
||||
; undefined peers. For this reason it is recommended to ONLY DEFINE NAT SETTINGS IN THE
|
||||
; GENERAL SECTION. Specifically, if nat=force_rport in one section and nat=no in the
|
||||
; other, then valid users with settings differing from those in the general section will
|
||||
; be discoverable.
|
||||
;
|
||||
; In addition to these settings, Asterisk *always* uses 'symmetric RTP' mode as defined by
|
||||
; RFC 4961; Asterisk will always send RTP packets from the same port number it expects
|
||||
; to receive them on.
|
||||
@@ -1202,12 +1210,10 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls
|
||||
type=friend
|
||||
|
||||
[natted-phone](!,basic-options) ; another template inheriting basic-options
|
||||
nat=yes
|
||||
directmedia=no
|
||||
host=dynamic
|
||||
|
||||
[public-phone](!,basic-options) ; another template inheriting basic-options
|
||||
nat=no
|
||||
directmedia=yes
|
||||
|
||||
[my-codecs](!) ; a template for my preferred codecs
|
||||
@@ -1243,7 +1249,6 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls
|
||||
;description=Courtesy Phone ; Description of the peer. Shown when doing 'sip show peers'.
|
||||
;host=192.168.0.23 ; we have a static but private IP address
|
||||
; No registration allowed
|
||||
;nat=no ; there is not NAT between phone and Asterisk
|
||||
;directmedia=yes ; allow RTP voice traffic to bypass Asterisk
|
||||
;dtmfmode=info ; either RFC2833 or INFO for the BudgeTone
|
||||
;call-limit=1 ; permit only 1 outgoing call and 1 incoming call at a time
|
||||
@@ -1273,7 +1278,6 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls
|
||||
;regexten=1234 ; When they register, create extension 1234
|
||||
;callerid="Jane Smith" <5678>
|
||||
;host=dynamic ; This device needs to register
|
||||
;nat=yes ; X-Lite is behind a NAT router
|
||||
;directmedia=no ; Typically set to NO if behind NAT
|
||||
;disallow=all
|
||||
;allow=gsm ; GSM consumes far less bandwidth than ulaw
|
||||
@@ -1347,9 +1351,6 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls
|
||||
;type=friend
|
||||
;secret=blah
|
||||
;qualify=200 ; Qualify peer is no more than 200ms away
|
||||
;nat=yes ; This phone may be natted
|
||||
; Send SIP and RTP to the IP address that packet is
|
||||
; received from instead of trusting SIP headers
|
||||
;host=dynamic ; This device registers with us
|
||||
;directmedia=no ; Asterisk by default tries to redirect the
|
||||
; RTP media stream (audio) to go directly from
|
||||
|
@@ -35,5 +35,6 @@ extern const char *ast_config_AST_RUN_DIR;
|
||||
extern const char *ast_config_AST_RUN_GROUP;
|
||||
extern const char *ast_config_AST_RUN_USER;
|
||||
extern const char *ast_config_AST_SYSTEM_NAME;
|
||||
extern const char *ast_config_AST_SBIN_DIR;
|
||||
|
||||
#endif /* _ASTERISK_PATHS_H */
|
||||
|
@@ -242,6 +242,7 @@ struct _cfg_paths {
|
||||
|
||||
char config_file[PATH_MAX];
|
||||
char db_path[PATH_MAX];
|
||||
char sbin_dir[PATH_MAX];
|
||||
char pid_path[PATH_MAX];
|
||||
char socket_path[PATH_MAX];
|
||||
char run_user[PATH_MAX];
|
||||
@@ -262,6 +263,7 @@ const char *ast_config_AST_LOG_DIR = cfg_paths.log_dir;
|
||||
const char *ast_config_AST_AGI_DIR = cfg_paths.agi_dir;
|
||||
const char *ast_config_AST_KEY_DIR = cfg_paths.key_dir;
|
||||
const char *ast_config_AST_RUN_DIR = cfg_paths.run_dir;
|
||||
const char *ast_config_AST_SBIN_DIR = cfg_paths.sbin_dir;
|
||||
|
||||
const char *ast_config_AST_DB = cfg_paths.db_path;
|
||||
const char *ast_config_AST_PID = cfg_paths.pid_path;
|
||||
@@ -2901,6 +2903,7 @@ static void ast_readconfig(void)
|
||||
ast_copy_string(cfg_paths.log_dir, DEFAULT_LOG_DIR, sizeof(cfg_paths.log_dir));
|
||||
ast_copy_string(cfg_paths.agi_dir, DEFAULT_AGI_DIR, sizeof(cfg_paths.agi_dir));
|
||||
ast_copy_string(cfg_paths.db_path, DEFAULT_DB, sizeof(cfg_paths.db_path));
|
||||
ast_copy_string(cfg_paths.sbin_dir, DEFAULT_SBIN_DIR, sizeof(cfg_paths.sbin_dir));
|
||||
ast_copy_string(cfg_paths.key_dir, DEFAULT_KEY_DIR, sizeof(cfg_paths.key_dir));
|
||||
ast_copy_string(cfg_paths.pid_path, DEFAULT_PID, sizeof(cfg_paths.pid_path));
|
||||
ast_copy_string(cfg_paths.socket_path, DEFAULT_SOCKET, sizeof(cfg_paths.socket_path));
|
||||
@@ -2954,6 +2957,8 @@ static void ast_readconfig(void)
|
||||
ast_copy_string(cfg_paths.run_dir, v->value, sizeof(cfg_paths.run_dir));
|
||||
} else if (!strcasecmp(v->name, "astmoddir")) {
|
||||
ast_copy_string(cfg_paths.module_dir, v->value, sizeof(cfg_paths.module_dir));
|
||||
} else if (!strcasecmp(v->name, "astsbindir")) {
|
||||
ast_copy_string(cfg_paths.sbin_dir, v->value, sizeof(cfg_paths.sbin_dir));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3671,7 +3676,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
canary_pid = fork();
|
||||
if (canary_pid == 0) {
|
||||
char canary_binary[128], *lastslash, ppid[12];
|
||||
char canary_binary[PATH_MAX], ppid[12];
|
||||
|
||||
/* Reset signal handler */
|
||||
signal(SIGCHLD, SIG_DFL);
|
||||
@@ -3681,14 +3686,9 @@ int main(int argc, char *argv[])
|
||||
ast_set_priority(0);
|
||||
snprintf(ppid, sizeof(ppid), "%d", (int) ast_mainpid);
|
||||
|
||||
execlp("astcanary", "astcanary", canary_filename, ppid, (char *)NULL);
|
||||
|
||||
/* If not found, try the same path as used to execute asterisk */
|
||||
ast_copy_string(canary_binary, argv[0], sizeof(canary_binary));
|
||||
if ((lastslash = strrchr(canary_binary, '/'))) {
|
||||
ast_copy_string(lastslash + 1, "astcanary", sizeof(canary_binary) + canary_binary - (lastslash + 1));
|
||||
execl(canary_binary, "astcanary", canary_filename, ppid, (char *)NULL);
|
||||
}
|
||||
/* Use the astcanary binary that we installed */
|
||||
snprintf(canary_binary, sizeof(canary_binary), "%s/astcanary", ast_config_AST_SBIN_DIR);
|
||||
execl(canary_binary, "astcanary", canary_filename, ppid, (char *)NULL);
|
||||
|
||||
/* Should never happen */
|
||||
_exit(1);
|
||||
|
@@ -739,12 +739,13 @@ static enum ast_bridge_channel_state bridge_channel_join_multithreaded(struct as
|
||||
|
||||
ao2_unlock(bridge_channel->bridge);
|
||||
|
||||
ao2_lock(bridge_channel);
|
||||
/* Wait for data to either come from the channel or us to be signalled */
|
||||
if (!bridge_channel->suspended) {
|
||||
ao2_unlock(bridge_channel);
|
||||
ast_debug(10, "Going into a multithreaded waitfor for bridge channel %p of bridge %p\n", bridge_channel, bridge_channel->bridge);
|
||||
chan = ast_waitfor_nandfds(&bridge_channel->chan, 1, fds, nfds, NULL, &outfd, &ms);
|
||||
} else {
|
||||
ao2_lock(bridge_channel);
|
||||
ast_debug(10, "Going into a multithreaded signal wait for bridge channel %p of bridge %p\n", bridge_channel, bridge_channel->bridge);
|
||||
ast_cond_wait(&bridge_channel->cond, ao2_object_get_lockaddr(bridge_channel));
|
||||
ao2_unlock(bridge_channel);
|
||||
@@ -777,9 +778,10 @@ static enum ast_bridge_channel_state bridge_channel_join_singlethreaded(struct a
|
||||
/*! \brief Internal function that suspends a channel from a bridge */
|
||||
static void bridge_channel_suspend(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
|
||||
{
|
||||
ao2_lock(bridge_channel);
|
||||
bridge_channel->suspended = 1;
|
||||
|
||||
bridge_array_remove(bridge, bridge_channel->chan);
|
||||
ao2_unlock(bridge_channel);
|
||||
|
||||
if (bridge->technology->suspend) {
|
||||
bridge->technology->suspend(bridge, bridge_channel);
|
||||
@@ -791,14 +793,18 @@ static void bridge_channel_suspend(struct ast_bridge *bridge, struct ast_bridge_
|
||||
/*! \brief Internal function that unsuspends a channel from a bridge */
|
||||
static void bridge_channel_unsuspend(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
|
||||
{
|
||||
bridge_channel->suspended =0;
|
||||
|
||||
ao2_lock(bridge_channel);
|
||||
bridge_channel->suspended = 0;
|
||||
bridge_array_add(bridge, bridge_channel->chan);
|
||||
ast_cond_signal(&bridge_channel->cond);
|
||||
ao2_unlock(bridge_channel);
|
||||
|
||||
if (bridge->technology->unsuspend) {
|
||||
bridge->technology->unsuspend(bridge, bridge_channel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -865,6 +871,12 @@ static void bridge_channel_feature(struct ast_bridge *bridge, struct ast_bridge_
|
||||
/* If a hook was actually matched execute it on this channel, otherwise stream up the DTMF to the other channels */
|
||||
if (hook) {
|
||||
hook->callback(bridge, bridge_channel, hook->hook_pvt);
|
||||
/* If we are handing the channel off to an external hook for ownership,
|
||||
* we are not guaranteed what kind of state it will come back in. If
|
||||
* the channel hungup, we need to detect that here. */
|
||||
if (bridge_channel->chan && ast_check_hangup_locked(bridge_channel->chan)) {
|
||||
ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
|
||||
}
|
||||
} else {
|
||||
ast_bridge_dtmf_stream(bridge, dtmf, bridge_channel->chan);
|
||||
}
|
||||
|
@@ -117,9 +117,9 @@ static void db_sync(void);
|
||||
DEFINE_SQL_STATEMENT(put_stmt, "INSERT OR REPLACE INTO astdb (key, value) VALUES (?, ?)")
|
||||
DEFINE_SQL_STATEMENT(get_stmt, "SELECT value FROM astdb WHERE key=?")
|
||||
DEFINE_SQL_STATEMENT(del_stmt, "DELETE FROM astdb WHERE key=?")
|
||||
DEFINE_SQL_STATEMENT(deltree_stmt, "DELETE FROM astdb WHERE key LIKE ? || '/' || '%'")
|
||||
DEFINE_SQL_STATEMENT(deltree_stmt, "DELETE FROM astdb WHERE key || '/' LIKE ? || '/' || '%'")
|
||||
DEFINE_SQL_STATEMENT(deltree_all_stmt, "DELETE FROM astdb")
|
||||
DEFINE_SQL_STATEMENT(gettree_stmt, "SELECT key, value FROM astdb WHERE key LIKE ? || '/' || '%'")
|
||||
DEFINE_SQL_STATEMENT(gettree_stmt, "SELECT key, value FROM astdb WHERE key || '/' LIKE ? || '/' || '%'")
|
||||
DEFINE_SQL_STATEMENT(gettree_all_stmt, "SELECT key, value FROM astdb")
|
||||
DEFINE_SQL_STATEMENT(showkey_stmt, "SELECT key, value FROM astdb WHERE key LIKE '%' || '/' || ?")
|
||||
DEFINE_SQL_STATEMENT(create_astdb_stmt, "CREATE TABLE IF NOT EXISTS astdb(key VARCHAR(256), value VARCHAR(256), PRIMARY KEY(key))")
|
||||
@@ -156,7 +156,7 @@ static int convert_bdb_to_sqlite3(void)
|
||||
char *cmd;
|
||||
int res;
|
||||
|
||||
ast_asprintf(&cmd, "astdb2sqlite3 '%s'\n", ast_config_AST_DB);
|
||||
ast_asprintf(&cmd, "%s/astdb2sqlite3 '%s'\n", ast_config_AST_SBIN_DIR, ast_config_AST_DB);
|
||||
res = ast_safe_system(cmd);
|
||||
ast_free(cmd);
|
||||
|
||||
|
Reference in New Issue
Block a user