/* $Id$ * $URL$ * * plugin for asterisk * * Copyright (C) 2003 Michael Reinelt * Copyright (C) 2004, 2005, 2006, 2007 The LCD4Linux Team * * This file is part of LCD4Linux. * * LCD4Linux is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * LCD4Linux is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* * exported functions: * * int plugin_init_sample (void) * adds various functions * */ /* define the include files you need */ #include "config.h" #include #include #include #include #include #include "debug.h" #include "plugin.h" #ifdef WITH_DMALLOC #include #endif struct Line { char Channel[25]; /* Zap Channel */ char EndPoint[25]; unsigned char active; }; static char *rtrim(char *string, char junk) { char *original = string + strlen(string); while (*--original == junk); *(original + 1) = '\0'; return string; } static void zapstatus(RESULT * result, RESULT * arg1) { FILE *infile; int skipline = 0; // Skip the first in the file, it throws off the detection char line[100], *SipLoc, Channel[25], Location[25], State[9], Application[25], EndPoint[8], Ret[50]; int i = 0, ChannelInt = 0, ZapLine = 0; struct Line Lines[32]; // Setup 32 lines, ZAP 1-32 (memory is cheap) ZapLine = R2N(arg1); // Set all the lines status's default to inactive for (i = 0; i < 32; i++) { strcpy(Lines[i].Channel, "ZAP/"); Lines[i].Channel[4] = (char) (i + 49); Lines[i].Channel[5] = '\0'; Lines[i].active = 0; } system("touch /tmp/asterisk.state"); // Touch the file in it's naughty place system("chmod 744 /tmp/asterisk.state"); system("asterisk -rx \"show channels\" > /tmp/asterisk.state"); // Crappy CLI way to do it infile = fopen("/tmp/asterisk.state", "r"); for (i = 0; i < 100; i++) { line[i] = ' '; } line[99] = '\0'; while (fgets(line, 100, infile) != NULL) { if (strstr(line, "Zap") != NULL) { for (i = 0; i < (int) strlen(line); i++) { if (i < 20) { Channel[i] = line[i]; } else if (i < 42) { Location[i - 21] = line[i]; } else if (i < 50) { State[i - 42] = line[i]; } else { Application[i - 50] = line[i]; } } strncpy(Channel, Channel, 7); Channel[7] = '\0'; strcpy(Location, rtrim(Location, ' ')); State[4] = '\0'; memcpy(EndPoint, Application + 13,
# Nantes - France
# T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
T 498000000 8MHz 2/3 NONE QAM64 8k 1/32 NONE
T 506000000 8MHz 2/3 NONE QAM64 8k 1/32 NONE
T 522000000 8MHz 2/3 NONE QAM64 8k 1/32 NONE
T 530000000 8MHz 2/3 NONE QAM64 8k 1/32 NONE
T 658000000 8MHz 2/3 NONE QAM64 8k 1/32 NONE
T 802000000 8MHz 2/3 NONE QAM64 8k 1/32 NONE