Skip to content

Commit

Permalink
app_rpt: add "archiveformat" to specify the audio recording format
Browse files Browse the repository at this point in the history
This change means that one will be now be able to specify an audio
recording format other than "wav49".

Resolves #485
  • Loading branch information
jxmx authored and Allan-N committed Feb 19, 2025
1 parent 33c1f20 commit 99ea26b
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 10 deletions.
30 changes: 21 additions & 9 deletions apps/app_rpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -2971,7 +2971,12 @@ static inline void log_keyed(struct rpt *myrpt)
time(&myt);
strftime(mydate, sizeof(mydate) - 1, "%Y%m%d%H%M%S", localtime(&myt));
sprintf(myfname, "%s/%s/%s", myrpt->p.archivedir, myrpt->name, mydate);
myrpt->monstream = ast_writefile(myfname, "wav49", "app_rpt Air Archive", O_CREAT | O_APPEND, 0, 0644);
myrpt->monstream = ast_writefile(myfname,
myrpt->p.archiveformat ? myrpt->p.archiveformat : "wav49",
"app_rpt Air Archive",
O_CREAT | O_APPEND,
0,
0644);
if (myrpt->p.monminblocks) {
blocksleft = diskavail(myrpt);
if (blocksleft >= myrpt->p.monminblocks) {
Expand Down Expand Up @@ -3801,9 +3806,12 @@ static inline int rxchannel_read(struct rpt *myrpt, const int lasttx)
if (myrpt->p.monminblocks) {
blocksleft = diskavail(myrpt);
if (blocksleft >= myrpt->p.monminblocks) {
myrpt->monstream =
ast_writefile(myfname, "wav49", "app_rpt Air Archive", O_CREAT | O_APPEND, 0,
0644);
myrpt->monstream = ast_writefile(myfname,
myrpt->p.archiveformat ? myrpt->p.archiveformat : "wav49",
"app_rpt Air Archive",
O_CREAT | O_APPEND,
0,
0644);
}
}
}
Expand Down Expand Up @@ -7085,12 +7093,16 @@ static int rpt_exec(struct ast_channel *chan, const char *data)
long blocksleft;

mkdir(myrpt->p.archivedir, 0700);
sprintf(mycmd, "%s/%s", myrpt->p.archivedir, myrpt->name);
snprintf(mycmd, sizeof(mycmd), "%s/%s", myrpt->p.archivedir, myrpt->name);
mkdir(mycmd, 0775);
time(&myt);
strftime(mydate, sizeof(mydate) - 1, "%Y%m%d%H%M%S", localtime(&myt));
sprintf(mycmd, "mixmonitor start %s %s/%s/%s.wav49 a", ast_channel_name(chan), myrpt->p.archivedir, myrpt->name,
mydate);
strftime(mydate, sizeof(mydate), "%Y%m%d%H%M%S", localtime(&myt));
snprintf(mycmd, sizeof(mycmd), "mixmonitor start %s %s/%s/%s.%s a",
ast_channel_name(chan),
myrpt->p.archivedir,
myrpt->name,
myrpt->p.archiveformat ? myrpt->p.archiveformat : "wav49",
mydate);
if (myrpt->p.monminblocks) {
blocksleft = diskavail(myrpt);
if (myrpt->p.remotetimeout) {
Expand All @@ -7100,7 +7112,7 @@ static int rpt_exec(struct ast_channel *chan, const char *data)
ast_cli_command(nullfd, mycmd);
} else
ast_cli_command(nullfd, mycmd);
sprintf(mycmd, "CONNECT,%s", b1);
snprintf(mycmd, sizeof(mycmd), "CONNECT,%s", b1);
donodelog(myrpt, mycmd);
rpt_update_links(myrpt);
doconpgm(myrpt, b1);
Expand Down
1 change: 1 addition & 0 deletions apps/app_rpt/app_rpt.h
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,7 @@ struct rpt {
struct rpt_xlat inxlat;
struct rpt_xlat outxlat;
const char *archivedir;
const char *archiveformat;
int authlevel;
const char *csstanzaname;
const char *skedstanzaname;
Expand Down
1 change: 1 addition & 0 deletions apps/app_rpt/rpt_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,7 @@ void load_rpt_vars(int n, int init)

RPT_CONFIG_VAR(patchconnect, "patchconnect");
RPT_CONFIG_VAR(archivedir, "archivedir");
RPT_CONFIG_VAR(archiveformat, "archiveformat");
RPT_CONFIG_VAR_INT(authlevel, "authlevel");

val = ast_variable_retrieve(cfg, cat, "parrot");
Expand Down
29 changes: 28 additions & 1 deletion configs/rpt/rpt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,36 @@ parrottime = 1000 ; Set the amount of time in milliseconds
; module app_gps.so will need to be enabled

; *** Status Reporting ***
; Uncomment the statpost line to report the status of your node to stats.allstarlink.org
;
; Uncomment the following "statpost_url" line to enable status reporting
; of all of your nodes to "stats.allstarlink.org". To enable reporting
; of a single node then add the line (without the leading ";") to the
; per-node stanza(s).
;
;statpost_url = http://stats.allstarlink.org/uhandler ; Status updates

; *** Audio Archiving ***
;
; The following "archivedir" line can be used to enable a simple log and
; audio recorder of the activity on a node. When enabled, a series of
; recordings, one for each active COR on the node. The file(s) will be
; named with the date and time down to the 1/100th of a second. This
; logging can be useful in debugging, policing, or other creative things.
;
; The "archiveformat" line can be used to specify the format of the audio
; recordings. By default, the format will be "wav49" (GSM in a WAV|wav49
; container). Other options you may consider include "wav" (SLIN in a wav

Check failure on line 205 in configs/rpt/rpt.conf

View workflow job for this annotation

GitHub Actions / Check for spelling errors

SLIN ==> SLING

Check failure on line 205 in configs/rpt/rpt.conf

View workflow job for this annotation

GitHub Actions / Check for spelling errors

SLIN ==> SLING
; container), and "gsm" (GSM in straight gsm format).
;
; The "archivedir" and "archiveformat" lines can be enabled here (affecting
; all nodes) or in the per-node stanzas (for recording of individual nodes).
;
; Note: enabling these recordings can adversly impact the CPU utilization
; on the device and consume large amounts of the available storage.
;
;archivedir = /var/spool/asterisk/monitor ; top-level recording directory
;archiveformat = wav49 ; audio format (default = wav49)

;;; End of node-main template

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Expand Down

0 comments on commit 99ea26b

Please sign in to comment.