[asterisk-commits] kmoore: branch kmoore/pimp_sip_srtp r386245 - in /team/kmoore/pimp_sip_srtp: ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Apr 22 10:21:31 CDT 2013
Author: kmoore
Date: Mon Apr 22 10:21:26 2013
New Revision: 386245
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386245
Log:
Add configuration option for selecting encryption type
Modified:
team/kmoore/pimp_sip_srtp/include/asterisk/res_sip.h
team/kmoore/pimp_sip_srtp/res/res_sip/sip_configuration.c
Modified: team/kmoore/pimp_sip_srtp/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pimp_sip_srtp/include/asterisk/res_sip.h?view=diff&rev=386245&r1=386244&r2=386245
==============================================================================
--- team/kmoore/pimp_sip_srtp/include/asterisk/res_sip.h (original)
+++ team/kmoore/pimp_sip_srtp/include/asterisk/res_sip.h Mon Apr 22 10:21:26 2013
@@ -247,6 +247,17 @@
* Subsequent session refreshes will be sent no matter the session direction
*/
AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_INCOMING,
+};
+
+enum ast_sip_session_media_encryption {
+ /*! Do not allow any encryption of session media */
+ AST_SIP_MEDIA_ENCRYPT_DENY,
+ /*! Do not offer media encryption, but accept it if offered */
+ AST_SIP_MEDIA_ENCRYPT_NONE,
+ /*! Offer SDES-encrypted session media */
+ AST_SIP_MEDIA_ENCRYPT_SDES,
+ /*! Offer encrypted session media with datagram TLS key exchange */
+ AST_SIP_MEDIA_ENCRYPT_DTLS,
};
/*!
@@ -328,6 +339,8 @@
unsigned int send_pai;
/*! Do we send Remote-Party-ID headers to this endpoint? */
unsigned int send_rpid;
+ /*! Do we use media encryption? what type? */
+ enum ast_sip_session_media_encryption media_encryption;
};
/*!
Modified: team/kmoore/pimp_sip_srtp/res/res_sip/sip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pimp_sip_srtp/res/res_sip/sip_configuration.c?view=diff&rev=386245&r1=386244&r2=386245
==============================================================================
--- team/kmoore/pimp_sip_srtp/res/res_sip/sip_configuration.c (original)
+++ team/kmoore/pimp_sip_srtp/res/res_sip/sip_configuration.c Mon Apr 22 10:21:26 2013
@@ -274,6 +274,25 @@
struct ast_sip_endpoint *endpoint = obj;
endpoint->id.tag = ast_strdup(var->value);
return endpoint->id.tag ? 0 : -1;
+}
+
+static int media_encryption_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
+{
+ struct ast_sip_endpoint *endpoint = obj;
+
+ if (!strcasecmp("deny", var->value)) {
+ endpoint->media_encryption = AST_SIP_MEDIA_ENCRYPT_DENY;
+ } else if (!strcasecmp("no", var->value)) {
+ endpoint->media_encryption = AST_SIP_MEDIA_ENCRYPT_NONE;
+ } else if (!strcasecmp("sdes", var->value)) {
+ endpoint->media_encryption = AST_SIP_MEDIA_ENCRYPT_SDES;
+ } else if (!strcasecmp("dtls", var->value)) {
+ endpoint->media_encryption = AST_SIP_MEDIA_ENCRYPT_DTLS;
+ } else {
+ return -1;
+ }
+
+ return 0;
}
static void *sip_nat_hook_alloc(const char *name)
@@ -349,6 +368,7 @@
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "trust_id_outbound", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, trust_id_outbound));
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_pai", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, send_pai));
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_rpid", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, send_rpid));
+ ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "media_encryption", "no", media_encryption_handler, NULL, 0, 0);
if (ast_sip_initialize_sorcery_transport(sip_sorcery)) {
ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n");
More information about the asterisk-commits
mailing list