Commit bc035c08 authored by jehan's avatar jehan

fix tag

fix automatic ack
fix Proxy-auth parsing
parent ed09a7e6
......@@ -173,6 +173,7 @@ belle_sip_header_contact_t* belle_sip_header_contact_create (const belle_sip_hea
void belle_sip_header_to_set_random_tag(belle_sip_header_to_t *obj);
#define BELLE_SIP_HEADER_TO(t) BELLE_SIP_CAST(t,belle_sip_header_to_t)
#define BELLE_SIP_TO "To"
/******************************
* Via header object inherent from header_address
......@@ -219,6 +220,7 @@ belle_sip_header_call_id_t* belle_sip_header_call_id_parse (const char* call_id)
const char* belle_sip_header_call_id_get_call_id(const belle_sip_header_call_id_t* call_id);
void belle_sip_header_call_id_set_call_id(belle_sip_header_call_id_t* via,const char* call_id);
#define BELLE_SIP_HEADER_CALL_ID(t) BELLE_SIP_CAST(t,belle_sip_header_call_id_t)
#define BELLE_SIP_CALL_ID "Call-ID"
/******************************
* cseq object inherent from object
*
......
......@@ -291,7 +291,7 @@ int belle_sip_header_to_marshal(belle_sip_header_to_t* to, char* buff,unsigned i
BELLE_SIP_FROM_LIKE_MARSHAL(to)
}
BELLE_SIP_NEW_HEADER(header_to,header_address,"To")
BELLE_SIP_NEW_HEADER(header_to,header_address,BELLE_SIP_TO)
BELLE_SIP_PARSE(header_to)
GET_SET_STRING_PARAM(belle_sip_header_to,tag);
......@@ -305,7 +305,7 @@ belle_sip_header_to_t* belle_sip_header_to_create2(const char *address, const ch
belle_sip_header_to_t* belle_sip_header_to_create(const belle_sip_header_address_t* address, const char *tag) {
belle_sip_header_to_t* header= belle_sip_header_to_new();
belle_sip_header_address_clone(BELLE_SIP_HEADER_ADDRESS(header),address);
belle_sip_header_to_set_tag(header,tag);
if (tag) belle_sip_header_to_set_tag(header,tag);
return header;
}
void belle_sip_header_to_set_random_tag(belle_sip_header_to_t *obj){
......@@ -485,7 +485,7 @@ int belle_sip_header_call_id_marshal(belle_sip_header_call_id_t* call_id, char*
return current_offset-offset;
}
BELLE_SIP_NEW_HEADER(header_call_id,header,"Call-ID")
BELLE_SIP_NEW_HEADER(header_call_id,header,BELLE_SIP_CALL_ID)
BELLE_SIP_PARSE(header_call_id)
GET_SET_STRING(belle_sip_header_call_id,call_id);
/**************************
......
......@@ -1070,6 +1070,8 @@ header_extension[ANTLR3_BOOLEAN check_for_known_header] returns [belle_sip_head
$ret = BELLE_SIP_HEADER(belle_sip_header_proxy_authorization_parse((const char*)$header_extension.text->chars));
} else if (check_for_known_header && strcmp("WWW-Authenticate",(const char*)$header_name.text->chars) == 0) {
$ret = BELLE_SIP_HEADER(belle_sip_header_www_authenticate_parse((const char*)$header_extension.text->chars));
} else if (check_for_known_header && strcmp("Proxy-Authenticate",(const char*)$header_name.text->chars) == 0) {
$ret = BELLE_SIP_HEADER(belle_sip_header_proxy_authenticate_parse((const char*)$header_extension.text->chars));
} else if (check_for_known_header && strcmp("Max-Forwards",(const char*)$header_name.text->chars) == 0) {
$ret = BELLE_SIP_HEADER(belle_sip_header_max_forwards_parse((const char*)$header_extension.text->chars));
} else if (check_for_known_header && strcmp("User-Agent",(const char*)$header_name.text->chars) == 0) {
......
......@@ -83,14 +83,12 @@ static int get_message_start_pos(char *buff, size_t bufflen) {
saved_char1_index=bufflen-1;
saved_char1=buff[saved_char1_index]; /*make sure buff is null terminated*/
buff[saved_char1_index]='\0';
if ((res=sscanf(buff+i,"SIP/2.0 %d ",&status_code)) == 1) {
buff[saved_char1_index]=saved_char1;
return i;
}
if (res==1) return i;
else {
res=sscanf(buff+i,"SIP/2.0 %d ",&status_code);
if (res!=1) {
res=sscanf(buff+i,"%16s %*s SIP/2.0 ",method);
}
buff[saved_char1_index]=saved_char1;
if (res==1) return i;
}
return -1;
}
......
......@@ -54,16 +54,18 @@ static belle_sip_request_t *make_ack(belle_sip_ict_t *obj, belle_sip_response_t
obj->ack=belle_sip_request_new();
belle_sip_request_set_method(obj->ack,"ACK");
belle_sip_request_set_uri(obj->ack,belle_sip_request_get_uri(base->request));
belle_sip_util_copy_headers((belle_sip_message_t*)base->request,(belle_sip_message_t*)obj->ack,"via",FALSE);
belle_sip_util_copy_headers((belle_sip_message_t*)base->request,(belle_sip_message_t*)obj->ack,"call-id",FALSE);
belle_sip_util_copy_headers((belle_sip_message_t*)base->request,(belle_sip_message_t*)obj->ack,"from",FALSE);
belle_sip_util_copy_headers((belle_sip_message_t*)base->request,(belle_sip_message_t*)obj->ack,"route",TRUE);
belle_sip_util_copy_headers((belle_sip_message_t*)base->request,(belle_sip_message_t*)obj->ack,BELLE_SIP_VIA,FALSE);
belle_sip_util_copy_headers((belle_sip_message_t*)base->request,(belle_sip_message_t*)obj->ack,BELLE_SIP_CALL_ID,FALSE);
belle_sip_util_copy_headers((belle_sip_message_t*)base->request,(belle_sip_message_t*)obj->ack,BELLE_SIP_FROM,FALSE);
belle_sip_util_copy_headers((belle_sip_message_t*)resp,(belle_sip_message_t*)obj->ack,BELLE_SIP_TO,FALSE);
belle_sip_util_copy_headers((belle_sip_message_t*)base->request,(belle_sip_message_t*)obj->ack,BELLE_SIP_CONTACT,TRUE);
belle_sip_util_copy_headers((belle_sip_message_t*)base->request,(belle_sip_message_t*)obj->ack,BELLE_SIP_ROUTE,TRUE);
belle_sip_message_add_header((belle_sip_message_t*)obj->ack,
(belle_sip_header_t*)belle_sip_header_cseq_create(
belle_sip_header_cseq_get_seq_number((belle_sip_header_cseq_t*)belle_sip_message_get_header((belle_sip_message_t*)base->request,"cseq")),
belle_sip_header_cseq_get_seq_number((belle_sip_header_cseq_t*)belle_sip_message_get_header((belle_sip_message_t*)base->request,BELLE_SIP_CSEQ)),
"CANCEL"));
}
belle_sip_util_copy_headers((belle_sip_message_t*)resp,(belle_sip_message_t*)obj->ack,"to",FALSE);
return obj->ack;
}
......
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