[asterisk-commits] oej: branch oej/codename-pineapple r45645 -
/team/oej/codename-pineapple/chan...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Oct 18 23:45:54 MST 2006
Author: oej
Date: Thu Oct 19 01:45:53 2006
New Revision: 45645
URL: http://svn.digium.com/view/asterisk?rev=45645&view=rev
Log:
Add some missing files
Added:
team/oej/codename-pineapple/channels/sip3/sip3_cli.c (with props)
team/oej/codename-pineapple/channels/sip3/sip3_config.c (with props)
Added: team/oej/codename-pineapple/channels/sip3/sip3_cli.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/channels/sip3/sip3_cli.c?rev=45645&view=auto
==============================================================================
--- team/oej/codename-pineapple/channels/sip3/sip3_cli.c (added)
+++ team/oej/codename-pineapple/channels/sip3/sip3_cli.c Thu Oct 19 01:45:53 2006
@@ -1,0 +1,120 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 1999 - 2006, Digium, Inc.
+ *
+ * Mark Spencer <markster at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*!
+ * \file
+ * \brief Various SIP transfer/refer functions
+ * Version 3 of chan_sip
+ *
+ * \author Mark Spencer <markster at digium.com>
+ * \author Olle E. Johansson <oej at edvina.net> (all the chan_sip3 changes)
+ *
+ * See Also:
+ * \arg \ref AstCREDITS
+ *
+ */
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <netdb.h>
+#include <signal.h>
+#include <sys/signal.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <arpa/inet.h>
+#include <netinet/ip.h>
+#include <regex.h>
+
+#include "asterisk/lock.h"
+#include "asterisk/channel.h"
+#include "asterisk/config.h"
+#include "asterisk/logger.h"
+#include "asterisk/module.h"
+#include "asterisk/pbx.h"
+#include "asterisk/options.h"
+#include "asterisk/lock.h"
+#include "asterisk/sched.h"
+#include "asterisk/io.h"
+#include "asterisk/rtp.h"
+#include "asterisk/udptl.h"
+#include "asterisk/acl.h"
+#include "asterisk/manager.h"
+#include "asterisk/callerid.h"
+#include "asterisk/cli.h"
+#include "asterisk/app.h"
+#include "asterisk/musiconhold.h"
+#include "asterisk/dsp.h"
+#include "asterisk/features.h"
+#include "asterisk/acl.h"
+#include "asterisk/srv.h"
+#include "asterisk/astdb.h"
+#include "asterisk/causes.h"
+#include "asterisk/utils.h"
+#include "asterisk/file.h"
+#include "asterisk/astobj.h"
+#include "asterisk/dnsmgr.h"
+#include "asterisk/devicestate.h"
+#include "asterisk/linkedlists.h"
+#include "asterisk/stringfields.h"
+#include "asterisk/monitor.h"
+#include "asterisk/localtime.h"
+#include "asterisk/abstract_jb.h"
+#include "asterisk/compiler.h"
+#include "sip3.h"
+
+/*! \brief Table to convert from REFER status variable to string */
+static const struct c_referstatusstring {
+ enum referstatus status;
+ char *text;
+} referstatusstrings[] = {
+ { REFER_IDLE, "<none>" },
+ { REFER_SENT, "Request sent" },
+ { REFER_RECEIVED, "Request received" },
+ { REFER_ACCEPTED, "Accepted" },
+ { REFER_RINGING, "Target ringing" },
+ { REFER_200OK, "Done" },
+ { REFER_FAILED, "Failed" },
+ { REFER_NOAUTH, "Failed - auth failure" }
+} ;
+
+
+/*! \brief Convert transfer status to string */
+char *referstatus2str(enum referstatus rstatus)
+{
+ int i = (sizeof(referstatusstrings) / sizeof(referstatusstrings[0]));
+ int x;
+
+ for (x = 0; x < i; x++) {
+ if (referstatusstrings[x].status == rstatus)
+ return (char *) referstatusstrings[x].text;
+ }
+ return "";
+}
+
Propchange: team/oej/codename-pineapple/channels/sip3/sip3_cli.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/oej/codename-pineapple/channels/sip3/sip3_cli.c
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/oej/codename-pineapple/channels/sip3/sip3_cli.c
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: team/oej/codename-pineapple/channels/sip3/sip3_config.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/channels/sip3/sip3_config.c?rev=45645&view=auto
==============================================================================
--- team/oej/codename-pineapple/channels/sip3/sip3_config.c (added)
+++ team/oej/codename-pineapple/channels/sip3/sip3_config.c Thu Oct 19 01:45:53 2006
@@ -1,0 +1,1257 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 1999 - 2006, Digium, Inc.
+ *
+ * Mark Spencer <markster at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*!
+ * \file
+ * \brief Various SIP configuration functions
+ * Version 3 of chan_sip
+ *
+ * \author Mark Spencer <markster at digium.com>
+ * \author Olle E. Johansson <oej at edvina.net> (all the chan_sip3 changes)
+ *
+ * See Also:
+ * \arg \ref AstCREDITS
+ *
+ */
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <netdb.h>
+#include <signal.h>
+#include <sys/signal.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <arpa/inet.h>
+#include <netinet/ip.h>
+#include <regex.h>
+
+#include "asterisk/lock.h"
+#include "asterisk/channel.h"
+#include "asterisk/config.h"
+#include "asterisk/logger.h"
+#include "asterisk/module.h"
+#include "asterisk/pbx.h"
+#include "asterisk/options.h"
+#include "asterisk/lock.h"
+#include "asterisk/acl.h"
+#include "asterisk/callerid.h"
+#include "asterisk/musiconhold.h"
+#include "asterisk/manager.h"
+#include "asterisk/dsp.h"
+#include "asterisk/rtp.h"
+#include "asterisk/acl.h"
+#include "asterisk/srv.h"
+#include "asterisk/causes.h"
+#include "asterisk/utils.h"
+#include "asterisk/file.h"
+#include "asterisk/astobj.h"
+#include "asterisk/dnsmgr.h"
+#include "asterisk/linkedlists.h"
+#include "asterisk/stringfields.h"
+#include "asterisk/monitor.h"
+#include "asterisk/localtime.h"
+#include "asterisk/compiler.h"
+#include "sip3.h"
+#include "sip3funcs.h"
+
+static const char config[] = "sip3.conf";
+const char notify_config[] = "sip3_notify.conf";
+
+/*! \brief Global jitterbuffer configuration - by default, jb is disabled */
+static struct ast_jb_conf default_jbconf =
+{
+ .flags = 0,
+ .max_size = -1,
+ .resync_threshold = -1,
+ .impl = ""
+};
+
+/*! \brief Destroy disused contexts between reloads
+ Only used in reload_config so the code for regcontext doesn't get ugly
+*/
+static void cleanup_stale_contexts(char *new, char *old)
+{
+ char *oldcontext, *newcontext, *stalecontext, *stringp, newlist[AST_MAX_CONTEXT];
+
+ while ((oldcontext = strsep(&old, "&"))) {
+ stalecontext = '\0';
+ ast_copy_string(newlist, new, sizeof(newlist));
+ stringp = newlist;
+ while ((newcontext = strsep(&stringp, "&"))) {
+ if (strcmp(newcontext, oldcontext) == 0) {
+ /* This is not the context you're looking for */
+ stalecontext = '\0';
+ break;
+ } else if (strcmp(newcontext, oldcontext)) {
+ stalecontext = oldcontext;
+ }
+
+ }
+ if (stalecontext)
+ ast_context_destroy(ast_context_find(stalecontext), "SIP");
+ }
+}
+
+/*!
+ \brief Handle flag-type options common to configuration of devices - users and peers
+ \param flags array of two struct ast_flags
+ \param mask array of two struct ast_flags
+ \param v linked list of config variables to process
+ \returns non-zero if any config options were handled, zero otherwise
+*/
+static int handle_common_options(struct ast_flags *flags, struct ast_flags *mask, struct ast_variable *v)
+{
+ int res = 0;
+
+ if (!strcasecmp(v->name, "trustrpid")) {
+ ast_set_flag(&mask[0], SIP_TRUSTRPID);
+ ast_set2_flag(&flags[0], ast_true(v->value), SIP_TRUSTRPID);
+ res = 1;
+ } else if (!strcasecmp(v->name, "sendrpid")) {
+ ast_set_flag(&mask[0], SIP_SENDRPID);
+ ast_set2_flag(&flags[0], ast_true(v->value), SIP_SENDRPID);
+ res = 1;
+ } else if (!strcasecmp(v->name, "g726nonstandard")) {
+ ast_set_flag(&mask[0], SIP_G726_NONSTANDARD);
+ ast_set2_flag(&flags[0], ast_true(v->value), SIP_G726_NONSTANDARD);
+ res = 1;
+ } else if (!strcasecmp(v->name, "useclientcode")) {
+ ast_set_flag(&mask[0], SIP_USECLIENTCODE);
+ ast_set2_flag(&flags[0], ast_true(v->value), SIP_USECLIENTCODE);
+ res = 1;
+ } else if (!strcasecmp(v->name, "dtmfmode")) {
+ ast_set_flag(&mask[0], SIP_DTMF);
+ ast_clear_flag(&flags[0], SIP_DTMF);
+ if (!strcasecmp(v->value, "inband"))
+ ast_set_flag(&flags[0], SIP_DTMF_INBAND);
+ else if (!strcasecmp(v->value, "rfc2833"))
+ ast_set_flag(&flags[0], SIP_DTMF_RFC2833);
+ else if (!strcasecmp(v->value, "info"))
+ ast_set_flag(&flags[0], SIP_DTMF_INFO);
+ else if (!strcasecmp(v->value, "auto"))
+ ast_set_flag(&flags[0], SIP_DTMF_AUTO);
+ else {
+ ast_log(LOG_WARNING, "Unknown dtmf mode '%s' on line %d, using rfc2833\n", v->value, v->lineno);
+ ast_set_flag(&flags[0], SIP_DTMF_RFC2833);
+ }
+ } else if (!strcasecmp(v->name, "nat")) {
+ ast_set_flag(&mask[0], SIP_NAT);
+ ast_clear_flag(&flags[0], SIP_NAT);
+ if (!strcasecmp(v->value, "never"))
+ ast_set_flag(&flags[0], SIP_NAT_NEVER);
+ else if (!strcasecmp(v->value, "route"))
+ ast_set_flag(&flags[0], SIP_NAT_ROUTE);
+ else if (ast_true(v->value))
+ ast_set_flag(&flags[0], SIP_NAT_ALWAYS);
+ else
+ ast_set_flag(&flags[0], SIP_NAT_RFC3581);
+ } else if (!strcasecmp(v->name, "canreinvite")) {
+ ast_set_flag(&mask[0], SIP_REINVITE);
+ ast_clear_flag(&flags[0], SIP_REINVITE);
+ if (ast_true(v->value)) {
+ ast_set_flag(&flags[0], SIP_CAN_REINVITE | SIP_CAN_REINVITE_NAT);
+ } else if (!ast_false(v->value)) {
+ char buf[64];
+ char *word, *next = buf;
+
+ ast_copy_string(buf, v->value, sizeof(buf));
+ while ((word = strsep(&next, ","))) {
+ if (!strcasecmp(word, "update")) {
+ ast_set_flag(&flags[0], SIP_REINVITE_UPDATE | SIP_CAN_REINVITE);
+ } else if (!strcasecmp(word, "nonat")) {
+ ast_set_flag(&flags[0], SIP_CAN_REINVITE);
+ ast_clear_flag(&flags[0], SIP_CAN_REINVITE_NAT);
+ } else {
+ ast_log(LOG_WARNING, "Unknown canreinvite mode '%s' on line %d\n", v->value, v->lineno);
+ }
+ }
+ }
+ } else if (!strcasecmp(v->name, "insecure")) {
+ ast_set_flag(&mask[0], SIP_INSECURE_PORT | SIP_INSECURE_INVITE);
+ ast_clear_flag(&flags[0], SIP_INSECURE_PORT | SIP_INSECURE_INVITE);
+ if (!ast_false(v->value)) {
+ char buf[64];
+ char *word, *next;
+
+ ast_copy_string(buf, v->value, sizeof(buf));
+ next = buf;
+ while ((word = strsep(&next, ","))) {
+ if (!strcasecmp(word, "port"))
+ ast_set_flag(&flags[0], SIP_INSECURE_PORT);
+ else if (!strcasecmp(word, "invite"))
+ ast_set_flag(&flags[0], SIP_INSECURE_INVITE);
+ else
+ ast_log(LOG_WARNING, "Unknown insecure mode '%s' on line %d\n", v->value, v->lineno);
+ }
+ }
+ } else if (!strcasecmp(v->name, "progressinband")) {
+ ast_set_flag(&mask[0], SIP_PROG_INBAND);
+ ast_clear_flag(&flags[0], SIP_PROG_INBAND);
+ if (ast_true(v->value))
+ ast_set_flag(&flags[0], SIP_PROG_INBAND_YES);
+ else if (strcasecmp(v->value, "never"))
+ ast_set_flag(&flags[0], SIP_PROG_INBAND_NO);
+ } else if (!strcasecmp(v->name, "allowguest")) {
+ global.allowguest = ast_true(v->value) ? 1 : 0;
+ } else if (!strcasecmp(v->name, "promiscredir")) {
+ ast_set_flag(&mask[0], SIP_PROMISCREDIR);
+ ast_set2_flag(&flags[0], ast_true(v->value), SIP_PROMISCREDIR);
+ res = 1;
+ } else if (!strcasecmp(v->name, "videosupport")) {
+ ast_set_flag(&mask[1], SIP_PAGE2_VIDEOSUPPORT);
+ ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_VIDEOSUPPORT);
+ } else if (!strcasecmp(v->name, "allowoverlap")) {
+ ast_set_flag(&mask[1], SIP_PAGE2_ALLOWOVERLAP);
+ ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_ALLOWOVERLAP);
+ } else if (!strcasecmp(v->name, "allowsubscribe")) {
+ ast_set_flag(&mask[1], SIP_PAGE2_ALLOWSUBSCRIBE);
+ ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_ALLOWSUBSCRIBE);
+ } else if (!strcasecmp(v->name, "t38pt_udptl")) {
+ ast_set_flag(&mask[1], SIP_PAGE2_T38SUPPORT_UDPTL);
+ ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_T38SUPPORT_UDPTL);
+ } else if (!strcasecmp(v->name, "t38pt_rtp")) {
+ ast_set_flag(&mask[1], SIP_PAGE2_T38SUPPORT_RTP);
+ ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_T38SUPPORT_RTP);
+ } else if (!strcasecmp(v->name, "t38pt_tcp")) {
+ ast_set_flag(&mask[1], SIP_PAGE2_T38SUPPORT_TCP);
+ ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_T38SUPPORT_TCP);
+ } else if (!strcasecmp(v->name, "rfc2833compensate")) {
+ ast_set_flag(&mask[1], SIP_PAGE2_RFC2833_COMPENSATE);
+ ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_RFC2833_COMPENSATE);
+ }
+
+ return res;
+}
+
+/*! \brief Set peer defaults before configuring specific configurations */
+void set_device_defaults(struct sip_peer *device)
+{
+ if (device->expire == 0) {
+ /* Don't reset expire or port time during reload
+ if we have an active registration
+ */
+ device->expire = -1;
+ device->pokeexpire = -1;
+ device->addr.sin_port = htons(STANDARD_SIP_PORT);
+ }
+ ast_copy_flags(&device->flags[0], &global.flags[0], SIP_FLAGS_TO_COPY);
+ ast_copy_flags(&device->flags[1], &global.flags[1], SIP_PAGE2_FLAGS_TO_COPY);
+ strcpy(device->context, global.default_context);
+ strcpy(device->subscribecontext, global.default_subscribecontext);
+ strcpy(device->language, global.default_language);
+ strcpy(device->mohinterpret, global.default_mohinterpret);
+ strcpy(device->mohsuggest, global.default_mohsuggest);
+ device->addr.sin_family = AF_INET;
+ device->defaddr.sin_family = AF_INET;
+ device->capability = global.capability;
+ device->rtptimeout = global.rtptimeout;
+ device->rtpholdtimeout = global.rtpholdtimeout;
+ device->rtpkeepalive = global.rtpkeepalive;
+ device->maxcallbitrate = global.default_maxcallbitrate;
+ strcpy(device->vmexten, global.default_vmexten);
+ device->secret[0] = '\0';
+ device->md5secret[0] = '\0';
+ device->cid_num[0] = '\0';
+ device->cid_name[0] = '\0';
+ device->fromdomain[0] = '\0';
+ device->fromuser[0] = '\0';
+ device->regexten[0] = '\0';
+ device->mailbox[0] = '\0';
+ device->callgroup = 0;
+ device->pickupgroup = 0;
+ device->allowtransfer = global.allowtransfer;
+ device->maxms = global.default_qualify;
+ device->prefs = global.default_prefs;
+}
+
+/*! \brief Initiate a SIP user structure from configuration (configuration or realtime) */
+/* XXX This function needs to go! */
+static struct sip_peer *build_user(const char *name, struct ast_variable *v, int realtime)
+{
+ struct sip_peer *user;
+ int format;
+ struct ast_ha *oldha = NULL;
+ char *varname = NULL, *varval = NULL;
+ struct ast_variable *tmpvar = NULL;
+ struct ast_flags userflags[2] = {{(0)}};
+ struct ast_flags mask[2] = {{(0)}};
+
+ if (!(user = ast_calloc(1, sizeof(*user))))
+ return NULL;
+
+ sipcounters.static_users++;
+ ASTOBJ_INIT(user);
+ user->type &= SIP_USER;
+ ast_copy_string(user->name, name, sizeof(user->name));
+ oldha = user->ha;
+ user->ha = NULL;
+ set_device_defaults(user); /* Set default values for this object */
+ for (; v; v = v->next) {
+ if (handle_common_options(&userflags[0], &mask[0], v))
+ continue;
+
+ if (!strcasecmp(v->name, "context")) {
+ ast_copy_string(user->context, v->value, sizeof(user->context));
+ } else if (!strcasecmp(v->name, "subscribecontext")) {
+ ast_copy_string(user->subscribecontext, v->value, sizeof(user->subscribecontext));
+ } else if (!strcasecmp(v->name, "setvar")) {
+ varname = ast_strdupa(v->value);
+ if ((varval = strchr(varname,'='))) {
+ *varval++ = '\0';
+ if ((tmpvar = ast_variable_new(varname, varval))) {
+ tmpvar->next = user->chanvars;
+ user->chanvars = tmpvar;
+ }
+ }
+ } else if (!strcasecmp(v->name, "permit") ||
+ !strcasecmp(v->name, "deny")) {
+ user->ha = ast_append_ha(v->name, v->value, user->ha);
+ } else if (!strcasecmp(v->name, "allowtransfer")) {
+ user->allowtransfer = ast_true(v->value) ? TRANSFER_OPENFORALL : TRANSFER_CLOSED;
+ } else if (!strcasecmp(v->name, "secret")) {
+ ast_copy_string(user->secret, v->value, sizeof(user->secret));
+ } else if (!strcasecmp(v->name, "md5secret")) {
+ ast_copy_string(user->md5secret, v->value, sizeof(user->md5secret));
+ } else if (!strcasecmp(v->name, "callerid")) {
+ ast_callerid_split(v->value, user->cid_name, sizeof(user->cid_name), user->cid_num, sizeof(user->cid_num));
+ } else if (!strcasecmp(v->name, "fullname")) {
+ ast_copy_string(user->cid_name, v->value, sizeof(user->cid_name));
+ } else if (!strcasecmp(v->name, "cid_number")) {
+ ast_copy_string(user->cid_num, v->value, sizeof(user->cid_num));
+ } else if (!strcasecmp(v->name, "callgroup")) {
+ user->callgroup = ast_get_group(v->value);
+ } else if (!strcasecmp(v->name, "pickupgroup")) {
+ user->pickupgroup = ast_get_group(v->value);
+ } else if (!strcasecmp(v->name, "language")) {
+ ast_copy_string(user->language, v->value, sizeof(user->language));
+ } else if (!strcasecmp(v->name, "mohinterpret")
+ || !strcasecmp(v->name, "musicclass") || !strcasecmp(v->name, "musiconhold")) {
+ ast_copy_string(user->mohinterpret, v->value, sizeof(user->mohinterpret));
+ } else if (!strcasecmp(v->name, "mohsuggest")) {
+ ast_copy_string(user->mohsuggest, v->value, sizeof(user->mohsuggest));
+ } else if (!strcasecmp(v->name, "accountcode")) {
+ ast_copy_string(user->accountcode, v->value, sizeof(user->accountcode));
+ } else if (!strcasecmp(v->name, "call-limit")) {
+ user->call_limit = atoi(v->value);
+ if (user->call_limit < 0)
+ user->call_limit = 0;
+ } else if (!strcasecmp(v->name, "amaflags")) {
+ format = ast_cdr_amaflags2int(v->value);
+ if (format < 0) {
+ ast_log(LOG_WARNING, "Invalid AMA Flags: %s at line %d\n", v->value, v->lineno);
+ } else {
+ user->amaflags = format;
+ }
+ } else if (!strcasecmp(v->name, "allow")) {
+ ast_parse_allow_disallow(&user->prefs, &user->capability, v->value, 1);
+ } else if (!strcasecmp(v->name, "disallow")) {
+ ast_parse_allow_disallow(&user->prefs, &user->capability, v->value, 0);
+ } else if (!strcasecmp(v->name, "autoframing")) {
+ user->autoframing = ast_true(v->value);
+ } else if (!strcasecmp(v->name, "callingpres")) {
+ user->callingpres = ast_parse_caller_presentation(v->value);
+ if (user->callingpres == -1)
+ user->callingpres = atoi(v->value);
+ } else if (!strcasecmp(v->name, "maxcallbitrate")) {
+ user->maxcallbitrate = atoi(v->value);
+ if (user->maxcallbitrate < 0)
+ user->maxcallbitrate = global.default_maxcallbitrate;
+ } else if (!strcasecmp(v->name, "t38pt_udptl")) {
+ ast_set2_flag(&user->flags[1], ast_true(v->value), SIP_PAGE2_T38SUPPORT_UDPTL);
+ } else if (!strcasecmp(v->name, "t38pt_rtp")) {
+ ast_set2_flag(&user->flags[1], ast_true(v->value), SIP_PAGE2_T38SUPPORT_RTP);
+ } else if (!strcasecmp(v->name, "t38pt_tcp")) {
+ ast_set2_flag(&user->flags[1], ast_true(v->value), SIP_PAGE2_T38SUPPORT_TCP);
+ }
+ }
+ ast_copy_flags(&user->flags[0], &userflags[0], mask[0].flags);
+ ast_copy_flags(&user->flags[1], &userflags[1], mask[1].flags);
+ if (ast_test_flag(&user->flags[1], SIP_PAGE2_ALLOWSUBSCRIBE))
+ global.allowsubscribe = TRUE; /* No global ban any more */
+ ast_free_ha(oldha);
+ return user;
+}
+
+/*! \brief Build peer from configuration (file or realtime static/dynamic) */
+static struct sip_peer *build_peer(const char *name, struct ast_variable *v, struct ast_variable *alt, int realtime)
+{
+ struct sip_peer *peer = NULL;
+ struct ast_ha *oldha = NULL;
+ int obproxyfound=0;
+ int found = 0;
+ int firstpass = 1;
+ int format = 0; /* Ama flags */
+ time_t regseconds = 0;
+ char *varname = NULL, *varval = NULL;
+ struct ast_variable *tmpvar = NULL;
+ struct ast_flags peerflags[2] = {{(0)}};
+ struct ast_flags mask[2] = {{(0)}};
+
+
+ if (!realtime)
+ /* Note we do NOT use find_peer here, to avoid realtime recursion */
+ /* We also use a case-sensitive comparison (unlike find_peer) so
+ that case changes made to the peer name will be properly handled
+ during reload
+ */
+ peer = ASTOBJ_CONTAINER_FIND_UNLINK_FULL(&peerl, name, name, 0, 0, strcmp);
+
+ if (peer) {
+ /* Already in the list, remove it and it will be added back (or FREE'd) */
+ found++;
+ if (!(peer->objflags & ASTOBJ_FLAG_MARKED))
+ firstpass = 0;
+ } else {
+ if (!(peer = ast_calloc(1, sizeof(*peer))))
+ return NULL;
+
+ if (realtime)
+ sipcounters.realtime_peers++;
+ else
+ sipcounters.static_peers++;
+ ASTOBJ_INIT(peer);
+ }
+ peer->type &= SIP_PEER;
+
+ /* Note that our peer HAS had its reference count incrased */
+
+ if (firstpass) {
+ peer->lastmsgssent = -1;
+ oldha = peer->ha;
+ peer->ha = NULL;
+ set_device_defaults(peer); /* Set peer defaults */
+ }
+ if (!found && name)
+ ast_copy_string(peer->name, name, sizeof(peer->name));
+
+ /* If we have channel variables, remove them (reload) */
+ if (peer->chanvars) {
+ ast_variables_destroy(peer->chanvars);
+ peer->chanvars = NULL;
+ /* XXX should unregister ? */
+ }
+ for (; v || ((v = alt) && !(alt=NULL)); v = v->next) {
+ if (handle_common_options(&peerflags[0], &mask[0], v))
+ continue;
+ if (realtime && !strcasecmp(v->name, "regseconds")) {
+ ast_get_time_t(v->value, ®seconds, 0, NULL);
+ } else if (realtime && !strcasecmp(v->name, "ipaddr") && !ast_strlen_zero(v->value) ) {
+ inet_aton(v->value, &(peer->addr.sin_addr));
+ } else if (realtime && !strcasecmp(v->name, "name"))
+ ast_copy_string(peer->name, v->value, sizeof(peer->name));
+ else if (realtime && !strcasecmp(v->name, "fullcontact")) {
+ ast_copy_string(peer->fullcontact, v->value, sizeof(peer->fullcontact));
+ ast_set_flag(&peer->flags[1], SIP_PAGE2_RT_FROMCONTACT);
+ } else if (!strcasecmp(v->name, "secret"))
+ ast_copy_string(peer->secret, v->value, sizeof(peer->secret));
+ else if (!strcasecmp(v->name, "md5secret"))
+ ast_copy_string(peer->md5secret, v->value, sizeof(peer->md5secret));
+ else if (!strcasecmp(v->name, "auth"))
+ peer->auth = add_realm_authentication(peer->auth, v->value, v->lineno);
+ else if (!strcasecmp(v->name, "callerid")) {
+ ast_callerid_split(v->value, peer->cid_name, sizeof(peer->cid_name), peer->cid_num, sizeof(peer->cid_num));
+ } else if (!strcasecmp(v->name, "fullname")) {
+ ast_copy_string(peer->cid_name, v->value, sizeof(peer->cid_name));
+ } else if (!strcasecmp(v->name, "cid_number")) {
+ ast_copy_string(peer->cid_num, v->value, sizeof(peer->cid_num));
+ } else if (!strcasecmp(v->name, "context")) {
+ ast_copy_string(peer->context, v->value, sizeof(peer->context));
+ } else if (!strcasecmp(v->name, "subscribecontext")) {
+ ast_copy_string(peer->subscribecontext, v->value, sizeof(peer->subscribecontext));
+ } else if (!strcasecmp(v->name, "fromdomain")) {
+ ast_copy_string(peer->fromdomain, v->value, sizeof(peer->fromdomain));
+ } else if (!strcasecmp(v->name, "usereqphone")) {
+ ast_set2_flag(&peer->flags[0], ast_true(v->value), SIP_USEREQPHONE);
+ } else if (!strcasecmp(v->name, "fromuser")) {
+ ast_copy_string(peer->fromuser, v->value, sizeof(peer->fromuser));
+ } else if (!strcasecmp(v->name, "host") || !strcasecmp(v->name, "outboundproxy")) {
+ if (!strcasecmp(v->value, "dynamic")) {
+ if (!strcasecmp(v->name, "outboundproxy") || obproxyfound) {
+ ast_log(LOG_WARNING, "You can't have a dynamic outbound proxy, you big silly head at line %d.\n", v->lineno);
+ } else {
+ /* They'll register with us */
+ ast_set_flag(&peer->flags[1], SIP_PAGE2_DYNAMIC);
+ if (!found) {
+ /* Initialize stuff iff we're not found, otherwise
+ we keep going with what we had */
+ memset(&peer->addr.sin_addr, 0, 4);
+ if (peer->addr.sin_port) {
+ /* If we've already got a port, make it the default rather than absolute */
+ peer->defaddr.sin_port = peer->addr.sin_port;
+ peer->addr.sin_port = 0;
+ }
+ }
+ }
+ } else {
+ /* Non-dynamic. Make sure we become that way if we're not */
+ if (peer->expire > -1)
+ ast_sched_del(sched, peer->expire);
+ peer->expire = -1;
+ ast_clear_flag(&peer->flags[1], SIP_PAGE2_DYNAMIC);
+ if (!obproxyfound || !strcasecmp(v->name, "outboundproxy")) {
+ if (ast_get_ip_or_srv(&peer->addr, v->value, global.srvlookup ? "_sip._udp" : NULL)) {
+ ASTOBJ_UNREF(peer, sip_destroy_device);
+ return NULL;
+ }
+ }
+ if (!strcasecmp(v->name, "outboundproxy"))
+ obproxyfound=1;
+ else {
+ ast_copy_string(peer->tohost, v->value, sizeof(peer->tohost));
+ if (!peer->addr.sin_port)
+ peer->addr.sin_port = htons(STANDARD_SIP_PORT);
+ }
+ }
+ } else if (!strcasecmp(v->name, "defaultip")) {
+ if (ast_get_ip(&peer->defaddr, v->value)) {
+ ASTOBJ_UNREF(peer, sip_destroy_device);
+ return NULL;
+ }
+ } else if (!strcasecmp(v->name, "permit") || !strcasecmp(v->name, "deny")) {
+ peer->ha = ast_append_ha(v->name, v->value, peer->ha);
+ } else if (!strcasecmp(v->name, "port")) {
+ if (!realtime && ast_test_flag(&peer->flags[1], SIP_PAGE2_DYNAMIC))
+ peer->defaddr.sin_port = htons(atoi(v->value));
+ else
+ peer->addr.sin_port = htons(atoi(v->value));
+ } else if (!strcasecmp(v->name, "callingpres")) {
+ peer->callingpres = ast_parse_caller_presentation(v->value);
+ if (peer->callingpres == -1)
+ peer->callingpres = atoi(v->value);
+ } else if (!strcasecmp(v->name, "username")) {
+ ast_copy_string(peer->username, v->value, sizeof(peer->username));
+ } else if (!strcasecmp(v->name, "language")) {
+ ast_copy_string(peer->language, v->value, sizeof(peer->language));
+ } else if (!strcasecmp(v->name, "regexten")) {
+ ast_copy_string(peer->regexten, v->value, sizeof(peer->regexten));
+ } else if (!strcasecmp(v->name, "call-limit")) {
+ peer->call_limit = atoi(v->value);
+ if (peer->call_limit < 0)
+ peer->call_limit = 0;
+ } else if (!strcasecmp(v->name, "amaflags")) {
+ format = ast_cdr_amaflags2int(v->value);
+ if (format < 0) {
+ ast_log(LOG_WARNING, "Invalid AMA Flags for peer: %s at line %d\n", v->value, v->lineno);
+ } else {
+ peer->amaflags = format;
+ }
+ } else if (!strcasecmp(v->name, "accountcode")) {
+ ast_copy_string(peer->accountcode, v->value, sizeof(peer->accountcode));
+ } else if (!strcasecmp(v->name, "mohinterpret")
+ || !strcasecmp(v->name, "musicclass") || !strcasecmp(v->name, "musiconhold")) {
+ ast_copy_string(peer->mohinterpret, v->value, sizeof(peer->mohinterpret));
+ } else if (!strcasecmp(v->name, "mohsuggest")) {
+ ast_copy_string(peer->mohsuggest, v->value, sizeof(peer->mohsuggest));
+ } else if (!strcasecmp(v->name, "mailbox")) {
+ ast_copy_string(peer->mailbox, v->value, sizeof(peer->mailbox));
+ } else if (!strcasecmp(v->name, "subscribemwi")) {
+ ast_set2_flag(&peer->flags[1], ast_true(v->value), SIP_PAGE2_SUBSCRIBEMWIONLY);
+ } else if (!strcasecmp(v->name, "vmexten")) {
+ ast_copy_string(peer->vmexten, v->value, sizeof(peer->vmexten));
+ } else if (!strcasecmp(v->name, "callgroup")) {
+ peer->callgroup = ast_get_group(v->value);
+ } else if (!strcasecmp(v->name, "allowtransfer")) {
+ peer->allowtransfer = ast_true(v->value) ? TRANSFER_OPENFORALL : TRANSFER_CLOSED;
+ } else if (!strcasecmp(v->name, "pickupgroup")) {
+ peer->pickupgroup = ast_get_group(v->value);
+ } else if (!strcasecmp(v->name, "allow")) {
+ ast_parse_allow_disallow(&peer->prefs, &peer->capability, v->value, 1);
+ } else if (!strcasecmp(v->name, "disallow")) {
+ ast_parse_allow_disallow(&peer->prefs, &peer->capability, v->value, 0);
+ } else if (!strcasecmp(v->name, "autoframing")) {
+ peer->autoframing = ast_true(v->value);
+ } else if (!strcasecmp(v->name, "rtptimeout")) {
+ if ((sscanf(v->value, "%d", &peer->rtptimeout) != 1) || (peer->rtptimeout < 0)) {
+ ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno);
+ peer->rtptimeout = global.rtptimeout;
+ }
+ } else if (!strcasecmp(v->name, "rtpholdtimeout")) {
+ if ((sscanf(v->value, "%d", &peer->rtpholdtimeout) != 1) || (peer->rtpholdtimeout < 0)) {
+ ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno);
+ peer->rtpholdtimeout = global.rtpholdtimeout;
+ }
+ } else if (!strcasecmp(v->name, "rtpkeepalive")) {
+ if ((sscanf(v->value, "%d", &peer->rtpkeepalive) != 1) || (peer->rtpkeepalive < 0)) {
+ ast_log(LOG_WARNING, "'%s' is not a valid RTP keepalive time at line %d. Using default.\n", v->value, v->lineno);
+ peer->rtpkeepalive = global.rtpkeepalive;
+ }
+ } else if (!strcasecmp(v->name, "setvar")) {
+ /* Set peer channel variable */
+ varname = ast_strdupa(v->value);
+ if ((varval = strchr(varname, '='))) {
+ *varval++ = '\0';
+ if ((tmpvar = ast_variable_new(varname, varval))) {
+ tmpvar->next = peer->chanvars;
+ peer->chanvars = tmpvar;
+ }
+ }
+ } else if (!strcasecmp(v->name, "qualify")) {
+ if (!strcasecmp(v->value, "no")) {
+ peer->maxms = 0;
+ } else if (!strcasecmp(v->value, "yes")) {
+ peer->maxms = DEFAULT_QUALIFY_MAXMS;
+ } else if (sscanf(v->value, "%d", &peer->maxms) != 1) {
+ 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")) {
+ peer->maxcallbitrate = atoi(v->value);
+ if (peer->maxcallbitrate < 0)
+ peer->maxcallbitrate = global.default_maxcallbitrate;
+ } else if (!strcasecmp(v->name, "t38pt_udptl")) {
+ ast_set2_flag(&peer->flags[1], ast_true(v->value), SIP_PAGE2_T38SUPPORT_UDPTL);
+ } else if (!strcasecmp(v->name, "t38pt_rtp")) {
+ ast_set2_flag(&peer->flags[1], ast_true(v->value), SIP_PAGE2_T38SUPPORT_RTP);
+ } else if (!strcasecmp(v->name, "t38pt_tcp")) {
+ ast_set2_flag(&peer->flags[1], ast_true(v->value), SIP_PAGE2_T38SUPPORT_TCP);
+ }
+ }
+ if (!ast_test_flag(&global.flags[1], SIP_PAGE2_IGNOREREGEXPIRE) && ast_test_flag(&peer->flags[1], SIP_PAGE2_DYNAMIC) && realtime) {
+ time_t nowtime = time(NULL);
+
+ if ((nowtime - regseconds) > 0) {
+ destroy_association(peer);
+ memset(&peer->addr, 0, sizeof(peer->addr));
+ if (option_debug)
+ ast_log(LOG_DEBUG, "Bah, we're expired (%d/%d/%d)!\n", (int)(nowtime - regseconds), (int)regseconds, (int)nowtime);
+ }
+ }
+ 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 */
+ if (!found && ast_test_flag(&peer->flags[1], SIP_PAGE2_DYNAMIC) && !ast_test_flag(&peer->flags[0], SIP_REALTIME))
+ reg_source_db(peer);
+ ASTOBJ_UNMARK(peer);
+ ast_free_ha(oldha);
+ return peer;
+}
+
+/*! \brief realtime_peer: Get peer from realtime storage
+ * Checks the "sippeers" realtime family from extconfig.conf
+ * \todo Consider adding check of port address when matching here to follow the same
+ * algorithm as for static peers. Will we break anything by adding that?
+*/
+struct sip_peer *realtime_peer(const char *newpeername, struct sockaddr_in *sin)
+{
+ struct sip_peer *peer;
+ struct ast_variable *var = NULL;
+ struct ast_variable *tmp;
+ char ipaddr[INET_ADDRSTRLEN];
+
+ /* First check on peer name */
+ if (newpeername)
+ var = ast_load_realtime("sippeers", "name", newpeername, NULL);
+ else if (sin) { /* Then check on IP address for dynamic peers */
+ ast_copy_string(ipaddr, ast_inet_ntoa(sin->sin_addr), sizeof(ipaddr));
+ var = ast_load_realtime("sippeers", "host", ipaddr, NULL); /* First check for fixed IP hosts */
+ if (!var)
+ var = ast_load_realtime("sippeers", "ipaddr", ipaddr, NULL); /* Then check for registred hosts */
+ }
+
+ if (!var)
+ return NULL;
+
+ for (tmp = var; tmp; tmp = tmp->next) {
+ /* If this is type=user, then skip this object. */
+ if (!strcasecmp(tmp->name, "type") &&
+ !strcasecmp(tmp->value, "user")) {
+ ast_variables_destroy(var);
+ return NULL;
+ } else if (!newpeername && !strcasecmp(tmp->name, "name")) {
+ newpeername = tmp->value;
+ }
+ }
+
+ if (!newpeername) { /* Did not find peer in realtime */
+ ast_log(LOG_WARNING, "Cannot Determine peer name ip=%s\n", ipaddr);
+ ast_variables_destroy(var);
+ return NULL;
+ }
+
+ /* Peer found in realtime, now build it in memory */
+ peer = build_peer(newpeername, var, NULL, !ast_test_flag(&global.flags[1], SIP_PAGE2_RTCACHEFRIENDS));
+ if (!peer) {
+ ast_variables_destroy(var);
+ return NULL;
+ }
+
+ if (ast_test_flag(&global.flags[1], SIP_PAGE2_RTCACHEFRIENDS)) {
+ /* Cache peer */
+ ast_copy_flags(&peer->flags[1],&global.flags[1], SIP_PAGE2_RTAUTOCLEAR|SIP_PAGE2_RTCACHEFRIENDS);
+ if (ast_test_flag(&global.flags[1], SIP_PAGE2_RTAUTOCLEAR)) {
+ if (peer->expire > -1) {
+ ast_sched_del(sched, peer->expire);
+ }
+ peer->expire = ast_sched_add(sched, (global.rtautoclear) * 1000, expire_register, (void *)peer);
+ }
+ ASTOBJ_CONTAINER_LINK(&peerl,peer);
+ } else {
+ ast_set_flag(&peer->flags[0], SIP_REALTIME);
+ }
+ ast_variables_destroy(var);
+
+ return peer;
+}
+
+/*! \brief Load user from realtime storage
+ * Loads user from "sipusers" category in realtime (extconfig.conf)
+ * Users are matched on From: user name (the domain in skipped) */
+struct sip_peer *realtime_user(const char *username)
+{
+ struct ast_variable *var;
+ struct ast_variable *tmp;
+ struct sip_peer *user = NULL;
+
+ var = ast_load_realtime("sipusers", "name", username, NULL);
+
+ if (!var)
+ return NULL;
+
+ for (tmp = var; tmp; tmp = tmp->next) {
+ if (!strcasecmp(tmp->name, "type") &&
+ !strcasecmp(tmp->value, "peer")) {
+ ast_variables_destroy(var);
+ return NULL;
+ }
+ }
+
+ user = build_user(username, var, !ast_test_flag((&global.flags[1]), SIP_PAGE2_RTCACHEFRIENDS));
+ if (!user) { /* No user found */
+ ast_variables_destroy(var);
+ return NULL;
+ }
+
+ if (ast_test_flag(&global.flags[1], SIP_PAGE2_RTCACHEFRIENDS)) {
+ ast_set_flag(&user->flags[1], SIP_PAGE2_RTCACHEFRIENDS);
+ sipcounters.static_users++;
+ ASTOBJ_CONTAINER_LINK(&userl,user);
+ } else {
+ /* Move counter from s to r... */
+ sipcounters.static_users--;
+ sipcounters.realtime_users++;
+ ast_set_flag(&user->flags[0], SIP_REALTIME);
+ }
+ ast_variables_destroy(var);
+ return user;
+}
+
+/*! \brief Re-read SIP.conf config file
+\note This function reloads all config data, except for
+ active peers (with registrations). They will only
+ change configuration data at restart, not at reload.
+ SIP debug and recordhistory state will not change
+ */
+int reload_config(enum channelreloadreason reason)
+{
+ struct ast_config *cfg;
+ struct ast_variable *v;
+ struct sip_peer *device = (struct sip_peer *) NULL;
+ struct ast_hostent ahp;
+ char *cat, *stringp, *context, *oldregcontext;
+ char newcontexts[AST_MAX_CONTEXT], oldcontexts[AST_MAX_CONTEXT];
+ struct hostent *hp;
+ int format;
+ struct ast_flags dummy[2];
+ int auto_sip_domains = FALSE;
+ struct sockaddr_in old_bindaddr = sipnet.bindaddr;
+ int registry_count = 0, peer_count = 0, user_count = 0;
+ struct ast_flags debugflag = {0};
+
+ cfg = ast_config_load(config);
+
+ /* We *must* have a config file otherwise stop immediately */
+ if (!cfg) {
+ ast_log(LOG_NOTICE, "Unable to load config %s\n", config);
+ return -1;
+ }
+
+ /* Initialize copy of current global.regcontext for later use in removing stale contexts */
+ ast_copy_string(oldcontexts, global.regcontext, sizeof(oldcontexts));
+ oldregcontext = oldcontexts;
+
+ /* Clear all flags before setting default values */
+ /* Preserve debugging settings for console */
+ ast_copy_flags(&debugflag, &global.flags[1], SIP_PAGE2_DEBUG_CONSOLE);
+ ast_clear_flag(&global.flags[0], AST_FLAGS_ALL);
+ ast_clear_flag(&global.flags[1], AST_FLAGS_ALL);
+ ast_copy_flags(&global.flags[1], &debugflag, SIP_PAGE2_DEBUG_CONSOLE);
+
+ /* Reset IP addresses */
+ memset(&sipnet.bindaddr, 0, sizeof(sipnet.bindaddr));
+ memset(&sipnet.localaddr, 0, sizeof(sipnet.localaddr));
+ memset(&sipnet.externip, 0, sizeof(sipnet.externip));
+ memset(&global.default_prefs, 0 , sizeof(global.default_prefs));
+ sipnet.outboundproxyip.sin_port = htons(STANDARD_SIP_PORT);
+ sipnet.outboundproxyip.sin_family = AF_INET; /* Type of address: IPv4 */
+ sipnet_ourport_set(DEFAULT_LISTEN_SIP_PORT);
+ global.srvlookup = TRUE;
+ /*! \brief Codecs that we support by default: */
+ global.capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263;
+ global.dtmf_capability = AST_RTP_DTMF;
+ /*!< This is default: NO MMR and JBIG trancoding, NO fill bit removal, transferredTCF TCF, UDP FEC, Version 0 and 9600 max fax rate */
+ global.t38_capability = T38FAX_VERSION_0 | T38FAX_RATE_2400 | T38FAX_RATE_4800 | T38FAX_RATE_7200 | T38FAX_RATE_9600;
+ global.tos_sip = DEFAULT_TOS_SIP;
+ global.tos_audio = DEFAULT_TOS_AUDIO;
+ global.tos_video = DEFAULT_TOS_VIDEO;
+ global.tos_presence = DEFAULT_TOS_SIP; /* Initialize to SIP type of service */
+ sipnet.externhost[0] = '\0'; /* External host name (for behind NAT DynDNS support) */
+ sipnet.externexpire = 0; /* Expiration for DNS re-issuing */
+ sipnet.externrefresh = 10;
+ memset(&sipnet.outboundproxyip, 0, sizeof(sipnet.outboundproxyip));
+
+ /* Reset channel settings to default before re-configuring */
+ global.allow_external_domains = DEFAULT_ALLOW_EXT_DOM; /* Allow external invites */
+ global.regcontext[0] = '\0';
+ expiry.min_expiry = DEFAULT_MIN_EXPIRY; /*!< Minimum accepted registration time */
+ expiry.max_expiry = DEFAULT_MAX_EXPIRY; /*!< Maximum accepted registration time */
+ expiry.default_expiry = DEFAULT_DEFAULT_EXPIRY;
+ expiry.expiry = DEFAULT_EXPIRY; /* Used anywhere??? */
+ global.notifyringing = DEFAULT_NOTIFYRINGING;
+ global.alwaysauthreject = 0;
+ global.allowsubscribe = FALSE;
+ ast_copy_string(global.useragent, DEFAULT_USERAGENT, sizeof(global.useragent));
+ ast_copy_string(global.default_notifymime, DEFAULT_NOTIFYMIME, sizeof(global.default_notifymime));
+ if (ast_strlen_zero(ast_config_AST_SYSTEM_NAME))
+ ast_copy_string(global.realm, DEFAULT_REALM, sizeof(global.realm));
+ else
+ ast_copy_string(global.realm, ast_config_AST_SYSTEM_NAME, sizeof(global.realm));
+ ast_copy_string(global.default_callerid, DEFAULT_CALLERID, sizeof(global.default_callerid));
+ global.compactheaders = DEFAULT_COMPACTHEADERS;
+ global.reg_timeout = DEFAULT_REGISTRATION_TIMEOUT;
+ global.regattempts_max = 0;
+ global.mwitime = DEFAULT_MWITIME;
+ global.autocreatepeer = DEFAULT_AUTOCREATEPEER;
+ global.allowguest = DEFAULT_ALLOWGUEST;
+ global.rtptimeout = 0;
+ global.rtpholdtimeout = 0;
+ global.rtpkeepalive = 0;
+ global.autoframing = 0;
+ global.allowtransfer = TRANSFER_OPENFORALL; /* Merrily accept all transfers by default */
+ global.rtautoclear = 120;
[... 412 lines stripped ...]
More information about the asterisk-commits
mailing list