diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2016-07-09 11:16:50 +0200 |
---|---|---|
committer | Andreas Eversberg <jolly@eversberg.eu> | 2016-07-09 11:27:02 +0200 |
commit | 62b3712ce56e86d73ddade1d15d058fcc3205587 (patch) | |
tree | 52bf56dc79f0d28041cf0994414053cbb2179c36 | |
parent | f39ee2f15a5ab52efe12fa4ac50d04e473a613c4 (diff) |
common code: Check and ignore events without callref set
-rw-r--r-- | src/common/call.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/common/call.c b/src/common/call.c index d83fc8f..20ea796 100644 --- a/src/common/call.c +++ b/src/common/call.c @@ -612,6 +612,11 @@ void process_call(int c) /* Setup is received from transceiver. */ int call_in_setup(int callref, const char *callerid, const char *dialing) { + if (!callref) { + PDEBUG(DCALL, DEBUG_DEBUG, "Ignoring setup, because callref not set. (not for us)\n"); + return -CAUSE_INVALCALLREF; + } + if (callref < 0x4000000) { PDEBUG(DCALL, DEBUG_ERROR, "Invalid callref from mobile station, please fix!\n"); abort(); @@ -676,6 +681,11 @@ int call_in_setup(int callref, const char *callerid, const char *dialing) /* Transceiver indicates alerting. */ void call_in_alerting(int callref) { + if (!callref) { + PDEBUG(DCALL, DEBUG_DEBUG, "Ignoring alerting, because callref not set. (not for us)\n"); + return; + } + PDEBUG(DCALL, DEBUG_INFO, "Call is alerting\n"); if (use_mncc_sock) { @@ -719,6 +729,11 @@ static void _indicate_answer(int callref, const char *connectid) } void call_in_answer(int callref, const char *connectid) { + if (!callref) { + PDEBUG(DCALL, DEBUG_DEBUG, "Ignoring answer, because callref not set. (not for us)\n"); + return; + } + PDEBUG(DCALL, DEBUG_INFO, "Call has been answered by '%s'\n", connectid); if (use_mncc_sock) { @@ -741,6 +756,11 @@ void call_in_answer(int callref, const char *connectid) /* Transceiver indicates release. */ void call_in_release(int callref, int cause) { + if (!callref) { + PDEBUG(DCALL, DEBUG_DEBUG, "Ignoring release, because callref not set. (not for us)\n"); + return; + } + PDEBUG(DCALL, DEBUG_INFO, "Call has been released with cause=%d\n", cause); if (use_mncc_sock) { @@ -784,6 +804,8 @@ void call_in_release(int callref, int cause) /* forward audio to MNCC or call instance */ void call_tx_audio(int callref, int16_t *samples, int count) { + if (!callref) + return; if (use_mncc_sock) { uint8_t buf[sizeof(struct gsm_data_frame) + count * sizeof(int16_t)]; |