Commit ba5c902b authored by jehan's avatar jehan
Browse files

add option sip_update to linphonerc to disable SIP UPDATE

parent a5af301c
......@@ -451,6 +451,7 @@ Sal * sal_init(){
sal->tls_verify=TRUE;
sal->tls_verify_cn=TRUE;
sal->refresher_retry_after=60000; /*default value in ms*/
sal->enable_sip_update=TRUE;
return sal;
}
......@@ -999,4 +1000,7 @@ void sal_cancel_timer(Sal *sal, belle_sip_source_t *timer) {
belle_sip_main_loop_t *ml = belle_sip_stack_get_main_loop(sal->stack);
belle_sip_main_loop_remove_source(ml, timer);
}
void sal_enable_sip_update_method(Sal *ctx,bool_t value) {
ctx->enable_sip_update=value;
}
......@@ -48,6 +48,7 @@ struct Sal{
bool_t auto_contacts;
bool_t enable_test_features;
bool_t no_initial_route;
bool_t enable_sip_update; /*true by default*/
};
typedef enum SalOpState {
......
......@@ -564,6 +564,9 @@ static void process_request_event(void *op_base, const belle_sip_request_event_t
} else if (strcmp("MESSAGE",method)==0){
sal_process_incoming_message(op,event);
} else if (strcmp("UPDATE",method)==0) {
/*FIXME jehan: It might be better to silently accept UPDATE which do not modify either the number or the nature of streams*/
/*rfc 3311
* 5.2 Receiving an UPDATE
* ...
......@@ -571,8 +574,9 @@ static void process_request_event(void *op_base, const belle_sip_request_event_t
* the request with a 504 response.
*/
resp=sal_op_create_response_from_request(op,req,504);
belle_sip_message_add_header( BELLE_SIP_MESSAGE(resp)
,belle_sip_header_create( "Warning", "Cannot change the session parameters without prompting the user"));
belle_sip_response_set_reason_phrase(resp,"Cannot change the session parameters without prompting the user");
/*belle_sip_message_add_header( BELLE_SIP_MESSAGE(resp)
,belle_sip_header_create( "Warning", "Cannot change the session parameters without prompting the user"));*/
belle_sip_server_transaction_send_response(server_transaction,resp);
return;
}else{
......@@ -610,14 +614,16 @@ int sal_call_set_local_media_description(SalOp *op, SalMediaDescription *desc){
return 0;
}
static belle_sip_header_allow_t *create_allow(){
static belle_sip_header_allow_t *create_allow(bool_t enable_update){
belle_sip_header_allow_t* header_allow;
header_allow = belle_sip_header_allow_create("INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO, UPDATE");
char allow [256];
snprintf(allow,sizeof(allow),"INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO%s",(enable_update?", UPDATE":""));
header_allow = belle_sip_header_allow_create(allow);
return header_allow;
}
static void sal_op_fill_invite(SalOp *op, belle_sip_request_t* invite) {
belle_sip_message_add_header(BELLE_SIP_MESSAGE(invite),BELLE_SIP_HEADER(create_allow()));
belle_sip_message_add_header(BELLE_SIP_MESSAGE(invite),BELLE_SIP_HEADER(create_allow(op->base.root->enable_sip_update)));
if (op->base.root->session_expires!=0){
belle_sip_message_add_header(BELLE_SIP_MESSAGE(invite),belle_sip_header_create( "Session-expires", "200"));
......@@ -745,7 +751,7 @@ int sal_call_accept(SalOp*h){
ms_error("Fail to build answer for call");
return -1;
}
belle_sip_message_add_header(BELLE_SIP_MESSAGE(response),BELLE_SIP_HEADER(create_allow()));
belle_sip_message_add_header(BELLE_SIP_MESSAGE(response),BELLE_SIP_HEADER(create_allow(h->base.root->enable_sip_update)));
if (h->base.root->session_expires!=0){
if (h->supports_session_timers) {
belle_sip_message_add_header(BELLE_SIP_MESSAGE(response),belle_sip_header_create("Supported", "timer"));
......
......@@ -754,6 +754,7 @@ static void sip_config_read(LinphoneCore *lc)
linphone_core_enable_keep_alive(lc, (lc->sip_conf.keepalive_period > 0));
sal_use_one_matching_codec_policy(lc->sal,lp_config_get_int(lc->config,"sip","only_one_codec",0));
sal_use_dates(lc->sal,lp_config_get_int(lc->config,"sip","put_date",0));
sal_enable_sip_update_method(lc->sal,lp_config_get_int(lc->config,"sip","sip_update",1));
}
static void rtp_config_read(LinphoneCore *lc)
......
......@@ -519,6 +519,9 @@ void sal_set_keepalive_period(Sal *ctx,unsigned int value);
void sal_use_tcp_tls_keepalive(Sal *ctx, bool_t enabled);
int sal_enable_tunnel(Sal *ctx, void *tunnelclient);
void sal_disable_tunnel(Sal *ctx);
/*Default value is true*/
void sal_enable_sip_update_method(Sal *ctx,bool_t value);
/**
* returns keepalive period in ms
* 0 desactiaved
......
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