diff --git a/src/readconf.c b/src/readconf.c index d586dd1..4ac9ea3 100644 --- a/src/readconf.c +++ b/src/readconf.c @@ -169,6 +169,7 @@ static int parse_config (FILE *configfile) { { "registration_file", TYP_STRING ,&configuration.registrationfile }, { "log_calls", TYP_INT4, &configuration.log_calls }, { "pid_file", TYP_STRING ,&configuration.pid_file }, + { "default_expires", TYP_INT4 ,&configuration.default_expires }, {0, 0, 0} }; @@ -294,3 +295,12 @@ static int parse_config (FILE *configfile) { } // while return STS_SUCCESS; } + + +int make_default_config(void){ + memset (&configuration, 0, sizeof(configuration)); + configuration.sip_listen_port=SIP_PORT; + configuration.default_expires=DEFAULT_EXPIRES; + + return STS_SUCCESS; +} diff --git a/src/register.c b/src/register.c index b242c22..ca723ec 100644 --- a/src/register.c +++ b/src/register.c @@ -237,10 +237,13 @@ int register_client(sip_ticket_t *ticket, int force_lcl_masq) { /* get expires from expires Header */ expires=atoi(expires_hdr->hvalue); } else { + char tmp[16]; /* it seems, the expires field is not present everywhere... */ - DEBUGC(DBCLASS_REG,"no 'expires' header found - set time to 600 sec"); - expires=600; - osip_message_set_expires(ticket->sipmsg, "600"); + DEBUGC(DBCLASS_REG,"no 'expires' header found - set time to %i sec", + configuration.default_expires); + expires=configuration.default_expires; + sprintf(tmp,"%i",expires); + osip_message_set_expires(ticket->sipmsg, tmp); } url1_to=ticket->sipmsg->to->url; diff --git a/src/siproxd.c b/src/siproxd.c index c94cab6..f3cc038 100644 --- a/src/siproxd.c +++ b/src/siproxd.c @@ -110,8 +110,7 @@ int main (int argc, char *argv[]) /* * prepare default configuration */ - memset (&configuration, 0, sizeof(configuration)); - configuration.sip_listen_port=SIP_PORT; + make_default_config(); log_set_pattern(configuration.debuglevel); diff --git a/src/siproxd.h b/src/siproxd.h index 80ad6d1..28aef67 100644 --- a/src/siproxd.h +++ b/src/siproxd.h @@ -81,6 +81,7 @@ struct siproxd_config { char *registrationfile; int log_calls; char *pid_file; + int default_expires; }; /* @@ -163,6 +164,7 @@ int sip_calculate_branch_id (sip_ticket_t *ticket, char *id); /*X*/ /* readconf.c */ int read_config(char *name, int search); /*X*/ +int make_default_config(void); /*X*/ /* rtpproxy.c */ int rtpproxy_init( void ); /*X*/ @@ -205,6 +207,7 @@ int comp_osip_message_parse (osip_message_t *sip, const char *message); */ #define SIP_PORT 5060 /* default port to listen */ #define DEFAULT_MAXFWD 70 /* default Max-Forward count */ +#define DEFAULT_EXPIRES 3600 /* default Expires timeout */ #define URLMAP_SIZE 32 /* number of URL mapping table entries */ #define RTPPROXY_SIZE 64 /* number of rtp proxy entries */