diff --git a/coreapi/bellesip_sal/sal_op_message.c b/coreapi/bellesip_sal/sal_op_message.c index 140dbe85f..17a038080 100644 --- a/coreapi/bellesip_sal/sal_op_message.c +++ b/coreapi/bellesip_sal/sal_op_message.c @@ -108,12 +108,19 @@ static void process_request_event(void *op_base, const belle_sip_request_event_t ,belle_sip_header_cseq_get_seq_number(cseq)); salmsg.from=from; salmsg.text=plain_text?belle_sip_message_get_body(BELLE_SIP_MESSAGE(req)):NULL; - salmsg.url=external_body?belle_sip_parameters_get_parameter(BELLE_SIP_PARAMETERS(content_type),"URL"):NULL; + salmsg.url=NULL; + if (external_body && belle_sip_parameters_get_parameter(BELLE_SIP_PARAMETERS(content_type),"URL")) { + size_t url_length=strlen(belle_sip_parameters_get_parameter(BELLE_SIP_PARAMETERS(content_type),"URL")); + char* url = ms_malloc(url_length); + if (sscanf(belle_sip_parameters_get_parameter(BELLE_SIP_PARAMETERS(content_type),"URL"),"\"%s\"",url) ==1) + salmsg.url=url; + } salmsg.message_id=message_id; salmsg.time=date ? belle_sip_header_date_get_time(date) : time(NULL); op->base.root->callbacks.text_received(op,&salmsg); belle_sip_object_unref(address); belle_sip_free(from); + if (salmsg.url) ms_free((char*)salmsg.url); response_code=200; } else { ms_error("Unsupported MESSAGE with content type [%s/%s]",belle_sip_header_content_type_get_type(content_type) diff --git a/tester/message_tester.c b/tester/message_tester.c index 33536ff7f..8e543de38 100644 --- a/tester/message_tester.c +++ b/tester/message_tester.c @@ -164,9 +164,10 @@ static void text_message_with_external_body(void) { linphone_chat_room_send_message2(chat_room,message,linphone_chat_message_state_change,pauline->lc); CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1)); CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageDelivered,1)); + CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1); CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageExtBodyReceived,1); - + /*fixme use history to check message content*/ linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); }