--- asterisk/channels/chan_sip.c 2007-12-18 12:11:00.768904147 +0100 +++ asterisk-qualityfreq/channels/chan_sip.c 2007-12-18 13:56:24.594375033 +0100 @@ -180,7 +180,6 @@ #define CALLERID_UNKNOWN "Unknown" #define DEFAULT_MAXMS 2000 /*!< Qualification: Must be faster than 2 seconds by default */ -#define DEFAULT_FREQ_OK 60 * 1000 /*!< Qualification: How often to check for the host to be up */ #define DEFAULT_FREQ_NOTOK 10 * 1000 /*!< Qualification: How often to check, if the host is down... */ #define DEFAULT_RETRANS 1000 /*!< How frequently to retransmit Default: 2 * 500 ms in RFC 3261 */ @@ -1350,6 +1349,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; /*!< Time for sending SIP OPTION in sip_pke_peer() */ struct sockaddr_in defaddr; /*!< Default IP address, used until registration */ struct ast_ha *ha; /*!< Access control list */ @@ -11609,6 +11609,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) @@ -11685,6 +11686,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"); @@ -13971,7 +13973,7 @@ /* Try again eventually */ peer->pokeexpire = ast_sched_replace(peer->pokeexpire, sched, - is_reachable ? DEFAULT_FREQ_OK : DEFAULT_FREQ_NOTOK, + is_reachable ? peer->qualifyfreq : DEFAULT_FREQ_NOTOK, sip_poke_peer_s, peer); } @@ -17947,6 +17949,7 @@ /* If we have realm authentication information, remove them (reload) */ clear_realm_authentication(peer->auth); peer->auth = NULL; + peer->qualifyfreq = 60 * 1000; for (; v || ((v = alt) && !(alt=NULL)); v = v->next) { if (handle_common_options(&peerflags[0], &mask[0], v)) @@ -18137,7 +18140,14 @@ ast_log(LOG_WARNING, "Qualification of peer '%s' should be 'yes', 'no', or a number of milliseconds at line %d of sip.conf\n", peer->name, v->lineno); peer->maxms = 0; } - } else if (!strcasecmp(v->name, "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); + } + } + else if (!strcasecmp(v->name, "maxcallbitrate")) { peer->maxcallbitrate = atoi(v->value); if (peer->maxcallbitrate < 0) peer->maxcallbitrate = default_maxcallbitrate;