Skip to content

Commit 7e6bcb8

Browse files
committed
res_telos_1a2: Add support for Telos 1A2 interface module.
Add an Asterisk module to interface with a Telos 1A2 interface module over a serial connection. This hardware provides line status information for a 1A2 key system; using this information, Asterisk can then provide line information and furnish music on hold to 1A2 systems without any music on hold KTU cards, using the standard Asterisk music on hold facilities.
1 parent 05f783c commit 7e6bcb8

File tree

5 files changed

+936
-2
lines changed

5 files changed

+936
-2
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ PhreakScript installs:
2323
- Analog enhancements
2424
- Real time dial pulsing support
2525
- "Hearpulsing" patches
26-
- SMDR support for "WHOZZ Calling?" call accounting devices
26+
- SMDR support for "WHOZZ Calling?" call accounting devices
27+
- Supervision test and hook state applications
28+
- 1A2 key system music on hold support
2729
- SIP enhancements
2830
- Automatic dialplan context to digit map generation (`res_digitmap`)
2931
- Broadworks compatible device feature key synchronization (PJSIP) (with `--experimental` flag)
@@ -93,6 +95,7 @@ PhreakScript installs:
9395
- ``TECH_EXISTS``
9496
- ``DTMF_FLASH``
9597
- ``DTMF_TRACE``
98+
- ``1A2_LINE_STATE``
9699
- ``NUM2DEVICE``
97100
- ``TEXT_QUERY``
98101
- ``COIN_DETECT``
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
; res_telos_1a2.conf
2+
; Configuration file for Asterisk resource module for Telos 1A2 Module Interface
3+
4+
;[general]
5+
;device = /dev/ttyS0 ; Serial device to use (at 1200 baud). Default is /dev/ttyS0
6+
7+
;[line1]
8+
;line = 1 ; 1A2 line number
9+
;device = DAHDI/1 ; FXO device that can be used to access this line
10+
;moh_class = default ; Music on hold class, to play music on hold when this 1A2 line is on hold (via the FXO device). There is no default.
11+
;hold_context = 1a2hold ; Dialplan context to execute for 1A2 lines on hold. Extension s will be executed at priority 1. If moh_class is also specified, hold_context takes precedence.
12+
13+
;[line2]
14+
;line = 2
15+
;device = DAHDI/2
16+
;moh_class = default

phreaknet.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2478,6 +2478,8 @@ phreak_patches() {
24782478
phreak_tree_module "configs/samples/verify.conf.sample" "1" # will fail for obsolete versions of Asterisk b/c of different directory structure, okay.
24792479
phreak_tree_module "configs/samples/irc.conf.sample" "1" # will fail for obsolete versions of Asterisk b/c of different directory structure, okay.
24802480
phreak_tree_module "configs/samples/res_alarmsystem.conf.sample" "1"
2481+
phreak_tree_module "configs/samples/res_smdr_whozz.conf.sample" "1"
2482+
phreak_tree_module "configs/samples/res_telos_1a2.conf.sample" "1"
24812483

24822484
phreak_tree_module "funcs/func_dbchan.c"
24832485
phreak_tree_module "funcs/func_dtmf_flash.c"

res/res_smdr_whozz.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ struct whozz_line {
147147
static AST_RWLIST_HEAD_STATIC(lines, whozz_line);
148148

149149
static pthread_t serial_thread = AST_PTHREADT_NULL;
150+
static int thread_running = 0;
150151

151152
static char serial_device[256] = "/dev/ttyS0"; /* Default serial port on a Linux system (especially if there's only one) */
152153
static int serial_fd = -1;
@@ -342,7 +343,6 @@ static int set_settings(struct pollfd *pfd, int reset)
342343
return 0;
343344
}
344345

345-
/*! \brief A channel technology used for the unit tests */
346346
static struct ast_channel_tech whozz_smdr_cdr_chan_tech = {
347347
.type = "WHOZZ",
348348
.description = "WHOZZ SMDR CDR",
@@ -922,9 +922,11 @@ static void *__serial_monitor(void *varg)
922922
while (!ast_fully_booted && !unloading) {
923923
usleep(50000);
924924
}
925+
thread_running = 1;
925926
if (!unloading) {
926927
serial_monitor(varg);
927928
}
929+
thread_running = 0;
928930
if (!unloading) {
929931
ast_log(LOG_ERROR, "Serial monitor thread exited prematurely, refresh module to reinitialize\n");
930932
}
@@ -978,6 +980,7 @@ static char *handle_show_lines(struct ast_cli_entry *e, int cmd, struct ast_cli_
978980
}
979981

980982
ast_cli(a->fd, "Serial device is %s (fd %d)\n", serial_device, serial_fd);
983+
ast_cli(a->fd, "Serial status is %s\n", thread_running ? "RUNNING" : "ABORTED");
981984
ast_cli(a->fd, "%4s %-8s %s\n", "Line", "State", "Associated Device");
982985
AST_RWLIST_RDLOCK(&lines);
983986
AST_RWLIST_TRAVERSE(&lines, w, entry) {

0 commit comments

Comments
 (0)