[asterisk-commits] dlee: branch dlee/ASTERISK-22451-ari-subscribe r399085 - in /team/dlee/ASTERI...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 13 09:53:45 CDT 2013


Author: dlee
Date: Fri Sep 13 09:53:42 2013
New Revision: 399085

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=399085
Log:
Merged revisions 398991-399083 from http://svn.asterisk.org/svn/asterisk/branches/12

Added:
    team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_log_forwarder.c
      - copied unchanged from r399083, branches/12/res/res_pjsip_log_forwarder.c
Modified:
    team/dlee/ASTERISK-22451-ari-subscribe/   (props changed)
    team/dlee/ASTERISK-22451-ari-subscribe/apps/app_meetme.c
    team/dlee/ASTERISK-22451-ari-subscribe/channels/chan_sip.c
    team/dlee/ASTERISK-22451-ari-subscribe/channels/sip/include/sip.h
    team/dlee/ASTERISK-22451-ari-subscribe/include/asterisk/res_pjsip.h
    team/dlee/ASTERISK-22451-ari-subscribe/main/bridge.c
    team/dlee/ASTERISK-22451-ari-subscribe/res/res_http_websocket.c
    team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip.c
    team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip.exports.in
    team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip/config_auth.c
    team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_acl.c
    team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_authenticator_digest.c
    team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_endpoint_identifier_ip.c
    team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_logger.c
    team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_outbound_authenticator_digest.c
    team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_pubsub.c
    team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_session.c
    team/dlee/ASTERISK-22451-ari-subscribe/res/res_rtp_asterisk.c

Propchange: team/dlee/ASTERISK-22451-ari-subscribe/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/dlee/ASTERISK-22451-ari-subscribe/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Sep 13 09:53:42 2013
@@ -1,1 +1,1 @@
-/branches/12:1-398940
+/branches/12:1-399084

Modified: team/dlee/ASTERISK-22451-ari-subscribe/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/apps/app_meetme.c?view=diff&rev=399085&r1=399084&r2=399085
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/apps/app_meetme.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/apps/app_meetme.c Fri Sep 13 09:53:42 2013
@@ -5253,6 +5253,23 @@
 			res = -2;
 			goto usernotfound;
 		}
+	} else {
+		/* fail for commands that require a user */
+		switch (*args.command) {
+		case 'm': /* Unmute */
+		case 'M': /* Mute */
+		case 't': /* Lower user's talk volume */
+		case 'T': /* Raise user's talk volume */
+		case 'u': /* Lower user's listen volume */
+		case 'U': /* Raise user's listen volume */
+		case 'r': /* Reset user's volume level */
+		case 'k': /* Kick user */
+			res = -2;
+			ast_log(LOG_NOTICE, "No user specified!\n");
+			goto usernotfound;
+		default:
+			break;
+		}
 	}
 
 	switch (*args.command) {
@@ -5268,21 +5285,22 @@
 	case 101: /* e: Eject last user*/
 	{
 		int max_no = 0;
-
-		/* If they passed in a user, disregard it */
-		if (user) {
-			ao2_ref(user, -1);
-		}
+		RAII_VAR(struct ast_conf_user *, eject_user, NULL, ao2_cleanup);
 
 		ao2_callback(cnf->usercontainer, OBJ_NODATA, user_max_cmp, &max_no);
-		user = ao2_find(cnf->usercontainer, &max_no, 0);
-		if (!ast_test_flag64(&user->userflags, CONFFLAG_ADMIN))
-			user->adminflags |= ADMINFLAG_KICKME;
-		else {
+		eject_user = ao2_find(cnf->usercontainer, &max_no, 0);
+		if (!eject_user) {
+			res = -1;
+			ast_log(LOG_NOTICE, "No last user to kick!\n");
+			break;
+		}
+
+		if (!ast_test_flag64(&eject_user->userflags, CONFFLAG_ADMIN)) {
+			eject_user->adminflags |= ADMINFLAG_KICKME;
+		} else {
 			res = -1;
 			ast_log(LOG_NOTICE, "Not kicking last user, is an Admin!\n");
 		}
-		ao2_ref(user, -1);
 		break;
 	}
 	case 77: /* M: Mute */ 

Modified: team/dlee/ASTERISK-22451-ari-subscribe/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/channels/chan_sip.c?view=diff&rev=399085&r1=399084&r2=399085
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/channels/chan_sip.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/channels/chan_sip.c Fri Sep 13 09:53:42 2013
@@ -23250,15 +23250,6 @@
 					ast_set_flag(&p->flags[0], SIP_PENDINGBYE);
 				}
 			ast_rtp_instance_activate(p->rtp);
-		} else if (!reinvite) {
-			struct ast_sockaddr remote_address = {{0,}};
-
-			ast_rtp_instance_get_remote_address(p->rtp, &remote_address);
-			if (ast_sockaddr_isnull(&remote_address) || (!ast_strlen_zero(p->theirprovtag) && strcmp(p->theirtag, p->theirprovtag))) {
-				ast_log(LOG_WARNING, "Received response: \"200 OK\" from '%s' without SDP\n", p->relatedpeer->name);
-				ast_set_flag(&p->flags[0], SIP_PENDINGBYE);
-				ast_rtp_instance_activate(p->rtp);
-			}
 		}
 
 		if (!req->ignore && p->owner) {
@@ -24209,11 +24200,7 @@
 
 		gettag(req, "To", tag, sizeof(tag));
 		ast_string_field_set(p, theirtag, tag);
-	} else {
-		/* Store theirtag to track for changes when 200 responses to invites are received without SDP */
-		ast_string_field_set(p, theirprovtag, p->theirtag);
-	}
-
+	}
 	/* This needs to be configurable on a channel/peer level,
 	   not mandatory for all communication. Sadly enough, NAT implementations
 	   are not so stable so we can always rely on these headers.

Modified: team/dlee/ASTERISK-22451-ari-subscribe/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/channels/sip/include/sip.h?view=diff&rev=399085&r1=399084&r2=399085
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/channels/sip/include/sip.h (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/channels/sip/include/sip.h Fri Sep 13 09:53:42 2013
@@ -1019,7 +1019,6 @@
 		AST_STRING_FIELD(rdnis);        /*!< Referring DNIS */
 		AST_STRING_FIELD(redircause);   /*!< Referring cause */
 		AST_STRING_FIELD(theirtag);     /*!< Their tag */
-		AST_STRING_FIELD(theirprovtag); /*!< Provisional their tag, used when evaluating responses to invites */
 		AST_STRING_FIELD(tag);          /*!< Our tag for this session */
 		AST_STRING_FIELD(username);     /*!< [user] name */
 		AST_STRING_FIELD(peername);     /*!< [peer] name, not set if [user] */

Modified: team/dlee/ASTERISK-22451-ari-subscribe/include/asterisk/res_pjsip.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/include/asterisk/res_pjsip.h?view=diff&rev=399085&r1=399084&r2=399085
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/include/asterisk/res_pjsip.h (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/include/asterisk/res_pjsip.h Fri Sep 13 09:53:42 2013
@@ -1188,7 +1188,7 @@
 };
 
 /*!
- * \brief General purpose method for creating a dialog with an endpoint
+ * \brief General purpose method for creating a UAC dialog with an endpoint
  *
  * \param endpoint A pointer to the endpoint
  * \param aor_name Optional name of the AOR to target, may even be an explicit SIP URI
@@ -1197,7 +1197,15 @@
  * \retval non-NULL success
  * \retval NULL failure
  */
- pjsip_dialog *ast_sip_create_dialog(const struct ast_sip_endpoint *endpoint, const char *aor_name, const char *request_user);
+pjsip_dialog *ast_sip_create_dialog_uac(const struct ast_sip_endpoint *endpoint, const char *aor_name, const char *request_user);
+
+/*!
+ * \brief General purpose method for creating a UAS dialog with an endpoint
+ *
+ * \param endpoint A pointer to the endpoint
+ * \param rdata The request that is starting the dialog
+ */
+pjsip_dialog *ast_sip_create_dialog_uas(const struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata);
 
 /*!
  * \brief General purpose method for creating a SIP request

Modified: team/dlee/ASTERISK-22451-ari-subscribe/main/bridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/main/bridge.c?view=diff&rev=399085&r1=399084&r2=399085
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/main/bridge.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/main/bridge.c Fri Sep 13 09:53:42 2013
@@ -4467,7 +4467,42 @@
 	return cmp;
 }
 
-static char *complete_bridge(const char *word, int state)
+struct bridge_complete {
+	/*! Nth match to return. */
+	int state;
+	/*! Which match currently on. */
+	int which;
+};
+
+static int complete_bridge_live_search(void *obj, void *arg, void *data, int flags)
+{
+	struct bridge_complete *search = data;
+
+	if (++search->which > search->state) {
+		return CMP_MATCH;
+	}
+	return 0;
+}
+
+static char *complete_bridge_live(const char *word, int state)
+{
+	char *ret;
+	struct ast_bridge *bridge;
+	struct bridge_complete search = {
+		.state = state,
+		};
+
+	bridge = ao2_callback_data(bridges, ast_strlen_zero(word) ? 0 : OBJ_PARTIAL_KEY,
+		complete_bridge_live_search, (char *) word, &search);
+	if (!bridge) {
+		return NULL;
+	}
+	ret = ast_strdup(bridge->uniqueid);
+	ao2_ref(bridge, -1);
+	return ret;
+}
+
+static char *complete_bridge_stasis(const char *word, int state)
 {
 	char *ret = NULL;
 	int wordlen = strlen(word), which = 0;
@@ -4475,7 +4510,8 @@
 	struct ao2_iterator iter;
 	struct stasis_message *msg;
 
-	if (!(cached_bridges = stasis_cache_dump(ast_bridge_cache(), ast_bridge_snapshot_type()))) {
+	cached_bridges = stasis_cache_dump(ast_bridge_cache(), ast_bridge_snapshot_type());
+	if (!cached_bridges) {
 		return NULL;
 	}
 
@@ -4513,7 +4549,8 @@
 		return NULL;
 	}
 
-	if (!(cached_bridges = stasis_cache_dump(ast_bridge_cache(), ast_bridge_snapshot_type()))) {
+	cached_bridges = stasis_cache_dump(ast_bridge_cache(), ast_bridge_snapshot_type());
+	if (!cached_bridges) {
 		ast_cli(a->fd, "Failed to retrieve cached bridges\n");
 		return CLI_SUCCESS;
 	}
@@ -4545,7 +4582,8 @@
 	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
 	struct ast_channel_snapshot *snapshot;
 
-	if (!(msg = stasis_cache_get(ast_channel_cache(), ast_channel_snapshot_type(), uniqueid))) {
+	msg = stasis_cache_get(ast_channel_cache(), ast_channel_snapshot_type(), uniqueid);
+	if (!msg) {
 		return 0;
 	}
 	snapshot = stasis_message_data(msg);
@@ -4569,7 +4607,7 @@
 		return NULL;
 	case CLI_GENERATE:
 		if (a->pos == 2) {
-			return complete_bridge(a->word, a->n);
+			return complete_bridge_stasis(a->word, a->n);
 		}
 		return NULL;
 	}
@@ -4607,7 +4645,7 @@
 		return NULL;
 	case CLI_GENERATE:
 		if (a->pos == 2) {
-			return complete_bridge(a->word, a->n);
+			return complete_bridge_live(a->word, a->n);
 		}
 		return NULL;
 	}
@@ -4670,7 +4708,7 @@
 		return NULL;
 	case CLI_GENERATE:
 		if (a->pos == 2) {
-			return complete_bridge(a->word, a->n);
+			return complete_bridge_live(a->word, a->n);
 		}
 		if (a->pos == 3) {
 			return complete_bridge_participant(a->argv[2], a->line, a->word, a->pos, a->n);
@@ -4843,6 +4881,28 @@
 
 /*!
  * \internal
+ * \brief Print bridge object key (name).
+ * \since 12.0.0
+ *
+ * \param v_obj A pointer to the object we want the key printed.
+ * \param where User data needed by prnt to determine where to put output.
+ * \param prnt Print output callback function to use.
+ *
+ * \return Nothing
+ */
+static void bridge_prnt_obj(void *v_obj, void *where, ao2_prnt_fn *prnt)
+{
+	struct ast_bridge *bridge = v_obj;
+
+	if (!bridge) {
+		return;
+	}
+	prnt(where, "%s %s chans:%d",
+		bridge->uniqueid, bridge->v_table->name, bridge->num_channels);
+}
+
+/*!
+ * \internal
  * \brief Shutdown the bridging system.
  * \since 12.0.0
  *
@@ -4851,6 +4911,7 @@
 static void bridge_shutdown(void)
 {
 	ast_cli_unregister_multiple(bridge_cli, ARRAY_LEN(bridge_cli));
+	ao2_container_unregister("bridges");
 	ao2_cleanup(bridges);
 	bridges = NULL;
 	ao2_cleanup(bridge_manager);
@@ -4875,6 +4936,7 @@
 	if (!bridges) {
 		return -1;
 	}
+	ao2_container_register("bridges", bridges, bridge_prnt_obj);
 
 	ast_bridging_init_basic();
 

Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/res_http_websocket.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/res_http_websocket.c?view=diff&rev=399085&r1=399084&r2=399085
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/res_http_websocket.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/res_http_websocket.c Fri Sep 13 09:53:42 2013
@@ -645,11 +645,25 @@
 		fprintf(ser->f, "HTTP/1.1 101 Switching Protocols\r\n"
 			"Upgrade: %s\r\n"
 			"Connection: Upgrade\r\n"
-			"Sec-WebSocket-Accept: %s\r\n"
-			"Sec-WebSocket-Protocol: %s\r\n\r\n",
+			"Sec-WebSocket-Accept: %s\r\n",
 			upgrade,
-			base64,
-			protocol_handler->name);
+			base64);
+
+		/* RFC 6455, Section 4.1:
+		 *
+		 * 6. If the response includes a |Sec-WebSocket-Protocol| header
+		 *    field and this header field indicates the use of a
+		 *    subprotocol that was not present in the client's handshake
+		 *    (the server has indicated a subprotocol not requested by
+		 *    the client), the client MUST _Fail the WebSocket
+		 *    Connection_.
+		 */
+		if (protocol) {
+			fprintf(ser->f, "Sec-WebSocket-Protocol: %s\r\n",
+				protocol);
+		}
+
+		fprintf(ser->f, "\r\n");
 	} else {
 
 		/* Specification defined in http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-75 or completely unknown */

Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip.c?view=diff&rev=399085&r1=399084&r2=399085
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip.c Fri Sep 13 09:53:42 2013
@@ -1324,7 +1324,7 @@
 	return 0;
 }
 
-pjsip_dialog *ast_sip_create_dialog(const struct ast_sip_endpoint *endpoint, const char *uri, const char *request_user)
+pjsip_dialog *ast_sip_create_dialog_uac(const struct ast_sip_endpoint *endpoint, const char *uri, const char *request_user)
 {
 	pj_str_t local_uri = { "sip:temp at temp", 13 }, remote_uri;
 	pjsip_dialog *dlg = NULL;
@@ -1382,6 +1382,38 @@
 	}
 
 	dlg->sess_count--;
+
+	return dlg;
+}
+
+pjsip_dialog *ast_sip_create_dialog_uas(const struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata)
+{
+	pjsip_dialog *dlg;
+	pj_str_t contact;
+	pjsip_transport_type_e type = rdata->tp_info.transport->key.type;
+	pj_status_t status;
+
+	contact.ptr = pj_pool_alloc(rdata->tp_info.pool, PJSIP_MAX_URL_SIZE);
+	contact.slen = pj_ansi_snprintf(contact.ptr, PJSIP_MAX_URL_SIZE,
+			"<%s:%s%.*s%s:%d%s%s>",
+			(pjsip_transport_get_flag_from_type(type) & PJSIP_TRANSPORT_SECURE) ? "sips" : "sip",
+			(type & PJSIP_TRANSPORT_IPV6) ? "[" : "",
+			(int)rdata->tp_info.transport->local_name.host.slen,
+			rdata->tp_info.transport->local_name.host.ptr,
+			(type & PJSIP_TRANSPORT_IPV6) ? "]" : "",
+			rdata->tp_info.transport->local_name.port,
+			(type != PJSIP_TRANSPORT_UDP && type != PJSIP_TRANSPORT_UDP6) ? ";transport=" : "",
+			(type != PJSIP_TRANSPORT_UDP && type != PJSIP_TRANSPORT_UDP6) ? pjsip_transport_get_type_name(type) : "");
+
+	status = pjsip_dlg_create_uas(pjsip_ua_instance(), rdata, &contact, &dlg);
+	if (status != PJ_SUCCESS) {
+		char err[PJ_ERR_MSG_SIZE];
+
+		pjsip_strerror(status, err, sizeof(err));
+		ast_log(LOG_ERROR, "Could not create dialog with endpoint %s. %s\n",
+				ast_sorcery_object_get_id(endpoint), err);
+		return NULL;
+	}
 
 	return dlg;
 }

Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip.exports.in
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip.exports.in?view=diff&rev=399085&r1=399084&r2=399085
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip.exports.in (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip.exports.in Fri Sep 13 09:53:42 2013
@@ -32,7 +32,8 @@
 		LINKER_SYMBOL_PREFIXast_sip_get_endpoints;
 		LINKER_SYMBOL_PREFIXast_copy_pj_str;
 		LINKER_SYMBOL_PREFIXast_sip_get_sorcery;
-		LINKER_SYMBOL_PREFIXast_sip_create_dialog;
+		LINKER_SYMBOL_PREFIXast_sip_create_dialog_uac;
+		LINKER_SYMBOL_PREFIXast_sip_create_dialog_uas;
 		LINKER_SYMBOL_PREFIXast_sip_location_retrieve_aor;
 		LINKER_SYMBOL_PREFIXast_sip_location_retrieve_first_aor_contact;
 		LINKER_SYMBOL_PREFIXast_sip_location_retrieve_contact_from_aor_list;

Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip/config_auth.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip/config_auth.c?view=diff&rev=399085&r1=399084&r2=399085
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip/config_auth.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip/config_auth.c Fri Sep 13 09:53:42 2013
@@ -117,7 +117,7 @@
 	ast_sorcery_object_field_register(sorcery, SIP_SORCERY_AUTH_TYPE, "md5_cred",
 			"", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_auth, md5_creds));
 	ast_sorcery_object_field_register(sorcery, SIP_SORCERY_AUTH_TYPE, "realm",
-			"asterisk", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_auth, realm));
+			"", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_auth, realm));
 	ast_sorcery_object_field_register(sorcery, SIP_SORCERY_AUTH_TYPE, "nonce_lifetime",
 			"32", OPT_UINT_T, 0, FLDSET(struct ast_sip_auth, nonce_lifetime));
 	ast_sorcery_object_field_register_custom(sorcery, SIP_SORCERY_AUTH_TYPE, "auth_type",

Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_acl.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_acl.c?view=diff&rev=399085&r1=399084&r2=399085
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_acl.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_acl.c Fri Sep 13 09:53:42 2013
@@ -37,47 +37,77 @@
 		<synopsis>SIP ACL module</synopsis>
 		<description><para>
 			<emphasis>ACL</emphasis>
-			</para>
-			<para>The ACL module used by <literal>res_pjsip</literal>. This module is
+			</para><para>
+			The ACL module used by <literal>res_pjsip</literal>. This module is
 			independent of <literal>endpoints</literal> and operates on all inbound
 			SIP communication using res_pjsip.
 			</para><para>
-			It should be noted that this module can also reference ACLs from
-			<filename>acl.conf</filename>.
+			There are two main ways of defining your ACL with the options
+			provided. You can use the <literal>permit</literal> and <literal>deny</literal> options
+			which act on <emphasis>IP</emphasis> addresses, or the <literal>contactpermit</literal>
+			and <literal>contactdeny</literal> options which act on <emphasis>Contact header</emphasis>
+			addresses in incoming REGISTER requests. You can combine the various options to
+			create a mixed ACL.
 			</para><para>
-			There are two main ways of creating an access list: <literal>IP-Domain</literal>
-			and <literal>Contact Header</literal>. It is possible to create a combined ACL using
-			both IP and Contact.
+			Additionally, instead of defining an ACL with options, you can reference IP or
+			Contact header ACLs from the file <filename>acl.conf</filename> by using the <literal>acl</literal>
+			or <literal>contactacl</literal> options.
 		</para></description>
 		<configFile name="pjsip.conf">
 			<configObject name="acl">
 				<synopsis>Access Control List</synopsis>
 				<configOption name="acl">
-					<synopsis>Name of IP ACL</synopsis>
-					<description><para>
-						This matches sections configured in <literal>acl.conf</literal>
+					<synopsis>List of IP ACL section names in acl.conf</synopsis>
+					<description><para>
+						This matches sections configured in <literal>acl.conf</literal>. The value is
+						defined as a list of comma-delimited section names.
 					</para></description>
 				</configOption>
 				<configOption name="contactacl">
-					<synopsis>Name of Contact ACL</synopsis>
-					<description><para>
-						This matches sections configured in <literal>acl.conf</literal>
+					<synopsis>List of Contact ACL section names in acl.conf</synopsis>
+					<description><para>
+						This matches sections configured in <literal>acl.conf</literal>. The value is
+						defined as a list of comma-delimited section names.
 					</para></description>
 				</configOption>
 				<configOption name="contactdeny">
-					<synopsis>List of Contact Header addresses to Deny</synopsis>
+					<synopsis>List of Contact header addresses to deny</synopsis>
+					<description><para>
+						The value is a comma-delimited list of IP addresses. IP addresses may
+						have a subnet mask appended. The subnet mask may be written in either
+						CIDR or dotted-decimal notation. Separate the IP address and subnet
+						mask with a slash ('/')
+					</para></description>
 				</configOption>
 				<configOption name="contactpermit">
-					<synopsis>List of Contact Header addresses to Permit</synopsis>
+					<synopsis>List of Contact header addresses to permit</synopsis>
+					<description><para>
+						The value is a comma-delimited list of IP addresses. IP addresses may
+						have a subnet mask appended. The subnet mask may be written in either
+						CIDR or dotted-decimal notation. Separate the IP address and subnet
+						mask with a slash ('/')
+					</para></description>
 				</configOption>
 				<configOption name="deny">
-					<synopsis>List of IP-domains to deny access from</synopsis>
+					<synopsis>List of IP addresses to deny access from</synopsis>
+					<description><para>
+						The value is a comma-delimited list of IP addresses. IP addresses may
+						have a subnet mask appended. The subnet mask may be written in either
+						CIDR or dotted-decimal notation. Separate the IP address and subnet
+						mask with a slash ('/')
+					</para></description>
 				</configOption>
 				<configOption name="permit">
-					<synopsis>List of IP-domains to allow access from</synopsis>
+					<synopsis>List of IP addresses to permit access from</synopsis>
+					<description><para>
+						The value is a comma-delimited list of IP addresses. IP addresses may
+						have a subnet mask appended. The subnet mask may be written in either
+						CIDR or dotted-decimal notation. Separate the IP address and subnet
+						mask with a slash ('/')
+					</para></description>
 				</configOption>
 				<configOption name="type">
-					<synopsis>Must be of type 'security'.</synopsis>
+					<synopsis>Must be of type 'acl'.</synopsis>
 				</configOption>
 			</configObject>
 		</configFile>

Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_authenticator_digest.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_authenticator_digest.c?view=diff&rev=399085&r1=399084&r2=399085
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_authenticator_digest.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_authenticator_digest.c Fri Sep 13 09:53:42 2013
@@ -395,6 +395,9 @@
 	}
 
 	for (i = 0; i < endpoint->inbound_auths.num; ++i) {
+		if (ast_strlen_zero(auths[i]->realm)) {
+			ast_string_field_set(auths[i], realm, "asterisk");
+		}
 		verify_res[i] = verify(auths[i], rdata, tdata->pool);
 		if (verify_res[i] == AUTH_SUCCESS) {
 			res = AST_SIP_AUTHENTICATION_SUCCESS;

Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_endpoint_identifier_ip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_endpoint_identifier_ip.c?view=diff&rev=399085&r1=399084&r2=399085
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_endpoint_identifier_ip.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_endpoint_identifier_ip.c Fri Sep 13 09:53:42 2013
@@ -35,11 +35,18 @@
 		<synopsis>Module that identifies endpoints via source IP address</synopsis>
 		<configFile name="pjsip.conf">
 			<configObject name="identify">
+				<synopsis>Identifies endpoints via source IP address</synopsis>
 				<configOption name="endpoint">
 					<synopsis>Name of Endpoint</synopsis>
 				</configOption>
 				<configOption name="match">
 					<synopsis>IP addresses or networks to match against</synopsis>
+					<description><para>
+						The value is a comma-delimited list of IP addresses. IP addresses may
+						have a subnet mask appended. The subnet mask may be written in either
+						CIDR or dot-decimal notation. Separate the IP address and subnet
+						mask with a slash ('/')
+					</para></description>
 				</configOption>
 				<configOption name="type">
 					<synopsis>Must be of type 'identify'.</synopsis>

Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_logger.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_logger.c?view=diff&rev=399085&r1=399084&r2=399085
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_logger.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_logger.c Fri Sep 13 09:53:42 2013
@@ -19,6 +19,7 @@
 /*** MODULEINFO
 	<depend>pjproject</depend>
 	<depend>res_pjsip</depend>
+	<defaultenabled>no</defaultenabled>
 	<support_level>core</support_level>
  ***/
 

Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_outbound_authenticator_digest.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_outbound_authenticator_digest.c?view=diff&rev=399085&r1=399084&r2=399085
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_outbound_authenticator_digest.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_outbound_authenticator_digest.c Fri Sep 13 09:53:42 2013
@@ -31,10 +31,30 @@
 #include "asterisk/module.h"
 #include "asterisk/strings.h"
 
-static int set_outbound_authentication_credentials(pjsip_auth_clt_sess *auth_sess, const struct ast_sip_auth_array *array)
+static pjsip_www_authenticate_hdr *get_auth_header(pjsip_rx_data *challenge) {
+	pjsip_hdr_e search_type;
+
+	if (challenge->msg_info.msg->line.status.code == PJSIP_SC_UNAUTHORIZED) {
+		search_type = PJSIP_H_WWW_AUTHENTICATE;
+	} else if (challenge->msg_info.msg->line.status.code == PJSIP_SC_PROXY_AUTHENTICATION_REQUIRED) {
+		search_type = PJSIP_H_PROXY_AUTHENTICATE;
+	} else {
+		ast_log(LOG_ERROR,
+				"Status code %d was received when it should have been 401 or 407.\n",
+				challenge->msg_info.msg->line.status.code);
+		return NULL ;
+	}
+
+	return pjsip_msg_find_hdr(challenge->msg_info.msg, search_type, NULL);
+
+}
+
+static int set_outbound_authentication_credentials(pjsip_auth_clt_sess *auth_sess,
+		const struct ast_sip_auth_array *array, pjsip_rx_data *challenge)
 {
 	struct ast_sip_auth **auths = ast_alloca(array->num * sizeof(*auths));
 	pjsip_cred_info *auth_creds = ast_alloca(array->num * sizeof(*auth_creds));
+	pjsip_www_authenticate_hdr *auth_hdr = NULL;
 	int res = 0;
 	int i;
 
@@ -43,8 +63,19 @@
 		goto cleanup;
 	}
 
+	auth_hdr = get_auth_header(challenge);
+	if (auth_hdr == NULL) {
+		res = -1;
+		ast_log(LOG_ERROR, "Unable to find authenticate header in challenge.\n");
+		goto cleanup;
+	}
+
 	for (i = 0; i < array->num; ++i) {
-		pj_cstr(&auth_creds[i].realm, auths[i]->realm);
+		if (ast_strlen_zero(auths[i]->realm)) {
+			pj_cstr(&auth_creds[i].realm, auth_hdr->challenge.common.realm.ptr);
+		} else {
+			pj_cstr(&auth_creds[i].realm, auths[i]->realm);
+		}
 		pj_cstr(&auth_creds[i].username, auths[i]->auth_user);
 		pj_cstr(&auth_creds[i].scheme, "digest");
 		switch (auths[i]->type) {
@@ -80,7 +111,7 @@
 		return -1;
 	}
 
-	if (set_outbound_authentication_credentials(&auth_sess, auths)) {
+	if (set_outbound_authentication_credentials(&auth_sess, auths, challenge)) {
 		ast_log(LOG_WARNING, "Failed to set authentication credentials\n");
 		return -1;
 	}

Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_pubsub.c?view=diff&rev=399085&r1=399084&r2=399085
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_pubsub.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_pubsub.c Fri Sep 13 09:53:42 2013
@@ -282,7 +282,7 @@
 	}
 	sub->role = role;
 	if (role == AST_SIP_NOTIFIER) {
-		pjsip_dlg_create_uas(pjsip_ua_instance(), rdata, NULL, &dlg);
+		dlg = ast_sip_create_dialog_uas(endpoint, rdata);
 	} else {
 		RAII_VAR(struct ast_sip_contact *, contact, NULL, ao2_cleanup);
 
@@ -293,7 +293,7 @@
 			ao2_ref(sub, -1);
 			return NULL;
 		}
-		dlg = ast_sip_create_dialog(endpoint, contact->uri, NULL);
+		dlg = ast_sip_create_dialog_uac(endpoint, contact->uri, NULL);
 	}
 	if (!dlg) {
 		ast_log(LOG_WARNING, "Unable to create dialog for SIP subscription\n");

Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_session.c?view=diff&rev=399085&r1=399084&r2=399085
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_session.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_session.c Fri Sep 13 09:53:42 2013
@@ -1185,7 +1185,7 @@
 		return NULL;
 	}
 
-	if (!(dlg = ast_sip_create_dialog(endpoint, uri, request_user))) {
+	if (!(dlg = ast_sip_create_dialog_uac(endpoint, uri, request_user))) {
 		return NULL;
 	}
 
@@ -1337,7 +1337,8 @@
 		}
 		return NULL;
 	}
-	if (pjsip_dlg_create_uas(pjsip_ua_instance(), rdata, NULL, &dlg) != PJ_SUCCESS) {
+	dlg = ast_sip_create_dialog_uas(endpoint, rdata);
+	if (!dlg) {
 		pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 500, NULL, NULL, NULL);
 		return NULL;
 	}

Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/res_rtp_asterisk.c?view=diff&rev=399085&r1=399084&r2=399085
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/res_rtp_asterisk.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/res_rtp_asterisk.c Fri Sep 13 09:53:42 2013
@@ -4537,8 +4537,6 @@
 #ifdef HAVE_PJPROJECT
 	pj_lock_t *lock;
 
-	pj_log_set_level(0);
-
 	if (pj_init() != PJ_SUCCESS) {
 		return AST_MODULE_LOAD_DECLINE;
 	}




More information about the asterisk-commits mailing list