]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add user_agent to sip lookups
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 17 Jan 2008 19:25:01 +0000 (19:25 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 17 Jan 2008 19:25:01 +0000 (19:25 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7269 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_reg.c

index 91caac1df1c00bf0b14f581d084b436fda7e5bcb..e07f5e1499f3fc1a8b11c4be9e9e20edc1971204 100644 (file)
@@ -469,8 +469,9 @@ void sofia_presence_mwi_event_handler(switch_event_t *event);
 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, 
index d573568543b066370be27835960cb731466e11a8..1293458902f6e77f71478d247cd83f5bac702b91 100644 (file)
@@ -196,7 +196,7 @@ void sofia_event_callback(nua_event_t event,
                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);
                }
 
index 767a203310c33b601935deff6746dc1e5a57f27a..40f0e502e2960a428d6e246eba74d4d0436f27ec 100644 (file)
@@ -412,8 +412,8 @@ uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t *profile, nua_han
 
        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 @@ void sofia_reg_handle_sip_r_challenge(int status,
        
 }
 
-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 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t co
                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;