]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5341 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 23 Apr 2013 19:49:07 +0000 (14:49 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 23 Apr 2013 19:49:36 +0000 (14:49 -0500)
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia_reg.c

index 622967d839afd57f8d6f06bf4c0e513f8c8fa0c4..b75ce46df26ad0c47728166d2d8218e5006adde6 100644 (file)
@@ -28,6 +28,7 @@
  * Paul D. Tinsley <pdt at jackhammer.org>
  * Bret McDanel <trixter AT 0xdecafbad.com>
  * Raymond Chandler <intralanman@freeswitch.org>
+ * Emmanuel Schmidbauer <e.schmidbauer@gmail.com>
  *
  *
  * mod_sofia.c -- SOFIA SIP Endpoint
@@ -597,7 +598,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
                                                        }
                                                        
                                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Challenging call\n");
-                                                       sofia_reg_auth_challenge(tech_pvt->profile, tech_pvt->nh, NULL, REG_INVITE, to_host, 0);                                                
+                                                       sofia_reg_auth_challenge(tech_pvt->profile, tech_pvt->nh, NULL, REG_INVITE, to_host, 0, 0);                                             
                                                        *reason = '\0';
                                                }
                                                break;
index a9c00cb4fb9d5d54b1561dfb7c4ec65856360c79..269b5577e05b021d8caf0c4644c3ce3718cd65f1 100644 (file)
@@ -29,6 +29,7 @@
  * Bret McDanel <trixter AT 0xdecafbad.com>
  * Marcel Barbulescu <marcelbarbulescu@gmail.com>
  * Raymond Chandler <intralanman@gmail.com>
+ * Emmanuel Schmidbauer <e.schmidbauer@gmail.com> 
  *
  *
  * mod_sofia.h -- SOFIA SIP Endpoint
@@ -986,7 +987,7 @@ void sofia_presence_event_handler(switch_event_t *event);
 void sofia_presence_cancel(void);
 switch_status_t config_sofia(sofia_config_t reload, char *profile_name);
 void sofia_reg_auth_challenge(sofia_profile_t *profile, nua_handle_t *nh, sofia_dispatch_event_t *de,
-                                                         sofia_regtype_t regtype, const char *realm, int stale);
+                                                         sofia_regtype_t regtype, const char *realm, int stale, long exptime);
 auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization,
                                                                sip_t const *sip,
                                                                sofia_dispatch_event_t *de, const char *regstr, char *np, size_t nplen, char *ip, switch_event_t **v_event,
index e7b1ae7560bd94cd622f7e3cd5419d11b243801c..ed9f82fa9ba0108d5a9d93a09c64c212c7288bc3 100644 (file)
@@ -31,6 +31,7 @@
  * David Knell <>
  * Eliot Gable <egable AT.AT broadvox.com>
  * Leon de Rooij <leon@scarlet-internet.nl>
+ * Emmanuel Schmidbauer <e.schmidbauer@gmail.com>
  *
  *
  * sofia_reg.c -- SOFIA SIP Endpoint (registration code)
@@ -988,7 +989,7 @@ switch_console_callback_match_t *sofia_reg_find_reg_url_with_positive_expires_mu
 
 
 void sofia_reg_auth_challenge(sofia_profile_t *profile, nua_handle_t *nh, sofia_dispatch_event_t *de,
-                                                         sofia_regtype_t regtype, const char *realm, int stale)
+                                                         sofia_regtype_t regtype, const char *realm, int stale, long exptime)
 {
        switch_uuid_t uuid;
        char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
@@ -1005,7 +1006,7 @@ void sofia_reg_auth_challenge(sofia_profile_t *profile, nua_handle_t *nh, sofia_
 
        sql = switch_mprintf("insert into sip_authentication (nonce,expires,profile_name,hostname, last_nc) "
                                                 "values('%q', %ld, '%q', '%q', 0)", uuid_str,
-                                                (long) switch_epoch_time_now(NULL) + (profile->nonce_ttl ? profile->nonce_ttl : DEFAULT_NONCE_TTL),
+                                                (long) switch_epoch_time_now(NULL) + (profile->nonce_ttl ? profile->nonce_ttl : DEFAULT_NONCE_TTL) + exptime,
                                                 profile->name, mod_sofia_globals.hostname);
        switch_assert(sql != NULL);
        sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
@@ -1513,7 +1514,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
                        realm = from_host;
                }
 
-               sofia_reg_auth_challenge(profile, nh, de, regtype, realm, stale);
+               sofia_reg_auth_challenge(profile, nh, de, regtype, realm, stale, exptime);
 
                if (profile->debug) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send challenge for [%s@%s]\n", to_user, to_host);
@@ -2848,7 +2849,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
 #define        LL_FMT "l"
 #endif
                sql = switch_mprintf("update sip_authentication set expires='%" LL_FMT "u',last_nc=%lu where nonce='%s'",
-                                                        switch_epoch_time_now(NULL) + (profile->nonce_ttl ? profile->nonce_ttl : exptime + 10), ncl, nonce);
+                                                        switch_epoch_time_now(NULL) + (profile->nonce_ttl ? profile->nonce_ttl : DEFAULT_NONCE_TTL) + exptime, ncl, nonce);
 
                switch_assert(sql != NULL);
                sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);