Compare commits

...

5 Commits

Author SHA1 Message Date
Andreas Eversberg 33b65d687f Fix use-after-free buf 2024-01-04 16:09:06 +01:00
Andreas Eversberg 96eb0c480d show that "NOTIFY" is not supported 2024-01-04 15:59:55 +01:00
Andreas Eversberg 7fd0d87aa0 show created callref when remote invites us to a call 2024-01-04 15:59:55 +01:00
Andreas Eversberg b54069541f minor fix on configure.ac 2024-01-04 15:59:55 +01:00
Andreas Eversberg 842d941d06 In release_and_destroy() show correct cc_callref 2024-01-04 15:59:55 +01:00
2 changed files with 12 additions and 5 deletions

View File

@ -27,7 +27,6 @@ if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
AC_MSG_ERROR([You need to install pkg-config])
fi
AC_CONFIG_MACRO_DIRS([m4])
AC_CONFIG_MACRO_DIR([m4])
AC_ARG_ENABLE(sanitize,

View File

@ -403,6 +403,7 @@ static void release_and_destroy(call_t *call, uint8_t cc_isdn_cause, uint16_t cc
{
char isdn_cause_str[256] = "", sip_cause_str[256] = "";
osmo_cc_msg_t *msg;
uint32_t cc_callref = call->cc_callref;
if (isdn_cause) {
sprintf(isdn_cause_str, "Q.850;cause=%d;text=\"%s\"", isdn_cause, "");
@ -411,7 +412,7 @@ static void release_and_destroy(call_t *call, uint8_t cc_isdn_cause, uint16_t cc
sprintf(sip_cause_str, "SIP;cause=%d;text=\"%s\"", sip_cause, "");
}
if (call->cc_callref && (cc_isdn_cause || cc_sip_cause)) {
if (cc_callref && (cc_isdn_cause || cc_sip_cause)) {
/* create osmo-cc message */
if (call->state == SIP_STATE_OUT_RELEASE)
msg = osmo_cc_new_msg(OSMO_CC_MSG_REL_CNF);
@ -425,7 +426,7 @@ static void release_and_destroy(call_t *call, uint8_t cc_isdn_cause, uint16_t cc
osmo_cc_add_ie_cause(msg, OSMO_CC_LOCATION_BEYOND_INTERWORKING, cc_isdn_cause, cc_sip_cause, 0);
/* send message to osmo-cc */
osmo_cc_ll_msg(&call->sip_ep->cc_ep, call->cc_callref, msg);
osmo_cc_ll_msg(&call->sip_ep->cc_ep, cc_callref, msg);
/* unlink */
call->cc_callref = 0;
@ -433,7 +434,7 @@ static void release_and_destroy(call_t *call, uint8_t cc_isdn_cause, uint16_t cc
if (call->nua_handle && (isdn_cause || sip_cause)) {
if (call->state == SIP_STATE_IN_INVITE) {
PDEBUG(DSIP, DEBUG_INFO, "Sending INVITE response: %d %s (callref %d)\n", sip_cause, sip_cause_text, call->cc_callref);
PDEBUG(DSIP, DEBUG_INFO, "Sending INVITE response: %d %s (callref %d)\n", sip_cause, sip_cause_text, cc_callref);
nua_respond(call->nua_handle, (sip_cause < 300) ? 486 : sip_cause, sip_cause_text, // if no usable sip_cause, use 486 (Busy Here)
TAG_IF(isdn_cause_str[0], SIPTAG_REASON_STR(isdn_cause_str)),
TAG_END());
@ -712,8 +713,10 @@ static void setup_rsp(call_t *call, osmo_cc_msg_t *msg)
sdp = sdp_replace_contact(sdp, call->sip_ep->public_ip);
PDEBUG(DSIP, DEBUG_DEBUG, " -> Modify Contact line(s) of SDP:\n");
}
/* Prevent use-after-free bug, by cloning sdp before freeing sdp_response. */
sdp = strdup(sdp);
free(call->sdp_response);
call->sdp_response = strdup(sdp);
call->sdp_response = (char*)sdp;
osmo_cc_debug_sdp(sdp);
} else
PDEBUG(DSIP, DEBUG_INFO, "There was no SDP received during PROC/ALERT/PROGRESS/SETUP-RSP from Osmo-CC. The call will fail due to missing SDP. (callref %d)\n", call->cc_callref);
@ -1307,6 +1310,7 @@ static void call_i_invite(call_t *call, nua_t *nua, nua_handle_t *nh, sip_t cons
/* create endpoint */
osmo_cc_call_t *cc_call = osmo_cc_call_new(&call->sip_ep->cc_ep);
call->cc_callref = cc_call->callref;
PDEBUG(DSIP, DEBUG_INFO, "New callref created. (callref %d)\n", call->cc_callref);
new_state(call, SIP_STATE_IN_INVITE);
@ -1690,6 +1694,10 @@ static void sip_message(nua_event_t event, int status, char const *phrase, nua_t
case nua_i_outbound:
PDEBUG(DSIP, DEBUG_DEBUG, "Outbound status\n");
break;
case nua_i_notify:
PDEBUG(DSIP, DEBUG_NOTICE, "Notify not supported.\n");
return;
default:
;
}