mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-02 11:58:40 +00:00
Add support for Digium Phones.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@357459 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -49,6 +49,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#include "asterisk/app.h"
|
||||
#include "asterisk/say.h"
|
||||
#include "asterisk/features.h"
|
||||
#include "asterisk/custom_control_frame.h"
|
||||
#include "asterisk/musiconhold.h"
|
||||
#include "asterisk/config.h"
|
||||
#include "asterisk/cli.h"
|
||||
@@ -378,6 +379,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>
|
||||
***/
|
||||
|
||||
#define DEFAULT_PARK_TIME 45000 /*!< ms */
|
||||
@@ -6986,6 +6998,41 @@ 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
|
||||
@@ -7002,6 +7049,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);
|
||||
@@ -7018,6 +7066,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"
|
||||
@@ -7026,7 +7075,8 @@ static int manager_parking_status(struct mansession *s, const struct message *m)
|
||||
"\r\n",
|
||||
curlot->name,
|
||||
cur->parkingnum, cur->chan->name, 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(cur->chan->caller.id.number.valid, cur->chan->caller.id.number.str, ""), /* XXX in other places it is <unknown> */
|
||||
S_COR(cur->chan->caller.id.name.valid, cur->chan->caller.id.name.str, ""),
|
||||
S_COR(cur->chan->connected.id.number.valid, cur->chan->connected.id.number.str, ""), /* XXX in other places it is <unknown> */
|
||||
@@ -8116,6 +8166,7 @@ int ast_features_init(void)
|
||||
res = ast_register_application2(parkcall, park_call_exec, NULL, NULL, NULL);
|
||||
if (!res) {
|
||||
ast_manager_register_xml("ParkedCalls", 0, manager_parking_status);
|
||||
ast_manager_register_xml("Parkinglots", 0, manager_parkinglot_list);
|
||||
ast_manager_register_xml("Park", EVENT_FLAG_CALL, manager_park);
|
||||
ast_manager_register_xml("Bridge", EVENT_FLAG_CALL, action_bridge);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user