Compare commits

...

4 Commits

Author SHA1 Message Date
netplanetat 3b417ccefa
Merge 6d4776e178 into 5cb74797fe 2025-01-17 16:41:40 +00:00
Aron Podrigal 5cb74797fe
[mod_pgsql] err is now set correctly (dbh:last_error())
New function, `void pgsql_handle_set_error_if_not_set(switch_pgsql_handle_t *handle, char **err)` has been added to mod_pgsql module. This function is now called at several points where an error occurred but *err was not yet set.
2025-01-17 18:51:45 +03:00
leecher1337 6d4776e178 [Core] Add handling of sendrcv flag for RFC4103 Real-Time Text (RTT). Fix bug that always used RTP RED, even when not advertised by peer leading to garbled text. 2025-01-13 12:33:52 +01:00
leecher1337 52617a0a3b [mod_sofia] On MIME multipart messages, pass on the Content-ID, this is vital i.e. for routing RFC6442 Geolocation information 2025-01-13 12:26:06 +01:00
3 changed files with 51 additions and 3 deletions

View File

@ -106,6 +106,22 @@ char * pgsql_handle_get_error(switch_pgsql_handle_t *handle)
return err_str;
}
void pgsql_handle_set_error_if_not_set(switch_pgsql_handle_t *handle, char **err)
{
char *err_str;
if (err && !(*err)) {
err_str = pgsql_handle_get_error(handle);
if (zstr(err_str)) {
switch_safe_free(err_str);
err_str = strdup((char *)"SQL ERROR!");
}
*err = err_str;
}
}
static int db_is_up(switch_pgsql_handle_t *handle)
{
int ret = 0;
@ -553,8 +569,15 @@ switch_status_t pgsql_handle_exec_detailed(const char *file, const char *func, i
goto error;
}
return pgsql_finish_results(handle);
if (pgsql_finish_results(handle) != SWITCH_STATUS_SUCCESS) {
goto error;
}
return SWITCH_STATUS_SUCCESS;
error:
pgsql_handle_set_error_if_not_set(handle, err);
return SWITCH_STATUS_FALSE;
}
@ -630,6 +653,7 @@ done:
pgsql_free_result(&result);
if (pgsql_finish_results(handle) != SWITCH_STATUS_SUCCESS) {
pgsql_handle_set_error_if_not_set(handle, err);
sstatus = SWITCH_STATUS_FALSE;
}
@ -638,6 +662,7 @@ done:
error:
pgsql_free_result(&result);
pgsql_handle_set_error_if_not_set(handle, err);
return SWITCH_STATUS_FALSE;
}
@ -1050,6 +1075,8 @@ switch_status_t pgsql_handle_callback_exec_detailed(const char *file, const char
return SWITCH_STATUS_SUCCESS;
error:
pgsql_handle_set_error_if_not_set(handle, err);
return SWITCH_STATUS_FALSE;
}

View File

@ -11171,7 +11171,9 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
for (mp = sip->sip_multipart; mp; mp = mp->mp_next) {
if (mp->mp_payload && mp->mp_payload->pl_data && mp->mp_content_type && mp->mp_content_type->c_type) {
char *val = switch_core_session_sprintf(session, "%s:%s", mp->mp_content_type->c_type, mp->mp_payload->pl_data);
char *val;
if (mp->mp_content_id) val = switch_core_session_sprintf(session, "%s:~Content-ID: %s\r\n\r\n%s", mp->mp_content_type->c_type, mp->mp_content_id->g_string, mp->mp_payload->pl_data);
else val = switch_core_session_sprintf(session, "%s:%s", mp->mp_content_type->c_type, mp->mp_payload->pl_data);
switch_channel_add_variable_var_check(channel, "sip_multipart", val, SWITCH_FALSE, SWITCH_STACK_PUSH);
}
}

View File

@ -3234,7 +3234,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
if (type == SWITCH_MEDIA_TYPE_TEXT && !switch_test_flag((&engine->read_frame), SFF_CNG)) {
if (engine->red_pt) {
if (engine->red_pt == engine->read_frame.payload) {
unsigned char *p = engine->read_frame.data;
*(p + engine->read_frame.datalen) = '\0';
@ -5892,6 +5892,25 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
got_text++;
switch_core_media_set_rmode(smh->session, SWITCH_MEDIA_TYPE_TEXT, sdp_media_flow(m->m_mode), sdp_type);
if (sdp_type == SDP_TYPE_REQUEST) {
switch(t_engine->rmode) {
case SWITCH_MEDIA_FLOW_RECVONLY:
switch_core_media_set_smode(smh->session, SWITCH_MEDIA_TYPE_TEXT, SWITCH_MEDIA_FLOW_SENDONLY, sdp_type);
break;
case SWITCH_MEDIA_FLOW_SENDONLY:
switch_core_media_set_smode(smh->session, SWITCH_MEDIA_TYPE_TEXT, SWITCH_MEDIA_FLOW_RECVONLY, sdp_type);
break;
case SWITCH_MEDIA_FLOW_INACTIVE:
switch_core_media_set_smode(smh->session, SWITCH_MEDIA_TYPE_TEXT, SWITCH_MEDIA_FLOW_INACTIVE, sdp_type);
break;
default:
switch_core_media_set_smode(smh->session, SWITCH_MEDIA_TYPE_TEXT, SWITCH_MEDIA_FLOW_SENDRECV, sdp_type);
break;
}
}
for (map = m->m_rtpmaps; map; map = map->rm_next) {
payload_map_t *pmap;