Commit e4185972 authored by Simon Morlat's avatar Simon Morlat

fix management of forking client transactions.

parent 3c25299e
......@@ -403,7 +403,7 @@ static unsigned int should_dialog_be_created(belle_sip_client_transaction_t *t,
belle_sip_request_t* req = belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(t));
const char* method = belle_sip_request_get_method(req);
int status_code = belle_sip_response_get_status_code(resp);
return status_code>=180 && status_code<300 && (strcmp(method,"INVITE")==0 || strcmp(method,"SUBSCRIBE")==0);
return status_code>=101 && status_code<300 && (strcmp(method,"INVITE")==0 || strcmp(method,"SUBSCRIBE")==0);
}
void belle_sip_client_transaction_notify_response(belle_sip_client_transaction_t *t, belle_sip_response_t *resp){
......@@ -418,17 +418,13 @@ void belle_sip_client_transaction_notify_response(belle_sip_client_transaction_t
base->last_response=(belle_sip_response_t*)belle_sip_object_ref(resp);
if (dialog){
if (status_code>=200 && status_code<300
if (status_code>=101 && status_code<300
&& strcmp(method,"INVITE")==0
&& (dialog->state==BELLE_SIP_DIALOG_EARLY || dialog->state==BELLE_SIP_DIALOG_CONFIRMED)){
/*make sure this response matches the current dialog, or creates a new one*/
if (!belle_sip_dialog_match(dialog,(belle_sip_message_t*)resp,FALSE)){
dialog=belle_sip_provider_create_dialog_internal(t->base.provider,BELLE_SIP_TRANSACTION(t),FALSE);/*belle_sip_dialog_new(base);*/
if (dialog){
/*copy userdata to avoid application from being lost*/
belle_sip_dialog_set_application_data(dialog,belle_sip_dialog_get_application_data(base->dialog));
belle_sip_message("Handling response creating a new dialog !");
}
belle_sip_message("Handling response creating a new dialog !");
}
}
} else if (should_dialog_be_created(t,resp)) {
......
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