void linphone_core_manager_uninit(LinphoneCoreManager *mgr) { if (mgr->stat.last_received_chat_message) { linphone_chat_message_unref(mgr->stat.last_received_chat_message); } if (mgr->stat.last_received_info_message) linphone_info_message_destroy(mgr->stat.last_received_info_message); if (mgr->lc){ const char *record_file=linphone_core_get_record_file(mgr->lc); int unterminated_calls; if (!liblinphone_tester_keep_record_files && record_file){ if ((bc_get_number_of_failures()-mgr->number_of_cunit_error_at_creation)>0) { ms_message ("Test has failed, keeping recorded file [%s]",record_file); } else { unlink(record_file); } } BC_ASSERT_EQUAL((unterminated_calls=ms_list_size(mgr->lc->calls)), 0, int, "%i"); if (unterminated_calls != 0) { ms_error("There are still %d calls pending, please terminates them before invoking linphone_core_manager_destroy().", unterminated_calls); } linphone_core_destroy(mgr->lc); } if (mgr->identity) { linphone_address_destroy(mgr->identity); } manager_count--; }
void info_message_received(LinphoneCore *lc, LinphoneCall* call, const LinphoneInfoMessage *msg){ stats* counters = get_stats(lc); if (counters->last_received_info_message) { linphone_info_message_destroy(counters->last_received_info_message); } counters->last_received_info_message=linphone_info_message_copy(msg); counters->number_of_inforeceived++; }
void linphone_core_notify_info_message(LinphoneCore* lc,SalOp *op, const SalBody *body){ LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op); if (call){ LinphoneInfoMessage *info=ms_new0(LinphoneInfoMessage,1); info->headers=sal_custom_header_clone(sal_op_get_recv_custom_header(op)); if (body) info->content=linphone_content_from_sal_body(body); linphone_core_notify_info_received(lc,call,info); linphone_info_message_destroy(info); } }
static void info_message_with_args(bool_t with_content) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); LinphoneInfoMessage *info; const LinphoneContent *content; const char *hvalue; CU_ASSERT_TRUE(call(pauline,marie)); info=linphone_core_create_info_message(marie->lc); linphone_info_message_add_header(info,"Weather","still bad"); if (with_content) { LinphoneContent* ct=linphone_core_create_content(marie->lc); linphone_content_set_type(ct,"application"); linphone_content_set_subtype(ct,"somexml"); linphone_content_set_buffer(ct,info_content,strlen(info_content)); linphone_info_message_set_content(info,ct); linphone_content_unref(ct); } { int dummy=0; wait_for_until(marie->lc,pauline->lc,&dummy,1,100); /*just to have time to purge message stored in the server*/ reset_counters(&marie->stat); reset_counters(&pauline->stat); } linphone_call_send_info_message(linphone_core_get_current_call(marie->lc),info); linphone_info_message_destroy(info); CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_inforeceived,1)); CU_ASSERT_PTR_NOT_NULL(pauline->stat.last_received_info_message); hvalue=linphone_info_message_get_header(pauline->stat.last_received_info_message, "Weather"); content=linphone_info_message_get_content(pauline->stat.last_received_info_message); CU_ASSERT_PTR_NOT_NULL(hvalue); if (hvalue) CU_ASSERT_TRUE(strcmp(hvalue,"still bad")==0); if (with_content){ CU_ASSERT_PTR_NOT_NULL(content); if (content) { CU_ASSERT_PTR_NOT_NULL(linphone_content_get_buffer(content)); CU_ASSERT_PTR_NOT_NULL(linphone_content_get_type(content)); CU_ASSERT_PTR_NOT_NULL(linphone_content_get_subtype(content)); if (linphone_content_get_type(content)) CU_ASSERT_TRUE(strcmp(linphone_content_get_type(content),"application")==0); if (linphone_content_get_subtype(content)) CU_ASSERT_TRUE(strcmp(linphone_content_get_subtype(content),"somexml")==0); if (linphone_content_get_buffer(content))CU_ASSERT_TRUE(strcmp((const char*)linphone_content_get_buffer(content),info_content)==0); CU_ASSERT_EQUAL(linphone_content_get_size(content),strlen(info_content)); } } linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); }
void reset_counters( stats* counters) { if (counters->last_received_chat_message) linphone_chat_message_unref(counters->last_received_chat_message); if (counters->last_received_info_message) linphone_info_message_destroy(counters->last_received_info_message); memset(counters,0,sizeof(stats)); }