- Call logging: display FROM & TO for calls.

This commit is contained in:
Thomas Ries 2005-12-28 19:01:59 +00:00
parent 9fd646574e
commit 888f998c8d
2 changed files with 38 additions and 28 deletions

View File

@ -1,5 +1,6 @@
0.5.12
======
28-Dec-2005: - Call logging: display FROM & TO for calls.
26-Dec-2005: - Added a short-dial feature ("pi_shortdial_*" config options)
18-Dec-2005: - Grandstream "unregister at startup" works now
9-Oct-2005: - Expiration timeout is now taken from the REGISTER response

View File

@ -111,38 +111,47 @@ int proxy_request (sip_ticket_t *ticket) {
* logging of passing calls
*/
if (configuration.log_calls) {
osip_uri_t *cont_url = NULL;
if (!osip_list_eol(request->contacts, 0))
cont_url = ((osip_contact_t*)(request->contacts->node->element))->url;
osip_uri_t *from_url = NULL;
osip_uri_t *to_url = NULL;
char *to_username =NULL;
char *to_host = NULL;
char *from_username =NULL;
char *from_host = NULL;
/* From: 1st preference is contact header, then use From field */
if (!osip_list_eol(request->contacts, 0)) {
from_url = ((osip_contact_t*)(request->contacts->node->element))->url;
} else {
from_url = request->from->url;
}
to_url = request->to->url;
if (to_url) {
to_username = to_url->username;
to_host = to_url->host;
}
if (from_url) {
from_username = from_url->username;
from_host = from_url->host;
}
/* INVITE */
if (MSG_IS_INVITE(request)) {
if (cont_url) {
INFO("%s Call from: %s@%s",
(type==REQTYP_INCOMING) ? "Incoming":"Outgoing",
cont_url->username ? cont_url->username:"*NULL*",
cont_url->host ? cont_url->host : "*NULL*");
} else {
INFO("%s Call (w/o contact header) from: %s@%s",
(type==REQTYP_INCOMING) ? "Incoming":"Outgoing",
request->from->url->username ?
request->from->url->username:"*NULL*",
request->from->url->host ?
request->from->url->host : "*NULL*");
}
INFO("%s Call: %s@%s -> %s@%s",
(type==REQTYP_INCOMING) ? "Incoming":"Outgoing",
from_username ? from_username: "*NULL*",
from_host ? from_host : "*NULL*",
to_username ? to_username : "*NULL*",
to_host ? to_host : "*NULL*");
/* BYE / CANCEL */
} else if (MSG_IS_BYE(request) || MSG_IS_CANCEL(request)) {
if (cont_url) {
INFO("Ending Call from: %s@%s",
cont_url->username ? cont_url->username:"*NULL*",
cont_url->host ? cont_url->host : "*NULL*");
} else {
INFO("Ending Call (w/o contact header) from: %s@%s",
request->from->url->username ?
request->from->url->username:"*NULL*",
request->from->url->host ?
request->from->url->host : "*NULL*");
}
INFO("Ending Call: %s@%s -> %s@%s",
from_username ? from_username: "*NULL*",
from_host ? from_host : "*NULL*",
to_username ? to_username : "*NULL*",
to_host ? to_host : "*NULL*");
}
} /* log_calls */