rendered paste body****************** BEFORE ***************************
v = ast_variable_browse(cfg, "general");
while(v) {
if (handle_common_options(&global_flags, &dummy, v)) {
v = v->next;
continue;
}
/* Create the interface list */
if (!strcasecmp(v->name, "context")) {
ast_copy_string(default_context, v->value, sizeof(default_context));
} else if (!strcasecmp(v->name, "realm")) {
ast_copy_string(global_realm, v->value, sizeof(global_realm));
} else if (!strcasecmp(v->name, "useragent")) {
ast_copy_string(default_useragent, v->value, sizeof(default_useragent));
ast_log(LOG_DEBUG, "Setting User Agent Name to %s\n",
default_useragent);
} else if (!strcasecmp(v->name, "rtcachefriends")) {
ast_set2_flag((&global_flags_page2), ast_true(v->value), SIP_PAGE2_RTCACHEFRIENDS);
} else if (!strcasecmp(v->name, "rtupdate")) {
ast_set2_flag((&global_flags_page2), ast_true(v->value), SIP_PAGE2_RTUPDATE);
} else if (!strcasecmp(v->name, "ignoreregexpire")) {
ast_set2_flag((&global_flags_page2), ast_true(v->value), SIP_PAGE2_IGNOREREGEXPIRE);
} else if (!strcasecmp(v->name, "rtautoclear")) {
int i = atoi(v->value);
if (i > 0)
global_rtautoclear = i;
else
i = 0;
ast_set2_flag((&global_flags_page2), i || ast_true(v->value), SIP_PAGE2_RTAUTOCLEAR);
} else if (!strcasecmp(v->name, "usereqphone")) {
ast_set2_flag((&global_flags), ast_true(v->value), SIP_USEREQPHONE);
} else if (!strcasecmp(v->name, "relaxdtmf")) {
relaxdtmf = ast_true(v->value);
} else if (!strcasecmp(v->name, "checkmwi")) {
if ((sscanf(v->value, "%d", &global_mwitime) != 1) || (global_mwitime < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid MWI time setting at line %d. Using default (10).\n", v->value, v->lineno);
global_mwitime = DEFAULT_MWITIME;
}
} else if (!strcasecmp(v->name, "vmexten")) {
ast_copy_string(global_vmexten, v->value, sizeof(global_vmexten));
} else if (!strcasecmp(v->name, "rtptimeout")) {
if ((sscanf(v->value, "%d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno);
global_rtptimeout = 0;
}
} else if (!strcasecmp(v->name, "rtpholdtimeout")) {
if ((sscanf(v->value, "%d", &global_rtpholdtimeout) != 1) || (global_rtpholdtimeout < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno);
global_rtpholdtimeout = 0;
}
} else if (!strcasecmp(v->name, "rtpkeepalive")) {
if ((sscanf(v->value, "%d", &global_rtpkeepalive) != 1) || (global_rtpkeepalive < 0)) {
ast_log(LOG_WARNING, "'%s' is not a valid RTP keepalive time at line %d. Using default.\n", v->value, v->lineno);
global_rtpkeepalive = 0;
}
} else if (!strcasecmp(v->name, "videosupport")) {
videosupport = ast_true(v->value);
} else if (!strcasecmp(v->name, "compactheaders")) {
compactheaders = ast_true(v->value);
} else if (!strcasecmp(v->name, "notifymimetype")) {
ast_copy_string(default_notifymime, v->value, sizeof(default_notifymime));
} else if (!strcasecmp(v->name, "notifyringing")) {
global_notifyringing = ast_true(v->value);
} else if (!strcasecmp(v->name, "musicclass") || !strcasecmp(v->name, "musiconhold")) {
ast_copy_string(global_musicclass, v->value, sizeof(global_musicclass));
} else if (!strcasecmp(v->name, "language")) {
ast_copy_string(default_language, v->value, sizeof(default_language));
} else if (!strcasecmp(v->name, "regcontext")) {
ast_copy_string(regcontext, v->value, sizeof(regcontext));
/* Create context if it doesn't exist already */
if (!ast_context_find(regcontext))
ast_context_create(NULL, regcontext, channeltype);
} else if (!strcasecmp(v->name, "callerid")) {
ast_copy_string(default_callerid, v->value, sizeof(default_callerid));
} else if (!strcasecmp(v->name, "fromdomain")) {
ast_copy_string(default_fromdomain, v->value, sizeof(default_fromdomain));
} else if (!strcasecmp(v->name, "outboundproxy")) {
if (ast_get_ip_or_srv(&outboundproxyip, v->value, "_sip._udp") < 0)
ast_log(LOG_WARNING, "Unable to locate host '%s'\n", v->value);
} else if (!strcasecmp(v->name, "outboundproxyport")) {
/* Port needs to be after IP */
sscanf(v->value, "%d", &format);
outboundproxyip.sin_port = htons(format);
} else if (!strcasecmp(v->name, "autocreatepeer")) {
autocreatepeer = ast_true(v->value);
} else if (!strcasecmp(v->name, "srvlookup")) {
srvlookup = ast_true(v->value);
} else if (!strcasecmp(v->name, "pedantic")) {
pedanticsipchecking = ast_true(v->value);
} else if (!strcasecmp(v->name, "maxexpirey") || !strcasecmp(v->name, "maxexpiry")) {
max_expiry = atoi(v->value);
if (max_expiry < 1)
max_expiry = DEFAULT_MAX_EXPIRY;
} else if (!strcasecmp(v->name, "defaultexpiry") || !strcasecmp(v->name, "defaultexpirey")) {
default_expiry = atoi(v->value);
if (default_expiry < 1)
default_expiry = DEFAULT_DEFAULT_EXPIRY;
} else if (!strcasecmp(v->name, "sipdebug")) {
if (ast_true(v->value))
sipdebug |= SIP_DEBUG_CONFIG;
} else if (!strcasecmp(v->name, "dumphistory")) {
dumphistory = ast_true(v->value);
} else if (!strcasecmp(v->name, "recordhistory")) {
recordhistory = ast_true(v->value);
} else if (!strcasecmp(v->name, "registertimeout")) {
global_reg_timeout = atoi(v->value);
if (global_reg_timeout < 1)
global_reg_timeout = DEFAULT_REGISTRATION_TIMEOUT;
} else if (!strcasecmp(v->name, "registerattempts")) {
global_regattempts_max = atoi(v->value);
***************** AFTER *****************************
AST_CONFIG_PARSE_BEGIN(cfg, "general")
SIP_COMMON_OPTIONS(&global_flags)
AST_CONFIG_STR("context", default_context)
AST_CONFIG_STR("realm", global_realm)
AST_CONFIG_STR("useragent", default_useragent)
AST_CONFIG_FLAG("rtcachefriends", &global_flags_page2, SIP_PAGE2_RTCACHEFRIENDS)
AST_CONFIG_FLAG("rtupdate", &global_flags_page2, SIP_PAGE2_RTUPDATE)
AST_CONFIG_FLAG("ignoreexpire", &global_flags_page2, SIP_PAGE2_IGNOEEXPIRE)
AST_CONFIG_CUSTOM("rtautoclear", parse_rtautoclear(val))
AST_CONFIG_FLAG("usereqphone", &global_flags, SIP_USEREQPHONE)
AST_CONFIG_BOOL("relaxdtmf", relaxdtmf)
AST_CONFIG_UINT("checkmwi", global_mwitime)
AST_CONFIG_STR("vmexten", global_vmexten)
AST_CONFIG_UINT("rtptimeout", global_rtptimeout)
AST_CONFIG_UINT("rtpholdtimeout", global_rtpholdtimeout)
AST_CONFIG_UINT("rtpkeepalive", global_rtpkeepalive)
AST_CONFIG_BOOL("videosupport", videosupport)
AST_CONFIG_BOOL("compactheaders", compactheaders)
AST_CONFIG_STR("notifymimetype", default_notifymime)
AST_CONFIG_BOOL("notifyringing", global_notifyringing)
AST_CONFIG_STR("musicclass", global_musicclass)
AST_CONFIG_STR("musiconhold", global_musicclass)
AST_CONFIG_STR("language", default_language)
AST_CONFIG_CUSTOM("regcontext", parse_regcontext(val))
AST_CONFIG_STR("callerid", default_callerid)
AST_CONFIG_STR("fromdomain", default_fromdomain)
AST_CONFIG_CUSTOM("outboundproxy", parse_outboundproxy(val))
AST_CONFIG_CUSTOM("outboundproxyport", parse_outboundproxyport(val))
AST_CONFIG_BOOL("autocreatepeer", autocreatepeer)
AST_CONFIG_BOOL("srvlookup", srvlookup)
AST_CONFIG_BOOL("pedantic", pendanticsipchecking)
AST_CONFIG_UINT("maxexpirey", max_expiry)
AST_CONFIG_UINT("maxexpiry", max_expiry)
AST_CONFIG_UINT("defaultexpirey", default_expiry)
AST_CONFIG_UINT("defaultexpiry", default_expiry)
AST_CONFIG_CUSTOM("sipdebug", if (ast_true(val)) sipdebug |= SIP_DEBUGCONFIG)
AST_CONFIG_BOOL("dumphistory", dumphistory)
AST_CONFIG_BOOL("recordhistory", recordhistory)
/* XXX a lot of these UINT opts want something > 1, and a default val otherwise ... XXX */
AST_CONFIG_UINT("registertimeout", global_reg_timeout)
AST_CONFIG_BOOL("registerattempts", global_regattempts_max)
AST_CONFIG_CUSTOM("bindaddr", parse_bindaddr(val))
AST_CONFIG_PARSE_END