mirror of
https://github.com/asterisk/asterisk.git
synced 2025-08-22 05:36:57 +00:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
affbc6907e | ||
|
aa4ec610ff | ||
|
b5310067fd | ||
|
2fd9440b58 | ||
|
6257356ecc | ||
|
2f9be4af66 | ||
|
c41eb44de9 | ||
|
fb2735c6aa | ||
|
efc57f4d64 | ||
|
42608e5587 |
1
.lastclean
Normal file
1
.lastclean
Normal file
@@ -0,0 +1 @@
|
||||
40
|
7505
asterisk-11.0.0-summary.html
Normal file
7505
asterisk-11.0.0-summary.html
Normal file
File diff suppressed because it is too large
Load Diff
9406
asterisk-11.0.0-summary.txt
Normal file
9406
asterisk-11.0.0-summary.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1092,7 +1092,6 @@ static void iax_pvt_callid_new(int callno)
|
||||
struct ast_callid *callid = ast_create_callid();
|
||||
char buffer[AST_CALLID_BUFFER_LENGTH];
|
||||
ast_callid_strnprint(buffer, sizeof(buffer), callid);
|
||||
ast_log(LOG_NOTICE, "iax_pvt_callid_new created and set %s\n", buffer);
|
||||
iax_pvt_callid_set(callno, callid);
|
||||
ast_callid_unref(callid);
|
||||
}
|
||||
|
@@ -1729,6 +1729,7 @@ static struct ast_channel *jingle_request(const char *type, struct ast_format_ca
|
||||
struct jingle_session *session;
|
||||
struct ast_channel *chan;
|
||||
enum jingle_transport transport = JINGLE_TRANSPORT_NONE;
|
||||
struct ast_rtp_engine_ice *ice;
|
||||
AST_DECLARE_APP_ARGS(args,
|
||||
AST_APP_ARG(name);
|
||||
AST_APP_ARG(target);
|
||||
@@ -1832,6 +1833,15 @@ static struct ast_channel *jingle_request(const char *type, struct ast_format_ca
|
||||
jingle_enable_video(session);
|
||||
}
|
||||
|
||||
/* As this is outgoing set ourselves as controlling */
|
||||
if (session->rtp && (ice = ast_rtp_instance_get_ice(session->rtp))) {
|
||||
ice->ice_lite(session->rtp);
|
||||
}
|
||||
|
||||
if (session->vrtp && (ice = ast_rtp_instance_get_ice(session->vrtp))) {
|
||||
ice->ice_lite(session->vrtp);
|
||||
}
|
||||
|
||||
/* We purposely don't decrement the session here as there is a reference on the channel */
|
||||
ao2_link(endpoint->state->sessions, session);
|
||||
|
||||
@@ -1939,14 +1949,10 @@ static int jingle_interpret_ice_udp_transport(struct jingle_session *session, ik
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ast_strlen_zero(ufrag) || ast_strlen_zero(pwd)) {
|
||||
jingle_queue_hangup_with_cause(session, AST_CAUSE_PROTOCOL_ERROR);
|
||||
ast_log(LOG_ERROR, "Invalid ICE-UDP transport information received on session '%s', ufrag or pwd not present\n", session->sid);
|
||||
return -1;
|
||||
if (!ast_strlen_zero(ufrag) && !ast_strlen_zero(pwd)) {
|
||||
ice->set_authentication(rtp, ufrag, pwd);
|
||||
}
|
||||
|
||||
ice->set_authentication(rtp, ufrag, pwd);
|
||||
|
||||
for (candidate = iks_child(transport); candidate; candidate = iks_next(candidate)) {
|
||||
char *component = iks_find_attrib(candidate, "component"), *foundation = iks_find_attrib(candidate, "foundation");
|
||||
char *generation = iks_find_attrib(candidate, "generation"), *id = iks_find_attrib(candidate, "id");
|
||||
@@ -2102,7 +2108,8 @@ static int jingle_interpret_content(struct jingle_session *session, ikspak *pak)
|
||||
struct ast_rtp_instance *rtp = NULL;
|
||||
iks *description, *transport;
|
||||
|
||||
if (strcmp(iks_name(content), "content")) {
|
||||
/* Ignore specific parts if they are known not to be useful */
|
||||
if (!strcmp(iks_name(content), "conference-info")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@@ -7287,7 +7287,8 @@ static int initialize_udptl(struct sip_pvt *p)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ast_sipinfo_send(
|
||||
|
||||
static int sipinfo_send(
|
||||
struct ast_channel *chan,
|
||||
struct ast_variable *headers,
|
||||
const char *content_type,
|
||||
@@ -33162,6 +33163,12 @@ static const struct ast_data_entry sip_data_providers[] = {
|
||||
AST_DATA_ENTRY("asterisk/channel/sip/peers", &peers_data_provider),
|
||||
};
|
||||
|
||||
static const struct ast_sip_api_tech chan_sip_api_provider = {
|
||||
.version = AST_SIP_API_VERSION,
|
||||
.name = "chan_sip",
|
||||
.sipinfo_send = sipinfo_send,
|
||||
};
|
||||
|
||||
/*! \brief PBX load module - initialization */
|
||||
static int load_module(void)
|
||||
{
|
||||
@@ -33171,6 +33178,10 @@ static int load_module(void)
|
||||
return AST_MODULE_LOAD_FAILURE;
|
||||
}
|
||||
|
||||
if (ast_sip_api_provider_register(&chan_sip_api_provider)) {
|
||||
return AST_MODULE_LOAD_FAILURE;
|
||||
}
|
||||
|
||||
/* the fact that ao2_containers can't resize automatically is a major worry! */
|
||||
/* if the number of objects gets above MAX_XXX_BUCKETS, things will slow down */
|
||||
peers = ao2_t_container_alloc(HASH_PEER_SIZE, peer_hash_cb, peer_cmp_cb, "allocate peers");
|
||||
@@ -33332,6 +33343,8 @@ static int unload_module(void)
|
||||
struct ao2_iterator i;
|
||||
int wait_count;
|
||||
|
||||
ast_sip_api_provider_unregister();
|
||||
|
||||
ast_websocket_remove_protocol("sip", sip_websocket_callback);
|
||||
|
||||
network_change_event_unsubscribe();
|
||||
@@ -33507,7 +33520,7 @@ static int unload_module(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "Session Initiation Protocol (SIP)",
|
||||
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Session Initiation Protocol (SIP)",
|
||||
.load = load_module,
|
||||
.unload = unload_module,
|
||||
.reload = reload,
|
||||
|
@@ -1,6 +0,0 @@
|
||||
{
|
||||
global:
|
||||
LINKER_SYMBOL_PREFIX*ast_sipinfo_send;
|
||||
local:
|
||||
*;
|
||||
};
|
@@ -26,6 +26,16 @@ extern "C" {
|
||||
#include "asterisk/optional_api.h"
|
||||
#include "asterisk/config.h"
|
||||
|
||||
#define AST_SIP_API_VERSION 1
|
||||
|
||||
struct ast_sip_api_tech {
|
||||
const int version;
|
||||
const char *name;
|
||||
int (*sipinfo_send)(struct ast_channel *chan,
|
||||
struct ast_variable *headers, const char *content_type,
|
||||
const char *content, const char *useragent_filter);
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Send a customized SIP INFO request
|
||||
*
|
||||
@@ -44,6 +54,23 @@ int ast_sipinfo_send(struct ast_channel *chan,
|
||||
const char *content,
|
||||
const char *useragent_filter);
|
||||
|
||||
/*!
|
||||
* \brief Register a SIP API provider
|
||||
*
|
||||
* This will fail if a provider has already registered or if the
|
||||
* provider is using an incorrect version.
|
||||
*
|
||||
* \param provider The provider to register
|
||||
* \retval 0 Success
|
||||
* \retval -1 Failure
|
||||
*/
|
||||
int ast_sip_api_provider_register(const struct ast_sip_api_tech *provider);
|
||||
|
||||
/*!
|
||||
* \brief Unregister a SIP API provider
|
||||
*/
|
||||
void ast_sip_api_provider_unregister(void);
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
#endif
|
||||
|
@@ -4369,7 +4369,7 @@ static int action_originate(struct mansession *s, const struct message *m)
|
||||
|
||||
/* Allocate requested channel variables */
|
||||
vars = astman_get_variables(m);
|
||||
if (s->session->chanvars) {
|
||||
if (s->session && s->session->chanvars) {
|
||||
struct ast_variable *v, *old;
|
||||
old = vars;
|
||||
vars = NULL;
|
||||
|
60
main/sip_api.c
Normal file
60
main/sip_api.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Asterisk -- An open source telephony toolkit.
|
||||
*
|
||||
* Copyright (C) 2012, Digium, Inc.
|
||||
*
|
||||
* Mark Michelson <mmichelson@digium.com>
|
||||
*
|
||||
* See http://www.asterisk.org for more information about
|
||||
* the Asterisk project. Please do not directly contact
|
||||
* any of the maintainers of this project for assistance;
|
||||
* the project provides a web site, mailing lists and IRC
|
||||
* channels for your use.
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License Version 2. See the LICENSE file
|
||||
* at the top of the source tree.
|
||||
*/
|
||||
#include "asterisk.h"
|
||||
|
||||
#include "asterisk/sip_api.h"
|
||||
#include "asterisk/logger.h"
|
||||
|
||||
static const struct ast_sip_api_tech *api_provider;
|
||||
|
||||
int ast_sipinfo_send(struct ast_channel *chan,
|
||||
struct ast_variable *headers,
|
||||
const char *content_type,
|
||||
const char *content,
|
||||
const char *useragent_filter)
|
||||
{
|
||||
if (!api_provider) {
|
||||
ast_log(LOG_WARNING, "Unable to send custom SIP INFO. No API provider registered\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return api_provider->sipinfo_send(chan, headers, content_type, content, useragent_filter);
|
||||
}
|
||||
|
||||
int ast_sip_api_provider_register(const struct ast_sip_api_tech *provider)
|
||||
{
|
||||
if (api_provider) {
|
||||
ast_log(LOG_WARNING, "SIP provider %s has already registered. Not registering provider %s\n",
|
||||
api_provider->name, provider->name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (provider->version != AST_SIP_API_VERSION) {
|
||||
ast_log(LOG_WARNING, "SIP API provider version mismatch: Current version is %d but provider "
|
||||
"uses version %d\n", AST_SIP_API_VERSION, provider->version);
|
||||
return -1;
|
||||
}
|
||||
|
||||
api_provider = provider;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ast_sip_api_provider_unregister(void)
|
||||
{
|
||||
api_provider = NULL;
|
||||
}
|
@@ -192,11 +192,19 @@ static void *handle_tcptls_connection(void *data)
|
||||
long res;
|
||||
peer = SSL_get_peer_certificate(tcptls_session->ssl);
|
||||
if (!peer) {
|
||||
ast_log(LOG_WARNING, "No peer SSL certificate\n");
|
||||
ast_log(LOG_ERROR, "No peer SSL certificate to verify\n");
|
||||
ast_tcptls_close_session_file(tcptls_session);
|
||||
ao2_ref(tcptls_session, -1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
res = SSL_get_verify_result(tcptls_session->ssl);
|
||||
if (res != X509_V_OK) {
|
||||
ast_log(LOG_ERROR, "Certificate did not verify: %s\n", X509_verify_cert_error_string(res));
|
||||
X509_free(peer);
|
||||
ast_tcptls_close_session_file(tcptls_session);
|
||||
ao2_ref(tcptls_session, -1);
|
||||
return NULL;
|
||||
}
|
||||
if (!ast_test_flag(&tcptls_session->parent->tls_cfg->flags, AST_SSL_IGNORE_COMMON_NAME)) {
|
||||
ASN1_STRING *str;
|
||||
@@ -227,17 +235,13 @@ static void *handle_tcptls_connection(void *data)
|
||||
}
|
||||
if (!found) {
|
||||
ast_log(LOG_ERROR, "Certificate common name did not match (%s)\n", tcptls_session->parent->hostname);
|
||||
if (peer) {
|
||||
X509_free(peer);
|
||||
}
|
||||
X509_free(peer);
|
||||
ast_tcptls_close_session_file(tcptls_session);
|
||||
ao2_ref(tcptls_session, -1);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (peer) {
|
||||
X509_free(peer);
|
||||
}
|
||||
X509_free(peer);
|
||||
}
|
||||
}
|
||||
if (!tcptls_session->f) { /* no success opening descriptor stacking */
|
||||
|
Reference in New Issue
Block a user