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

dialog progresses

parent 96575213
......@@ -157,7 +157,7 @@ static belle_sip_object_vptr_t *find_common_floor(belle_sip_object_vptr_t *vptr1
if (vptr1==it2)
return vptr1;
}
return NULL;
return find_common_floor(vptr1->parent,vptr2);
}
/*copy the content of ref object to new object, for the part they have in common in their inheritence diagram*/
......
......@@ -73,7 +73,6 @@ static int belle_sip_dialog_init_as_uas(belle_sip_dialog_t *obj, belle_sip_reque
belle_sip_header_contact_t *ct=belle_sip_message_get_header_by_type(req,belle_sip_header_contact_t);
belle_sip_header_cseq_t *cseq=belle_sip_message_get_header_by_type(req,belle_sip_header_cseq_t);
belle_sip_header_to_t *to=belle_sip_message_get_header_by_type(resp,belle_sip_header_to_t);
belle_sip_header_call_id_t *call_id=belle_sip_message_get_header_by_type(req,belle_sip_header_call_id_t);
belle_sip_header_via_t *via=belle_sip_message_get_header_by_type(req,belle_sip_header_via_t);
belle_sip_uri_t *requri=belle_sip_request_get_uri(req);
......@@ -89,10 +88,6 @@ static int belle_sip_dialog_init_as_uas(belle_sip_dialog_t *obj, belle_sip_reque
belle_sip_error("No cseq in request.");
return -1;
}
if (!call_id){
belle_sip_error("No call_id in request.");
return -1;
}
if (!via){
belle_sip_error("No via in request.");
return -1;
......@@ -108,7 +103,7 @@ static int belle_sip_dialog_init_as_uas(belle_sip_dialog_t *obj, belle_sip_reque
check_route_set(obj->route_set);
obj->remote_target=(belle_sip_header_address_t*)belle_sip_object_ref(ct);
obj->remote_cseq=belle_sip_header_cseq_get_seq_number(cseq);
obj->call_id=(belle_sip_header_call_id_t*)belle_sip_object_ref(call_id);
/*call id already set */
/*remote party already set */
obj->local_party=(belle_sip_header_address_t*)belle_sip_object_ref(to);
return 0;
......@@ -125,7 +120,6 @@ static int belle_sip_dialog_init_as_uac(belle_sip_dialog_t *obj, belle_sip_reque
belle_sip_header_contact_t *ct=belle_sip_message_get_header_by_type(resp,belle_sip_header_contact_t);
belle_sip_header_cseq_t *cseq=belle_sip_message_get_header_by_type(req,belle_sip_header_cseq_t);
belle_sip_header_to_t *to=belle_sip_message_get_header_by_type(resp,belle_sip_header_to_t);
belle_sip_header_call_id_t *call_id=belle_sip_message_get_header_by_type(req,belle_sip_header_call_id_t);
belle_sip_header_via_t *via=belle_sip_message_get_header_by_type(req,belle_sip_header_via_t);
belle_sip_uri_t *requri=belle_sip_request_get_uri(req);
......@@ -141,10 +135,6 @@ static int belle_sip_dialog_init_as_uac(belle_sip_dialog_t *obj, belle_sip_reque
belle_sip_error("No cseq in request.");
return -1;
}
if (!call_id){
belle_sip_error("No call_id in request.");
return -1;
}
if (!via){
belle_sip_error("No via in request.");
return -1;
......@@ -160,7 +150,7 @@ static int belle_sip_dialog_init_as_uac(belle_sip_dialog_t *obj, belle_sip_reque
check_route_set(obj->route_set);
obj->remote_target=(belle_sip_header_address_t*)belle_sip_object_ref(ct);
obj->local_cseq=belle_sip_header_cseq_get_seq_number(cseq);
obj->call_id=(belle_sip_header_call_id_t*)belle_sip_object_ref(call_id);
/*call id is already set */
/*local_tag is already set*/
obj->remote_party=(belle_sip_header_address_t*)belle_sip_object_ref(to);
/*local party is already set*/
......@@ -180,19 +170,29 @@ int belle_sip_dialog_establish_full(belle_sip_dialog_t *obj, belle_sip_request_t
int belle_sip_dialog_establish(belle_sip_dialog_t *obj, belle_sip_request_t *req, belle_sip_response_t *resp){
int code=belle_sip_response_get_status_code(resp);
belle_sip_header_to_t *to=belle_sip_message_get_header_by_type(resp,belle_sip_header_to_t);
belle_sip_header_call_id_t *call_id=belle_sip_message_get_header_by_type(req,belle_sip_header_call_id_t);
if (!to){
belle_sip_error("No to in response.");
return -1;
}
if (!call_id){
belle_sip_error("No call-id in response.");
return -1;
}
if (code>100 && code<200){
if (obj->state==BELLE_SIP_DIALOG_NULL)
if (obj->state==BELLE_SIP_DIALOG_NULL){
set_to_tag(obj,to);
obj->state=BELLE_SIP_DIALOG_EARLY;
obj->call_id=(belle_sip_header_call_id_t*)belle_sip_object_ref(call_id);
obj->state=BELLE_SIP_DIALOG_EARLY;
}
return -1;
}else if (code>=200 && code<300){
if (obj->state==BELLE_SIP_DIALOG_NULL)
if (obj->state==BELLE_SIP_DIALOG_NULL){
set_to_tag(obj,to);
obj->call_id=(belle_sip_header_call_id_t*)belle_sip_object_ref(call_id);
}
if (belle_sip_dialog_establish_full(obj,req,resp)==0){
obj->state=BELLE_SIP_DIALOG_CONFIRMED;
obj->needs_ack=TRUE;
......
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