Merge changes dealing with support for Digium phones.

Presence support has been added. This is accomplished by
allowing for presence hints in addition to device state
hints. A dialplan function called PRESENCE_STATE has been
added to allow for setting and reading presence. Presence
can be transmitted to Digium phones using custom XML
elements in a PIDF presence document.

Voicemail has new APIs that allow for moving, removing,
forwarding, and playing messages. Messages have had a new
unique message ID added to them so that the APIs will work
reliably. The state of a voicemail mailbox can be obtained
using an API that allows one to get a snapshot of the mailbox.
A voicemail Dialplan App called VoiceMailPlayMsg has been
added to be able to play back a specific message.

Configuration hooks have been added. Configuration hooks
allow for a piece of code to be executed when a specific
configuration file is loaded by a specific module. This is
useful for modules that are dependent on the configuration
of other modules.

chan_sip now has a public method that allows for a custom
SIP INFO request to be sent mid-dialog. Digium phones use
this in order to display progress bars when files are played.

Messaging support has been expanded a bit. The main
visible difference is the addition of an AMI action
MessageSend.

Finally, a ParkingLots manager action has been added in order
to get a list of parking lots.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368435 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Michelson
2012-06-04 20:26:12 +00:00
parent c1bbe79748
commit 14a985560e
36 changed files with 6672 additions and 195 deletions

View File

@@ -82,6 +82,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/security_events.h"
#include "asterisk/aoc.h"
#include "asterisk/stringfields.h"
#include "asterisk/presencestate.h"
/*** DOCUMENTATION
<manager name="Ping" language="en_US">
@@ -510,6 +511,22 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
the hint for the extension and the status.</para>
</description>
</manager>
<manager name="PresenceState" language="en_US">
<synopsis>
Check Presence State
</synopsis>
<syntax>
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
<parameter name="Provider" required="true">
<para>Presence Provider to check the state of</para>
</parameter>
</syntax>
<description>
<para>Report the presence state for the given presence provider.</para>
<para>Will return a <literal>Presence State</literal> message. The response will include the
presence state and, if set, a presence subtype and custom message.</para>
</description>
</manager>
<manager name="AbsoluteTimeout" language="en_US">
<synopsis>
Set absolute timeout.
@@ -1218,6 +1235,7 @@ static const struct permalias {
{ EVENT_FLAG_CC, "cc" },
{ EVENT_FLAG_AOC, "aoc" },
{ EVENT_FLAG_TEST, "test" },
{ EVENT_FLAG_MESSAGE, "message" },
{ INT_MAX, "all" },
{ 0, "none" },
};
@@ -3211,6 +3229,7 @@ static int action_hangup(struct mansession *s, const struct message *m)
if (name_or_regex[0] != '/') {
if (!(c = ast_channel_get_by_name(name_or_regex))) {
ast_log(LOG_NOTICE, "!!!!!!!!!! Can't find channel to hang up!\n");
astman_send_error(s, m, "No such channel");
return 0;
}
@@ -4384,6 +4403,43 @@ static int action_extensionstate(struct mansession *s, const struct message *m)
return 0;
}
static int action_presencestate(struct mansession *s, const struct message *m)
{
const char *provider = astman_get_header(m, "Provider");
enum ast_presence_state state;
char *subtype;
char *message;
char subtype_header[256] = "";
char message_header[256] = "";
if (ast_strlen_zero(provider)) {
astman_send_error(s, m, "No provider specified");
return 0;
}
state = ast_presence_state(provider, &subtype, &message);
if (!ast_strlen_zero(subtype)) {
snprintf(subtype_header, sizeof(subtype_header),
"Subtype: %s\r\n", subtype);
}
if (!ast_strlen_zero(message)) {
snprintf(message_header, sizeof(message_header),
"Message: %s\r\n", message);
}
astman_append(s, "Message: Presence State\r\n"
"State: %s\r\n"
"%s"
"%s"
"\r\n",
ast_presence_state2str(state),
subtype_header,
message_header);
return 0;
}
static int action_timeout(struct mansession *s, const struct message *m)
{
struct ast_channel *c;
@@ -5485,10 +5541,17 @@ int ast_manager_unregister(const char *action)
return 0;
}
static int manager_state_cb(const char *context, const char *exten, enum ast_extension_states state, void *data)
static int manager_state_cb(char *context, char *exten, struct ast_state_cb_info *info, void *data)
{
/* Notify managers of change */
char hint[512];
int state = info->exten_state;
/* only interested in device state for this right now */
if (info->reason != AST_HINT_UPDATE_DEVICE) {
return 0;
}
ast_get_hint(hint, sizeof(hint), NULL, 0, NULL, context, exten);
manager_event(EVENT_FLAG_CALL, "ExtensionStatus", "Exten: %s\r\nContext: %s\r\nHint: %s\r\nStatus: %d\r\n", exten, context, hint, state);
@@ -6850,6 +6913,7 @@ static int __init_manager(int reload)
ast_manager_register_xml_core("Originate", EVENT_FLAG_ORIGINATE, action_originate);
ast_manager_register_xml_core("Command", EVENT_FLAG_COMMAND, action_command);
ast_manager_register_xml_core("ExtensionState", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, action_extensionstate);
ast_manager_register_xml_core("PresenceState", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, action_presencestate);
ast_manager_register_xml_core("AbsoluteTimeout", EVENT_FLAG_SYSTEM | EVENT_FLAG_CALL, action_timeout);
ast_manager_register_xml_core("MailboxStatus", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, action_mailboxstatus);
ast_manager_register_xml_core("MailboxCount", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, action_mailboxcount);