[asterisk-commits] mmichelson: branch 10-digiumphones r361206 - /branches/10-digiumphones/includ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 4 14:26:34 CDT 2012


Author: mmichelson
Date: Wed Apr  4 14:26:30 2012
New Revision: 361206

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=361206
Log:
Add Digium phone changes for the include/asterisk directory


Added:
    branches/10-digiumphones/include/asterisk/app_voicemail.h   (with props)
    branches/10-digiumphones/include/asterisk/custom_control_frame.h   (with props)
    branches/10-digiumphones/include/asterisk/presencestate.h   (with props)
Modified:
    branches/10-digiumphones/include/asterisk/app.h
    branches/10-digiumphones/include/asterisk/config.h
    branches/10-digiumphones/include/asterisk/event_defs.h
    branches/10-digiumphones/include/asterisk/file.h
    branches/10-digiumphones/include/asterisk/frame.h
    branches/10-digiumphones/include/asterisk/manager.h
    branches/10-digiumphones/include/asterisk/message.h
    branches/10-digiumphones/include/asterisk/pbx.h

Modified: branches/10-digiumphones/include/asterisk/app.h
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/include/asterisk/app.h?view=diff&rev=361206&r1=361205&r2=361206
==============================================================================
--- branches/10-digiumphones/include/asterisk/app.h (original)
+++ branches/10-digiumphones/include/asterisk/app.h Wed Apr  4 14:26:30 2012
@@ -23,8 +23,10 @@
 #ifndef _ASTERISK_APP_H
 #define _ASTERISK_APP_H
 
+#include "asterisk/stringfields.h"
 #include "asterisk/strings.h"
 #include "asterisk/threadstorage.h"
+#include "asterisk/file.h"
 
 struct ast_flags64;
 
@@ -78,6 +80,27 @@
 	struct ast_ivr_option *options;	/*!< All options */
 };
 
+/*!
+ * \brief Structure used for ast_copy_recording_to_vm in order to cleanly supply
+ * data needed for making the recording from the recorded file.
+ */
+struct ast_vm_recording_data {
+	AST_DECLARE_STRING_FIELDS(
+		AST_STRING_FIELD(context);
+		AST_STRING_FIELD(mailbox);
+		AST_STRING_FIELD(folder);
+		AST_STRING_FIELD(recording_file);
+		AST_STRING_FIELD(recording_ext);
+
+		AST_STRING_FIELD(call_context);
+		AST_STRING_FIELD(call_macrocontext);
+		AST_STRING_FIELD(call_extension);
+		AST_STRING_FIELD(call_callerchan);
+		AST_STRING_FIELD(call_callerid);
+		);
+	int call_priority;
+};
+
 #define AST_IVR_FLAG_AUTORESTART (1 << 0)
 
 #define AST_IVR_DECLARE_MENU(holder, title, flags, foo...) \
@@ -147,9 +170,18 @@
 			      int (*inboxcount_func)(const char *mailbox, int *newmsgs, int *oldmsgs),
 			      int (*inboxcount2_func)(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs),
 			      int (*messagecount_func)(const char *context, const char *mailbox, const char *folder),
-			      int (*sayname_func)(struct ast_channel *chan, const char *mailbox, const char *context));
+			      int (*sayname_func)(struct ast_channel *chan, const char *mailbox, const char *context),
+			      int (*copy_recording_to_vm_func)(struct ast_vm_recording_data *vm_rec_data));
 
 void ast_uninstall_vm_functions(void);
+
+/*!
+ * \brief
+ * param[in] vm_rec_data Contains data needed to make the recording.
+ * retval 0 voicemail successfully created from recording.
+ * retval -1 Failure
+ */
+int ast_app_copy_recording_to_vm(struct ast_vm_recording_data *vm_rec_data);
 
 /*!
  * \brief Determine if a given mailbox has any voicemail
@@ -267,6 +299,29 @@
  */
 int ast_control_streamfile(struct ast_channel *chan, const char *file, const char *fwd, const char *rev, const char *stop, const char *pause, const char *restart, int skipms, long *offsetms);
 
+/*!
+ * \brief Stream a file with fast forward, pause, reverse, restart.
+ * \param chan
+ * \param file filename
+ * \param fwd, rev, stop, pause, restart, skipms, offsetms
+ * \param waitstream callback to invoke when fastforward or rewind occurrs.
+ *
+ * Before calling this function, set this to be the number
+ * of ms to start from the beginning of the file.  When the function
+ * returns, it will be the number of ms from the beginning where the
+ * playback stopped.  Pass NULL if you don't care.
+ */
+int ast_control_streamfile_w_cb(struct ast_channel *chan,
+	const char *file,
+	const char *fwd,
+	const char *rev,
+	const char *stop,
+	const char *pause,
+	const char *restart,
+	int skipms,
+	long *offsetms,
+	ast_waitstream_fr_cb cb);
+
 /*! \brief Play a stream and wait for a digit, returning the digit that was pressed */
 int ast_play_and_wait(struct ast_channel *chan, const char *fn);
 

Added: branches/10-digiumphones/include/asterisk/app_voicemail.h
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/include/asterisk/app_voicemail.h?view=auto&rev=361206
==============================================================================
--- branches/10-digiumphones/include/asterisk/app_voicemail.h (added)
+++ branches/10-digiumphones/include/asterisk/app_voicemail.h Wed Apr  4 14:26:30 2012
@@ -1,0 +1,194 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2011-2012, Digium, Inc.
+ *
+ * David Vossel <dvossel at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ * \brief Voice Mail API
+ * \author David Vossel <dvossel at digium.com>
+ */
+
+#ifndef _ASTERISK_VM_H
+#define _ASTERISK_VM_H
+
+#include "asterisk/stringfields.h"
+#include "asterisk/linkedlists.h"
+
+#define AST_VM_FOLDER_NUMBER 12
+
+enum ast_vm_snapshot_sort_val {
+	AST_VM_SNAPSHOT_SORT_BY_ID = 0,
+	AST_VM_SNAPSHOT_SORT_BY_TIME,
+};
+
+struct ast_vm_msg_snapshot {
+	AST_DECLARE_STRING_FIELDS(
+		AST_STRING_FIELD(msg_id);
+		AST_STRING_FIELD(callerid);
+		AST_STRING_FIELD(callerchan);
+		AST_STRING_FIELD(exten);
+		AST_STRING_FIELD(origdate);
+		AST_STRING_FIELD(origtime);
+		AST_STRING_FIELD(duration);
+		AST_STRING_FIELD(folder_name);
+		AST_STRING_FIELD(folder_dir);
+		AST_STRING_FIELD(flag);
+	);
+	unsigned int msg_number;
+
+	AST_LIST_ENTRY(ast_vm_msg_snapshot) msg;
+};
+
+struct ast_vm_mailbox_snapshot {
+	int total_msg_num;
+	AST_LIST_HEAD_NOLOCK(, ast_vm_msg_snapshot) snapshots[AST_VM_FOLDER_NUMBER];
+};
+
+/*
+ * \brief Create a snapshot of a mailbox which contains information about every msg.
+ *
+ * \param mailbox, the mailbox to look for
+ * \param context, the context to look for the mailbox in
+ * \param folder, OPTIONAL.  When not NULL only msgs from the specified folder will be included.
+ * \param desending, list the msgs in descending order rather than ascending order.
+ * \param combine_INBOX_and_OLD, When this argument is set, The OLD folder will be represented
+ *        in the INBOX folder of the snapshot. This allows the snapshot to represent the
+ *        OLD and INBOX messages in sorted order merged together.
+ *
+ * \retval snapshot on success
+ * \retval NULL on failure
+ */
+struct ast_vm_mailbox_snapshot *ast_vm_mailbox_snapshot_create(const char *mailbox,
+	const char *context,
+	const char *folder,
+	int descending,
+	enum ast_vm_snapshot_sort_val sort_val,
+	int combine_INBOX_and_OLD);
+
+/*
+ * \brief destroy a snapshot
+ *
+ * \param mailbox_snapshot The snapshot to destroy.
+ * \retval NULL
+ */
+struct ast_vm_mailbox_snapshot *ast_vm_mailbox_snapshot_destroy(struct ast_vm_mailbox_snapshot *mailbox_snapshot);
+
+/*!
+ * \brief Move messages from one folder to another
+ *
+ * \param mailbox The mailbox to which the folders belong
+ * \param context The voicemail context for the mailbox
+ * \param num_msgs The number of messages to move
+ * \param oldfolder The folder from where messages should be moved
+ * \param old_msg_nums The message IDs of the messages to move
+ * \param newfolder The folder to which messages should be moved
+ * \param new_msg_ids[out] An array of message IDs for the messages as they are in the
+ * new folder. This array must be num_msgs sized.
+ *
+ * \retval -1 Failure
+ * \retval 0 Success
+ */
+int ast_vm_msg_move(const char *mailbox,
+	const char *context,
+	size_t num_msgs,
+	const char *oldfolder,
+	int *old_msg_ids,
+	const char *newfolder,
+	int *new_msg_ids);
+
+/*!
+ * \brief Remove/delete messages from a mailbox folder.
+ *
+ * \param mailbox The mailbox from which to delete messages
+ * \param context The voicemail context for the mailbox
+ * \param num_msgs The number of messages to delete
+ * \param folder The folder from which to remove messages
+ * \param msgs The message IDs of the messages to delete
+ * 
+ * \retval -1 Failure
+ * \retval 0 Success
+ */
+int ast_vm_msg_remove(const char *mailbox,
+	const char *context,
+	size_t num_msgs,
+	const char *folder,
+	int *msgs);
+
+/*!
+ * \brief forward a message from one mailbox to another.
+ *
+ * \brief from_mailbox The original mailbox the message is being forwarded from
+ * \brief from_context The voicemail context of the from_mailbox
+ * \brief from_folder The folder from which the message is being forwarded
+ * \brief to_mailbox The mailbox to forward the message to
+ * \brief to_context The voicemail context of the to_mailbox
+ * \brief to_folder The folder to which the message is being forwarded
+ * \brief num_msgs The number of messages being forwarded
+ * \brief msg_ids The message IDs of the messages in from_mailbox to forward
+ * \brief delete_old If non-zero, the forwarded messages are also deleted from from_mailbox.
+ * Otherwise, the messages will remain in the from_mailbox.
+ *
+ * \retval -1 Failure
+ * \retval 0 Success
+ */
+int ast_vm_msg_forward(const char *from_mailbox,
+	const char *from_context,
+	const char *from_folder,
+	const char *to_mailbox,
+	const char *to_context,
+	const char *to_folder,
+	size_t num_msgs,
+	int *msg_ids,
+	int delete_old);
+
+/*!
+ * \brief Voicemail playback callback function definition
+ *
+ * \param channel to play the file back on.
+ * \param location of file on disk
+ * \param duration of file in seconds. This will be zero if msg is very short or
+ * has an unknown duration.
+ */
+typedef void (ast_vm_msg_play_cb)(struct ast_channel *chan, const char *playfile, int duration);
+
+/*!
+ * \brief Play a voicemail msg back on a channel.
+ *
+ * \param mailbox msg is in.
+ * \param context of mailbox.
+ * \param voicemail folder to look in.
+ * \param message number in the voicemailbox to playback to the channel.
+ *
+ * \retval 0 success
+ * \retval -1 failure
+ */
+int ast_vm_msg_play(struct ast_channel *chan,
+	const char *mailbox,
+	const char *context,
+	const char *folder,
+	const char *msg_num,
+	ast_vm_msg_play_cb cb);
+
+/*!
+ * \brief Get the name of a folder given its numeric index
+ *
+ * \param index The integer value of the mailbox.
+ * \retval "" Invalid index provided
+ * \retval other The name of the mailbox
+ */
+const char *ast_vm_index_to_foldername(unsigned int index);
+#endif
+

Propchange: branches/10-digiumphones/include/asterisk/app_voicemail.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: branches/10-digiumphones/include/asterisk/app_voicemail.h
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: branches/10-digiumphones/include/asterisk/app_voicemail.h
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: branches/10-digiumphones/include/asterisk/config.h
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/include/asterisk/config.h?view=diff&rev=361206&r1=361205&r2=361206
==============================================================================
--- branches/10-digiumphones/include/asterisk/config.h (original)
+++ branches/10-digiumphones/include/asterisk/config.h Wed Apr  4 14:26:30 2012
@@ -589,6 +589,65 @@
 int config_text_file_save(const char *filename, const struct ast_config *cfg, const char *generator) __attribute__((deprecated));
 
 struct ast_config *ast_config_internal_load(const char *configfile, struct ast_config *cfg, struct ast_flags flags, const char *suggested_incl_file, const char *who_asked);
+
+/*!
+ * \brief
+ * Copies the contents of one ast_config into another
+ *
+ * \note
+ * This creates a config on the heap. The caller of this must
+ * be prepared to free the memory returned.
+ *
+ * \param orig the config to copy
+ * \return The new config on success, NULL on failure.
+ */
+struct ast_config *ast_config_copy(const struct ast_config *orig);
+
+/*!
+ * \brief
+ * Flags that affect the behaviour of config hooks.
+ */
+enum config_hook_flags {
+	blah,
+};
+
+/*
+ * \brief Callback when configuration is updated
+ *
+ * \param cfg A copy of the configuration that is being changed.
+ *            This MUST be freed by the callback before returning.
+ */
+typedef int (*config_hook_cb)(struct ast_config *cfg);
+
+/*!
+ * \brief
+ * Register a config hook for a particular file and module
+ *
+ * \param name The name of the hook you are registering.
+ * \param filename The file whose config you wish to hook into.
+ * \param module The module that is reloading the config. This
+ *               can be useful if multiple modules may possibly
+ *               reload the same file, but you are only interested
+ *               when a specific module reloads the file
+ * \param flags Flags that affect the way hooks work.
+ * \param hook The callback to be called when config is loaded.
+ * return 0 Success
+ * return -1 Unsuccess, also known as UTTER AND COMPLETE FAILURE
+ */
+int ast_config_hook_register(const char *name,
+		const char *filename,
+		const char *module,
+		enum config_hook_flags flags,
+		config_hook_cb hook);
+
+/*!
+ * \brief
+ * Unregister a config hook
+ *
+ * \param name The name of the hook to unregister
+ */
+void ast_config_hook_unregister(const char *name);
+
 
 /*!
  * \brief Support code to parse config file arguments

Added: branches/10-digiumphones/include/asterisk/custom_control_frame.h
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/include/asterisk/custom_control_frame.h?view=auto&rev=361206
==============================================================================
--- branches/10-digiumphones/include/asterisk/custom_control_frame.h (added)
+++ branches/10-digiumphones/include/asterisk/custom_control_frame.h Wed Apr  4 14:26:30 2012
@@ -1,0 +1,80 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2011-2012, Digium, Inc.
+ *
+ * David Vossel <dvossel at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ * \brief Defines the use of the AST_CONTROL_CUSTOM control frame subclass.
+ */
+
+#ifndef _ASTERISK_CUSTOM_FRAME_H
+#define _ASTERISK_CUSTOM_FRAME_H
+
+#include "asterisk/config.h"
+
+/*! \brief this is the payload structure used in every AST_CONTROL_CUSTOM frame. */
+struct ast_custom_payload;
+
+enum ast_custom_payload_type {
+	/*! Custom SIP INFO payload type, used only in the sip channel driver. */
+	AST_CUSTOM_SIP_INFO,
+};
+
+/*!
+ * \brief returns the type of payload the custom payload represents
+ *
+ * \retval payload type, on success
+ * \retval -1, on failure
+ */
+enum ast_custom_payload_type ast_custom_payload_type(struct ast_custom_payload *type);
+
+/*!
+ * \brief returns the length of a custom payload
+ *
+ * \retval len on success
+ * \retval -1 on failure
+ */
+size_t ast_custom_payload_len(struct ast_custom_payload *type);
+
+/*!
+ * \brief Encodes and allocates a sip info custom payload type
+ *
+ * \retval encoded custom payload on success
+ * \retval NULL on failure.
+ */
+struct ast_custom_payload *ast_custom_payload_sipinfo_encode(struct ast_variable *headers,
+	const char *content_type,
+	const char *content,
+	const char *useragent_filter);
+
+/*!
+ * \brief Decodes a sip info custom payload type, returns results in parameters.
+ * 
+ * \note This is the reverse of the encode function.  Pass in a payload, get the headers
+ * content type and content variables back out.  Make sure to free all the variables
+ * this function returns.
+ *
+ * \retval 0, variables allocated and returned in output parameters
+ * \retval -1, failure no variables were allocated.
+ */
+int ast_custom_payload_sipinfo_decode(struct ast_custom_payload *pl,
+	struct ast_variable **headers,
+	char **content_type,
+	char **content,
+	char **useragent_filter);
+
+#endif
+

Propchange: branches/10-digiumphones/include/asterisk/custom_control_frame.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: branches/10-digiumphones/include/asterisk/custom_control_frame.h
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: branches/10-digiumphones/include/asterisk/custom_control_frame.h
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: branches/10-digiumphones/include/asterisk/event_defs.h
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/include/asterisk/event_defs.h?view=diff&rev=361206&r1=361205&r2=361206
==============================================================================
--- branches/10-digiumphones/include/asterisk/event_defs.h (original)
+++ branches/10-digiumphones/include/asterisk/event_defs.h Wed Apr  4 14:26:30 2012
@@ -54,8 +54,10 @@
 	AST_EVENT_SECURITY            = 0x08,
 	/*! Used by res_stun_monitor to alert listeners to an exernal network address change. */
 	AST_EVENT_NETWORK_CHANGE      = 0x09,
+	/*! The presence state for a presence provider */
+	AST_EVENT_PRESENCE_STATE      = 0x0a,
 	/*! Number of event types.  This should be the last event type + 1 */
-	AST_EVENT_TOTAL               = 0x0a,
+	AST_EVENT_TOTAL               = 0x0b,
 };
 
 /*! \brief Event Information Element types */
@@ -287,6 +289,10 @@
 	AST_EVENT_IE_RECEIVED_HASH       = 0x0036,
 	AST_EVENT_IE_USING_PASSWORD      = 0x0037,
 	AST_EVENT_IE_ATTEMPTED_TRANSPORT = 0x0038,
+	AST_EVENT_IE_PRESENCE_PROVIDER   = 0x0039,
+	AST_EVENT_IE_PRESENCE_STATE      = 0x003a,
+	AST_EVENT_IE_PRESENCE_SUBTYPE    = 0x003b,
+	AST_EVENT_IE_PRESENCE_MESSAGE    = 0x003c,
 
 	/*! \brief Must be the last IE value +1 */
 	AST_EVENT_IE_TOTAL               = 0x0039,

Modified: branches/10-digiumphones/include/asterisk/file.h
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/include/asterisk/file.h?view=diff&rev=361206&r1=361205&r2=361206
==============================================================================
--- branches/10-digiumphones/include/asterisk/file.h (original)
+++ branches/10-digiumphones/include/asterisk/file.h Wed Apr  4 14:26:30 2012
@@ -48,7 +48,21 @@
 #define AST_DIGIT_ANYNUM "0123456789"
 
 #define SEEK_FORCECUR	10
-	
+
+/*! The type of event associated with a ast_waitstream_fr_cb invocation */
+enum ast_waitstream_fr_cb_values {
+	AST_WAITSTREAM_CB_REWIND = 1,
+	AST_WAITSTREAM_CB_FASTFORWARD,
+	AST_WAITSTREAM_CB_START
+};
+
+/*!
+ * \brief callback used during dtmf controlled file playback to indicate
+ * location of playback in a file after rewinding or fastfowarding
+ * a file.
+ */
+typedef void (ast_waitstream_fr_cb)(struct ast_channel *chan, long ms, enum ast_waitstream_fr_cb_values val);
+
 /*! 
  * \brief Streams a file 
  * \param c channel to stream the file to
@@ -160,6 +174,28 @@
  * \retval -1 on error.
  */
 int ast_waitstream_fr(struct ast_channel *c, const char *breakon, const char *forward, const char *rewind, int ms);
+
+/*! 
+ * \brief Same as waitstream_fr but allows a callback to be alerted when a user
+ * fastforwards or rewinds the file.
+ * \param c channel to waitstream on
+ * \param breakon string of DTMF digits to break upon
+ * \param forward DTMF digit to fast forward upon
+ * \param rewind DTMF digit to rewind upon
+ * \param ms How many milliseconds to skip forward/back
+ * \param cb to call when rewind or fastfoward occurs. 
+ * Begins playback of a stream...
+ * Wait for a stream to stop or for any one of a given digit to arrive,  
+ * \retval 0 if the stream finishes.
+ * \retval the character if it was interrupted.
+ * \retval -1 on error.
+ */
+int ast_waitstream_fr_w_cb(struct ast_channel *c,
+	const char *breakon,
+	const char *forward,
+	const char *rewind,
+	int ms,
+	ast_waitstream_fr_cb cb);
 
 /*!
  * Same as waitstream, but with audio output to fd and monitored fd checking.  

Modified: branches/10-digiumphones/include/asterisk/frame.h
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/include/asterisk/frame.h?view=diff&rev=361206&r1=361205&r2=361206
==============================================================================
--- branches/10-digiumphones/include/asterisk/frame.h (original)
+++ branches/10-digiumphones/include/asterisk/frame.h Wed Apr  4 14:26:30 2012
@@ -263,6 +263,7 @@
 	AST_CONTROL_READ_ACTION = 27,	/*!< Tell ast_read to take a specific action */
 	AST_CONTROL_AOC = 28,			/*!< Advice of Charge with encoded generic AOC payload */
 	AST_CONTROL_END_OF_Q = 29,		/*!< Indicate that this position was the end of the channel queue for a softhangup. */
+	AST_CONTROL_CUSTOM = 200,		/*!< Indicate a custom channel driver specific payload.  Look in custom_control_frame.h for how to define and use this frame. */
 	AST_CONTROL_INCOMPLETE = 30,	/*!< Indication that the extension dialed is incomplete */
 	AST_CONTROL_MCID = 31,			/*!< Indicate that the caller is being malicious. */
 	AST_CONTROL_UPDATE_RTP_PEER = 32, /*!< Interrupt the bridge and have it update the peer */

Modified: branches/10-digiumphones/include/asterisk/manager.h
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/include/asterisk/manager.h?view=diff&rev=361206&r1=361205&r2=361206
==============================================================================
--- branches/10-digiumphones/include/asterisk/manager.h (original)
+++ branches/10-digiumphones/include/asterisk/manager.h Wed Apr  4 14:26:30 2012
@@ -86,6 +86,7 @@
 #define EVENT_FLAG_CC			(1 << 15) /* Call Completion events */
 #define EVENT_FLAG_AOC			(1 << 16) /* Advice Of Charge events */
 #define EVENT_FLAG_TEST			(1 << 17) /* Test event used to signal the Asterisk Test Suite */
+#define EVENT_FLAG_MESSAGE		(1 << 30) /* MESSAGE events. */
 /*@} */
 
 /*! \brief Export manager structures */

Modified: branches/10-digiumphones/include/asterisk/message.h
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/include/asterisk/message.h?view=diff&rev=361206&r1=361205&r2=361206
==============================================================================
--- branches/10-digiumphones/include/asterisk/message.h (original)
+++ branches/10-digiumphones/include/asterisk/message.h Wed Apr  4 14:26:30 2012
@@ -114,6 +114,11 @@
 struct ast_msg *ast_msg_destroy(struct ast_msg *msg);
 
 /*!
+ * \brief Bump a msg's ref count
+ */
+struct ast_msg *ast_msg_ref(struct ast_msg *msg);
+
+/*!
  * \brief Set the 'to' URI of a message
  *
  * \retval 0 success
@@ -169,6 +174,18 @@
  * \retval -1 failure
  */
 int ast_msg_set_var(struct ast_msg *msg, const char *name, const char *value);
+
+/*!
+ * \brief Set a variable on the message being sent to a message tech directly.
+ * \note Setting a variable that already exists overwrites the existing variable value
+ *
+ * \param name Name of variable to set
+ * \param value Value of variable to set
+ *
+ * \retval 0 success
+ * \retval -1 failure
+ */
+int ast_msg_set_var_outbound(struct ast_msg *msg, const char *name, const char *value);
 
 /*!
  * \brief Get the specified variable on the message
@@ -199,6 +216,17 @@
  * \retval non-zero failure, message not sent to dialplan
  */
 int ast_msg_queue(struct ast_msg *msg);
+
+/*!
+ * \brief Send a msg directly to an endpoint.
+ *
+ * Regardless of the return value of this function, this funciton will take
+ * care of ensuring that the message object is properly destroyed when needed.
+ *
+ * \retval 0 message successfully queued to be sent out
+ * \retval non-zero failure, message not get sent out.
+ */
+int ast_msg_send(struct ast_msg *msg, const char *to, const char *from);
 
 /*!
  * \brief Opaque iterator for msg variables

Modified: branches/10-digiumphones/include/asterisk/pbx.h
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/include/asterisk/pbx.h?view=diff&rev=361206&r1=361205&r2=361206
==============================================================================
--- branches/10-digiumphones/include/asterisk/pbx.h (original)
+++ branches/10-digiumphones/include/asterisk/pbx.h Wed Apr  4 14:26:30 2012
@@ -26,6 +26,7 @@
 #include "asterisk/channel.h"
 #include "asterisk/sched.h"
 #include "asterisk/devicestate.h"
+#include "asterisk/presencestate.h"
 #include "asterisk/chanvars.h"
 #include "asterisk/hashtab.h"
 #include "asterisk/stringfields.h"
@@ -75,8 +76,23 @@
 struct ast_ignorepat;
 struct ast_sw;
 
+enum ast_state_cb_update_reason {
+	/*! The extension state update is a result of a device state changing on the extension. */
+	AST_HINT_UPDATE_DEVICE = 1,
+	/*! The extension state update is a result of presence state changing on the extension. */
+	AST_HINT_UPDATE_PRESENCE = 2,
+};
+
+struct ast_state_cb_info {
+	enum ast_state_cb_update_reason reason;
+	enum ast_extension_states exten_state;
+	enum ast_presence_state presence_state;
+	const char *presence_subtype;
+	const char *presence_message;
+};
+
 /*! \brief Typedef for devicestate and hint callbacks */
-typedef int (*ast_state_cb_type)(const char *context, const char *exten, enum ast_extension_states state, void *data);
+typedef int (*ast_state_cb_type)(char *context, char *id, struct ast_state_cb_info *info, void *data);
 
 /*! \brief Typedef for devicestate and hint callback removal indication callback */
 typedef void (*ast_state_cb_destroy_type)(int id, void *data);
@@ -402,6 +418,22 @@
 int ast_extension_state(struct ast_channel *c, const char *context, const char *exten);
 
 /*!
+ * \brief Uses hint and presence state callback to get the presence state of an extension
+ *
+ * \param c this is not important
+ * \param context which context to look in
+ * \param exten which extension to get state
+ * \param[out] subtype Further information regarding the presence returned
+ * \param[out] message Custom message further describing current presence
+ *
+ * \note The subtype and message are dynamically allocated and must be freed by
+ * the caller of this function.
+ *
+ * \return returns the presence state value.
+ */
+int ast_hint_presence_state(struct ast_channel *c, const char *context, const char *exten, char **subtype, char **message);
+
+/*!
  * \brief Return string representation of the state of an extension
  *
  * \param extension_state is the numerical state delivered by ast_extension_state

Added: branches/10-digiumphones/include/asterisk/presencestate.h
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/include/asterisk/presencestate.h?view=auto&rev=361206
==============================================================================
--- branches/10-digiumphones/include/asterisk/presencestate.h (added)
+++ branches/10-digiumphones/include/asterisk/presencestate.h Wed Apr  4 14:26:30 2012
@@ -1,0 +1,96 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2011-2012, Digium, Inc.
+ *
+ * David Vossel <dvossel at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ * \brief Presence state management
+ */
+
+#ifndef _ASTERISK_PRESSTATE_H
+#define _ASTERISK_PRESSTATE_H
+
+enum ast_presence_state {
+	AST_PRESENCE_NOT_SET = 0,
+	AST_PRESENCE_UNAVAILABLE,
+	AST_PRESENCE_AVAILABLE,
+	AST_PRESENCE_AWAY,
+	AST_PRESENCE_XA,
+	AST_PRESENCE_CHAT,
+	AST_PRESENCE_DND,
+};
+
+/*! \brief Presence state provider call back */
+typedef enum ast_presence_state (*ast_presence_state_prov_cb_type)(const char *data, char **subtype, char **message);
+
+/*!
+ * \brief Convert presence state to text string for output
+ *
+ * \param state Current presence state
+ */
+const char *ast_presence_state2str(enum ast_presence_state state);
+
+/*!
+ * \brief Convert presence state from text to integer value
+ *
+ * \param val The text representing the presence state.  Valid values are anything
+ *        that comes after AST_PRESENCE_ in one of the defined values.
+ *
+ * \return The AST_PRESENCE_ integer value
+ */
+enum ast_presence_state ast_presence_state_val(const char *val);
+
+/*!
+ * \brief Asks a presence state provider for the current presence state.
+ *
+ * \param presence_provider, The presence provider to retrieve the state from.
+ * \param subtype, The output paramenter to store the subtype string in. Must be freed if returned
+ * \param message, The output paramenter to store the message string in. Must be freed if returned
+ *
+ * \retval presence state value on success,
+ * \retval -1 on failure.
+ */
+enum ast_presence_state ast_presence_state(const char *presence_provider, char **subtype, char **message);
+
+/*!
+ * \brief Notify the world that a presence provider state changed.
+ */
+int ast_presence_state_changed(const char *presence_provider);
+
+/*!
+ * \brief Add presence state provider
+ *
+ * \param label to use in hint, like label:object
+ * \param callback Callback
+ *
+ * \retval 0 success
+ * \retval -1 failure
+ */
+int ast_presence_state_prov_add(const char *label, ast_presence_state_prov_cb_type callback);
+
+/*!
+ * \brief Remove presence state provider
+ *
+ * \param label to use in hint, like label:object
+ *
+ * \retval -1 on failure
+ * \retval 0 on success
+ */
+int ast_presence_state_prov_del(const char *label);
+
+int ast_presence_state_engine_init(void);
+#endif
+

Propchange: branches/10-digiumphones/include/asterisk/presencestate.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: branches/10-digiumphones/include/asterisk/presencestate.h
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: branches/10-digiumphones/include/asterisk/presencestate.h
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the asterisk-commits mailing list