- Expiration timeout is now taken from the REGISTER response
This commit is contained in:
parent
fb744b6ba4
commit
60f8c0c6b8
@ -1,11 +1,12 @@
|
|||||||
0.5.12
|
0.5.12
|
||||||
======
|
======
|
||||||
14-Jul-2005: - allocate only even port numbers for RTP traffic
|
9-Oct-2005: - Expiration timeout is now taken from the REGISTER response
|
||||||
1-Oct-2005: - [1278537] Read proxy_auth_pwfile after config file is read
|
1-Oct-2005: - [1278537] Read proxy_auth_pwfile after config file is read
|
||||||
- [1278591] Proxy-Authenticate header not included in response
|
- [1278591] Proxy-Authenticate header not included in response
|
||||||
- process empty Contact header (means "query registrations")
|
- process empty Contact header (means "query registrations")
|
||||||
(only supported for registrations at a remote server)
|
(only supported for registrations at a remote server)
|
||||||
- handle multiple Contact headers (e.g. in REGISTER response)
|
- handle multiple Contact headers (e.g. in REGISTER response)
|
||||||
|
14-Jul-2005: - allocate only even port numbers for RTP traffic
|
||||||
|
|
||||||
0.5.11
|
0.5.11
|
||||||
======
|
======
|
||||||
|
|||||||
@ -786,7 +786,10 @@ int proxy_response (sip_ticket_t *ticket) {
|
|||||||
* REGISTER returns *my* Contact header information.
|
* REGISTER returns *my* Contact header information.
|
||||||
* Rewrite Contact header back to represent the true address.
|
* Rewrite Contact header back to represent the true address.
|
||||||
* Other responses do return the Contact header of the sender.
|
* Other responses do return the Contact header of the sender.
|
||||||
|
* also change the expiration timeout to the value returned by the
|
||||||
|
* server.
|
||||||
*/
|
*/
|
||||||
|
sts = register_set_expire(ticket);
|
||||||
sip_rewrite_contact(ticket, DIR_INCOMING);
|
sip_rewrite_contact(ticket, DIR_INCOMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -601,3 +601,72 @@ int register_response(sip_ticket_t *ticket, int flag) {
|
|||||||
return STS_SUCCESS;
|
return STS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* set expiration timeout from a SIP response
|
||||||
|
*
|
||||||
|
* RETURNS
|
||||||
|
* STS_SUCCESS on success
|
||||||
|
* STS_FAILURE on error
|
||||||
|
*/
|
||||||
|
int register_set_expire(sip_ticket_t *ticket) {
|
||||||
|
int i, j;
|
||||||
|
int expires=-1;
|
||||||
|
osip_contact_t *contact;
|
||||||
|
time_t time_now;
|
||||||
|
osip_header_t *expires_hdr=NULL;
|
||||||
|
osip_uri_param_t *expires_param=NULL;
|
||||||
|
|
||||||
|
if (ticket->direction != RESTYP_INCOMING) {
|
||||||
|
WARN("register_set_expire called with != incoming response");
|
||||||
|
return STS_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
time(&time_now);
|
||||||
|
|
||||||
|
DEBUGC(DBCLASS_REG,"REGISTER response, looking for 'Expire' information");
|
||||||
|
|
||||||
|
/* evaluate Expires Header field */
|
||||||
|
osip_message_get_expires(ticket->sipmsg, 0, &expires_hdr);
|
||||||
|
|
||||||
|
/* loop for all existing contact headers in message */
|
||||||
|
for (j=0; contact != NULL; j++) {
|
||||||
|
osip_message_get_contact(ticket->sipmsg, j, &contact);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* look for an Contact expires parameter - in case of REGISTER
|
||||||
|
* these two are equal. The Contact expires has higher priority!
|
||||||
|
*/
|
||||||
|
if (contact==NULL) continue;
|
||||||
|
|
||||||
|
osip_contact_param_get_byname(contact, EXPIRES, &expires_param);
|
||||||
|
|
||||||
|
if (expires_param && expires_param->gvalue) {
|
||||||
|
/* get expires from contact Header */
|
||||||
|
expires=atoi(expires_param->gvalue);
|
||||||
|
} else if (expires_hdr && expires_hdr->hvalue) {
|
||||||
|
/* get expires from expires Header */
|
||||||
|
expires=atoi(expires_hdr->hvalue);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (expires > 0) {
|
||||||
|
|
||||||
|
/* search for an entry */
|
||||||
|
for (i=0;i<URLMAP_SIZE;i++){
|
||||||
|
if (urlmap[i].active == 0) continue;
|
||||||
|
if ((compare_url(contact->url, urlmap[i].masq_url)==STS_SUCCESS)) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* found a mapping entry */
|
||||||
|
if (i<URLMAP_SIZE) {
|
||||||
|
/* update registration timeout */
|
||||||
|
DEBUGC(DBCLASS_REG,"changing registration timeout to %i"
|
||||||
|
" entry [%i]", expires, i);
|
||||||
|
urlmap[i].expires=time_now+expires;
|
||||||
|
} else {
|
||||||
|
DEBUGC(DBCLASS_REG,"no urlmap entry found");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* for j */
|
||||||
|
return STS_SUCCESS;
|
||||||
|
}
|
||||||
|
|||||||
@ -406,9 +406,9 @@ int main (int argc, char *argv[])
|
|||||||
ticket.sipmsg->sip_method : "NULL") :
|
ticket.sipmsg->sip_method : "NULL") :
|
||||||
((ticket.sipmsg->reason_phrase) ?
|
((ticket.sipmsg->reason_phrase) ?
|
||||||
ticket.sipmsg->reason_phrase : "NULL")));
|
ticket.sipmsg->reason_phrase : "NULL")));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if an REQ REGISTER, check if it is directed to myself,
|
* if a REQ REGISTER, check if it is directed to myself,
|
||||||
* or am I just the outbound proxy but no registrar.
|
* or am I just the outbound proxy but no registrar.
|
||||||
* - If I'm the registrar, register & generate answer
|
* - If I'm the registrar, register & generate answer
|
||||||
* - If I'm just the outbound proxy, register, rewrite & forward
|
* - If I'm just the outbound proxy, register, rewrite & forward
|
||||||
@ -441,9 +441,7 @@ int main (int argc, char *argv[])
|
|||||||
sts = proxy_request(&ticket);
|
sts = proxy_request(&ticket);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (MSG_IS_REQUEST(ticket.sipmsg)) {
|
sip_gen_response(&ticket, 408 /*request timeout*/);
|
||||||
sip_gen_response(&ticket, 408 /*request timeout*/);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
WARN("non-authorized registration attempt from %s",
|
WARN("non-authorized registration attempt from %s",
|
||||||
|
|||||||
@ -131,6 +131,7 @@ void register_save(void);
|
|||||||
int register_client(sip_ticket_t *ticket, int force_lcl_masq); /*X*/
|
int register_client(sip_ticket_t *ticket, int force_lcl_masq); /*X*/
|
||||||
void register_agemap(void);
|
void register_agemap(void);
|
||||||
int register_response(sip_ticket_t *ticket, int flag); /*X*/
|
int register_response(sip_ticket_t *ticket, int flag); /*X*/
|
||||||
|
int register_set_expire(sip_ticket_t *ticket); /*X*/
|
||||||
|
|
||||||
/* proxy.c */
|
/* proxy.c */
|
||||||
int proxy_request (sip_ticket_t *ticket); /*X*/
|
int proxy_request (sip_ticket_t *ticket); /*X*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user