C-Netz: callref is moved completely to transaction object
This commit is contained in:
parent
8d7c7f4425
commit
17930af920
|
@ -355,10 +355,14 @@ void cnetz_destroy(sender_t *sender)
|
|||
/* Abort connection, if any and send idle broadcast */
|
||||
static void cnetz_go_idle(cnetz_t *cnetz)
|
||||
{
|
||||
if (cnetz->callref) {
|
||||
PDEBUG(DCNETZ, DEBUG_ERROR, "Releasing but still having callref, please fix!\n");
|
||||
call_in_release(cnetz->callref, CAUSE_NORMAL);
|
||||
cnetz->callref = 0;
|
||||
if (cnetz->state == CNETZ_IDLE)
|
||||
return;
|
||||
|
||||
if (cnetz->trans_list) {
|
||||
PDEBUG(DCNETZ, DEBUG_ERROR, "Releasing but still having transaction, please fix!\n");
|
||||
if (cnetz->trans_list->callref)
|
||||
call_in_release(cnetz->trans_list->callref, CAUSE_NORMAL);
|
||||
destroy_transaction(cnetz->trans_list);
|
||||
}
|
||||
|
||||
PDEBUG(DCNETZ, DEBUG_INFO, "Entering IDLE state on channel %d.\n", cnetz->sender.kanal);
|
||||
|
@ -392,7 +396,7 @@ void call_rx_audio(int callref, int16_t *samples, int count)
|
|||
|
||||
for (sender = sender_head; sender; sender = sender->next) {
|
||||
cnetz = (cnetz_t *) sender;
|
||||
if (cnetz->callref == callref)
|
||||
if (cnetz->trans_list && cnetz->trans_list->callref == callref)
|
||||
break;
|
||||
}
|
||||
if (!sender)
|
||||
|
@ -520,7 +524,6 @@ inval:
|
|||
trans = create_transaction(cnetz, TRANS_VAK, dialing[0] - '0', dialing[1] - '0', atoi(dialing + 2), -1);
|
||||
if (!trans) {
|
||||
PDEBUG(DCNETZ, DEBUG_ERROR, "Failed to create transaction\n");
|
||||
cnetz->callref = 0;
|
||||
return -CAUSE_TEMPFAIL;
|
||||
}
|
||||
trans->callref = callref;
|
||||
|
@ -554,25 +557,6 @@ void call_out_disconnect(int callref, int cause)
|
|||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
dont use this, because busy state is only entered when channel is actually used for voice
|
||||
if (cnetz->state != CNETZ_BUSY) {
|
||||
PDEBUG(DCNETZ, DEBUG_NOTICE, "Outgoing disconnect, but sender is not in busy state.\n");
|
||||
call_in_release(callref, cause);
|
||||
cnetz->callref = 0;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
trans = cnetz->trans_list;
|
||||
if (!trans) {
|
||||
call_in_release(callref, cause);
|
||||
cnetz->callref = 0;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Release when not active */
|
||||
|
||||
switch (cnetz->dsp_mode) {
|
||||
|
@ -582,13 +566,11 @@ void call_out_disconnect(int callref, int cause)
|
|||
PDEBUG(DCNETZ, DEBUG_INFO, "Call control disconnects on speech channel, releasing towards mobile station.\n");
|
||||
cnetz_release(trans, cnetz_cause_isdn2cnetz(cause));
|
||||
call_in_release(callref, cause);
|
||||
cnetz->callref = 0;
|
||||
trans->callref = 0;
|
||||
break;
|
||||
default:
|
||||
PDEBUG(DCNETZ, DEBUG_INFO, "Call control disconnects on organisation channel, removing transaction.\n");
|
||||
call_in_release(callref, cause);
|
||||
cnetz->callref = 0;
|
||||
destroy_transaction(trans);
|
||||
cnetz_go_idle(cnetz);
|
||||
}
|
||||
|
@ -617,21 +599,8 @@ void call_out_release(int callref, int cause)
|
|||
return;
|
||||
}
|
||||
|
||||
cnetz->callref = 0;
|
||||
trans->callref = 0;
|
||||
|
||||
#if 0
|
||||
dont use this, because busy state is only entered when channel is actually used for voice
|
||||
if (cnetz->state != CNETZ_BUSY) {
|
||||
PDEBUG(DCNETZ, DEBUG_NOTICE, "Outgoing release, but sender is not in busy state.\n");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
trans = cnetz->trans_list;
|
||||
if (!trans)
|
||||
return;
|
||||
|
||||
switch (cnetz->dsp_mode) {
|
||||
case DSP_MODE_SPK_K:
|
||||
case DSP_MODE_SPK_V:
|
||||
|
@ -754,29 +723,25 @@ void transaction_timeout(struct timer *timer)
|
|||
PDEBUG_CHAN(DCNETZ, DEBUG_NOTICE, "Lost signal from 'FuTln' (mobile station)\n");
|
||||
if (trans->callref) {
|
||||
call_in_release(trans->callref, CAUSE_TEMPFAIL);
|
||||
cnetz->callref = 0;
|
||||
trans->callref = 0;
|
||||
}
|
||||
cnetz_release(trans, CNETZ_CAUSE_FUNKTECHNISCH);
|
||||
break;
|
||||
case TRANS_DS:
|
||||
PDEBUG_CHAN(DCNETZ, DEBUG_NOTICE, "No response after connect 'Durchschalten'\n");
|
||||
call_in_release(cnetz->callref, CAUSE_TEMPFAIL);
|
||||
cnetz->callref = 0;
|
||||
call_in_release(trans->callref, CAUSE_TEMPFAIL);
|
||||
trans->callref = 0;
|
||||
cnetz_release(trans, CNETZ_CAUSE_FUNKTECHNISCH);
|
||||
break;
|
||||
case TRANS_RTA:
|
||||
PDEBUG_CHAN(DCNETZ, DEBUG_NOTICE, "No response after ringing order 'Rufton anschalten'\n");
|
||||
call_in_release(cnetz->callref, CAUSE_TEMPFAIL);
|
||||
cnetz->callref = 0;
|
||||
call_in_release(trans->callref, CAUSE_TEMPFAIL);
|
||||
trans->callref = 0;
|
||||
cnetz_release(trans, CNETZ_CAUSE_FUNKTECHNISCH);
|
||||
break;
|
||||
case TRANS_AHQ:
|
||||
PDEBUG_CHAN(DCNETZ, DEBUG_NOTICE, "No response after answer 'Abhebequittung'\n");
|
||||
call_in_release(cnetz->callref, CAUSE_TEMPFAIL);
|
||||
cnetz->callref = 0;
|
||||
call_in_release(trans->callref, CAUSE_TEMPFAIL);
|
||||
trans->callref = 0;
|
||||
cnetz_release(trans, CNETZ_CAUSE_FUNKTECHNISCH);
|
||||
break;
|
||||
|
@ -919,7 +884,6 @@ wbn:
|
|||
PDEBUG(DCNETZ, DEBUG_INFO, "Staying on combined calling + traffic channel %d\n", spk->sender.kanal);
|
||||
} else {
|
||||
PDEBUG(DCNETZ, DEBUG_INFO, "Assigning phone to traffic channel %d\n", spk->sender.kanal);
|
||||
spk->callref = trans->callref;
|
||||
/* sync RX time to current OgK time */
|
||||
spk->fsk_demod.bit_time = cnetz->fsk_demod.bit_time;
|
||||
}
|
||||
|
@ -1153,13 +1117,11 @@ const telegramm_t *cnetz_transmit_telegramm_spk_k(cnetz_t *cnetz)
|
|||
cnetz_release(trans, cnetz_cause_isdn2cnetz(-rc));
|
||||
goto call_failed;
|
||||
}
|
||||
cnetz->callref = trans->callref;
|
||||
trans_new_state(trans, TRANS_DS);
|
||||
trans->repeat = 0;
|
||||
timer_start(&trans->timer, 0.0375 * F_DS); /* F_DS frames */
|
||||
}
|
||||
if (trans->mt_call) {
|
||||
cnetz->callref = trans->callref;
|
||||
trans_new_state(trans, TRANS_RTA);
|
||||
timer_start(&trans->timer, 0.0375 * F_RTA); /* F_RTA frames */
|
||||
trans->repeat = 0;
|
||||
|
@ -1210,10 +1172,8 @@ call_failed:
|
|||
if (trans->try == N) {
|
||||
PDEBUG(DCNETZ, DEBUG_INFO, "Maximum retries, removing transaction\n");
|
||||
cnetz_release(trans, CNETZ_CAUSE_FUNKTECHNISCH);
|
||||
if (trans->callref) {
|
||||
if (trans->callref)
|
||||
call_in_release(trans->callref, CAUSE_TEMPFAIL);
|
||||
cnetz->callref = 0;
|
||||
}
|
||||
/* must destroy transaction after cnetz_release */
|
||||
destroy_transaction(trans);
|
||||
cnetz_go_idle(cnetz);
|
||||
|
@ -1221,7 +1181,6 @@ call_failed:
|
|||
}
|
||||
/* remove call from SpK (or OgK+SpK) */
|
||||
unlink_transaction(trans);
|
||||
cnetz->callref = 0;
|
||||
/* idle channel */
|
||||
cnetz_go_idle(cnetz);
|
||||
/* alloc ogk again */
|
||||
|
@ -1358,7 +1317,6 @@ void cnetz_receive_telegramm_spk_k(cnetz_t *cnetz, telegramm_t *telegramm)
|
|||
timer_stop(&trans->timer);
|
||||
if (trans->callref) {
|
||||
call_in_release(trans->callref, CAUSE_NORMAL);
|
||||
cnetz->callref = 0;
|
||||
trans->callref = 0;
|
||||
}
|
||||
break;
|
||||
|
@ -1470,7 +1428,6 @@ void cnetz_receive_telegramm_spk_v(cnetz_t *cnetz, telegramm_t *telegramm)
|
|||
timer_stop(&trans->timer);
|
||||
if (trans->callref) {
|
||||
call_in_release(trans->callref, CAUSE_NORMAL);
|
||||
cnetz->callref = 0;
|
||||
trans->callref = 0;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -70,7 +70,6 @@ typedef struct cnetz {
|
|||
|
||||
/* all cnetz states */
|
||||
enum cnetz_state state; /* main state of sender */
|
||||
int callref; /* call reference while in SpK mode */
|
||||
|
||||
/* cell nr selection */
|
||||
int cell_auto; /* if set, cell_nr is selected automatically */
|
||||
|
|
|
@ -837,7 +837,7 @@ void unshrink_speech(cnetz_t *cnetz, int16_t *speech_buffer, int count)
|
|||
for (i = 0; i < count; i++) {
|
||||
spl[pos++] = speech_buffer[i];
|
||||
if (pos == 160) {
|
||||
call_tx_audio(cnetz->callref, spl, 160);
|
||||
call_tx_audio(cnetz->trans_list->callref, spl, 160);
|
||||
pos = 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue