Commit 70be244d authored by jehan's avatar jehan
Browse files

check dialog state before creating request from dialog

parent 6b41cfa0
......@@ -474,6 +474,7 @@ typedef struct _belle_sip_header_subscription_state belle_sip_header_subscriptio
belle_sip_header_subscription_state_t* belle_sip_header_subscription_state_new();
belle_sip_header_subscription_state_t* belle_sip_header_subscription_state_parse (const char* subscription_state) ;
belle_sip_header_subscription_state_t* belle_sip_header_subscription_state_create (const char* subscription_state,int expires);
const char* belle_sip_header_subscription_state_get_state(const belle_sip_header_subscription_state_t* subscription_state);
int belle_sip_header_subscription_state_get_expires(const belle_sip_header_subscription_state_t* subscription_state);
......
......@@ -1125,7 +1125,7 @@ static void belle_sip_header_subscription_state_clone(belle_sip_header_subscript
int belle_sip_header_subscription_state_marshal(belle_sip_header_subscription_state_t* subscription_state, char* buff,unsigned int offset,unsigned int buff_size) {
unsigned int current_offset=offset;
current_offset+=belle_sip_header_marshal(BELLE_SIP_HEADER(subscription_state), buff,current_offset, buff_size);
current_offset+=snprintf(buff+current_offset,buff_size-current_offset," %s",subscription_state->state);
current_offset+=snprintf(buff+current_offset,buff_size-current_offset,"%s",subscription_state->state);
current_offset+=belle_sip_parameters_marshal(BELLE_SIP_PARAMETERS(subscription_state), buff,current_offset, buff_size);
return current_offset-offset;
}
......@@ -1135,3 +1135,9 @@ GET_SET_STRING(belle_sip_header_subscription_state,state);
GET_SET_STRING_PARAM(belle_sip_header_subscription_state,reason);
GET_SET_INT_PARAM2(belle_sip_header_subscription_state,retry-after,int,retry_after);
GET_SET_INT_PARAM(belle_sip_header_subscription_state,expires,int)
belle_sip_header_subscription_state_t* belle_sip_header_subscription_state_create (const char* subscription_state,int expires) {
belle_sip_header_subscription_state_t* sub_state=belle_sip_header_subscription_state_new();
belle_sip_header_subscription_state_set_state(sub_state,subscription_state);
belle_sip_header_subscription_state_set_expires(sub_state,expires);
return sub_state;
}
......@@ -344,6 +344,10 @@ belle_sip_request_t *belle_sip_dialog_create_ack(belle_sip_dialog_t *obj, unsign
}
belle_sip_request_t *belle_sip_dialog_create_request(belle_sip_dialog_t *obj, const char *method){
if (obj->state != BELLE_SIP_DIALOG_CONFIRMED && obj->state != BELLE_SIP_DIALOG_EARLY) {
belle_sip_error("Cannot create method [%s] from dialog [%p] in state [%s]",method,obj,belle_sip_dialog_state_to_string(obj->dialog));
return NULL;
}
if (obj->local_cseq==0) obj->local_cseq=110;
if (strcmp(method,"ACK")!=0) obj->local_cseq++;
belle_sip_request_t *req=belle_sip_request_create(belle_sip_header_address_get_uri(obj->remote_target),
......
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