Commit 2e71de96 authored by Simon Morlat's avatar Simon Morlat
Browse files

Fix client dialog creation. The response must have a to-tag as specified in RFC3261:

12.1 Creation of a Dialog

   Dialogs are created through the generation of non-failure responses
   to requests with specific methods.  Within this specification, only
   2xx and 101-199 responses with a To tag, where the request was
   INVITE, will establish a dialog.
parent 7d2f7b41
......@@ -573,7 +573,9 @@ 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>=101 && status_code<300 && (strcmp(method,"INVITE")==0 || strcmp(method,"SUBSCRIBE")==0);
belle_sip_header_to_t *to = belle_sip_message_get_header_by_type((belle_sip_message_t*)resp, belle_sip_header_to_t);
return status_code>=101 && status_code<300 && (strcmp(method,"INVITE")==0 || strcmp(method,"SUBSCRIBE")==0)
&& to && belle_sip_header_to_get_tag(to);
void belle_sip_client_transaction_notify_response(belle_sip_client_transaction_t *t, belle_sip_response_t *resp){
......@@ -594,7 +596,7 @@ void belle_sip_client_transaction_notify_response(belle_sip_client_transaction_t
/*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)){
if (!dialog){
if (!dialog && should_dialog_be_created(t, resp)){
belle_sip_message("Handling response creating a new dialog !");
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