aboutsummaryrefslogtreecommitdiffstats
path: root/channel.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-01-15 21:51:38 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-01-15 21:51:38 +0000
commit8701d138d18de92b3e6b733b7c8c35b70acdf584 (patch)
treedd6a81383376b62800c69ebf1e2db5bd1dae311b /channel.c
parent20ef4fa9e2013bde8d7823c0811b34021be0324e (diff)
Make groups be 64-bits (bug #3351, with mods)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4803 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channel.c')
-rwxr-xr-xchannel.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/channel.c b/channel.c
index 0d1c5da06..1fb729553 100755
--- a/channel.c
+++ b/channel.c
@@ -3033,13 +3033,13 @@ int ast_tonepair(struct ast_channel *chan, int freq1, int freq2, int duration, i
return 0;
}
-unsigned int ast_get_group(char *s)
+ast_group_t ast_get_group(char *s)
{
char *copy;
char *piece;
char *c=NULL;
int start=0, finish=0,x;
- unsigned int group = 0;
+ ast_group_t group = 0;
copy = ast_strdupa(s);
if (!copy) {
ast_log(LOG_ERROR, "Out of memory\n");
@@ -3058,8 +3058,8 @@ unsigned int ast_get_group(char *s)
continue;
}
for (x=start;x<=finish;x++) {
- if ((x > 31) || (x < 0)) {
- ast_log(LOG_WARNING, "Ignoring invalid group %d (maximum group is 31)\n", x);
+ if ((x > 63) || (x < 0)) {
+ ast_log(LOG_WARNING, "Ignoring invalid group %d (maximum group is 63)\n", x);
} else
group |= (1 << x);
}
@@ -3118,3 +3118,29 @@ void ast_channels_init(void)
{
ast_cli_register(&cli_show_channeltypes);
}
+
+/*--- ast_print_group: Print call group and pickup group ---*/
+char *ast_print_group(char *buf, int buflen, ast_group_t group)
+{
+ unsigned int i;
+ int first=1;
+ char num[3];
+
+ buf[0] = '\0';
+
+ if (!group) /* Return empty string if no group */
+ return(buf);
+
+ for (i=0; i<=63; i++) { /* Max group is 63 */
+ if (group & (1 << i)) {
+ if (!first) {
+ strncat(buf, ", ", buflen);
+ } else {
+ first=0;
+ }
+ snprintf(num, sizeof(num), "%u", i);
+ strncat(buf, num, buflen);
+ }
+ }
+ return(buf);
+}