Commit cd11a06f authored by Simon Morlat's avatar Simon Morlat
Browse files

fix condition for accepting a request in a dialog

parent c043253b
......@@ -771,11 +771,22 @@ If an initial SUBSCRIBE is sent on a pre-existing dialog, a matching
int belle_sip_dialog_is_authorized_transaction(const belle_sip_dialog_t *dialog,const char* method) {
if (belle_sip_dialog_request_pending(dialog) && strcasecmp(method,"BYE")!=0 ){
const char* last_transaction_request = belle_sip_request_get_method(belle_sip_transaction_get_request(dialog->last_transaction));
return last_transaction_request && BELLE_SIP_OBJECT_IS_INSTANCE_OF(dialog->last_transaction,belle_sip_client_transaction_t)
&& ((strcasecmp(last_transaction_request,"SUBSCRIBE")==0 && strcasecmp(method,"NOTIFY")==0)
|| (strcasecmp(last_transaction_request,"INVITE")==0 && strcasecmp(method,"PRACK")==0));
if (belle_sip_dialog_request_pending(dialog)){
const char* last_transaction_request;
if (strcasecmp(method,"BYE")==0)
return TRUE; /*don't reject a BYE*/
last_transaction_request = belle_sip_request_get_method(belle_sip_transaction_get_request(dialog->last_transaction));
if (BELLE_SIP_OBJECT_IS_INSTANCE_OF(dialog->last_transaction,belle_sip_client_transaction_t)
&& strcmp(last_transaction_request,"SUBSCRIBE")==0 && strcmp(method,"NOTIFY")==0){
/*stupid as it is, you have to accept a NOTIFY for a SUBSCRIBE for which no answer is received yet...*/
return TRUE;
}
if (strcmp(last_transaction_request,"INVITE")==0 && strcmp(method,"PRACK")==0){
/*PRACK needs to be sent or received during reINVITEs.*/
return TRUE;
}
return FALSE;
} else {
return TRUE;
}
......
......@@ -102,10 +102,7 @@ static void belle_sip_provider_dispatch_request(belle_sip_provider_t* prov, bell
/*absorbed ACK retransmission, ignore */
return;
}
}
else if (!belle_sip_dialog_is_authorized_transaction(ev.dialog,method)){
}else if (!belle_sip_dialog_is_authorized_transaction(ev.dialog,method)){
belle_sip_server_transaction_t *tr=belle_sip_provider_create_server_transaction(prov,req);
belle_sip_server_transaction_send_response(tr,
belle_sip_response_create_from_request(req,491));
......
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