eurosignal: Fixed and simplified notification (beep) on received ID

This commit is contained in:
Andreas Eversberg 2019-12-24 15:20:55 +01:00
parent b1e36be99f
commit 5c8919a78b
2 changed files with 14 additions and 28 deletions

View File

@ -46,6 +46,7 @@
This offset of 0x400000000 is required for MNCC interface. */ This offset of 0x400000000 is required for MNCC interface. */
static int new_callref = 0x40000000; static int new_callref = 0x40000000;
/* these calls are not associated with a transmitter */
euro_call_t *ooo_call_list = NULL; euro_call_t *ooo_call_list = NULL;
struct id_list { struct id_list {
@ -464,31 +465,24 @@ void euro_receive_id(euro_t *euro, char *id)
/* we want to send beep via MNCC */ /* we want to send beep via MNCC */
if (id_list) { if (id_list) {
sender_t *sender;
euro_t *e;
euro_call_t *call; euro_call_t *call;
char dialing[32]; char dialing[32];
int callref; int callref;
int rc; int rc;
/* check if we already have a call that beeps */ /* check if we already have a call that beeps */
for (sender = sender_head; sender; sender = sender->next) { for (call = ooo_call_list; call; call = call->next) {
e = (euro_t *) sender; if (!strcmp(call->station_id, id) && call->state == EURO_CALL_BEEPING)
for (call = e->call_list; call; call = call->next) {
if (!strcmp(call->station_id, id) && call->state == EURO_CALL_BEEPING)
break;
}
if (call)
break; break;
} }
/* if already beeping */ /* if already beeping */
if (sender) if (call)
return; return;
/* create call and send setup */ /* create call and send setup */
PDEBUG_CHAN(DEURO, DEBUG_INFO, "Sending setup towards network.'\n"); PDEBUG_CHAN(DEURO, DEBUG_INFO, "Sending setup towards network.'\n");
callref = ++new_callref; callref = ++new_callref;
call = euro_call_create(euro, callref, id); call = euro_call_create(NULL, callref, id);
call_new_state(call, EURO_CALL_BEEPING); call_new_state(call, EURO_CALL_BEEPING);
sprintf(dialing, "%d", count); sprintf(dialing, "%d", count);
rc = call_up_setup(callref, call->station_id, dialing); rc = call_up_setup(callref, call->station_id, dialing);
@ -554,11 +548,8 @@ void euro_clock_chunk(sender_t *sender)
/* no callref */ /* no callref */
if (!call->callref) if (!call->callref)
continue; continue;
/* beep or announcement */ /* announcement */
if (call->state == EURO_CALL_BEEPING) call_play_announcement(call);
call_play_beep(call);
else
call_play_announcement(call);
} }
} }
@ -727,23 +718,16 @@ inval:
void call_down_answer(int __attribute__((unused)) callref) void call_down_answer(int __attribute__((unused)) callref)
{ {
sender_t *sender;
euro_t *euro;
euro_call_t *call; euro_call_t *call;
PDEBUG(DEURO, DEBUG_INFO, "Call has been answered by network.\n"); PDEBUG(DEURO, DEBUG_INFO, "Call has been answered by network.\n");
for (sender = sender_head; sender; sender = sender->next) { for (call = ooo_call_list; call; call = call->next) {
euro = (euro_t *) sender; if (call->callref == callref)
for (call = euro->call_list; call; call = call->next) {
if (call->callref == callref)
break;
}
if (call)
break; break;
} }
if (!call) { if (!call) {
PDEBUG(DEURO, DEBUG_NOTICE, "Outgoing disconnect, but no callref!\n"); PDEBUG(DEURO, DEBUG_NOTICE, "Answer from network, but no callref!\n");
call_up_release(callref, CAUSE_INVALCALLREF); call_up_release(callref, CAUSE_INVALCALLREF);
return; return;
} }

View File

@ -63,8 +63,10 @@ void print_help(const char *arg0)
printf(" Give one or more IDs to allow only the given IDs to be transmitted and\n"); printf(" Give one or more IDs to allow only the given IDs to be transmitted and\n");
printf(" received. This option can be repeated many times. If this option is not\n"); printf(" received. This option can be repeated many times. If this option is not\n");
printf(" specified, any ID is allowed to transmit.\n"); printf(" specified, any ID is allowed to transmit.\n");
printf(" Also, any ID given will cause a beep when the ID was received. This\n"); printf(" Also, any given ID will cause a beep when received. This requires call\n");
printf(" requires call device (sound card) to be defined or MNCC interface.\n"); printf(" device (sound card) to be defined or MNCC interface. (The caller ID will\n");
printf(" be the received pager ID. The called number will be '1' for the first\n");
printf(" ID given, '2' for scond, ...)\n");
printf(" -D --degraded\n"); printf(" -D --degraded\n");
printf(" Play the anouncement that the system is degraded due to failure of one\n"); printf(" Play the anouncement that the system is degraded due to failure of one\n");
printf(" or more transmitters. If the caller hangs up during or rigt after the\n"); printf(" or more transmitters. If the caller hangs up during or rigt after the\n");