- Default Expires timeout is now configurable.

This commit is contained in:
Thomas Ries 2004-10-24 08:38:02 +00:00
parent 78ef28f802
commit dd3c548fa0
4 changed files with 20 additions and 5 deletions

View File

@ -169,6 +169,7 @@ static int parse_config (FILE *configfile) {
{ "registration_file", TYP_STRING ,&configuration.registrationfile }, { "registration_file", TYP_STRING ,&configuration.registrationfile },
{ "log_calls", TYP_INT4, &configuration.log_calls }, { "log_calls", TYP_INT4, &configuration.log_calls },
{ "pid_file", TYP_STRING ,&configuration.pid_file }, { "pid_file", TYP_STRING ,&configuration.pid_file },
{ "default_expires", TYP_INT4 ,&configuration.default_expires },
{0, 0, 0} {0, 0, 0}
}; };
@ -294,3 +295,12 @@ static int parse_config (FILE *configfile) {
} // while } // while
return STS_SUCCESS; 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;
}

View File

@ -237,10 +237,13 @@ int register_client(sip_ticket_t *ticket, int force_lcl_masq) {
/* get expires from expires Header */ /* get expires from expires Header */
expires=atoi(expires_hdr->hvalue); expires=atoi(expires_hdr->hvalue);
} else { } else {
char tmp[16];
/* it seems, the expires field is not present everywhere... */ /* it seems, the expires field is not present everywhere... */
DEBUGC(DBCLASS_REG,"no 'expires' header found - set time to 600 sec"); DEBUGC(DBCLASS_REG,"no 'expires' header found - set time to %i sec",
expires=600; configuration.default_expires);
osip_message_set_expires(ticket->sipmsg, "600"); expires=configuration.default_expires;
sprintf(tmp,"%i",expires);
osip_message_set_expires(ticket->sipmsg, tmp);
} }
url1_to=ticket->sipmsg->to->url; url1_to=ticket->sipmsg->to->url;

View File

@ -110,8 +110,7 @@ int main (int argc, char *argv[])
/* /*
* prepare default configuration * prepare default configuration
*/ */
memset (&configuration, 0, sizeof(configuration)); make_default_config();
configuration.sip_listen_port=SIP_PORT;
log_set_pattern(configuration.debuglevel); log_set_pattern(configuration.debuglevel);

View File

@ -81,6 +81,7 @@ struct siproxd_config {
char *registrationfile; char *registrationfile;
int log_calls; int log_calls;
char *pid_file; char *pid_file;
int default_expires;
}; };
/* /*
@ -163,6 +164,7 @@ int sip_calculate_branch_id (sip_ticket_t *ticket, char *id); /*X*/
/* readconf.c */ /* readconf.c */
int read_config(char *name, int search); /*X*/ int read_config(char *name, int search); /*X*/
int make_default_config(void); /*X*/
/* rtpproxy.c */ /* rtpproxy.c */
int rtpproxy_init( void ); /*X*/ 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 SIP_PORT 5060 /* default port to listen */
#define DEFAULT_MAXFWD 70 /* default Max-Forward count */ #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 URLMAP_SIZE 32 /* number of URL mapping table entries */
#define RTPPROXY_SIZE 64 /* number of rtp proxy entries */ #define RTPPROXY_SIZE 64 /* number of rtp proxy entries */