summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorOlle Johansson <oej@edvina.net>2009-01-26 15:51:00 +0000
committerOlle Johansson <oej@edvina.net>2009-01-26 15:51:00 +0000
commitf35874c3f5b5c450ca87946e860ef122aa51c54c (patch)
tree139b9d0003b05f94b838304b68442bc909a97bef /channels
parenta6228ccaf3354152ce8fb023cecd9cb9f1dd7570 (diff)
Continue to move variables into the sip_cfg structure to make them easier to handle in the future as a group of settings for a group of devices.
At some point, I want one sip_cfg per domain handled, so we can have "group" settings. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@171400 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c154
1 files changed, 77 insertions, 77 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 450ee9ccb..45ba12d67 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -751,7 +751,7 @@ enum sip_transport {
* For outbound proxies, a sip_peer will contain a reference to a
* dynamically allocated instance of a sip_proxy. A sip_pvt may also
* contain a reference to a peer's outboundproxy, or it may contain
- * a reference to the global_outboundproxy.
+ * a reference to the sip_cfg.outboundproxy.
*/
struct sip_proxy {
char name[MAXHOSTNAMELEN]; /*!< DNS name of domain/host or IP */
@@ -1013,8 +1013,6 @@ static const struct cfsip_options {
configuring devices
*/
/*@{*/
-static char default_context[AST_MAX_CONTEXT];
-static char default_subscribecontext[AST_MAX_CONTEXT];
static char default_language[MAX_LANGUAGE];
static char default_callerid[AST_MAX_EXTENSION];
static char default_fromdomain[AST_MAX_EXTENSION];
@@ -1038,6 +1036,7 @@ static unsigned int default_primary_transport; /*!< Default primary Transport (
*/
/*@{*/
/*! \brief a place to store all global settings for the sip channel driver
+ These are settings that will be possibly to apply on a group level later on.
*/
struct sip_settings {
int peer_rtupdate; /*!< G: Update database with registration data for peer? */
@@ -1055,16 +1054,22 @@ struct sip_settings {
int callevents; /*!< Whether we send manager events or not */
int regextenonqualify; /*!< Whether to add/remove regexten when qualifying peers */
int matchexterniplocally; /*!< Match externip/externhost setting against localnet setting */
+ int notifyringing; /*!< Send notifications on ringing */
+ int notifyhold; /*!< Send notifications on hold */
+ enum notifycid_setting notifycid; /*!< Send CID with ringing notifications */
+ enum transfermodes allowtransfer; /*!< SIP Refer restriction scheme */
+ int allowsubscribe; /*!< Flag for disabling ALL subscriptions, this is FALSE only if all peers are FALSE
+ the global setting is in globals_flags[1] */
+ char realm[MAXHOSTNAMELEN]; /*!< Default realm */
+ struct sip_proxy outboundproxy; /*!< Outbound proxy */
+ char default_context[AST_MAX_CONTEXT];
+ char default_subscribecontext[AST_MAX_CONTEXT];
};
static struct sip_settings sip_cfg;
-static int global_notifyringing; /*!< Send notifications on ringing */
-static int global_notifyhold; /*!< Send notifications on hold */
static int global_match_auth_username; /*!< Match auth username if available instead of From: Default off. */
-static enum notifycid_setting global_notifycid; /*!< Send CID with ringing notifications */
-
static int global_relaxdtmf; /*!< Relax DTMF */
static int global_rtptimeout; /*!< Time out call if no RTP */
static int global_rtpholdtimeout; /*!< Time out call if no RTP during hold */
@@ -1074,9 +1079,6 @@ static int global_regattempts_max; /*!< Registration attempts before giving up *
static int global_callcounter; /*!< Enable call counters for all devices. This is currently enabled by setting the peer
call-limit to 999. When we remove the call-limit from the code, we can make it
with just a boolean flag in the device structure */
-static enum transfermodes global_allowtransfer; /*!< SIP Refer restriction scheme */
-static int global_allowsubscribe; /*!< Flag for disabling ALL subscriptions, this is FALSE only if all peers are FALSE
- the global setting is in globals_flags[1] */
static unsigned int global_tos_sip; /*!< IP type of service for SIP packets */
static unsigned int global_tos_audio; /*!< IP type of service for audio RTP packets */
static unsigned int global_tos_video; /*!< IP type of service for video RTP packets */
@@ -1087,7 +1089,6 @@ static unsigned int global_cos_video; /*!< 802.1p class of service for video RT
static unsigned int global_cos_text; /*!< 802.1p class of service for text RTP packets */
static int recordhistory; /*!< Record SIP history. Off by default */
static int dumphistory; /*!< Dump history to verbose before destroying SIP dialog */
-static char global_realm[MAXHOSTNAMELEN]; /*!< Default realm */
static char global_regcontext[AST_MAX_CONTEXT]; /*!< Context for auto-extensions */
static char global_useragent[AST_MAX_EXTENSION]; /*!< Useragent for the SIP channel */
static char global_sdpsession[AST_MAX_EXTENSION]; /*!< SDP session name for the SIP channel */
@@ -1097,7 +1098,6 @@ static int global_t1; /*!< T1 time */
static int global_t1min; /*!< T1 roundtrip time minimum */
static int global_timer_b; /*!< Timer B - RFC 3261 Section 17.1.1.2 */
static int global_autoframing; /*!< Turn autoframing on or off. */
-static struct sip_proxy global_outboundproxy; /*!< Outbound proxy */
static int global_qualifyfreq; /*!< Qualify frequency */
static int global_qualify_gap; /*!< Time between our group of peer pokes */
static int global_qualify_peers; /*!< Number of peers to poke at a given time */
@@ -2858,14 +2858,14 @@ static struct sip_peer *ref_peer(struct sip_peer *peer, char *tag)
static void ref_proxy(struct sip_pvt *pvt, struct sip_proxy *proxy)
{
struct sip_proxy *old_obproxy = pvt->outboundproxy;
- /* The global_outboundproxy is statically allocated, and so
+ /* The sip_cfg.outboundproxy is statically allocated, and so
* we don't ever need to adjust refcounts for it
*/
- if (proxy && proxy != &global_outboundproxy) {
+ if (proxy && proxy != &sip_cfg.outboundproxy) {
ao2_ref(proxy, +1);
}
pvt->outboundproxy = proxy;
- if (old_obproxy && old_obproxy != &global_outboundproxy) {
+ if (old_obproxy && old_obproxy != &sip_cfg.outboundproxy) {
ao2_ref(old_obproxy, -1);
}
}
@@ -3033,11 +3033,11 @@ static struct sip_proxy *obproxy_get(struct sip_pvt *dialog, struct sip_peer *pe
append_history(dialog, "OBproxy", "Using peer obproxy %s", peer->outboundproxy->name);
return peer->outboundproxy;
}
- if (global_outboundproxy.name[0]) {
+ if (sip_cfg.outboundproxy.name[0]) {
if (sipdebug)
ast_debug(1, "OBPROXY: Applying global OBproxy to this call\n");
- append_history(dialog, "OBproxy", "Using global obproxy %s", global_outboundproxy.name);
- return &global_outboundproxy;
+ append_history(dialog, "OBproxy", "Using global obproxy %s", sip_cfg.outboundproxy.name);
+ return &sip_cfg.outboundproxy;
}
if (sipdebug)
ast_debug(1, "OBPROXY: Not applying OBproxy to this call\n");
@@ -5226,7 +5226,7 @@ static int update_call_counter(struct sip_pvt *fup, int event)
/* Decrement onhold count if applicable */
sip_pvt_lock(fup);
ao2_lock(p);
- if (ast_test_flag(&fup->flags[1], SIP_PAGE2_CALL_ONHOLD) && global_notifyhold) {
+ if (ast_test_flag(&fup->flags[1], SIP_PAGE2_CALL_ONHOLD) && sip_cfg.notifyhold) {
ast_clear_flag(&fup->flags[1], SIP_PAGE2_CALL_ONHOLD);
ao2_unlock(p);
sip_pvt_unlock(fup);
@@ -6669,7 +6669,7 @@ static struct sip_pvt *sip_alloc(ast_string_field callid, struct sockaddr_in *si
ast_string_field_set(p, mohinterpret, default_mohinterpret);
ast_string_field_set(p, mohsuggest, default_mohsuggest);
p->capability = global_capability;
- p->allowtransfer = global_allowtransfer;
+ p->allowtransfer = sip_cfg.allowtransfer;
if ((ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833) ||
(ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_AUTO))
p->noncodeccapability |= AST_RTP_DTMF;
@@ -6678,7 +6678,7 @@ static struct sip_pvt *sip_alloc(ast_string_field callid, struct sockaddr_in *si
set_t38_capabilities(p);
p->t38.jointcapability = p->t38.capability;
}
- ast_string_field_set(p, context, default_context);
+ ast_string_field_set(p, context, sip_cfg.default_context);
ast_string_field_set(p, parkinglot, default_parkinglot);
AST_LIST_HEAD_INIT_NOLOCK(&p->request_queue);
@@ -8023,7 +8023,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
"Uniqueid: %s\r\n",
p->owner->name,
p->owner->uniqueid);
- if (global_notifyhold)
+ if (sip_cfg.notifyhold)
sip_peer_hold(p, FALSE);
ast_clear_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD); /* Clear both flags */
} else if (!sin.sin_addr.s_addr || (sendonly && sendonly != -1)) {
@@ -8052,7 +8052,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
ast_set_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD_INACTIVE);
else
ast_set_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD_ACTIVE);
- if (global_notifyhold && !already_on_hold)
+ if (sip_cfg.notifyhold && !already_on_hold)
sip_peer_hold(p, TRUE);
}
@@ -8728,7 +8728,7 @@ static int transmit_response_with_auth(struct sip_pvt *p, const char *msg, const
}
/* Stale means that they sent us correct authentication, but
based it on an old challenge (nonce) */
- snprintf(tmp, sizeof(tmp), "Digest algorithm=MD5, realm=\"%s\", nonce=\"%s\"%s", global_realm, randdata, stale ? ", stale=true" : "");
+ snprintf(tmp, sizeof(tmp), "Digest algorithm=MD5, realm=\"%s\", nonce=\"%s\"%s", sip_cfg.realm, randdata, stale ? ", stale=true" : "");
respprep(&resp, p, msg, req);
add_header(&resp, header, tmp);
add_header_contentLength(&resp, 0);
@@ -10026,7 +10026,7 @@ static int find_calling_channel(struct ast_channel *c, void *data) {
return (c->pbx &&
(!strcasecmp(c->macroexten, p->exten) || !strcasecmp(c->exten, p->exten)) &&
- (global_notifycid == IGNORE_CONTEXT || !strcasecmp(c->context, p->context)));
+ (sip_cfg.notifycid == IGNORE_CONTEXT || !strcasecmp(c->context, p->context)));
}
/*! \brief Used in the SUBSCRIBE notification subsystem (RFC3265) */
@@ -10048,7 +10048,7 @@ static int transmit_state_notify(struct sip_pvt *p, int state, int full, int tim
switch (state) {
case (AST_EXTENSION_RINGING | AST_EXTENSION_INUSE):
- statestring = (global_notifyringing) ? "early" : "confirmed";
+ statestring = (sip_cfg.notifyringing) ? "early" : "confirmed";
local_state = NOTIFY_INUSE;
pidfstate = "busy";
pidfnote = "Ringing";
@@ -10187,13 +10187,13 @@ static int transmit_state_notify(struct sip_pvt *p, int state, int full, int tim
case DIALOG_INFO_XML: /* SNOM subscribes in this format */
ast_str_append(&tmp, 0, "<?xml version=\"1.0\"?>\n");
ast_str_append(&tmp, 0, "<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"%d\" state=\"%s\" entity=\"%s\">\n", p->dialogver++, full ? "full" : "partial", mto);
- if ((state & AST_EXTENSION_RINGING) && global_notifyringing) {
+ if ((state & AST_EXTENSION_RINGING) && sip_cfg.notifyringing) {
const char *local_display = p->exten, *local_target = mto;
/* There are some limitations to how this works. The primary one is that the
callee must be dialing the same extension that is being monitored. Simply dialing
the hint'd device is not sufficient. */
- if (global_notifycid) {
+ if (sip_cfg.notifycid) {
struct ast_channel *caller = ast_channel_search_locked(find_calling_channel, p);
if (caller) {
@@ -11600,7 +11600,7 @@ static enum check_auth_result check_auth(struct sip_pvt *p, struct sip_request *
ast_copy_string(a1_hash, md5secret, sizeof(a1_hash));
else {
char a1[256];
- snprintf(a1, sizeof(a1), "%s:%s:%s", username, global_realm, secret);
+ snprintf(a1, sizeof(a1), "%s:%s:%s", username, sip_cfg.realm, secret);
ast_md5_hash(a1_hash, a1);
}
@@ -12440,7 +12440,7 @@ static int get_refer_info(struct sip_pvt *transferer, struct sip_request *outgoi
/* By default, use the context in the channel sending the REFER */
if (ast_strlen_zero(transfer_context)) {
transfer_context = S_OR(transferer->owner->macrocontext,
- S_OR(transferer->context, default_context));
+ S_OR(transferer->context, sip_cfg.default_context));
}
ast_copy_string(referdata->refer_to_context, transfer_context, sizeof(referdata->refer_to_context));
@@ -12508,7 +12508,7 @@ static int get_also_info(struct sip_pvt *p, struct sip_request *oreq)
/* By default, use the context in the channel sending the REFER */
if (ast_strlen_zero(transfer_context)) {
transfer_context = S_OR(p->owner->macrocontext,
- S_OR(p->context, default_context));
+ S_OR(p->context, sip_cfg.default_context));
}
if (ast_exists_extension(NULL, transfer_context, c, 1, NULL)) {
/* This is a blind transfer */
@@ -14758,7 +14758,7 @@ static char *sip_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_
ast_cli(a->fd, " Enable call counters: %s\n", cli_yesno(global_callcounter));
ast_cli(a->fd, " SIP domain support: %s\n", cli_yesno(!AST_LIST_EMPTY(&domain_list)));
ast_cli(a->fd, " Realm. auth: %s\n", cli_yesno(authl != NULL));
- ast_cli(a->fd, " Our auth realm %s\n", global_realm);
+ ast_cli(a->fd, " Our auth realm %s\n", sip_cfg.realm);
ast_cli(a->fd, " Call to non-local dom.: %s\n", cli_yesno(sip_cfg.allow_external_domains));
ast_cli(a->fd, " URI user is phone no: %s\n", cli_yesno(ast_test_flag(&global_flags[0], SIP_USEREQPHONE)));
ast_cli(a->fd, " Always auth rejects: %s\n", cli_yesno(sip_cfg.alwaysauthreject));
@@ -14854,18 +14854,18 @@ static char *sip_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_
ast_cli(a->fd, " Reg. default duration: %d secs\n", default_expiry);
ast_cli(a->fd, " Outbound reg. timeout: %d secs\n", global_reg_timeout);
ast_cli(a->fd, " Outbound reg. attempts: %d\n", global_regattempts_max);
- ast_cli(a->fd, " Notify ringing state: %s\n", cli_yesno(global_notifyringing));
- if (global_notifyringing) {
+ ast_cli(a->fd, " Notify ringing state: %s\n", cli_yesno(sip_cfg.notifyringing));
+ if (sip_cfg.notifyringing) {
ast_cli(a->fd, " Include CID: %s%s\n",
- cli_yesno(global_notifycid),
- global_notifycid == IGNORE_CONTEXT ? " (Ignoring context)" : "");
+ cli_yesno(sip_cfg.notifycid),
+ sip_cfg.notifycid == IGNORE_CONTEXT ? " (Ignoring context)" : "");
}
- ast_cli(a->fd, " Notify hold state: %s\n", cli_yesno(global_notifyhold));
- ast_cli(a->fd, " SIP Transfer mode: %s\n", transfermode2str(global_allowtransfer));
+ ast_cli(a->fd, " Notify hold state: %s\n", cli_yesno(sip_cfg.notifyhold));
+ ast_cli(a->fd, " SIP Transfer mode: %s\n", transfermode2str(sip_cfg.allowtransfer));
ast_cli(a->fd, " Max Call Bitrate: %d kbps\n", default_maxcallbitrate);
ast_cli(a->fd, " Auto-Framing: %s\n", cli_yesno(global_autoframing));
- ast_cli(a->fd, " Outb. proxy: %s %s\n", ast_strlen_zero(global_outboundproxy.name) ? "<not set>" : global_outboundproxy.name,
- global_outboundproxy.force ? "(forced)" : "");
+ ast_cli(a->fd, " Outb. proxy: %s %s\n", ast_strlen_zero(sip_cfg.outboundproxy.name) ? "<not set>" : sip_cfg.outboundproxy.name,
+ sip_cfg.outboundproxy.force ? "(forced)" : "");
ast_cli(a->fd, " Session Timers: %s\n", stmode2str(global_st_mode));
ast_cli(a->fd, " Session Refresher: %s\n", strefresher2str (global_st_refresher));
ast_cli(a->fd, " Session Expires: %d secs\n", global_max_se);
@@ -14878,7 +14878,7 @@ static char *sip_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_
ast_cli(a->fd, "-----------------\n");
ast_cli(a->fd, " Allowed transports: %s\n", get_transport_list(default_transports));
ast_cli(a->fd, " Outbound transport: %s\n", get_transport(default_primary_transport));
- ast_cli(a->fd, " Context: %s\n", default_context);
+ ast_cli(a->fd, " Context: %s\n", sip_cfg.default_context);
ast_cli(a->fd, " Nat: %s\n", nat2str(ast_test_flag(&global_flags[0], SIP_NAT)));
ast_cli(a->fd, " DTMF: %s\n", dtmfmode2str(ast_test_flag(&global_flags[0], SIP_DTMF)));
ast_cli(a->fd, " Qualify: %d\n", default_qualify);
@@ -17955,7 +17955,7 @@ static int handle_request_options(struct sip_pvt *p, struct sip_request *req)
build_contact(p);
if (ast_strlen_zero(p->context))
- ast_string_field_set(p, context, default_context);
+ ast_string_field_set(p, context, sip_cfg.default_context);
if (ast_shutting_down())
transmit_response_with_allow(p, "503 Unavailable", req, 0);
@@ -18746,7 +18746,7 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int
/* Initialize the context if it hasn't been already */
if (ast_strlen_zero(p->context))
- ast_string_field_set(p, context, default_context);
+ ast_string_field_set(p, context, sip_cfg.default_context);
/* Check number of concurrent calls -vs- incoming limit HERE */
@@ -19394,7 +19394,7 @@ static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int
return 0;
}
if (ast_strlen_zero(p->context))
- ast_string_field_set(p, context, default_context);
+ ast_string_field_set(p, context, sip_cfg.default_context);
/* If we do not support SIP domains, all transfers are local */
if (sip_cfg.allow_external_domains && check_sip_domain(p->refer->refer_to_domain, NULL, 0)) {
@@ -19827,7 +19827,7 @@ static int handle_request_bye(struct sip_pvt *p, struct sip_request *req)
ast_log(LOG_NOTICE, "Client '%s' using deprecated BYE/Also transfer method. Ask vendor to support REFER instead\n",
ast_inet_ntoa(p->recv.sin_addr));
if (ast_strlen_zero(p->context))
- ast_string_field_set(p, context, default_context);
+ ast_string_field_set(p, context, sip_cfg.default_context);
res = get_also_info(p, req);
if (!res) {
c = p->owner;
@@ -19915,7 +19915,7 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
/* Check if we have a global disallow setting on subscriptions.
if so, we don't have to check peer settings after auth, which saves a lot of processing
*/
- if (!global_allowsubscribe) {
+ if (!sip_cfg.allowsubscribe) {
transmit_response(p, "403 Forbidden (policy)", req);
pvt_set_needdestroy(p, "forbidden");
return 0;
@@ -22199,8 +22199,8 @@ static void set_peer_defaults(struct sip_peer *peer)
}
ast_copy_flags(&peer->flags[0], &global_flags[0], SIP_FLAGS_TO_COPY);
ast_copy_flags(&peer->flags[1], &global_flags[1], SIP_PAGE2_FLAGS_TO_COPY);
- ast_string_field_set(peer, context, default_context);
- ast_string_field_set(peer, subscribecontext, default_subscribecontext);
+ ast_string_field_set(peer, context, sip_cfg.default_context);
+ ast_string_field_set(peer, subscribecontext, sip_cfg.default_subscribecontext);
ast_string_field_set(peer, language, default_language);
ast_string_field_set(peer, mohinterpret, default_mohinterpret);
ast_string_field_set(peer, mohsuggest, default_mohsuggest);
@@ -22211,7 +22211,7 @@ static void set_peer_defaults(struct sip_peer *peer)
peer->rtptimeout = global_rtptimeout;
peer->rtpholdtimeout = global_rtpholdtimeout;
peer->rtpkeepalive = global_rtpkeepalive;
- peer->allowtransfer = global_allowtransfer;
+ peer->allowtransfer = sip_cfg.allowtransfer;
peer->autoframing = global_autoframing;
peer->qualifyfreq = global_qualifyfreq;
if (global_callcounter)
@@ -22733,7 +22733,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
ast_copy_flags(&peer->flags[0], &peerflags[0], mask[0].flags);
ast_copy_flags(&peer->flags[1], &peerflags[1], mask[1].flags);
if (ast_test_flag(&peer->flags[1], SIP_PAGE2_ALLOWSUBSCRIBE))
- global_allowsubscribe = TRUE; /* No global ban any more */
+ sip_cfg.allowsubscribe = TRUE; /* No global ban any more */
if (!found && peer->host_dynamic && !peer->is_realtime)
reg_source_db(peer);
@@ -22904,10 +22904,10 @@ static int reload_config(enum channelreloadreason reason)
memset(&localaddr, 0, sizeof(localaddr));
memset(&externip, 0, sizeof(externip));
memset(&default_prefs, 0 , sizeof(default_prefs));
- memset(&global_outboundproxy, 0, sizeof(struct sip_proxy));
- global_outboundproxy.ip.sin_port = htons(STANDARD_SIP_PORT);
- global_outboundproxy.ip.sin_family = AF_INET; /*!< Type of address: IPv4 */
- global_outboundproxy.force = FALSE; /*!< Don't force proxy usage, use route: headers */
+ memset(&sip_cfg.outboundproxy, 0, sizeof(struct sip_proxy));
+ sip_cfg.outboundproxy.ip.sin_port = htons(STANDARD_SIP_PORT);
+ sip_cfg.outboundproxy.ip.sin_family = AF_INET; /*!< Type of address: IPv4 */
+ sip_cfg.outboundproxy.force = FALSE; /*!< Don't force proxy usage, use route: headers */
default_transports = 0; /*!< Reset default transport to zero here, default value later on */
default_primary_transport = 0; /*!< Reset default primary transport to zero here, default value later on */
ourport_tcp = STANDARD_SIP_PORT;
@@ -22931,17 +22931,17 @@ static int reload_config(enum channelreloadreason reason)
sip_cfg.allow_external_domains = DEFAULT_ALLOW_EXT_DOM; /* Allow external invites */
global_regcontext[0] = '\0';
sip_cfg.regextenonqualify = DEFAULT_REGEXTENONQUALIFY;
- global_notifyringing = DEFAULT_NOTIFYRINGING;
- global_notifycid = DEFAULT_NOTIFYCID;
- global_notifyhold = FALSE; /*!< Keep track of hold status for a peer */
+ sip_cfg.notifyringing = DEFAULT_NOTIFYRINGING;
+ sip_cfg.notifycid = DEFAULT_NOTIFYCID;
+ sip_cfg.notifyhold = FALSE; /*!< Keep track of hold status for a peer */
sip_cfg.directrtpsetup = FALSE; /* Experimental feature, disabled by default */
sip_cfg.alwaysauthreject = DEFAULT_ALWAYSAUTHREJECT;
- global_allowsubscribe = FALSE;
+ sip_cfg.allowsubscribe = FALSE;
snprintf(global_useragent, sizeof(global_useragent), "%s %s", DEFAULT_USERAGENT, ast_get_version());
snprintf(global_sdpsession, sizeof(global_sdpsession), "%s %s", DEFAULT_SDPSESSION, ast_get_version());
snprintf(global_sdpowner, sizeof(global_sdpowner), "%s", DEFAULT_SDPOWNER);
ast_copy_string(default_notifymime, DEFAULT_NOTIFYMIME, sizeof(default_notifymime));
- ast_copy_string(global_realm, S_OR(ast_config_AST_SYSTEM_NAME, DEFAULT_REALM), sizeof(global_realm));
+ ast_copy_string(sip_cfg.realm, S_OR(ast_config_AST_SYSTEM_NAME, DEFAULT_REALM), sizeof(sip_cfg.realm));
ast_copy_string(default_callerid, DEFAULT_CALLERID, sizeof(default_callerid));
sip_cfg.compactheaders = DEFAULT_COMPACTHEADERS;
global_reg_timeout = DEFAULT_REGISTRATION_TIMEOUT;
@@ -22955,7 +22955,7 @@ static int reload_config(enum channelreloadreason reason)
global_rtptimeout = 0;
global_rtpholdtimeout = 0;
global_rtpkeepalive = DEFAULT_RTPKEEPALIVE;
- global_allowtransfer = TRANSFER_OPENFORALL; /* Merrily accept all transfers by default */
+ sip_cfg.allowtransfer = TRANSFER_OPENFORALL; /* Merrily accept all transfers by default */
sip_cfg.rtautoclear = 120;
ast_set_flag(&global_flags[1], SIP_PAGE2_ALLOWSUBSCRIBE); /* Default for all devices: TRUE */
ast_set_flag(&global_flags[1], SIP_PAGE2_ALLOWOVERLAP); /* Default for all devices: TRUE */
@@ -22972,8 +22972,8 @@ static int reload_config(enum channelreloadreason reason)
global_qualify_peers = DEFAULT_QUALIFY_PEERS;
/* Initialize some reasonable defaults at SIP reload (used both for channel and as default for devices */
- ast_copy_string(default_context, DEFAULT_CONTEXT, sizeof(default_context));
- default_subscribecontext[0] = '\0';
+ ast_copy_string(sip_cfg.default_context, DEFAULT_CONTEXT, sizeof(sip_cfg.default_context));
+ sip_cfg.default_subscribecontext[0] = '\0';
default_language[0] = '\0';
default_fromdomain[0] = '\0';
default_qualify = DEFAULT_QUALIFY;
@@ -23019,15 +23019,15 @@ static int reload_config(enum channelreloadreason reason)
continue;
if (!strcasecmp(v->name, "context")) {
- ast_copy_string(default_context, v->value, sizeof(default_context));
+ ast_copy_string(sip_cfg.default_context, v->value, sizeof(sip_cfg.default_context));
} else if (!strcasecmp(v->name, "subscribecontext")) {
- ast_copy_string(default_subscribecontext, v->value, sizeof(default_subscribecontext));
+ ast_copy_string(sip_cfg.default_subscribecontext, v->value, sizeof(sip_cfg.default_subscribecontext));
} else if (!strcasecmp(v->name, "callcounter")) {
global_callcounter = ast_true(v->value) ? 1 : 0;
} else if (!strcasecmp(v->name, "allowguest")) {
sip_cfg.allowguest = ast_true(v->value) ? 1 : 0;
} else if (!strcasecmp(v->name, "realm")) {
- ast_copy_string(global_realm, v->value, sizeof(global_realm));
+ ast_copy_string(sip_cfg.realm, v->value, sizeof(sip_cfg.realm));
} else if (!strcasecmp(v->name, "useragent")) {
ast_copy_string(global_useragent, v->value, sizeof(global_useragent));
ast_debug(1, "Setting SIP channel User-Agent Name to %s\n", global_useragent);
@@ -23040,7 +23040,7 @@ static int reload_config(enum channelreloadreason reason)
else
ast_log(LOG_WARNING, "'%s' must not contain spaces at line %d. Using default.\n", v->value, v->lineno);
} else if (!strcasecmp(v->name, "allowtransfer")) {
- global_allowtransfer = ast_true(v->value) ? TRANSFER_OPENFORALL : TRANSFER_CLOSED;
+ sip_cfg.allowtransfer = ast_true(v->value) ? TRANSFER_OPENFORALL : TRANSFER_CLOSED;
} else if (!strcasecmp(v->name, "rtcachefriends")) {
ast_set2_flag(&global_flags[1], ast_true(v->value), SIP_PAGE2_RTCACHEFRIENDS);
} else if (!strcasecmp(v->name, "rtsavesysname")) {
@@ -23151,14 +23151,14 @@ static int reload_config(enum channelreloadreason reason)
} else if (!strcasecmp(v->name, "directrtpsetup")) {
sip_cfg.directrtpsetup = ast_true(v->value);
} else if (!strcasecmp(v->name, "notifyringing")) {
- global_notifyringing = ast_true(v->value);
+ sip_cfg.notifyringing = ast_true(v->value);
} else if (!strcasecmp(v->name, "notifyhold")) {
- global_notifyhold = ast_true(v->value);
+ sip_cfg.notifyhold = ast_true(v->value);
} else if (!strcasecmp(v->name, "notifycid")) {
if (!strcasecmp(v->value, "ignore-context")) {
- global_notifycid = IGNORE_CONTEXT;
+ sip_cfg.notifycid = IGNORE_CONTEXT;
} else {
- global_notifycid = ast_true(v->value);
+ sip_cfg.notifycid = ast_true(v->value);
}
} else if (!strcasecmp(v->name, "alwaysauthreject")) {
sip_cfg.alwaysauthreject = ast_true(v->value);
@@ -23196,25 +23196,25 @@ static int reload_config(enum channelreloadreason reason)
tok = ast_skip_blanks(strtok(ast_strdupa(v->value), ","));
- sip_parse_host(tok, v->lineno, &proxyname, &portnum, &global_outboundproxy.transport);
+ sip_parse_host(tok, v->lineno, &proxyname, &portnum, &sip_cfg.outboundproxy.transport);
- global_outboundproxy.ip.sin_port = htons(portnum);
+ sip_cfg.outboundproxy.ip.sin_port = htons(portnum);
if ((tok = strtok(NULL, ","))) {
- global_outboundproxy.force = !strncasecmp(ast_skip_blanks(tok), "force", 5);
+ sip_cfg.outboundproxy.force = !strncasecmp(ast_skip_blanks(tok), "force", 5);
} else {
- global_outboundproxy.force = FALSE;
+ sip_cfg.outboundproxy.force = FALSE;
}
if (ast_strlen_zero(proxyname)) {
ast_log(LOG_WARNING, "you must specify a name for the outboundproxy on line %d of sip.conf.", v->lineno);
- global_outboundproxy.name[0] = '\0';
+ sip_cfg.outboundproxy.name[0] = '\0';
continue;
}
- ast_copy_string(global_outboundproxy.name, proxyname, sizeof(global_outboundproxy.name));
+ ast_copy_string(sip_cfg.outboundproxy.name, proxyname, sizeof(sip_cfg.outboundproxy.name));
- proxy_update(&global_outboundproxy);
+ proxy_update(&sip_cfg.outboundproxy);
} else if (!strcasecmp(v->name, "autocreatepeer")) {
sip_cfg.autocreatepeer = ast_true(v->value);
} else if (!strcasecmp(v->name, "match_auth_username")) {