[svn-commits] kmoore: branch kmoore/pjsip_dtls r394807 - in /team/kmoore/pjsip_dtls: ./ cha...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jul 19 13:34:52 CDT 2013


Author: kmoore
Date: Fri Jul 19 13:34:50 2013
New Revision: 394807

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=394807
Log:
fix merge conflict

Added:
    team/kmoore/pjsip_dtls/res/res_sip/config_global.c
      - copied unchanged from r394795, trunk/res/res_sip/config_global.c
    team/kmoore/pjsip_dtls/res/res_sip/config_system.c
      - copied unchanged from r394795, trunk/res/res_sip/config_system.c
    team/kmoore/pjsip_dtls/res/res_sip/sip_global_headers.c
      - copied unchanged from r394795, trunk/res/res_sip/sip_global_headers.c
Modified:
    team/kmoore/pjsip_dtls/   (props changed)
    team/kmoore/pjsip_dtls/channels/chan_gulp.c
    team/kmoore/pjsip_dtls/channels/chan_sip.c
    team/kmoore/pjsip_dtls/include/asterisk/channel.h
    team/kmoore/pjsip_dtls/include/asterisk/res_sip.h
    team/kmoore/pjsip_dtls/include/asterisk/stasis_system.h
    team/kmoore/pjsip_dtls/main/bridging.c
    team/kmoore/pjsip_dtls/main/ccss.c
    team/kmoore/pjsip_dtls/main/stasis_system.c
    team/kmoore/pjsip_dtls/res/res_sip.c
    team/kmoore/pjsip_dtls/res/res_sip.exports.in
    team/kmoore/pjsip_dtls/res/res_sip/config_transport.c
    team/kmoore/pjsip_dtls/res/res_sip/include/res_sip_private.h
    team/kmoore/pjsip_dtls/res/res_sip/sip_configuration.c
    team/kmoore/pjsip_dtls/res/res_sip_caller_id.c
    team/kmoore/pjsip_dtls/res/res_sip_mwi.c
    team/kmoore/pjsip_dtls/res/res_sip_one_touch_record_info.c
    team/kmoore/pjsip_dtls/res/res_sip_pubsub.c
    team/kmoore/pjsip_dtls/res/res_sip_refer.c
    team/kmoore/pjsip_dtls/res/res_sip_sdp_rtp.c
    team/kmoore/pjsip_dtls/res/res_sip_session.c

Propchange: team/kmoore/pjsip_dtls/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Jul 19 13:34:50 2013
@@ -1,1 +1,1 @@
-/trunk:1-394745
+/trunk:1-394806

Modified: team/kmoore/pjsip_dtls/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_dtls/channels/chan_gulp.c?view=diff&rev=394807&r1=394806&r2=394807
==============================================================================
--- team/kmoore/pjsip_dtls/channels/chan_gulp.c (original)
+++ team/kmoore/pjsip_dtls/channels/chan_gulp.c Fri Jul 19 13:34:50 2013
@@ -56,6 +56,7 @@
 #include "asterisk/dsp.h"
 #include "asterisk/stasis_endpoints.h"
 #include "asterisk/stasis_channels.h"
+#include "asterisk/indications.h"
 
 #include "asterisk/res_sip.h"
 #include "asterisk/res_sip_session.h"
@@ -612,6 +613,18 @@
 
 	ast_channel_named_callgroups_set(chan, session->endpoint->named_callgroups);
 	ast_channel_named_pickupgroups_set(chan, session->endpoint->named_pickupgroups);
+
+	if (!ast_strlen_zero(session->endpoint->language)) {
+		ast_channel_language_set(chan, session->endpoint->language);
+	}
+
+	if (!ast_strlen_zero(session->endpoint->zone)) {
+		struct ast_tone_zone *zone = ast_get_indication_zone(session->endpoint->zone);
+		if (!zone) {
+			ast_log(LOG_ERROR, "Unknown country code '%s' for tonezone. Check indications.conf for available country codes.\n", session->endpoint->zone);
+		}
+		ast_channel_zone_set(chan, zone);
+	}
 
 	ast_endpoint_add_channel(session->endpoint->persistent, chan);
 

Modified: team/kmoore/pjsip_dtls/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_dtls/channels/chan_sip.c?view=diff&rev=394807&r1=394806&r2=394807
==============================================================================
--- team/kmoore/pjsip_dtls/channels/chan_sip.c (original)
+++ team/kmoore/pjsip_dtls/channels/chan_sip.c Fri Jul 19 13:34:50 2013
@@ -8044,7 +8044,7 @@
 		return NULL;
 	}
 
-	if (i->relatedpeer) {
+	if (i->relatedpeer && i->relatedpeer->endpoint) {
 		if (ast_endpoint_add_channel(i->relatedpeer->endpoint, tmp)) {
 			ast_channel_unref(tmp);
 			sip_pvt_lock(i);
@@ -15750,7 +15750,6 @@
 static int expire_register(const void *data)
 {
 	struct sip_peer *peer = (struct sip_peer *)data;
-	RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
 
 	if (!peer) {		/* Hmmm. We have no peer. Weird. */
 		return 0;
@@ -15770,11 +15769,14 @@
 		peer->socket.ws_session = NULL;
 	}
 
-	ast_endpoint_set_state(peer->endpoint, AST_ENDPOINT_OFFLINE);
-	blob = ast_json_pack("{s: s, s: s}",
-		"peer_status", "Unregistered",
-		"cause", "Expired");
-	ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
+	if (peer->endpoint) {
+		RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
+		ast_endpoint_set_state(peer->endpoint, AST_ENDPOINT_OFFLINE);
+		blob = ast_json_pack("{s: s, s: s}",
+			"peer_status", "Unregistered",
+			"cause", "Expired");
+		ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
+	}
 	register_peer_exten(peer, FALSE);	/* Remove regexten */
 	ast_devstate_changed(AST_DEVICE_UNKNOWN, AST_DEVSTATE_CACHABLE, "SIP/%s", peer->name);
 
@@ -16019,7 +16021,6 @@
 	int start = 0;
 	int wildcard_found = 0;
 	int single_binding_found = 0;
-	RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
 
 	ast_copy_string(contact, __get_header(req, "Contact", &start), sizeof(contact));
 
@@ -16207,11 +16208,14 @@
 		ast_db_put("SIP/Registry", peer->name, data);
 	}
 
-	ast_endpoint_set_state(peer->endpoint, AST_ENDPOINT_ONLINE);
-	blob = ast_json_pack("{s: s, s: s}",
-		"peer_status", "Registered",
-		"address", ast_sockaddr_stringify(&peer->addr));
-	ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
+	if (peer->endpoint) {
+		RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
+		ast_endpoint_set_state(peer->endpoint, AST_ENDPOINT_ONLINE);
+		blob = ast_json_pack("{s: s, s: s}",
+			"peer_status", "Registered",
+			"address", ast_sockaddr_stringify(&peer->addr));
+		ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
+	}
 
 	/* Is this a new IP address for us? */
 	if (ast_sockaddr_cmp(&peer->addr, &oldsin)) {
@@ -17215,7 +17219,6 @@
 		/* Create peer if we have autocreate mode enabled */
 		peer = temp_peer(name);
 		if (peer) {
-			RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
 			ao2_t_link(peers, peer, "link peer into peer table");
 			if (!ast_sockaddr_isnull(&peer->addr)) {
 				ao2_t_link(peers_by_ip, peer, "link peer into peers-by-ip table");
@@ -17244,11 +17247,14 @@
 				ast_string_field_set(p, fullcontact, peer->fullcontact);
 				/* Say OK and ask subsystem to retransmit msg counter */
 				transmit_response_with_date(p, "200 OK", req);
-				ast_endpoint_set_state(peer->endpoint, AST_ENDPOINT_ONLINE);
-				blob = ast_json_pack("{s: s, s: s}",
-					"peer_status", "Registered",
-					"address", ast_sockaddr_stringify(addr));
-				ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
+				if (peer->endpoint) {
+					RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
+					ast_endpoint_set_state(peer->endpoint, AST_ENDPOINT_ONLINE);
+					blob = ast_json_pack("{s: s, s: s}",
+						"peer_status", "Registered",
+						"address", ast_sockaddr_stringify(addr));
+					ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
+				}
 				send_mwi = 1;
 				res = 0;
 				break;
@@ -17338,7 +17344,9 @@
 			break;
 		}
 
-		ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
+		if (peer->endpoint) {
+			ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
+		}
 	}
 	if (peer) {
 		sip_unref_peer(peer, "register_verify: sip_unref_peer: tossing stack peer pointer at end of func");
@@ -23821,7 +23829,6 @@
 	if (statechanged) {
 		const char *s = is_reachable ? "Reachable" : "Lagged";
 		char str_lastms[20];
-		RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
 
 		snprintf(str_lastms, sizeof(str_lastms), "%d", pingtime);
 
@@ -23831,13 +23838,18 @@
 		if (sip_cfg.peer_rtupdate) {
 			ast_update_realtime(ast_check_realtime("sipregs") ? "sipregs" : "sippeers", "name", peer->name, "lastms", str_lastms, SENTINEL);
 		}
-		ast_endpoint_set_state(peer->endpoint, AST_ENDPOINT_ONLINE);
-		blob = ast_json_pack("{s: s, s: i}",
-			"peer_status", s,
-			"time", pingtime);
-		ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
-		if (is_reachable && sip_cfg.regextenonqualify)
+		if (peer->endpoint) {
+			RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
+			ast_endpoint_set_state(peer->endpoint, AST_ENDPOINT_ONLINE);
+			blob = ast_json_pack("{s: s, s: i}",
+				"peer_status", s,
+				"time", pingtime);
+			ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
+		}
+
+		if (is_reachable && sip_cfg.regextenonqualify) {
 			register_peer_exten(peer, TRUE);
+		}
 	}
 
 	pvt_set_needdestroy(p, "got OPTIONS response");
@@ -29149,17 +29161,21 @@
 	peer->pokeexpire = -1;
 
 	if (peer->lastms > -1) {
-		RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
 
 		ast_log(LOG_NOTICE, "Peer '%s' is now UNREACHABLE!  Last qualify: %d\n", peer->name, peer->lastms);
 		if (sip_cfg.peer_rtupdate) {
 			ast_update_realtime(ast_check_realtime("sipregs") ? "sipregs" : "sippeers", "name", peer->name, "lastms", "-1", SENTINEL);
 		}
-		ast_endpoint_set_state(peer->endpoint, AST_ENDPOINT_OFFLINE);
-		blob = ast_json_pack("{s: s, s: s}",
-			"peer_status", "Unreachable",
-			"time", "-1");
-		ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
+
+		if (peer->endpoint) {
+			RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
+			ast_endpoint_set_state(peer->endpoint, AST_ENDPOINT_OFFLINE);
+			blob = ast_json_pack("{s: s, s: s}",
+				"peer_status", "Unreachable",
+				"time", "-1");
+			ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
+		}
+
 		if (sip_cfg.regextenonqualify) {
 			register_peer_exten(peer, FALSE);
 		}

Modified: team/kmoore/pjsip_dtls/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_dtls/include/asterisk/channel.h?view=diff&rev=394807&r1=394806&r2=394807
==============================================================================
--- team/kmoore/pjsip_dtls/include/asterisk/channel.h (original)
+++ team/kmoore/pjsip_dtls/include/asterisk/channel.h Fri Jul 19 13:34:50 2013
@@ -1426,7 +1426,7 @@
  * \note This function performs a hard hangup on a channel.  Unlike the soft-hangup, this function
  * performs all stream stopping, etc, on the channel that needs to end.
  * chan is no longer valid after this call.
- * \param chan channel to hang up
+ * \param chan channel to hang up (NULL tolerant)
  * \return Nothing
  */
 void ast_hangup(struct ast_channel *chan);

Modified: team/kmoore/pjsip_dtls/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_dtls/include/asterisk/res_sip.h?view=diff&rev=394807&r1=394806&r2=394807
==============================================================================
--- team/kmoore/pjsip_dtls/include/asterisk/res_sip.h (original)
+++ team/kmoore/pjsip_dtls/include/asterisk/res_sip.h Fri Jul 19 13:34:50 2013
@@ -117,6 +117,10 @@
 	struct ast_sockaddr external_address;
 	/*! Transport state information */
 	struct ast_sip_transport_state *state;
+	/*! QOS DSCP TOS bits */
+	unsigned int tos;
+	/*! QOS COS value */
+	unsigned int cos;
 };
 
 /*!
@@ -325,6 +329,26 @@
 		AST_STRING_FIELD(external_media_address);
 		/*! Configured voicemail boxes for this endpoint. Used for MWI */
 		AST_STRING_FIELD(mailboxes);
+		/*! 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);
+		/*! Feature to enact when one-touch recording INFO with Record: On is received */
+		AST_STRING_FIELD(recordonfeature);
+		/*! Feature to enact when one-touch recording INFO with Record: Off is received */
+		AST_STRING_FIELD(recordofffeature);
+		/*! 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 */
+		AST_STRING_FIELD(fromdomain);
+		/*! Username to use when sending MWI NOTIFYs to this endpoint */
+		AST_STRING_FIELD(mwi_from);
 	);
 	/*! Identification information for this endpoint */
 	struct ast_party_id id;
@@ -410,6 +434,20 @@
 	struct ast_endpoint *persistent;
 	/*! The number of channels at which busy device state is returned */
 	unsigned int devicestate_busy_at;
+	/*! Determines if transfers (using REFER) are allowed by this endpoint */
+	unsigned int allowtransfer;
+	/*! 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;
+	/*! Indicates if endpoint is allowed to initiate subscriptions */
+	unsigned int allowsubscribe;
+	/*! The minimum allowed expiration for subscriptions from endpoint */
+	unsigned int subminexpiry;
 	/*! \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? */
@@ -1063,13 +1101,15 @@
  * \param endpoint Optional. If specified, the request will be created out-of-dialog
  * to the endpoint.
  * \param uri Optional. If specified, the request will be sent to this URI rather
+ * this value.
  * than one configured for the endpoint.
  * \param[out] tdata The newly-created request
  * \retval 0 Success
  * \retval -1 Failure
  */
 int ast_sip_create_request(const char *method, struct pjsip_dialog *dlg,
-		struct ast_sip_endpoint *endpoint, const char *uri, pjsip_tx_data **tdata);
+		struct ast_sip_endpoint *endpoint, const char *uri,
+		pjsip_tx_data **tdata);
 
 /*!
  * \brief General purpose method for sending a SIP request
@@ -1314,4 +1354,12 @@
  */
 void ast_sip_report_auth_challenge_sent(struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata, pjsip_tx_data *tdata);
 
+void ast_sip_initialize_global_headers(void);
+void ast_sip_destroy_global_headers(void);
+
+int ast_sip_add_global_request_header(const char *name, const char *value, int replace);
+int ast_sip_add_global_response_header(const char *name, const char *value, int replace);
+
+int ast_sip_initialize_sorcery_global(struct ast_sorcery *sorcery);
+
 #endif /* _RES_SIP_H */

Modified: team/kmoore/pjsip_dtls/include/asterisk/stasis_system.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_dtls/include/asterisk/stasis_system.h?view=diff&rev=394807&r1=394806&r2=394807
==============================================================================
--- team/kmoore/pjsip_dtls/include/asterisk/stasis_system.h (original)
+++ team/kmoore/pjsip_dtls/include/asterisk/stasis_system.h Fri Jul 19 13:34:50 2013
@@ -62,6 +62,66 @@
 struct stasis_message_type *ast_system_registry_type(void);
 
 /*!
+ * \brief A \ref stasis_message_type for CCSS Available messages.
+ * \since 12
+ */
+struct stasis_message_type *ast_cc_available_type(void);
+
+/*!
+ * \brief A \ref stasis_message_type for CCSS Offer Timer Start messages.
+ * \since 12
+ */
+struct stasis_message_type *ast_cc_offertimerstart_type(void);
+
+/*!
+ * \brief A \ref stasis_message_type for CCSS Requested messages.
+ * \since 12
+ */
+struct stasis_message_type *ast_cc_requested_type(void);
+
+/*!
+ * \brief A \ref stasis_message_type for CCSS Request Acknowledged messages.
+ * \since 12
+ */
+struct stasis_message_type *ast_cc_requestacknowledged_type(void);
+
+/*!
+ * \brief A \ref stasis_message_type for CCSS Caller Stop Monitoring messages.
+ * \since 12
+ */
+struct stasis_message_type *ast_cc_callerstopmonitoring_type(void);
+
+/*!
+ * \brief A \ref stasis_message_type for CCSS Caller Start Monitoring messages.
+ * \since 12
+ */
+struct stasis_message_type *ast_cc_callerstartmonitoring_type(void);
+
+/*!
+ * \brief A \ref stasis_message_type for CCSS Caller Recalling messages.
+ * \since 12
+ */
+struct stasis_message_type *ast_cc_callerrecalling_type(void);
+
+/*!
+ * \brief A \ref stasis_message_type for CCSS Recall Complete messages.
+ * \since 12
+ */
+struct stasis_message_type *ast_cc_recallcomplete_type(void);
+
+/*!
+ * \brief A \ref stasis_message_type for CCSS Failure messages.
+ * \since 12
+ */
+struct stasis_message_type *ast_cc_failure_type(void);
+
+/*!
+ * \brief A \ref stasis_message_type for CCSS Monitor Failed messages.
+ * \since 12
+ */
+struct stasis_message_type *ast_cc_monitorfailed_type(void);
+
+/*!
  * \brief Initialize the stasis system topic and message types
  * \retval 0 on success
  * \retval -1 on failure

Modified: team/kmoore/pjsip_dtls/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_dtls/main/bridging.c?view=diff&rev=394807&r1=394806&r2=394807
==============================================================================
--- team/kmoore/pjsip_dtls/main/bridging.c (original)
+++ team/kmoore/pjsip_dtls/main/bridging.c Fri Jul 19 13:34:50 2013
@@ -63,6 +63,7 @@
 #include "asterisk/core_local.h"
 #include "asterisk/core_unreal.h"
 #include "asterisk/features_config.h"
+#include "asterisk/audiohook.h"
 
 /*! All bridges container. */
 static struct ao2_container *bridges;
@@ -4721,6 +4722,13 @@
 	if (!AST_LIST_EMPTY(ast_channel_readq(chan))) {
 		return NULL;
 	}
+	if (ast_channel_monitor(chan)
+		|| (ast_channel_audiohooks(chan)
+			&& !ast_audiohook_write_list_empty(ast_channel_audiohooks(chan)))
+		|| !ast_framehook_list_contains_no_active(ast_channel_framehooks(chan))) {
+		/* Channel has an active monitor, audiohook, or framehook. */
+		return NULL;
+	}
 	bridge_channel = ast_channel_internal_bridge_channel(chan);
 	if (!bridge_channel || ast_bridge_channel_trylock(bridge_channel)) {
 		return NULL;
@@ -4760,6 +4768,14 @@
 		return NULL;
 	}
 	if (!AST_LIST_EMPTY(ast_channel_readq(peer))) {
+		ast_channel_unlock(peer);
+		return NULL;
+	}
+	if (ast_channel_monitor(peer)
+		|| (ast_channel_audiohooks(peer)
+			&& !ast_audiohook_write_list_empty(ast_channel_audiohooks(peer)))
+		|| !ast_framehook_list_contains_no_active(ast_channel_framehooks(peer))) {
+		/* Peer has an active monitor, audiohook, or framehook. */
 		ast_channel_unlock(peer);
 		return NULL;
 	}

Modified: team/kmoore/pjsip_dtls/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_dtls/main/ccss.c?view=diff&rev=394807&r1=394806&r2=394807
==============================================================================
--- team/kmoore/pjsip_dtls/main/ccss.c (original)
+++ team/kmoore/pjsip_dtls/main/ccss.c Fri Jul 19 13:34:50 2013
@@ -52,6 +52,7 @@
 #include "asterisk/cli.h"
 #include "asterisk/manager.h"
 #include "asterisk/causes.h"
+#include "asterisk/stasis_system.h"
 
 /*** DOCUMENTATION
 	<application name="CallCompletionRequest" language="en_US">
@@ -1025,6 +1026,136 @@
 	}
 }
 
+static int cc_publish(struct stasis_message_type *message_type, int core_id, struct ast_json *extras)
+{
+	RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
+	RAII_VAR(struct ast_json_payload *, payload, NULL, ao2_cleanup);
+	RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
+
+	blob = ast_json_pack("{s: i}",
+		"core_id", core_id);
+
+	if (extras) {
+		ast_json_object_update(blob, extras);
+	}
+
+	if (!(payload = ast_json_payload_create(blob))) {
+		return -1;
+	}
+
+	if (!(message = stasis_message_create(message_type, payload))) {
+		return -1;
+	}
+
+	stasis_publish(ast_system_topic(), message);
+
+	return 0;
+}
+
+static void cc_publish_available(int core_id, const char *callee, const char *service)
+{
+	RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
+
+	extras = ast_json_pack("{s: s, s: s}",
+		"callee", callee,
+		"service", service);
+
+	cc_publish(ast_cc_available_type(), core_id, extras);
+}
+
+static void cc_publish_offertimerstart(int core_id, const char *caller, unsigned int expires)
+{
+	RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
+
+	extras = ast_json_pack("{s: s, s: i}",
+		"caller", caller,
+		"expires", expires);
+
+	cc_publish(ast_cc_offertimerstart_type(), core_id, extras);
+}
+
+static void cc_publish_requested(int core_id, const char *caller, const char *callee)
+{
+	RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
+
+	extras = ast_json_pack("{s: s, s: s}",
+		"caller", caller,
+		"callee", callee);
+
+	cc_publish(ast_cc_requested_type(), core_id, extras);
+}
+
+static void cc_publish_requestacknowledged(int core_id, const char *caller)
+{
+	RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
+
+	extras = ast_json_pack("{s: s}",
+		"caller", caller);
+
+	cc_publish(ast_cc_requestacknowledged_type(), core_id, extras);
+}
+
+static void cc_publish_callerstopmonitoring(int core_id, const char *caller)
+{
+	RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
+
+	extras = ast_json_pack("{s: s}",
+		"caller", caller);
+
+	cc_publish(ast_cc_callerstopmonitoring_type(), core_id, extras);
+}
+
+static void cc_publish_callerstartmonitoring(int core_id, const char *caller)
+{
+	RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
+
+	extras = ast_json_pack("{s: s}",
+		"caller", caller);
+
+	cc_publish(ast_cc_callerstartmonitoring_type(), core_id, extras);
+}
+
+static void cc_publish_callerrecalling(int core_id, const char *caller)
+{
+	RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
+
+	extras = ast_json_pack("{s: s}",
+		"caller", caller);
+
+	cc_publish(ast_cc_callerrecalling_type(), core_id, extras);
+}
+
+static void cc_publish_recallcomplete(int core_id, const char *caller)
+{
+	RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
+
+	extras = ast_json_pack("{s: s}",
+		"caller", caller);
+
+	cc_publish(ast_cc_recallcomplete_type(), core_id, extras);
+}
+
+static void cc_publish_failure(int core_id, const char *caller, const char *reason)
+{
+	RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
+
+	extras = ast_json_pack("{s: s, s: s}",
+		"caller", caller,
+		"reason", reason);
+
+	cc_publish(ast_cc_failure_type(), core_id, extras);
+}
+
+static void cc_publish_monitorfailed(int core_id, const char *callee)
+{
+	RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);
+
+	extras = ast_json_pack("{s: s}",
+		"callee", callee);
+
+	cc_publish(ast_cc_monitorfailed_type(), core_id, extras);
+}
+
 struct cc_monitor_backend {
 	AST_LIST_ENTRY(cc_monitor_backend) next;
 	const struct ast_cc_monitor_callbacks *callbacks;
@@ -2262,12 +2393,7 @@
 
 	cc_extension_monitor_change_is_valid(core_instance, monitor->parent_id, monitor->interface->device_name, 0);
 
-	manager_event(EVENT_FLAG_CC, "CCAvailable",
-		"CoreID: %d\r\n"
-		"Callee: %s\r\n"
-		"Service: %s\r\n",
-		cc_interfaces->core_id, device_name, cc_service_to_string(cc_data->service)
-	);
+	cc_publish_available(cc_interfaces->core_id, device_name, cc_service_to_string(cc_data->service));
 
 	cc_unref(core_instance, "Done with core_instance after handling CC control frame");
 	cc_unref(monitor, "Unref reference from allocating monitor");
@@ -2933,11 +3059,7 @@
 				core_instance->agent->device_name);
 		return -1;
 	}
-	manager_event(EVENT_FLAG_CC, "CCOfferTimerStart",
-		"CoreID: %d\r\n"
-		"Caller: %s\r\n"
-		"Expires: %u\r\n",
-		core_instance->core_id, core_instance->agent->device_name, core_instance->agent->cc_params->cc_offer_timer);
+	cc_publish_offertimerstart(core_instance->core_id, core_instance->agent->device_name, core_instance->agent->cc_params->cc_offer_timer);
 	ast_log_dynamic_level(cc_logger_level, "Core %d: Started the offer timer for the agent %s!\n",
 			core_instance->core_id, core_instance->agent->device_name);
 	return 0;
@@ -2986,11 +3108,7 @@
 						monitor_iter->interface->device_name, 1);
 				cc_unref(monitor_iter, "request_cc failed. Unref list's reference to monitor");
 			} else {
-				manager_event(EVENT_FLAG_CC, "CCRequested",
-					"CoreID: %d\r\n"
-					"Caller: %s\r\n"
-					"Callee: %s\r\n",
-					core_instance->core_id, core_instance->agent->device_name, monitor_iter->interface->device_name);
+				cc_publish_requested(core_instance->core_id, core_instance->agent->device_name, monitor_iter->interface->device_name);
 			}
 		}
 	}
@@ -3048,15 +3166,9 @@
 	if (previous_state == CC_CALLER_REQUESTED) {
 		core_instance->agent->callbacks->respond(core_instance->agent,
 			AST_CC_AGENT_RESPONSE_SUCCESS);
-		manager_event(EVENT_FLAG_CC, "CCRequestAcknowledged",
-			"CoreID: %d\r\n"
-			"Caller: %s\r\n",
-			core_instance->core_id, core_instance->agent->device_name);
+		cc_publish_requestacknowledged(core_instance->core_id, core_instance->agent->device_name);
 	} else if (previous_state == CC_CALLER_BUSY) {
-		manager_event(EVENT_FLAG_CC, "CCCallerStopMonitoring",
-			"CoreID: %d\r\n"
-			"Caller: %s\r\n",
-			core_instance->core_id, core_instance->agent->device_name);
+		cc_publish_callerstopmonitoring(core_instance->core_id, core_instance->agent->device_name);
 		unsuspend(core_instance);
 	}
 	/* Not possible for previous_state to be anything else due to the is_state_change_valid check at the beginning */
@@ -3098,10 +3210,7 @@
 	 */
 	suspend(core_instance);
 	core_instance->agent->callbacks->start_monitoring(core_instance->agent);
-	manager_event(EVENT_FLAG_CC, "CCCallerStartMonitoring",
-		"CoreID: %d\r\n"
-		"Caller: %s\r\n",
-		core_instance->core_id, core_instance->agent->device_name);
+	cc_publish_callerstartmonitoring(core_instance->core_id, core_instance->agent->device_name);
 	return 0;
 }
 
@@ -3132,10 +3241,7 @@
 	/* Both caller and callee are available, call agent's recall callback
 	 */
 	cancel_available_timer(core_instance);
-	manager_event(EVENT_FLAG_CC, "CCCallerRecalling",
-		"CoreID: %d\r\n"
-		"Caller: %s\r\n",
-		core_instance->core_id, core_instance->agent->device_name);
+	cc_publish_callerrecalling(core_instance->core_id, core_instance->agent->device_name);
 	return 0;
 }
 
@@ -3143,21 +3249,14 @@
 {
 	/* Recall has made progress, call agent and monitor destructor functions
 	 */
-	manager_event(EVENT_FLAG_CC, "CCRecallComplete",
-		"CoreID: %d\r\n"
-		"Caller: %s\r\n",
-		core_instance->core_id, core_instance->agent->device_name);
+	cc_publish_recallcomplete(core_instance->core_id, core_instance->agent->device_name);
 	ao2_t_unlink(cc_core_instances, core_instance, "Unlink core instance since CC recall has completed");
 	return 0;
 }
 
 static int cc_failed(struct cc_core_instance *core_instance, struct cc_state_change_args *args, enum cc_state previous_state)
 {
-	manager_event(EVENT_FLAG_CC, "CCFailure",
-		"CoreID: %d\r\n"
-		"Caller: %s\r\n"
-		"Reason: %s\r\n",
-		core_instance->core_id, core_instance->agent->device_name, args->debug);
+	cc_publish_failure(core_instance->core_id, core_instance->agent->device_name, args->debug);
 	ao2_t_unlink(cc_core_instances, core_instance, "Unlink core instance since CC failed");
 	return 0;
 }
@@ -3811,10 +3910,7 @@
 				cc_extension_monitor_change_is_valid(core_instance, monitor_iter->parent_id,
 						monitor_iter->interface->device_name, 1);
 				monitor_iter->callbacks->cancel_available_timer(monitor_iter, &monitor_iter->available_timer_id);
-				manager_event(EVENT_FLAG_CC, "CCMonitorFailed",
-					"CoreID: %d\r\n"
-					"Callee: %s\r\n",
-					monitor_iter->core_id, monitor_iter->interface->device_name);
+				cc_publish_monitorfailed(monitor_iter->core_id, monitor_iter->interface->device_name);
 				cc_unref(monitor_iter, "Monitor reported failure. Unref list's reference.");
 			}
 		}

Modified: team/kmoore/pjsip_dtls/main/stasis_system.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_dtls/main/stasis_system.c?view=diff&rev=394807&r1=394806&r2=394807
==============================================================================
--- team/kmoore/pjsip_dtls/main/stasis_system.c (original)
+++ team/kmoore/pjsip_dtls/main/stasis_system.c Fri Jul 19 13:34:50 2013
@@ -70,10 +70,50 @@
 static struct stasis_topic *system_topic;
 
 static struct ast_manager_event_blob *system_registry_to_ami(struct stasis_message *message);
+static struct ast_manager_event_blob *cc_available_to_ami(struct stasis_message *message);
+static struct ast_manager_event_blob *cc_offertimerstart_to_ami(struct stasis_message *message);
+static struct ast_manager_event_blob *cc_requested_to_ami(struct stasis_message *message);
+static struct ast_manager_event_blob *cc_requestacknowledged_to_ami(struct stasis_message *message);
+static struct ast_manager_event_blob *cc_callerstopmonitoring_to_ami(struct stasis_message *message);
+static struct ast_manager_event_blob *cc_callerstartmonitoring_to_ami(struct stasis_message *message);
+static struct ast_manager_event_blob *cc_callerrecalling_to_ami(struct stasis_message *message);
+static struct ast_manager_event_blob *cc_recallcomplete_to_ami(struct stasis_message *message);
+static struct ast_manager_event_blob *cc_failure_to_ami(struct stasis_message *message);
+static struct ast_manager_event_blob *cc_monitorfailed_to_ami(struct stasis_message *message);
 
 STASIS_MESSAGE_TYPE_DEFN(ast_network_change_type);
 STASIS_MESSAGE_TYPE_DEFN(ast_system_registry_type,
 	.to_ami = system_registry_to_ami,
+	);
+STASIS_MESSAGE_TYPE_DEFN(ast_cc_available_type,
+	.to_ami = cc_available_to_ami,
+	);
+STASIS_MESSAGE_TYPE_DEFN(ast_cc_offertimerstart_type,
+	.to_ami = cc_offertimerstart_to_ami,
+	);
+STASIS_MESSAGE_TYPE_DEFN(ast_cc_requested_type,
+	.to_ami = cc_requested_to_ami,
+	);
+STASIS_MESSAGE_TYPE_DEFN(ast_cc_requestacknowledged_type,
+	.to_ami = cc_requestacknowledged_to_ami,
+	);
+STASIS_MESSAGE_TYPE_DEFN(ast_cc_callerstopmonitoring_type,
+	.to_ami = cc_callerstopmonitoring_to_ami,
+	);
+STASIS_MESSAGE_TYPE_DEFN(ast_cc_callerstartmonitoring_type,
+	.to_ami = cc_callerstartmonitoring_to_ami,
+	);
+STASIS_MESSAGE_TYPE_DEFN(ast_cc_callerrecalling_type,
+	.to_ami = cc_callerrecalling_to_ami,
+	);
+STASIS_MESSAGE_TYPE_DEFN(ast_cc_recallcomplete_type,
+	.to_ami = cc_recallcomplete_to_ami,
+	);
+STASIS_MESSAGE_TYPE_DEFN(ast_cc_failure_type,
+	.to_ami = cc_failure_to_ami,
+	);
+STASIS_MESSAGE_TYPE_DEFN(ast_cc_monitorfailed_type,
+	.to_ami = cc_monitorfailed_to_ami,
 	);
 
 void ast_system_publish_registry(const char *channeltype, const char *username, const char *domain, const char *status, const char *cause)
@@ -134,6 +174,168 @@
 		channeltype, username, domain, status, ast_str_buffer(cause_string));
 }
 
+static struct ast_manager_event_blob *cc_available_to_ami(struct stasis_message *message)
+{
+	struct ast_json_payload *payload = stasis_message_data(message);
+	int core_id;
+	const char *callee;
+	const char *service;
+
+	core_id = ast_json_integer_get(ast_json_object_get(payload->json, "core_id"));
+	callee = ast_json_string_get(ast_json_object_get(payload->json, "callee"));
+	service = ast_json_string_get(ast_json_object_get(payload->json, "service"));
+
+	return ast_manager_event_blob_create(EVENT_FLAG_CC, "CCAvailable",
+		"CoreID: %d\r\n"
+		"Callee: %s\r\n"
+		"Service: %s\r\n",
+		core_id, callee, service);
+}
+
+static struct ast_manager_event_blob *cc_offertimerstart_to_ami(struct stasis_message *message)
+{
+	struct ast_json_payload *payload = stasis_message_data(message);
+	int core_id;
+	const char *caller;
+	unsigned int expires;
+
+	core_id = ast_json_integer_get(ast_json_object_get(payload->json, "core_id"));
+	caller = ast_json_string_get(ast_json_object_get(payload->json, "caller"));
+	expires = ast_json_integer_get(ast_json_object_get(payload->json, "expires"));
+
+	return ast_manager_event_blob_create(EVENT_FLAG_CC, "CCOfferTimerStart",
+		"CoreID: %d\r\n"
+		"Caller: %s\r\n"
+		"Expires: %u\r\n",
+		core_id, caller, expires);
+}
+
+static struct ast_manager_event_blob *cc_requested_to_ami(struct stasis_message *message)
+{
+	struct ast_json_payload *payload = stasis_message_data(message);
+	int core_id;
+	const char *caller;
+	const char *callee;
+
+	core_id = ast_json_integer_get(ast_json_object_get(payload->json, "core_id"));
+	caller = ast_json_string_get(ast_json_object_get(payload->json, "caller"));
+	callee = ast_json_string_get(ast_json_object_get(payload->json, "callee"));
+
+	return ast_manager_event_blob_create(EVENT_FLAG_CC, "CCRequested",
+		"CoreID: %d\r\n"
+		"Caller: %s\r\n"
+		"Callee: %s\r\n",
+		core_id, caller, callee);
+}
+
+static struct ast_manager_event_blob *cc_requestacknowledged_to_ami(struct stasis_message *message)
+{
+	struct ast_json_payload *payload = stasis_message_data(message);
+	int core_id;
+	const char *caller;
+
+	core_id = ast_json_integer_get(ast_json_object_get(payload->json, "core_id"));
+	caller = ast_json_string_get(ast_json_object_get(payload->json, "caller"));
+
+	return ast_manager_event_blob_create(EVENT_FLAG_CC, "CCRequestAcknowledged",
+		"CoreID: %d\r\n"
+		"Caller: %s\r\n",
+		core_id, caller);
+}
+
+static struct ast_manager_event_blob *cc_callerstopmonitoring_to_ami(struct stasis_message *message)
+{
+	struct ast_json_payload *payload = stasis_message_data(message);
+	int core_id;
+	const char *caller;
+
+	core_id = ast_json_integer_get(ast_json_object_get(payload->json, "core_id"));
+	caller = ast_json_string_get(ast_json_object_get(payload->json, "caller"));
+
+	return ast_manager_event_blob_create(EVENT_FLAG_CC, "CCCallerStopMonitoring",
+		"CoreID: %d\r\n"
+		"Caller: %s\r\n",
+		core_id, caller);
+}
+
+static struct ast_manager_event_blob *cc_callerstartmonitoring_to_ami(struct stasis_message *message)
+{
+	struct ast_json_payload *payload = stasis_message_data(message);
+	int core_id;
+	const char *caller;
+
+	core_id = ast_json_integer_get(ast_json_object_get(payload->json, "core_id"));
+	caller = ast_json_string_get(ast_json_object_get(payload->json, "caller"));
+
+	return ast_manager_event_blob_create(EVENT_FLAG_CC, "CCCallerStartMonitoring",
+		"CoreID: %d\r\n"
+		"Caller: %s\r\n",
+		core_id, caller);
+}
+
+static struct ast_manager_event_blob *cc_callerrecalling_to_ami(struct stasis_message *message)
+{
+	struct ast_json_payload *payload = stasis_message_data(message);
+	int core_id;
+	const char *caller;
+
+	core_id = ast_json_integer_get(ast_json_object_get(payload->json, "core_id"));
+	caller = ast_json_string_get(ast_json_object_get(payload->json, "caller"));
+
+	return ast_manager_event_blob_create(EVENT_FLAG_CC, "CCCallerRecalling",
+		"CoreID: %d\r\n"
+		"Caller: %s\r\n",
+		core_id, caller);
+}
+
+static struct ast_manager_event_blob *cc_recallcomplete_to_ami(struct stasis_message *message)
+{
+	struct ast_json_payload *payload = stasis_message_data(message);
+	int core_id;
+	const char *caller;
+
+	core_id = ast_json_integer_get(ast_json_object_get(payload->json, "core_id"));
+	caller = ast_json_string_get(ast_json_object_get(payload->json, "caller"));
+
+	return ast_manager_event_blob_create(EVENT_FLAG_CC, "CCRecallComplete",
+		"CoreID: %d\r\n"
+		"Caller: %s\r\n",
+		core_id, caller);
+}
+
+static struct ast_manager_event_blob *cc_failure_to_ami(struct stasis_message *message)
+{
+	struct ast_json_payload *payload = stasis_message_data(message);
+	int core_id;
+	const char *caller;
+	const char *reason;
+
+	core_id = ast_json_integer_get(ast_json_object_get(payload->json, "core_id"));
+	caller = ast_json_string_get(ast_json_object_get(payload->json, "caller"));
+	reason = ast_json_string_get(ast_json_object_get(payload->json, "reason"));
+
+	return ast_manager_event_blob_create(EVENT_FLAG_CC, "CCFailure",
+		"CoreID: %d\r\n"
+		"Caller: %s\r\n"
+		"Reason: %s\r\n",
+		core_id, caller, reason);
+}
+
+static struct ast_manager_event_blob *cc_monitorfailed_to_ami(struct stasis_message *message)
+{
+	struct ast_json_payload *payload = stasis_message_data(message);
+	int core_id;
+	const char *callee;
+
+	core_id = ast_json_integer_get(ast_json_object_get(payload->json, "core_id"));
+	callee = ast_json_string_get(ast_json_object_get(payload->json, "callee"));
+
+	return ast_manager_event_blob_create(EVENT_FLAG_CC, "CCMonitorFailed",
+		"CoreID: %d\r\n"
+		"Callee: %s\r\n",
+		core_id, callee);
+}
+
 struct stasis_topic *ast_system_topic(void)
 {
 	return system_topic;
@@ -146,6 +348,16 @@
 	system_topic = NULL;
 	STASIS_MESSAGE_TYPE_CLEANUP(ast_network_change_type);
 	STASIS_MESSAGE_TYPE_CLEANUP(ast_system_registry_type);
+	STASIS_MESSAGE_TYPE_CLEANUP(ast_cc_available_type);
+	STASIS_MESSAGE_TYPE_CLEANUP(ast_cc_offertimerstart_type);
+	STASIS_MESSAGE_TYPE_CLEANUP(ast_cc_requested_type);
+	STASIS_MESSAGE_TYPE_CLEANUP(ast_cc_requestacknowledged_type);
+	STASIS_MESSAGE_TYPE_CLEANUP(ast_cc_callerstopmonitoring_type);
+	STASIS_MESSAGE_TYPE_CLEANUP(ast_cc_callerstartmonitoring_type);
+	STASIS_MESSAGE_TYPE_CLEANUP(ast_cc_callerrecalling_type);
+	STASIS_MESSAGE_TYPE_CLEANUP(ast_cc_recallcomplete_type);
+	STASIS_MESSAGE_TYPE_CLEANUP(ast_cc_failure_type);
+	STASIS_MESSAGE_TYPE_CLEANUP(ast_cc_monitorfailed_type);
 }
 
 /*! \brief Initialize the system level items for \ref stasis */
@@ -166,5 +378,45 @@
 		return -1;
 	}
 
+	if (STASIS_MESSAGE_TYPE_INIT(ast_cc_available_type) != 0) {
+		return -1;
+	}
+
+	if (STASIS_MESSAGE_TYPE_INIT(ast_cc_offertimerstart_type) != 0) {
+		return -1;
+	}
+
+	if (STASIS_MESSAGE_TYPE_INIT(ast_cc_requested_type) != 0) {
+		return -1;
+	}
+
+	if (STASIS_MESSAGE_TYPE_INIT(ast_cc_requestacknowledged_type) != 0) {
+		return -1;
+	}
+
+	if (STASIS_MESSAGE_TYPE_INIT(ast_cc_callerstopmonitoring_type) != 0) {
+		return -1;
+	}
+
+	if (STASIS_MESSAGE_TYPE_INIT(ast_cc_callerstartmonitoring_type) != 0) {
+		return -1;
+	}
+
+	if (STASIS_MESSAGE_TYPE_INIT(ast_cc_callerrecalling_type) != 0) {
+		return -1;
+	}
+
+	if (STASIS_MESSAGE_TYPE_INIT(ast_cc_recallcomplete_type) != 0) {
+		return -1;
+	}
+
+	if (STASIS_MESSAGE_TYPE_INIT(ast_cc_failure_type) != 0) {
+		return -1;
+	}
+
+	if (STASIS_MESSAGE_TYPE_INIT(ast_cc_monitorfailed_type) != 0) {
+		return -1;
+	}
+
 	return 0;
 }

Modified: team/kmoore/pjsip_dtls/res/res_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_dtls/res/res_sip.c?view=diff&rev=394807&r1=394806&r2=394807
==============================================================================
--- team/kmoore/pjsip_dtls/res/res_sip.c (original)
+++ team/kmoore/pjsip_dtls/res/res_sip.c Fri Jul 19 13:34:50 2013
@@ -389,6 +389,96 @@
 						Gulp channel driver will return busy as the device state instead of in use.
 					</para></description>
 				</configOption>
+				<configOption name="tonezone">
+					<synopsis>Set which country's indications to use for channels created for this endpoint.</synopsis>
+				</configOption>
+				<configOption name="language">
+					<synopsis>Set the default language to use for channels created for this endpoint.</synopsis>
+				</configOption>
+				<configOption name="one_touch_recording" default="no">
+					<synopsis>Determines whether one-touch recording is allowed for this endpoint.</synopsis>
+					<see-also>
+						<ref type="configOption">recordonfeature</ref>
+						<ref type="configOption">recordofffeature</ref>
+					</see-also>
+				</configOption>
+				<configOption name="recordonfeature" default="automixmon">
+					<synopsis>The feature to enact when one-touch recording is turned on.</synopsis>
+					<description>
+						<para>When an INFO request for one-touch recording arrives with a Record header set to "on", this
+						feature will be enabled for the channel. The feature designated here can be any built-in
+						or dynamic feature defined in features.conf.</para>
+						<note><para>This setting has no effect if the endpoint's one_touch_recording option is disabled</para></note>
+					</description>
+					<see-also>
+						<ref type="configOption">one_touch_recording</ref>
+						<ref type="configOption">recordofffeature</ref>
+					</see-also>
+				</configOption>
+				<configOption name="recordofffeature" default="automixmon">
+					<synopsis>The feature to enact when one-touch recording is turned off.</synopsis>
+					<description>

[... 611 lines stripped ...]



More information about the svn-commits mailing list