void dtmf_received(LinphoneCore *lc, LinphoneCall *call, int dtmf) { stats* counters = get_stats(lc); char** dst = &counters->dtmf_list_received; *dst = *dst ? ms_strcat_printf(*dst, "%c", dtmf) : ms_strdup_printf("%c", dtmf); counters->dtmf_count++; }
char * sal_media_description_print_differences(int result){ char *out = NULL; if (result & SAL_MEDIA_DESCRIPTION_CODEC_CHANGED){ out = ms_strcat_printf(out, "%s ", "CODEC_CHANGED"); result &= ~SAL_MEDIA_DESCRIPTION_CODEC_CHANGED; } if (result & SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED){ out = ms_strcat_printf(out, "%s ", "NETWORK_CHANGED"); result &= ~SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED; } if (result & SAL_MEDIA_DESCRIPTION_ICE_RESTART_DETECTED){ out = ms_strcat_printf(out, "%s ", "ICE_RESTART_DETECTED"); result &= ~SAL_MEDIA_DESCRIPTION_ICE_RESTART_DETECTED; } if (result & SAL_MEDIA_DESCRIPTION_CRYPTO_KEYS_CHANGED){ out = ms_strcat_printf(out, "%s ", "CRYPTO_KEYS_CHANGED"); result &= ~SAL_MEDIA_DESCRIPTION_CRYPTO_KEYS_CHANGED; } if (result & SAL_MEDIA_DESCRIPTION_NETWORK_XXXCAST_CHANGED){ out = ms_strcat_printf(out, "%s ", "NETWORK_XXXCAST_CHANGED"); result &= ~SAL_MEDIA_DESCRIPTION_NETWORK_XXXCAST_CHANGED; } if (result & SAL_MEDIA_DESCRIPTION_STREAMS_CHANGED){ out = ms_strcat_printf(out, "%s ", "STREAMS_CHANGED"); result &= ~SAL_MEDIA_DESCRIPTION_STREAMS_CHANGED; } if (result & SAL_MEDIA_DESCRIPTION_CRYPTO_POLICY_CHANGED){ out = ms_strcat_printf(out, "%s ", "CRYPTO_POLICY_CHANGED"); result &= ~SAL_MEDIA_DESCRIPTION_CRYPTO_POLICY_CHANGED; } if (result & SAL_MEDIA_DESCRIPTION_FORCE_STREAM_RECONSTRUCTION){ out = ms_strcat_printf(out, "%s ", "FORCE_STREAM_RECONSTRUCTION"); result &= ~SAL_MEDIA_DESCRIPTION_FORCE_STREAM_RECONSTRUCTION; } if (result){ ms_fatal("There are unhandled result bitmasks in sal_media_description_print_differences(), fix it"); } if (!out) out = ms_strdup("NONE"); return out; }
void liblinphone_tester_after_each(void) { if (!liblinphone_tester_leak_detector_disabled){ int leaked_objects = belle_sip_object_get_object_count() - leaked_objects_count; if (leaked_objects > 0) { char* format = ms_strdup_printf("%d object%s leaked in suite [%s] test [%s], please fix that!", leaked_objects, leaked_objects>1?"s were":"was", bc_tester_current_suite_name(), bc_tester_current_test_name()); belle_sip_object_dump_active_objects(); belle_sip_object_flush_active_objects(); bc_tester_printf(bc_printf_verbosity_info, format); ms_error("%s", format); all_leaks_buffer = ms_strcat_printf(all_leaks_buffer, "\n%s", format); } } if (manager_count != 0) { ms_fatal("%d Linphone core managers are still alive!", manager_count); } }
int liblinphone_tester_after_each(void) { if (!liblinphone_tester_leak_detector_disabled){ int leaked_objects = belle_sip_object_get_object_count() - leaked_objects_count; if (leaked_objects > 0) { char* format = ms_strdup_printf("%d object%s leaked in suite [%s] test [%s], please fix that!", leaked_objects, leaked_objects>1?"s were":" was", bc_tester_current_suite_name(), bc_tester_current_test_name()); belle_sip_object_dump_active_objects(); belle_sip_object_flush_active_objects(); bc_tester_printf(ORTP_MESSAGE, format); ms_error("%s", format); all_leaks_buffer = ms_strcat_printf(all_leaks_buffer, "\n%s", format); } // prevent any future leaks { const char **tags = bc_tester_current_test_tags(); int leaks_expected = (tags && ((tags[0] && !strcmp(tags[0], "LeaksMemory")) || (tags[1] && !strcmp(tags[1], "LeaksMemory")))); // if the test is NOT marked as leaking memory and it actually is, we should make it fail if (!leaks_expected && leaked_objects > 0) { BC_FAIL("This test is leaking memory!"); return 1; // and reciprocally } else if (leaks_expected && leaked_objects == 0) { BC_FAIL("This test is not leaking anymore, please remove LeaksMemory tag!"); return 1; } } } if (manager_count != 0) { ms_fatal("%d Linphone core managers are still alive!", manager_count); } return 0; }
static void dump_section(const char *section, void *data) { struct _entry_data *d = (struct _entry_data *) data; d->section = section; *d->buffer = ms_strcat_printf(*d->buffer, "[%s]\n", section); lp_config_for_each_entry(d->conf, section, dump_entry, d); }
static void dump_entry(const char *entry, void *data) { struct _entry_data *d = (struct _entry_data *) data; const char *value = lp_config_get_string(d->conf, d->section, entry, ""); *d->buffer = ms_strcat_printf(*d->buffer, "\t%s=%s\n", entry, value); }