diff -ru asterisk-original/channels/chan_sip.c asterisk/channels/chan_sip.c --- asterisk-original/channels/chan_sip.c 2008-01-02 11:43:07.299249028 +0100 +++ asterisk/channels/chan_sip.c 2008-01-02 22:46:21.778148732 +0100 @@ -208,6 +208,7 @@ }; static struct ast_jb_conf global_jbconf; /*!< Global jitterbuffer configuration */ +static int default_freq_ok = DEFAULT_FREQ_OK; static const char config[] = "sip.conf"; /*!< Main configuration file */ static const char notify_config[] = "sip_notify.conf"; /*!< Configuration file for sending Notify with CLI commands to reconfigure or reboot phones */ @@ -1351,6 +1352,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 */ @@ -11648,6 +11650,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) @@ -11724,6 +11727,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"); @@ -11969,6 +11973,7 @@ ast_cli(a->fd, " SIP realtime: Disabled\n" ); else ast_cli(a->fd, " SIP realtime: Enabled\n" ); + ast_cli(a->fd, " Qualify Freq : %d\n", default_freq_ok/1000); ast_cli(a->fd, "\nNetwork Settings:\n"); ast_cli(a->fd, "---------------------------\n"); @@ -14010,7 +14015,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); } @@ -18010,6 +18015,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)) @@ -18200,7 +18206,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; @@ -18363,6 +18376,7 @@ global_directrtpsetup = FALSE; /* Experimental feature, disabled by default */ global_alwaysauthreject = 0; global_allowsubscribe = FALSE; + default_freq_ok = DEFAULT_FREQ_OK; snprintf(global_useragent, sizeof(global_useragent), "%s %s", DEFAULT_USERAGENT, ASTERISK_VERSION); snprintf(global_sdpsession, sizeof(global_sdpsession), "%s %s", DEFAULT_SDPSESSION, ASTERISK_VERSION); snprintf(global_sdpowner, sizeof(global_sdpowner), "%s", DEFAULT_SDPOWNER); @@ -18680,7 +18694,15 @@ ast_log(LOG_WARNING, "Qualification default should be 'yes', 'no', or a number of milliseconds at line %d of sip.conf\n", v->lineno); default_qualify = 0; } - } else if (!strcasecmp(v->name, "callevents")) { + } 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, "callevents")) { global_callevents = ast_true(v->value); } else if (!strcasecmp(v->name, "maxcallbitrate")) { default_maxcallbitrate = atoi(v->value); diff -ru asterisk-original/configs/sip.conf.sample asterisk/configs/sip.conf.sample --- asterisk-original/configs/sip.conf.sample 2008-01-02 11:43:08.495202673 +0100 +++ asterisk/configs/sip.conf.sample 2008-01-02 15:46:29.600854295 +0100 @@ -101,6 +101,10 @@ ; and subscriptions (seconds) ;minexpiry=60 ; Minimum length of registrations/subscriptions (default 60) ;defaultexpiry=120 ; Default length of incoming/outgoing registration +;qualifyfreq=60 ; Qualification: How often to check for the + ; host to be up in seconds + ; Set to low value if you use low timeout for + ; NAT of UDP sessions ;notifymimetype=text/plain ; Allow overriding of mime type in MWI NOTIFY ;buggymwi=no ; Cisco SIP firmware doesn't support the MWI RFC ; fully. Enable this option to not get error messages @@ -812,6 +816,10 @@ ;qualify=1000 ; Consider it down if it's 1 second to reply ; Helps with NAT session ; qualify=yes uses default value +;qualifyfreq=60 ; Qualification: How often to check for the + ; host to be up in seconds + ; Set to low value if you use low timeout for + ; NAT of UDP sessions ; ; Call group and Pickup group should be in the range from 0 to 63 ;