Release active call, when disconnect is received from network

If early disconnect is received, the connecion is kept established, so the
announcement can be heared by mobile subscriber.
This commit is contained in:
Andreas Eversberg
2016-07-20 12:50:22 +02:00
parent 4745b29115
commit 5807a49f49
3 changed files with 15 additions and 4 deletions

View File

@@ -35,6 +35,7 @@
extern int use_mncc_sock;
extern int send_patterns;
extern int release_on_disconnect;
/* stream patterns/announcements */
int16_t *ringback_spl = NULL;
@@ -972,7 +973,6 @@ void call_mncc_recv(uint8_t *buf, int length)
if (send_patterns) {
PDEBUG(DCALL, DEBUG_DEBUG, "Early connecting after setup\n");
set_state_process(callref, CALL_CONNECT);
_indicate_answer(callref, number);
break;
}
@@ -984,6 +984,14 @@ void call_mncc_recv(uint8_t *buf, int length)
case MNCC_DISC_REQ:
PDEBUG(DMNCC, DEBUG_INFO, "Received MNCC disconnect from Network with cause %d\n", mncc->cause.value);
if (is_process_state(callref) == CALL_CONNECT && release_on_disconnect) {
PDEBUG(DCALL, DEBUG_INFO, "Releaseing, because we don't send disconnect tones to mobile phone\n");
PDEBUG(DMNCC, DEBUG_INFO, "Releasing MNCC call towards Network\n");
mncc->msg_type = MNCC_REL_IND;
mncc_write(buf, sizeof(struct gsm_mncc));
goto release;
}
set_state_process(callref, CALL_DISCONNECTED);
PDEBUG(DCALL, DEBUG_INFO, "Call disconnected\n");
call_out_disconnect(callref, mncc->cause.value);
@@ -991,6 +999,7 @@ void call_mncc_recv(uint8_t *buf, int length)
case MNCC_REL_REQ:
PDEBUG(DMNCC, DEBUG_INFO, "Received MNCC release from Network with cause %d\n", mncc->cause.value);
release:
destroy_process(callref);
PDEBUG(DCALL, DEBUG_INFO, "Call released\n");
call_out_release(callref, mncc->cause.value);

View File

@@ -47,6 +47,7 @@ int do_de_emphasis = 0;
double rx_gain = 1.0;
int use_mncc_sock = 0;
int send_patterns = 1;
int release_on_disconnect = 1;
int loopback = 0;
int rt_prio = 0;
const char *read_wave = NULL;
@@ -94,7 +95,8 @@ void print_help_common(const char *arg0, const char *ext_usage)
printf(" -c --call-device hw:<card>,<device>\n");
printf(" Sound card and device number for headset (default = '%s')\n", call_sounddev);
printf(" -p --send-patterns 0 | 1\n");
printf(" Connect call on setup/release to provide classic tones (default = '%d')\n", send_patterns);
printf(" Connect call on setup/release to provide classic tones towards fixed\n");
printf(" network (default = '%d')\n", send_patterns);
printf(" -L --loopback <type>\n");
printf(" Loopback test: 1 = internal | 2 = external | 3 = echo\n");
printf(" -r --realtime <prio>\n");

View File

@@ -1641,8 +1641,8 @@ void call_out_disconnect(int callref, int cause)
return;
}
/* Release when not active */
if (nmt->state == STATE_ACTIVE)
/* Release when not active and not waiting for answer */
if (nmt->state == STATE_ACTIVE || nmt->state == STATE_MO_COMPLETE)
return;
switch (nmt->state) {
case STATE_MT_RINGING: