[asterisk-commits] mvanbaak: branch group/multiparking r105673 - /team/group/multiparking/main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Mar 4 12:03:34 CST 2008
Author: mvanbaak
Date: Tue Mar 4 12:03:34 2008
New Revision: 105673
URL: http://svn.digium.com/view/asterisk?view=rev&rev=105673
Log:
Look ma, it compiles !!!
Modified:
team/group/multiparking/main/features.c
Modified: team/group/multiparking/main/features.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/main/features.c?view=diff&rev=105673&r1=105672&r2=105673
==============================================================================
--- team/group/multiparking/main/features.c (original)
+++ team/group/multiparking/main/features.c Tue Mar 4 12:03:34 2008
@@ -2325,8 +2325,8 @@
set_c_e_p(chan, pu->parkinglot->parking_con_dial, peername_flat, 1);
} else {
ast_log(LOG_WARNING, "now going to parkedcallstimeout,s,1 | ps is %d\n",pu->parkingnum);
- snprintf(parkingslot, sizeof(parkingslot), "%d", pu->parkingnum);
- pbx_builtin_setvar_helper(chan, "PARKINGSLOT", parkingslot);
+ //snprintf(parkingslot, sizeof(parkingslot), "%d", pu->parkingnum);
+ //pbx_builtin_setvar_helper(chan, "PARKINGSLOT", parkingslot);
set_c_e_p(chan, "parkedcallstimeout", peername_flat, 1);
}
} else {
@@ -2737,11 +2737,11 @@
if (!strcasecmp(confvar->name, "context")) {
ast_copy_string(parkinglot->parking_con, confvar->value, sizeof(parkinglot->parking_con));
} else if (!strcasecmp(confvar->name, "parkingtime")) {
- if ((sscanf(confvar->value, "%d", &parkingtime) != 1) || (parkingtime < 1)) {
+ if ((sscanf(confvar->value, "%d", &parkinglot->parkingtime) != 1) || (parkinglot->parkingtime < 1)) {
ast_log(LOG_WARNING, "%s is not a valid parkingtime\n", confvar->value);
parkinglot->parkingtime = DEFAULT_PARK_TIME;
} else
- parkinglot->parkingtime = parkingtime * 1000;
+ parkinglot->parkingtime = parkinglot->parkingtime * 1000;
} else if (!strcasecmp(confvar->name, "parkpos")) {
if (sscanf(confvar->value, "%d-%d", &start, &end) != 2) {
ast_log(LOG_WARNING, "Format for parking positions is a-b, where a and b are numbers at line %d of parking.conf\n", confvar->lineno);
@@ -2852,7 +2852,6 @@
default_parkinglot->parking_offset = 0;
default_parkinglot->parkfindnext = 0;
default_parkinglot->parkingtime = 0;
- default_parkinglot->occupiedlots = NULL;
}
}
if (default_parkinglot) {
@@ -2895,18 +2894,18 @@
} else if (!strcasecmp(var->name, "context")) {
ast_copy_string(default_parkinglot->parking_con, var->value, sizeof(default_parkinglot->parking_con));
} else if (!strcasecmp(var->name, "parkingtime")) {
- if ((sscanf(var->value, "%d", &parkingtime) != 1) || (parkingtime < 1)) {
+ if ((sscanf(var->value, "%d", &default_parkinglot->parkingtime) != 1) || (default_parkinglot->parkingtime < 1)) {
ast_log(LOG_WARNING, "%s is not a valid parkingtime\n", var->value);
- parkingtime = DEFAULT_PARK_TIME;
+ default_parkinglot->parkingtime = DEFAULT_PARK_TIME;
} else
- parkingtime = parkingtime * 1000;
+ default_parkinglot->parkingtime = default_parkinglot->parkingtime * 1000;
} else if (!strcasecmp(var->name, "parkpos")) {
if (sscanf(var->value, "%d-%d", &start, &end) != 2) {
ast_log(LOG_WARNING, "Format for parking positions is a-b, where a and b are numbers at line %d of features.conf\n", var->lineno);
} else if (default_parkinglot) {
default_parkinglot->parking_start = start;
default_parkinglot->parking_stop = end;
- } else
+ } else {
ast_log(LOG_WARNING, "No default parking lot!\n");
}
} else if (!strcasecmp(var->name, "findslot")) {
@@ -3186,7 +3185,7 @@
}
ast_cli(a->fd, "\nCall parking (default parking lot)\n");
ast_cli(a->fd, "------------\n");
- ast_cli(a->fd,"%-20s: %s\n", "Parking extension", default_parkinglot->parking_ext);
+ //ast_cli(a->fd,"%-20s: %s\n", "Parking extension", default_parkinglot->parking_ext);
ast_cli(a->fd,"%-20s: %s\n", "Parking context", default_parkinglot->parking_con);
ast_cli(a->fd,"%-20s: %d-%d\n", "Parked call extensions", default_parkinglot->parking_start, default_parkinglot->parking_stop);
ast_cli(a->fd,"\n");
@@ -3196,6 +3195,7 @@
int ast_features_reload(void)
{
+ int res;
/* Release parking lot list */
ASTOBJ_CONTAINER_MARKALL(&parkinglots);
@@ -3400,29 +3400,23 @@
ASTOBJ_CONTAINER_TRAVERSE(&parkinglots, 1, do {
int lotparked = 0;
ASTOBJ_RDLOCK(iterator);
- cur = iterator->occupiedlots;
- if (cur) {
- ast_cli(fd, "*** Parking lot: %s\n", iterator->name);
-
- AST_LIST_LOCK(&iterator->parkings);
- AST_LIST_TRAVERSE(&iterator->parkings, cur, list) {
- ast_cli(a->fd, "%-10.10s %25s (%-15s %-12s %-4d) %6lds\n"
- ,cur->parkingexten, cur->chan->name, cur->context, cur->exten
- ,cur->priority, cur->start.tv_sec + (cur->parkingtime/1000) - time(NULL));
- numparked++;
- numparked += lotparked;
- }
- AST_LIST_UNLOCK(&iterator->parkings);
- }
+ ast_cli(a->fd, "*** Parking lot: %s\n", iterator->name);
+
+ AST_LIST_LOCK(&iterator->parkings);
+ AST_LIST_TRAVERSE(&iterator->parkings, cur, list) {
+ ast_cli(a->fd, "%-10.10s %25s (%-15s %-12s %-4d) %6lds\n"
+ ,cur->parkingexten, cur->chan->name, cur->context, cur->exten
+ ,cur->priority, cur->start.tv_sec + (cur->parkingtime/1000) - time(NULL));
+ numparked++;
+ numparked += lotparked;
+ }
+ AST_LIST_UNLOCK(&iterator->parkings);
if (lotparked)
- ast_cli(fd, " %d parked call%s in parking lot %s\n", lotparked, ESS(lotparked), iterator->name);
+ ast_cli(a->fd, " %d parked call%s in parking lot %s\n", lotparked, ESS(lotparked), iterator->name);
ASTOBJ_UNLOCK(iterator);
} while (0) );
- ast_cli(fd, "---\n%d parked call%s in total.\n", numparked, ESS(numparked));
- ast_mutex_unlock(&parking_lock);
- }
-
+ ast_cli(a->fd, "---\n%d parked call%s in total.\n", numparked, ESS(numparked));
return CLI_SUCCESS;
}
@@ -3462,31 +3456,36 @@
astman_send_ack(s, m, "Parked calls will follow");
- AST_LIST_LOCK(&parkings);
-
- AST_LIST_TRAVERSE(&parkings, cur, list) {
- astman_append(s, "Event: ParkedCall\r\n"
- "Exten: %d\r\n"
- "Channel: %s\r\n"
- "From: %s\r\n"
- "Timeout: %ld\r\n"
- "CallerIDNum: %s\r\n"
- "CallerIDName: %s\r\n"
- "%s"
- "\r\n",
- cur->parkingnum, cur->chan->name, cur->peername,
- (long) cur->start.tv_sec + (long) (cur->parkingtime / 1000) - (long) time(NULL),
- S_OR(cur->chan->cid.cid_num, ""), /* XXX in other places it is <unknown> */
- S_OR(cur->chan->cid.cid_name, ""),
- idText);
- }
+ ASTOBJ_CONTAINER_TRAVERSE(&parkinglots, 1, do {
+ ASTOBJ_RDLOCK(iterator);
+
+ AST_LIST_LOCK(&iterator->parkings);
+ AST_LIST_TRAVERSE(&iterator->parkings, cur, list) {
+ astman_append(s, "Event: ParkedCall\r\n"
+ "Exten: %d\r\n"
+ "Channel: %s\r\n"
+ "From: %s\r\n"
+ "Timeout: %ld\r\n"
+ "CallerIDNum: %s\r\n"
+ "CallerIDName: %s\r\n"
+ "%s"
+ "\r\n",
+ cur->parkingnum, cur->chan->name, cur->peername,
+ (long) cur->start.tv_sec + (long) (cur->parkingtime / 1000) - (long) time(NULL),
+ S_OR(cur->chan->cid.cid_num, ""), /* XXX in other places it is <unknown> */
+ S_OR(cur->chan->cid.cid_name, ""),
+ idText);
+ }
+ AST_LIST_UNLOCK(&iterator->parkings);
+
+ ASTOBJ_UNLOCK(iterator);
+ } while (0) );
astman_append(s,
"Event: ParkedCallsComplete\r\n"
"%s"
"\r\n",idText);
- AST_LIST_UNLOCK(&parkings);
return RESULT_SUCCESS;
}
More information about the asterisk-commits
mailing list