mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
add linphonerc option to put dates in REGISTER messages
This commit is contained in:
parent
ca80f9d914
commit
2448f16d92
4 changed files with 30 additions and 1 deletions
|
|
@ -620,6 +620,7 @@ static void sip_config_read(LinphoneCore *lc)
|
|||
sal_use_one_matching_codec_policy(lc->sal,lp_config_get_int(lc->config,"sip","only_one_codec",0));
|
||||
sal_use_double_registrations(lc->sal,lp_config_get_int(lc->config,"sip","use_double_registrations",1));
|
||||
sal_set_dscp(lc->sal,linphone_core_get_sip_dscp(lc));
|
||||
sal_use_dates(lc->sal,lp_config_get_int(lc->config,"sip","put_date",0));
|
||||
}
|
||||
|
||||
static void rtp_config_read(LinphoneCore *lc)
|
||||
|
|
|
|||
|
|
@ -340,6 +340,7 @@ unsigned int sal_get_keepalive_period(Sal *ctx);
|
|||
void sal_use_session_timers(Sal *ctx, int expires);
|
||||
void sal_use_double_registrations(Sal *ctx, bool_t enabled);
|
||||
void sal_expire_old_registration_contacts(Sal *ctx, bool_t enabled);
|
||||
void sal_use_dates(Sal *ctx, bool_t enabled);
|
||||
void sal_reuse_authorization(Sal *ctx, bool_t enabled);
|
||||
void sal_use_one_matching_codec_policy(Sal *ctx, bool_t one_matching_codec);
|
||||
void sal_use_rport(Sal *ctx, bool_t use_rports);
|
||||
|
|
|
|||
|
|
@ -283,6 +283,7 @@ Sal * sal_init(){
|
|||
sal->rootCa = 0;
|
||||
sal->verify_server_certs=TRUE;
|
||||
sal->expire_old_contact=FALSE;
|
||||
sal->add_dates=FALSE;
|
||||
sal->dscp=-1;
|
||||
return sal;
|
||||
}
|
||||
|
|
@ -460,6 +461,10 @@ void sal_expire_old_registration_contacts(Sal *ctx, bool_t enabled){
|
|||
ctx->expire_old_contact=enabled;
|
||||
}
|
||||
|
||||
void sal_use_dates(Sal *ctx, bool_t enabled){
|
||||
ctx->add_dates=enabled;
|
||||
}
|
||||
|
||||
void sal_use_rport(Sal *ctx, bool_t use_rports){
|
||||
ctx->use_rports=use_rports;
|
||||
}
|
||||
|
|
@ -2215,6 +2220,25 @@ static void sal_register_add_route(osip_message_t *msg, const char *proxy){
|
|||
osip_message_set_route(msg,tmp);
|
||||
}
|
||||
|
||||
static const char *days[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
|
||||
static const char *months[]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
|
||||
|
||||
static void sal_register_set_date(osip_message_t *msg){
|
||||
char tmp[256]={0};
|
||||
time_t curtime=time(NULL);
|
||||
struct tm *ret;
|
||||
#ifndef WIN32
|
||||
struct tm gmt;
|
||||
ret=gmtime_r(&curtime,&gmt);
|
||||
#else
|
||||
ret=gmtime(&curtime);
|
||||
#endif
|
||||
/*cannot use strftime because it is locale dependant*/
|
||||
snprintf(tmp,sizeof(tmp)-1,"%s, %i %s %i %02i:%02i:%02i GMT",
|
||||
days[ret->tm_wday],ret->tm_mday,months[ret->tm_mon],1900+ret->tm_year,ret->tm_hour,ret->tm_min,ret->tm_sec);
|
||||
osip_message_replace_header(msg,"Date",tmp);
|
||||
}
|
||||
|
||||
int sal_register(SalOp *h, const char *proxy, const char *from, int expires){
|
||||
osip_message_t *msg;
|
||||
const char *contact=sal_op_get_contact(h);
|
||||
|
|
@ -2255,8 +2279,10 @@ int sal_register(SalOp *h, const char *proxy, const char *from, int expires){
|
|||
eXosip_register_build_register(h->rid,expires,&msg);
|
||||
sal_register_add_route(msg,proxy);
|
||||
}
|
||||
if (msg)
|
||||
if (msg){
|
||||
if (h->base.root->add_dates) sal_register_set_date(msg);
|
||||
eXosip_register_send_register(h->rid,msg);
|
||||
}
|
||||
eXosip_unlock();
|
||||
h->expires=expires;
|
||||
return (msg != NULL) ? 0 : -1;
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ struct Sal{
|
|||
bool_t reuse_authorization;
|
||||
bool_t verify_server_certs;
|
||||
bool_t expire_old_contact;
|
||||
bool_t add_dates;
|
||||
};
|
||||
|
||||
struct SalOp{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue