Browse Source

call: check common audio codecs for incoming call

for incoming calls, check that we have at least 1 common audio
codec. if there are no common audio codecs, reject the call
with 488 status code.

Suggested and Tested by Juha Heinanen -- thanks!
master^2
Alfred E. Heggestad 7 years ago
parent
commit
309ba2242c
1 changed files with 30 additions and 0 deletions
  1. +30
    -0
      src/call.c

+ 30
- 0
src/call.c View File

@ -1171,6 +1171,21 @@ static void sipsess_close_handler(int err, const struct sip_msg *msg,
}
static bool have_common_audio_codecs(const struct call *call)
{
const struct sdp_format *sc;
struct aucodec *ac;
sc = sdp_media_rformat(stream_sdpmedia(audio_strm(call->audio)), NULL);
if (!sc)
return false;
ac = sc->data;
return ac != NULL;
}
int call_accept(struct call *call, struct sipsess_sock *sess_sock,
const struct sip_msg *msg)
{
@ -1199,6 +1214,21 @@ int call_accept(struct call *call, struct sipsess_sock *sess_sock,
return err;
call->got_offer = true;
/* Check if we have any common audio codecs, after
* the SDP offer has been parsed
*/
if (!have_common_audio_codecs(call)) {
info("call: no common audio codecs - rejected\n");
sip_treply(NULL, uag_sip(), msg,
488, "Not Acceptable Here");
call_event_handler(call, CALL_EVENT_CLOSED,
"No audio codecs");
return 0;
}
}
err = sipsess_accept(&call->sess, sess_sock, msg, 180, "Ringing",

Loading…
Cancel
Save