--- asterisk-1.4.26-orig/channels/chan_sip.c 2009-07-10 19:39:13.000000000 +0200 +++ asterisk-1.4.26/channels/chan_sip.c 2009-08-14 12:58:53.000000000 +0200 @@ -230,6 +230,7 @@ }; static struct ast_jb_conf global_jbconf; +static int default_freq_ok = DEFAULT_FREQ_OK; static const char config[] = "sip.conf"; static const char notify_config[] = "sip_notify.conf"; @@ -1141,6 +1142,7 @@ int pokeexpire; /*!< When to expire poke (qualify= checking) */ int lastms; /*!< How long last response took (in ms), or -1 for no response */ int maxms; /*!< Max ms we will accept for the host to be up, 0 to not monitor */ + int qualifyfreq; /*!< Qualification: How often to check for the host to be up */ struct timeval ps; /*!< Ping send time */ struct sockaddr_in defaddr; /*!< Default IP address, used until registration */ @@ -10966,6 +10968,7 @@ ast_cli(fd, "%s\n",status); ast_cli(fd, " Useragent : %s\n", peer->useragent); ast_cli(fd, " Reg. Contact : %s\n", peer->fullcontact); + ast_cli(fd, " Qualify Freq : %d seconds\n", peer->qualifyfreq/1000); if (peer->chanvars) { ast_cli(fd, " Variables :\n"); for (v = peer->chanvars ; v ; v = v->next) @@ -11039,6 +11042,7 @@ astman_append(s, "%s\r\n", status); astman_append(s, "SIP-Useragent: %s\r\n", peer->useragent); astman_append(s, "Reg-Contact : %s\r\n", peer->fullcontact); + astman_append(s, "Qualify Freq : %d seconds\n", peer->qualifyfreq/1000); if (peer->chanvars) { for (v = peer->chanvars ; v ; v = v->next) { astman_append(s, "ChanVariable:\n"); @@ -11191,6 +11195,7 @@ ast_cli(fd, " SIP realtime: Disabled\n" ); else ast_cli(fd, " SIP realtime: Enabled\n" ); + ast_cli(fd, " Qualify Freq : %d\n", default_freq_ok/1000); ast_cli(fd, "\nGlobal Signalling Settings:\n"); ast_cli(fd, "---------------------------\n"); @@ -13124,7 +13129,8 @@ /* Try again eventually */ peer->pokeexpire = ast_sched_add(sched, - is_reachable ? DEFAULT_FREQ_OK : DEFAULT_FREQ_NOTOK, +// old: is_reachable ? DEFAULT_FREQ_OK : DEFAULT_FREQ_NOTOK, + is_reachable ? peer->qualifyfreq : DEFAULT_FREQ_NOTOK, sip_poke_peer_s, ASTOBJ_REF(peer)); if (peer->pokeexpire == -1) { @@ -17652,6 +17658,7 @@ /* If we have realm authentication information, remove them (reload) */ clear_realm_authentication(peer->auth); peer->auth = NULL; + peer->qualifyfreq = default_freq_ok; for (; v || ((v = alt) && !(alt=NULL)); v = v->next) { if (handle_common_options(&peerflags[0], &mask[0], v)) @@ -17859,7 +17866,14 @@ peer->maxcallbitrate = atoi(v->value); if (peer->maxcallbitrate < 0) peer->maxcallbitrate = default_maxcallbitrate; + } else if (!strcasecmp(v->name, "qualifyfreq")) { + int i; + if (sscanf(v->value, "%d", &i) == 1) { + peer->qualifyfreq = i * 1000; } else { + ast_log(LOG_WARNING, "Invalid qualifyfreq number '%s' at line %d of %s\n",v->value, v->lineno, config); + } } + } if (!ast_strlen_zero(fullcontact)) { ast_copy_string(peer->fullcontact, fullcontact, sizeof(peer->fullcontact)); @@ -18007,6 +18021,7 @@ global_notifyhold = FALSE; global_alwaysauthreject = 0; global_allowsubscribe = FALSE; + default_freq_ok = DEFAULT_FREQ_OK; ast_copy_string(global_useragent, DEFAULT_USERAGENT, sizeof(global_useragent)); ast_copy_string(default_notifymime, DEFAULT_NOTIFYMIME, sizeof(default_notifymime)); if (ast_strlen_zero(ast_config_AST_SYSTEM_NAME)) @@ -18298,6 +18313,13 @@ } } else if (!strcasecmp(v->name, "callevents")) { global_callevents = ast_true(v->value); + } else if (!strcasecmp(v->name, "qualifyfreq")) { + int i; + if (sscanf(v->value, "%d", &i) == 1) { + default_freq_ok = i * 1000; + } else { + ast_log(LOG_WARNING, "Invalid qualifyfreq number '%s' at line %d of %s\n", v->value, v->lineno, config); + } } else if (!strcasecmp(v->name, "maxcallbitrate")) { default_maxcallbitrate = atoi(v->value); if (default_maxcallbitrate < 0)