Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for an info message on the EchoLink connect page #432

Merged
merged 24 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 42 additions & 6 deletions channels/chan_echolink.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ do not use 127.0.0.1
#define EL_IP_SIZE 16
#define EL_CALL_SIZE 12
#define EL_NAME_SIZE 32
#define EL_MESSAGE_SIZE 256
#define EL_APRS_SIZE 200
#define EL_PWD_SIZE 16
#define EL_EMAIL_SIZE 32
Expand Down Expand Up @@ -384,6 +385,7 @@ struct el_instance {
char name[EL_NAME_SIZE];
char mycall[EL_CALL_SIZE];
char myname[EL_NAME_SIZE];
char mymessage[EL_MESSAGE_SIZE];
char mypwd[EL_PWD_SIZE];
char myemail[EL_EMAIL_SIZE];
char myqth[EL_QTH_SIZE];
Expand Down Expand Up @@ -1813,24 +1815,47 @@ static void send_info(const void *nodep, const VISIT which, const int depth)
i = snprintf(pkt, sizeof(pkt), "oNDATA\rWelcome to Allstar Node %s\r", instp->astnode);
if (i >= sizeof(pkt)) {
ast_log(LOG_WARNING, "Exceeded buffer size");
return;
goto send_message;
}
j = snprintf(pkt + i, sizeof(pkt) - i, "Echolink Node %s\rNumber %u\r \r", instp->mycall, instp->mynode);
if (j >= sizeof(pkt) - i) {
ast_log(LOG_WARNING, "Exceeded buffer size");
return;
goto send_message;
}

i += j;

if (instp->mymessage[0] != '\0') {
j = snprintf(pkt + i, sizeof(pkt) - i, "%s\n\n", instp->mymessage);

if (j >= sizeof(pkt) - i) {
ast_log(LOG_WARNING, "Exceeded buffer size");
goto send_message;
}

i += j;
}

if ((*(struct el_node **) nodep)->pvt && (*(struct el_node **) nodep)->pvt->linkstr) {
i = strlen(pkt);
strncat(pkt + i, "Systems Linked:\r", sizeof(pkt) - i);
i += snprintf(pkt + i, sizeof(pkt) - i, "Systems Linked:\r");

if (i >= sizeof(pkt)) {
ast_log(LOG_WARNING, "Exceeded buffer size");
goto send_message;
}

cp = ast_strdup((*(struct el_node **) nodep)->pvt->linkstr);
if (cp) {
i = strlen(pkt);
strncat(pkt + i, cp, sizeof(pkt) - i);
j = snprintf(pkt + i, sizeof(pkt) - i, "%s", cp);
ast_free(cp);

if (j >= sizeof(pkt) - i) {
ast_log(LOG_WARNING, "Exceeded buffer size");
}
}
}

send_message:
sendto(instp->audio_sock, pkt, strlen(pkt), 0, (struct sockaddr *) &sin, sizeof(sin));

instp->tx_ctrl_packets++;
Expand Down Expand Up @@ -3818,6 +3843,17 @@ static int store_config(struct ast_config *cfg, char *ctg)
ast_copy_string(instp->myname, val, sizeof(instp->myname));
}

val = ast_variable_retrieve(cfg, ctg, "message");
ast_copy_string(instp->mymessage, S_OR(val, ""), sizeof(instp->mymessage));
if (instp->mymessage[0] != '\0') {
char *p = instp->mymessage;
while ((p = strstr(p, "\\n")) != NULL) {
*p = '\n'; /* Replace the literal \n with a newline character */
memmove(p + 1, p + 2, strlen(p + 2) + 1); /* Shift the string to remove the \n */
p++;
}
}

val = ast_variable_retrieve(cfg, ctg, "recfile");
if (!val) {
ast_copy_string(instp->fdr_file, "/tmp/echolink_recorded.gsm", FILENAME_MAX - 1);
Expand Down
3 changes: 3 additions & 0 deletions configs/rpt/echolink.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ height = 0 ; 0=10 1=20 2=40 3=80 4=160 5=320 6=640 7=1280 8=2560 9=5120 (A
gain = 0 ; Gain in db (0-9)
dir = 0 ; 0=omni 1=45deg 2=90deg 3=135deg 4=180deg 5=225deg 6=270deg 7=315deg 8=360deg (Direction)

; Message to show on the echolink connect page. Use \n for new lines.
; message = This is the first line\nThis is another line\nThis is another line

maxstns = 20 ; Max Stations

rtcptimeout = 10 ; Max number of missed heartbeats from EL
Expand Down