[asterisk-commits] mmichelson: branch mmichelson/sip_endpoint_reorg r395547 - in /team/mmichelso...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jul 26 14:15:51 CDT 2013
Author: mmichelson
Date: Fri Jul 26 14:15:49 2013
New Revision: 395547
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395547
Log:
Un-anonymize media configuration structures.
Modified:
team/mmichelson/sip_endpoint_reorg/include/asterisk/res_sip.h
team/mmichelson/sip_endpoint_reorg/res/res_sip/sip_configuration.c
team/mmichelson/sip_endpoint_reorg/res/res_sip_sdp_rtp.c
team/mmichelson/sip_endpoint_reorg/res/res_sip_session.c
Modified: team/mmichelson/sip_endpoint_reorg/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_endpoint_reorg/include/asterisk/res_sip.h?view=diff&rev=395547&r1=395546&r2=395547
==============================================================================
--- team/mmichelson/sip_endpoint_reorg/include/asterisk/res_sip.h (original)
+++ team/mmichelson/sip_endpoint_reorg/include/asterisk/res_sip.h Fri Jul 26 14:15:49 2013
@@ -409,6 +409,67 @@
struct ast_sip_info_recording_configuration recording;
};
+struct ast_sip_media_rtp_configuration {
+ AST_DECLARE_STRING_FIELDS(
+ /*! Configured RTP engine for this endpoint. */
+ AST_STRING_FIELD(engine);
+ );
+ /*! Whether IPv6 RTP is enabled or not */
+ unsigned int ipv6;
+ /*! Whether symmetric RTP is enabled or not */
+ unsigned int symmetric;
+ /*! Whether ICE support is enabled or not */
+ unsigned int ice_support;
+ /*! Whether to use the "ptime" attribute received from the endpoint or not */
+ unsigned int use_ptime;
+ /*! Do we use AVPF exclusively for this endpoint? */
+ unsigned int use_avpf;
+ /*! \brief DTLS-SRTP configuration information */
+ struct ast_rtp_dtls_cfg dtls_cfg;
+ /*! Should SRTP use a 32 byte tag instead of an 80 byte tag? */
+ unsigned int srtp_tag_32;
+ /*! Do we use media encryption? what type? */
+ enum ast_sip_session_media_encryption encryption;
+};
+
+struct ast_sip_direct_media_configuration {
+ /*! Boolean indicating if direct_media is permissible */
+ unsigned int enabled;
+ /*! When using direct media, which method should be used */
+ enum ast_sip_session_refresh_method method;
+ /*! Take steps to mitigate glare for direct media */
+ enum ast_sip_direct_media_glare_mitigation glare_mitigation;
+ /*! Do not attempt direct media session refreshes if a media NAT is detected */
+ unsigned int disable_on_nat;
+};
+
+
+struct ast_sip_endpoint_media_configuration {
+ AST_DECLARE_STRING_FIELDS(
+ /*! Optional external media address to use in SDP */
+ AST_STRING_FIELD(external_address);
+ /*! SDP origin username */
+ AST_STRING_FIELD(sdpowner);
+ /*! SDP session name */
+ AST_STRING_FIELD(sdpsession);
+ );
+ /*! RTP media configuration */
+ struct ast_sip_media_rtp_configuration rtp;
+ /*! Direct media options */
+ struct ast_sip_direct_media_configuration direct_media;
+ /*! Codec preferences */
+ struct ast_codec_pref prefs;
+ /*! Configured codecs */
+ struct ast_format_cap *codecs;
+ /*! DSCP TOS bits for audio streams */
+ unsigned int tos_audio;
+ /*! Priority for audio streams */
+ unsigned int cos_audio;
+ /*! DSCP TOS bits for video streams */
+ unsigned int tos_video;
+ /*! Priority for video streams */
+ unsigned int cos_video;
+};
/*!
* \brief An entity with which Asterisk communicates
*/
@@ -425,18 +486,10 @@
AST_STRING_FIELD(aors);
/*! Musiconhold class to suggest that the other side use when placing on hold */
AST_STRING_FIELD(mohsuggest);
- /*! Optional external media address to use in SDP */
- AST_STRING_FIELD(external_media_address);
- /*! Configured RTP engine for this endpoint. */
- AST_STRING_FIELD(rtp_engine);
/*! Configured tone zone for this endpoint. */
AST_STRING_FIELD(zone);
/*! Configured language for this endpoint. */
AST_STRING_FIELD(language);
- /*! SDP origin username */
- AST_STRING_FIELD(sdpowner);
- /*! SDP session name */
- AST_STRING_FIELD(sdpsession);
/*! Default username to place in From header */
AST_STRING_FIELD(fromuser);
/*! Domain to place in From header */
@@ -445,50 +498,7 @@
/*! Configuration for extensions */
struct ast_sip_endpoint_extensions extensions;
/*! Configuration relating to media */
- struct {
- /*! RTP media configuration */
- struct {
- /*! Whether IPv6 RTP is enabled or not */
- unsigned int ipv6;
- /*! Whether symmetric RTP is enabled or not */
- unsigned int symmetric;
- /*! Whether ICE support is enabled or not */
- unsigned int ice_support;
- /*! Whether to use the "ptime" attribute received from the endpoint or not */
- unsigned int use_ptime;
- /*! Do we use AVPF exclusively for this endpoint? */
- unsigned int use_avpf;
- /*! \brief DTLS-SRTP configuration information */
- struct ast_rtp_dtls_cfg dtls_cfg;
- /*! Should SRTP use a 32 byte tag instead of an 80 byte tag? */
- unsigned int srtp_tag_32;
- /*! Do we use media encryption? what type? */
- enum ast_sip_session_media_encryption encryption;
- } rtp;
- /*! Direct media options */
- struct {
- /*! Boolean indicating if direct_media is permissible */
- unsigned int enabled;
- /*! When using direct media, which method should be used */
- enum ast_sip_session_refresh_method method;
- /*! Take steps to mitigate glare for direct media */
- enum ast_sip_direct_media_glare_mitigation glare_mitigation;
- /*! Do not attempt direct media session refreshes if a media NAT is detected */
- unsigned int disable_on_nat;
- } direct_media;
- /*! Codec preferences */
- struct ast_codec_pref prefs;
- /*! Configured codecs */
- struct ast_format_cap *codecs;
- /*! DSCP TOS bits for audio streams */
- unsigned int tos_audio;
- /*! Priority for audio streams */
- unsigned int cos_audio;
- /*! DSCP TOS bits for video streams */
- unsigned int tos_video;
- /*! Priority for video streams */
- unsigned int cos_video;
- } media;
+ struct ast_sip_endpoint_media_configuration media;
struct ast_sip_endpoint_subscription_configuration subscription;
struct ast_sip_endpoint_nat_configuration nat;
struct ast_sip_endpoint_id_configuration id;
Modified: team/mmichelson/sip_endpoint_reorg/res/res_sip/sip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_endpoint_reorg/res/res_sip/sip_configuration.c?view=diff&rev=395547&r1=395546&r2=395547
==============================================================================
--- team/mmichelson/sip_endpoint_reorg/res/res_sip/sip_configuration.c (original)
+++ team/mmichelson/sip_endpoint_reorg/res/res_sip/sip_configuration.c Fri Jul 26 14:15:49 2013
@@ -635,7 +635,7 @@
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "auth", "", inbound_auth_handler, NULL, 0, 0);
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "outbound_auth", "", outbound_auth_handler, NULL, 0, 0);
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "aors", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, aors));
- ast_sorcery_object_field_register(sip_sorcery, "endpoint", "external_media_address", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, external_media_address));
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "external_media_address", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, media.external_address));
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "identify_by", "username,location", ident_handler, NULL, 0, 0);
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "direct_media", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.direct_media.enabled));
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "direct_media_method", "invite", direct_media_method_handler, NULL, 0, 0);
@@ -661,14 +661,14 @@
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "namedcallgroup", "", named_groups_handler, NULL, 0, 0);
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "namedpickupgroup", "", named_groups_handler, NULL, 0, 0);
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "devicestate_busy_at", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, devicestate_busy_at));
- ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtpengine", "asterisk", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, rtp_engine));
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtpengine", "asterisk", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, media.rtp.engine));
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "tonezone", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, zone));
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "language", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, language));
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "recordonfeature", "automixmon", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, info.recording.onfeature));
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "recordofffeature", "automixmon", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, info.recording.offfeature));
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allowtransfer", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, allowtransfer));
- ast_sorcery_object_field_register(sip_sorcery, "endpoint", "sdpowner", "-", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, sdpowner));
- ast_sorcery_object_field_register(sip_sorcery, "endpoint", "sdpsession", "Asterisk", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, sdpsession));
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "sdpowner", "-", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, media.sdpowner));
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "sdpsession", "Asterisk", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, media.sdpsession));
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "tos_audio", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.tos_audio));
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "tos_video", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.tos_video));
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "cos_audio", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.cos_audio));
@@ -762,6 +762,12 @@
ast_string_field_free_memory(&info->recording);
}
+static void media_configuration_destroy(struct ast_sip_endpoint_media_configuration *media)
+{
+ ast_string_field_free_memory(&media->rtp);
+ ast_string_field_free_memory(media);
+}
+
static void endpoint_destructor(void* obj)
{
struct ast_sip_endpoint *endpoint = obj;
@@ -773,6 +779,7 @@
}
subscription_configuration_destroy(&endpoint->subscription);
info_configuration_destroy(&endpoint->info);
+ media_configuration_destroy(&endpoint->media);
ast_sip_auth_array_destroy(&endpoint->inbound_auths);
ast_sip_auth_array_destroy(&endpoint->outbound_auths);
ast_party_id_free(&endpoint->id.self);
@@ -791,6 +798,11 @@
return ast_string_field_init(&info->recording, 32);
}
+static int init_media_configuration(struct ast_sip_endpoint_media_configuration *media)
+{
+ return ast_string_field_init(media, 64) || ast_string_field_init(&media->rtp, 32);
+}
+
void *ast_sip_endpoint_alloc(const char *name)
{
struct ast_sip_endpoint *endpoint = ast_sorcery_generic_alloc(sizeof(*endpoint), endpoint_destructor);
@@ -810,6 +822,10 @@
return NULL;
}
if (init_info_configuration(&endpoint->info)) {
+ ao2_cleanup(endpoint);
+ return NULL;
+ }
+ if (init_media_configuration(&endpoint->media)) {
ao2_cleanup(endpoint);
return NULL;
}
Modified: team/mmichelson/sip_endpoint_reorg/res/res_sip_sdp_rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_endpoint_reorg/res/res_sip_sdp_rtp.c?view=diff&rev=395547&r1=395546&r2=395547
==============================================================================
--- team/mmichelson/sip_endpoint_reorg/res/res_sip_sdp_rtp.c (original)
+++ team/mmichelson/sip_endpoint_reorg/res/res_sip_sdp_rtp.c Fri Jul 26 14:15:49 2013
@@ -108,8 +108,8 @@
{
struct ast_rtp_engine_ice *ice;
- if (!(session_media->rtp = ast_rtp_instance_new(session->endpoint->rtp_engine, sched, ipv6 ? &address_ipv6 : &address_ipv4, NULL))) {
- ast_log(LOG_ERROR, "Unable to create RTP instance using RTP engine '%s'\n", session->endpoint->rtp_engine);
+ if (!(session_media->rtp = ast_rtp_instance_new(session->endpoint->media.rtp.engine, sched, ipv6 ? &address_ipv6 : &address_ipv4, NULL))) {
+ ast_log(LOG_ERROR, "Unable to create RTP instance using RTP engine '%s'\n", session->endpoint->media.rtp.engine);
return -1;
}
@@ -887,7 +887,7 @@
/* Add connection level details */
if (direct_media_enabled) {
ast_copy_string(hostip, ast_sockaddr_stringify_fmt(&session_media->direct_media_addr, AST_SOCKADDR_STR_ADDR), sizeof(hostip));
- } else if (ast_strlen_zero(session->endpoint->external_media_address)) {
+ } else if (ast_strlen_zero(session->endpoint->media.external_address)) {
pj_sockaddr localaddr;
if (pj_gethostip(session->endpoint->media.rtp.ipv6 ? pj_AF_INET6() : pj_AF_INET(), &localaddr)) {
@@ -895,7 +895,7 @@
}
pj_sockaddr_print(&localaddr, hostip, sizeof(hostip), 2);
} else {
- ast_copy_string(hostip, session->endpoint->external_media_address, sizeof(hostip));
+ ast_copy_string(hostip, session->endpoint->media.external_address, sizeof(hostip));
}
media->conn->net_type = STR_IN;
Modified: team/mmichelson/sip_endpoint_reorg/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_endpoint_reorg/res/res_sip_session.c?view=diff&rev=395547&r1=395546&r2=395547
==============================================================================
--- team/mmichelson/sip_endpoint_reorg/res/res_sip_session.c (original)
+++ team/mmichelson/sip_endpoint_reorg/res/res_sip_session.c Fri Jul 26 14:15:49 2013
@@ -1801,11 +1801,11 @@
local->origin.id = offer->origin.id;
}
- pj_strdup2(inv->pool, &local->origin.user, session->endpoint->sdpowner);
+ pj_strdup2(inv->pool, &local->origin.user, session->endpoint->media.sdpowner);
local->origin.net_type = STR_IN;
local->origin.addr_type = session->endpoint->media.rtp.ipv6 ? STR_IP6 : STR_IP4;
local->origin.addr = *pj_gethostname();
- pj_strdup2(inv->pool, &local->name, session->endpoint->sdpsession);
+ pj_strdup2(inv->pool, &local->name, session->endpoint->media.sdpsession);
/* Now let the handlers add streams of various types, pjmedia will automatically reorder the media streams for us */
successful = ao2_callback_data(session->media, OBJ_MULTIPLE, add_sdp_streams, local, session);
More information about the asterisk-commits
mailing list