[Freeswitch-svn] [commit] r7269 - freeswitch/trunk/src/mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Thu Jan 17 14:25:01 EST 2008


Author: anthm
Date: Thu Jan 17 14:25:01 2008
New Revision: 7269

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c

Log:
add user_agent to sip lookups

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	Thu Jan 17 14:25:01 2008
@@ -469,8 +469,9 @@
 void sofia_presence_cancel(void);
 switch_status_t config_sofia(int reload, char *profile_name);
 void sofia_reg_auth_challange(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_regtype_t regtype, const char *realm, int stale);
-auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, const char *regstr, char *np, size_t nplen,
-								char *ip, switch_event_t **v_event, long exptime, sofia_regtype_t regtype, const char *to_user);
+auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, sip_t const *sip, const char *regstr, 
+								char *np, size_t nplen, char *ip, switch_event_t **v_event, long exptime, sofia_regtype_t regtype, const char *to_user);
+
 void sofia_reg_handle_sip_r_challenge(int status,
 									  char const *phrase,
 									  nua_t *nua, sofia_profile_t *profile, 

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	Thu Jan 17 14:25:01 2008
@@ -196,7 +196,7 @@
 		if (authorization) {
 			char network_ip[80];
 			get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_addr);
-			auth_res = sofia_reg_parse_auth(profile, authorization, 
+			auth_res = sofia_reg_parse_auth(profile, authorization, sip, 
 											(char *) sip->sip_request->rq_method_name, tech_pvt->key, strlen(tech_pvt->key), network_ip, NULL, 0, REG_INVITE, NULL);
 		}
 

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	Thu Jan 17 14:25:01 2008
@@ -412,8 +412,8 @@
 
 	if (authorization) {
 		char *v_contact_str;
-		if ((auth_res = sofia_reg_parse_auth(profile, authorization, sip->sip_request->rq_method_name, key, keylen, network_ip, v_event, exptime, regtype, to_user)) 
-			== AUTH_STALE) {
+		if ((auth_res = sofia_reg_parse_auth(profile, authorization, sip, sip->sip_request->rq_method_name, 
+											 key, keylen, network_ip, v_event, exptime, regtype, to_user)) == AUTH_STALE) {
 			stale = 1;
 		}
 		
@@ -757,7 +757,7 @@
 	
 }
 
-auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, const char *regstr, 
+auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, sip_t const *sip, const char *regstr, 
 		char *np, size_t nplen, char *ip, switch_event_t **v_event, long exptime, sofia_regtype_t regtype, const char *to_user)
 {
 	int indexnum;
@@ -853,8 +853,9 @@
 		free(sql);
 	} 
 	
-	pbuf = switch_mprintf("profile=%s", profile->name);
-
+	pbuf = switch_mprintf("action=sip_auth&profile=%s&user_agent=%s", 
+						  profile->name, 
+						  (sip && sip->sip_user_agent) ? sip->sip_user_agent->g_string : "unknown");
 	
 	if (!switch_strlen_zero(profile->reg_domain)) {
 		domain_name = profile->reg_domain;



More information about the Freeswitch-svn mailing list