[asterisk-commits] mmichelson: branch mmichelson/sip_options r394175 - in /team/mmichelson/sip_o...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jul 11 16:56:23 CDT 2013
Author: mmichelson
Date: Thu Jul 11 16:56:21 2013
New Revision: 394175
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=394175
Log:
Implement "allowsubscribe" option.
Modified:
team/mmichelson/sip_options/include/asterisk/res_sip.h
team/mmichelson/sip_options/res/res_sip/sip_configuration.c
team/mmichelson/sip_options/res/res_sip_pubsub.c
Modified: team/mmichelson/sip_options/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_options/include/asterisk/res_sip.h?view=diff&rev=394175&r1=394174&r2=394175
==============================================================================
--- team/mmichelson/sip_options/include/asterisk/res_sip.h (original)
+++ team/mmichelson/sip_options/include/asterisk/res_sip.h Thu Jul 11 16:56:21 2013
@@ -436,6 +436,8 @@
unsigned int tos_video;
/*! Priority for video streams */
unsigned int cos_video;
+ /*! Indicates if endpoint is allowed to initiate subscriptions */
+ unsigned int allowsubscribe;
};
/*!
Modified: team/mmichelson/sip_options/res/res_sip/sip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_options/res/res_sip/sip_configuration.c?view=diff&rev=394175&r1=394174&r2=394175
==============================================================================
--- team/mmichelson/sip_options/res/res_sip/sip_configuration.c (original)
+++ team/mmichelson/sip_options/res/res_sip/sip_configuration.c Thu Jul 11 16:56:21 2013
@@ -670,6 +670,7 @@
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "tos_video", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, tos_video));
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "cos_audio", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, cos_audio));
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "cos_video", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, cos_video));
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allowsubscribe", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, allowsubscribe));
if (ast_sip_initialize_sorcery_transport(sip_sorcery)) {
ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n");
Modified: team/mmichelson/sip_options/res/res_sip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_options/res/res_sip_pubsub.c?view=diff&rev=394175&r1=394174&r2=394175
==============================================================================
--- team/mmichelson/sip_options/res/res_sip_pubsub.c (original)
+++ team/mmichelson/sip_options/res/res_sip_pubsub.c Thu Jul 11 16:56:21 2013
@@ -624,6 +624,12 @@
endpoint = ast_pjsip_rdata_get_endpoint(rdata);
ast_assert(endpoint != NULL);
+ if (!endpoint->allowsubscribe) {
+ ast_log(LOG_WARNING, "Subscriptions not permitted for endpoint %s.\n", ast_sorcery_object_get_id(endpoint));
+ pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 603, NULL, NULL, NULL);
+ return PJ_TRUE;
+ }
+
event_header = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &str_event_name, rdata->msg_info.msg->hdr.next);
if (!event_header) {
ast_log(LOG_WARNING, "Incoming SUBSCRIBE request with no Event header\n");
More information about the asterisk-commits
mailing list