Commit d0b541a4 authored by Simon Morlat's avatar Simon Morlat

fix test doing weak assertions regarding dialog change.

parent a25069ed
......@@ -68,8 +68,6 @@ BELLESIP_EXPORT void *belle_sip_dialog_get_application_data(const belle_sip_dial
BELLESIP_EXPORT void belle_sip_dialog_set_application_data(belle_sip_dialog_t *dialog, void *data);
BELLESIP_EXPORT const char *belle_sip_dialog_get_dialog_id(const belle_sip_dialog_t *dialog);
BELLESIP_EXPORT const belle_sip_header_call_id_t *belle_sip_dialog_get_call_id(const belle_sip_dialog_t *dialog);
BELLESIP_EXPORT const belle_sip_header_address_t *belle_sip_dialog_get_local_party(const belle_sip_dialog_t *dialog);
......
......@@ -893,10 +893,6 @@ const belle_sip_header_call_id_t *belle_sip_dialog_get_call_id(const belle_sip_d
return dialog->call_id;
}
const char *belle_sip_dialog_get_dialog_id(const belle_sip_dialog_t *dialog){
return NULL;
}
const belle_sip_header_address_t *belle_sip_dialog_get_local_party(const belle_sip_dialog_t *dialog){
return dialog->local_party;
}
......
......@@ -524,15 +524,13 @@ static int belle_sip_refresher_refresh_internal(belle_sip_refresher_t* refresher
}
case BELLE_SIP_DIALOG_TERMINATED: {
if (refresher->first_acknoleged_request) {
char tmp[11];
belle_sip_message("Dialog [%p] is in state terminated, recreating a new one for refresher [%p]",dialog,refresher);
request = refresher->first_acknoleged_request;
belle_sip_header_cseq_set_seq_number(belle_sip_message_get_header_by_type(request,belle_sip_header_cseq_t)
,20);
belle_sip_parameters_remove_parameter(BELLE_SIP_PARAMETERS(belle_sip_message_get_header_by_type(request,belle_sip_header_to_t)),"tag");
belle_sip_header_call_id_set_call_id( belle_sip_message_get_header_by_type(request,belle_sip_header_call_id_t)
, belle_sip_random_token(tmp,sizeof(tmp)));
belle_sip_message_set_header((belle_sip_message_t*)request, (belle_sip_header_t*)belle_sip_provider_create_call_id(prov));
break;
} /*else nop, error case*/
......
......@@ -517,6 +517,7 @@ static void subscribe_base(int with_resource_lists) {
belle_sip_refresher_t* refresher;
belle_sip_header_contact_t* contact=belle_sip_header_contact_new();
belle_sip_dialog_t * client_dialog;
char *call_id = NULL;
int dummy = 0;
uint64_t begin;
uint64_t end;
......@@ -572,6 +573,8 @@ static void subscribe_base(int with_resource_lists) {
BC_ASSERT_TRUE(wait_for(server->stack,client->stack,&client->stat.twoHundredOk,1,1000));
/*maybe dialog should be automatically created*/
BC_ASSERT_PTR_NOT_NULL(client_dialog = belle_sip_transaction_get_dialog(BELLE_SIP_TRANSACTION(trans)));
call_id = belle_sip_strdup(belle_sip_header_call_id_get_call_id(belle_sip_dialog_get_call_id(client_dialog)));
belle_sip_object_ref(client_dialog);
refresher = belle_sip_client_transaction_create_refresher(trans);
belle_sip_object_unref(trans);
......@@ -596,11 +599,15 @@ static void subscribe_base(int with_resource_lists) {
/*make sure dialog has changed*/
BC_ASSERT_PTR_NOT_EQUAL(client_dialog, belle_sip_transaction_get_dialog(BELLE_SIP_TRANSACTION(belle_sip_refresher_get_transaction(refresher))));
BC_ASSERT_STRING_NOT_EQUAL(call_id, belle_sip_header_call_id_get_call_id(belle_sip_dialog_get_call_id(belle_sip_transaction_get_dialog(BELLE_SIP_TRANSACTION(belle_sip_refresher_get_transaction(refresher))))));
belle_sip_free(call_id);
belle_sip_object_unref(client_dialog);
belle_sip_message("simulating dialog terminated server side and recovery");
client_dialog = belle_sip_transaction_get_dialog(BELLE_SIP_TRANSACTION(belle_sip_refresher_get_transaction(refresher)));
call_id = belle_sip_strdup(belle_sip_header_call_id_get_call_id(belle_sip_dialog_get_call_id(client_dialog)));
belle_sip_object_ref(client_dialog);
belle_sip_provider_enable_unconditional_answer(server->provider,TRUE);
belle_sip_provider_set_unconditional_answer(server->provider,481);
......@@ -614,7 +621,9 @@ static void subscribe_base(int with_resource_lists) {
/*make sure dialog has changed*/
BC_ASSERT_PTR_NOT_EQUAL(client_dialog, belle_sip_transaction_get_dialog(BELLE_SIP_TRANSACTION(belle_sip_refresher_get_transaction(refresher))));
BC_ASSERT_STRING_NOT_EQUAL(call_id, belle_sip_header_call_id_get_call_id(belle_sip_dialog_get_call_id(belle_sip_transaction_get_dialog(BELLE_SIP_TRANSACTION(belle_sip_refresher_get_transaction(refresher))))));
belle_sip_free(call_id);
belle_sip_object_unref(client_dialog);
belle_sip_refresher_refresh(refresher, 0);
belle_sip_refresher_refresh(refresher, 0);
......
......@@ -53,18 +53,29 @@ int main(int argc, char *argv[]){
belle_http_request_t *req;
belle_generic_uri_t *uri;
belle_http_request_listener_callbacks_t cbs={0};
const char *ca_path = NULL;
belle_tls_crypto_config_t *cfg;
int i;
if (argc<2){
fprintf(stderr,"Usage:\n%s <http uri> [--debug]\n",argv[0]);
fprintf(stderr,"Usage:\n%s <http uri> [--ca-path <path> ] [--debug]\n",argv[0]);
return -1;
}
if (argc==3){
if (strcmp(argv[2],"--debug")==0){
for (i = 2; i < argc; ++i){
if (strcmp(argv[i], "--ca-path") == 0){
i++;
ca_path = argv[i];
}else if (strcmp(argv[i], "--debug")==0){
belle_sip_set_log_level(BELLE_SIP_LOG_DEBUG);
}
}
stack=belle_sip_stack_new(NULL);
prov=belle_sip_stack_create_http_provider(stack,"0.0.0.0");
prov=belle_sip_stack_create_http_provider(stack,"::0");
if (ca_path){
cfg = belle_tls_crypto_config_new();
belle_tls_crypto_config_set_root_ca(cfg, ca_path);
belle_http_provider_set_tls_crypto_config(prov, cfg);
}
uri=belle_generic_uri_parse(argv[1]);
if (!uri){
fprintf(stderr,"Bad uri %s\n",argv[1]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment