summaryrefslogtreecommitdiff
path: root/main/features.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2012-06-04 20:26:12 +0000
committerMark Michelson <mmichelson@digium.com>2012-06-04 20:26:12 +0000
commit14a985560ed5830aa3e1b5880890a59a5d0f0c2f (patch)
tree4d6f57c4358566c5508d79e97560640ce59df5c8 /main/features.c
parentc1bbe79748bb1615ab116fe287b8d5d28a83b330 (diff)
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
Diffstat (limited to 'main/features.c')
-rw-r--r--main/features.c54
1 files changed, 52 insertions, 2 deletions
diff --git a/main/features.c b/main/features.c
index 8b69d1385..04bc5326a 100644
--- a/main/features.c
+++ b/main/features.c
@@ -409,6 +409,17 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
<para>Bridge together two channels already in the PBX.</para>
</description>
</manager>
+ <manager name="Parkinglots" language="en_US">
+ <synopsis>
+ Get a list of parking lots
+ </synopsis>
+ <syntax>
+ <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+ </syntax>
+ <description>
+ <para>List all parking lots as a series of AMI events</para>
+ </description>
+ </manager>
<function name="FEATURE" language="en_US">
<synopsis>
Get or set a feature option on a channel.
@@ -7347,7 +7358,42 @@ static struct ast_cli_entry cli_features[] = {
AST_CLI_DEFINE(handle_parkedcalls, "List currently parked calls"),
};
-/*!
+static int manager_parkinglot_list(struct mansession *s, const struct message *m)
+{
+ const char *id = astman_get_header(m, "ActionID");
+ char idText[256] = "";
+ struct ao2_iterator iter;
+ struct ast_parkinglot *curlot;
+
+ if (!ast_strlen_zero(id))
+ snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id);
+
+ astman_send_ack(s, m, "Parking lots will follow");
+
+ iter = ao2_iterator_init(parkinglots, 0);
+ while ((curlot = ao2_iterator_next(&iter))) {
+ astman_append(s, "Event: Parkinglot\r\n"
+ "Name: %s\r\n"
+ "StartExten: %d\r\n"
+ "StopExten: %d\r\n"
+ "Timeout: %d\r\n"
+ "\r\n",
+ curlot->name,
+ curlot->cfg.parking_start,
+ curlot->cfg.parking_stop,
+ curlot->cfg.parkingtime ? curlot->cfg.parkingtime / 1000 : curlot->cfg.parkingtime);
+ ao2_ref(curlot, -1);
+ }
+
+ astman_append(s,
+ "Event: ParkinglotsComplete\r\n"
+ "%s"
+ "\r\n",idText);
+
+ return RESULT_SUCCESS;
+}
+
+/*!
* \brief Dump parking lot status
* \param s
* \param m
@@ -7363,6 +7409,7 @@ static int manager_parking_status(struct mansession *s, const struct message *m)
struct ao2_iterator iter;
struct ast_parkinglot *curlot;
int numparked = 0;
+ long now = time(NULL);
if (!ast_strlen_zero(id))
snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id);
@@ -7379,6 +7426,7 @@ static int manager_parking_status(struct mansession *s, const struct message *m)
"Channel: %s\r\n"
"From: %s\r\n"
"Timeout: %ld\r\n"
+ "Duration: %ld\r\n"
"CallerIDNum: %s\r\n"
"CallerIDName: %s\r\n"
"ConnectedLineNum: %s\r\n"
@@ -7387,7 +7435,8 @@ static int manager_parking_status(struct mansession *s, const struct message *m)
"\r\n",
curlot->name,
cur->parkingnum, ast_channel_name(cur->chan), cur->peername,
- (long) cur->start.tv_sec + (long) (cur->parkingtime / 1000) - (long) time(NULL),
+ (long) cur->start.tv_sec + (long) (cur->parkingtime / 1000) - now,
+ now - (long) cur->start.tv_sec,
S_COR(ast_channel_caller(cur->chan)->id.number.valid, ast_channel_caller(cur->chan)->id.number.str, ""), /* XXX in other places it is <unknown> */
S_COR(ast_channel_caller(cur->chan)->id.name.valid, ast_channel_caller(cur->chan)->id.name.str, ""),
S_COR(ast_channel_connected(cur->chan)->id.number.valid, ast_channel_connected(cur->chan)->id.number.str, ""), /* XXX in other places it is <unknown> */
@@ -8669,6 +8718,7 @@ int ast_features_init(void)
res = ast_register_application2(parkcall, park_call_exec, NULL, NULL, NULL);
if (!res) {
ast_manager_register_xml_core("ParkedCalls", 0, manager_parking_status);
+ ast_manager_register_xml_core("Parkinglots", 0, manager_parkinglot_list);
ast_manager_register_xml_core("Park", EVENT_FLAG_CALL, manager_park);
ast_manager_register_xml_core("Bridge", EVENT_FLAG_CALL, action_bridge);
}