-#if 0
-
-static int reload_zt(void)
-{
- struct ast_config *cfg;
- struct ast_variable *v;
- struct zt_pvt *tmp;
- struct zt_pvt *prev = NULL;
- char *chan;
- char *ringc;
- int start, finish,x;
- char *stringp=NULL;
-
- /* Some crap that needs to be reinitialized on the reload */
- strncpy(context, "default", sizeof(context) - 1);
- language[0] = '\0';
- musicclass[0] = '\0';
- use_callerid = 1;
- cid_signalling = CID_SIG_BELL;
- cid_start = CID_START_RING;
- cur_signalling = -1;
- cur_group = 0;
- cur_callergroup = 0;
- cur_pickupgroup = 0;
- immediate = 0;
- stripmsd = 0;
- callwaiting = 0;
- busydetect = 0;
- busycount = 3;
- callprogress = 0;
- callwaitingcallerid = 0;
- hidecallerid = 0;
- callreturn = 0;
- threewaycalling = 0;
- transfer = 0;
- rxgain = 0.0;
- txgain = 0.0;
- tonezone = -1;
- firstdigittimeout = 16000;
- gendigittimeout = 8000;
- amaflags = 0;
- adsi = 0;
- memset(drings,0,sizeof(drings));
- strncpy(accountcode, "", sizeof(accountcode)-1);
-#ifdef ZAPATA_PRI
- strncpy(idleext, "", sizeof(idleext) - 1);
- strncpy(idledial, "", sizeof(idledial) - 1);
- minunused = 2;
- minidle = 0;
-#endif
-// usecnt = 0;
-
-#if 0
-#ifdef ZAPATA_PRI
- int y;
-#endif
-#endif
-
-
-#if 0
-#ifdef ZAPATA_PRI
- for (y=0;y<NUM_SPANS;y++)
- ast_mutex_destroy(&pris[y]->lock);
- memset(pris, 0, sizeof(pris));
- for (y=0;y<NUM_SPANS;y++) {
- ast_mutex_init(&pris[y]->lock);
- pris[y].fd = -1;
- }
-#endif
-#endif /* 0 */
-
- cfg = ast_load(config);
-
- /* We *must* have a config file otherwise stop immediately */
- if (!cfg) {
- ast_log(LOG_ERROR, "Unable to load config %s\n", config);
- return -1;
- }
-
-
- if (ast_mutex_lock(&iflock)) {
- /* It's a little silly to lock it, but we mind as well just to be sure */
- ast_log(LOG_ERROR, "Unable to lock interface list???\n");
- return -1;
- }
-
- /* Part of the primary changes for the reload... */
- tmp = iflist;
-
- while (tmp) {
- tmp->destroy = 1;
- tmp = tmp->next;
- }
-
- v = ast_variable_browse(cfg, "channels");
-
- while(v) {
- /* Create the interface list */
- if (!strcasecmp(v->name, "channel")) {
- if (cur_signalling < 0) {
- ast_log(LOG_ERROR, "Signalling must be specified before any channels are.\n");
- ast_destroy(cfg);
- ast_mutex_unlock(&iflock);
- return -1;
- }
- stringp=v->value;
- chan = strsep(&stringp, ",");
- while(chan) {
- if (sscanf(chan, "%d-%d", &start, &finish) == 2) {
- /* Range */
- } else if (sscanf(chan, "%d", &start)) {
- /* Just one */
- finish = start;
- } else {
- ast_log(LOG_ERROR, "Syntax error parsing '%s' at '%s'\n", v->value, chan);
- ast_destroy(cfg);
- ast_mutex_unlock(&iflock);
- return -1;
- }
- if (finish < start) {
- ast_log(LOG_WARNING, "Sillyness: %d < %d\n", start, finish);
- x = finish;
- finish = start;
- start = x;
- }
- for (x = start; x <= finish; x++) {
- tmp = mkintf(x, cur_signalling);
- if (tmp) {
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "Registered channel %d, %s signalling\n", x, sig2str(tmp->sig));
- } else {
- ast_log(LOG_ERROR, "Unable to register channel '%s'\n", v->value);
- ast_destroy(cfg);
- ast_mutex_unlock(&iflock);
- return -1;
- }
- }
- chan = strsep(&stringp, ",");
- }
- } else if (!strcasecmp(v->name, "usedistinctiveringdetection")) {
- if (ast_true(v->value))
- usedistinctiveringdetection = 1;
- } else if (!strcasecmp(v->name, "dring1context")) {
- strncpy(drings.ringContext[0].contextData,v->value,sizeof(drings.ringContext[0].contextData)-1);
- } else if (!strcasecmp(v->name, "dring2context")) {
- strncpy(drings.ringContext[1].contextData,v->value,sizeof(drings.ringContext[1].contextData)-1);
- } else if (!strcasecmp(v->name, "dring3context")) {
- strncpy(drings.ringContext[2].contextData,v->value,sizeof(drings.ringContext[2].contextData)-1);
- } else if (!strcasecmp(v->name, "dring1")) {
- ringc = v->value;
- sscanf(ringc, "%d,%d,%d", &drings.ringnum[0].ring[0], &drings.ringnum[0].ring[1], &drings.ringnum[0].ring[2]);
- } else if (!strcasecmp(v->name, "dring2")) {
- ringc = v->value;
- sscanf(ringc,"%d,%d,%d", &drings.ringnum[1].ring[0], &drings.ringnum[1].ring[1], &drings.ringnum[1].ring[2]);
- } else if (!strcasecmp(v->name, "dring3")) {
- ringc = v->value;
- sscanf(ringc, "%d,%d,%d", &drings.ringnum[2].ring[0], &drings.ringnum[2].ring[1], &drings.ringnum[2].ring[2]);
- } else if (!strcasecmp(v->name, "usecallerid")) {
- use_callerid = ast_true(v->value);
- } else if (!strcasecmp(v->name, "cidsignalling")) {
- if (!strcasecmp(v->value, "bell"))
- cid_signalling = CID_SIG_BELL;
- else if (!strcasecmp(v->value, "v23"))
- cid_signalling = CID_SIG_V23;
- else if (!strcasecmp(v->value, "dtmf"))
- cid_signalling = CID_SIG_DTMF;
- else if (ast_true(v->value))
- cid_signalling = CID_SIG_BELL;
- } else if (!strcasecmp(v->name, "cidstart")) {
- if (!strcasecmp(v->value, "ring"))
- cid_start = CID_START_RING;
- else if (!strcasecmp(v->value, "polarity"))
- cid_start = CID_START_POLARITY;
- else if (ast_true(v->value))
- cid_start = CID_START_RING;
- } else if (!strcasecmp(v->name, "threewaycalling")) {
- threewaycalling = ast_true(v->value);
- } else if (!strcasecmp(v->name, "transfer")) {
- transfer = ast_true(v->value);
- } else if (!strcasecmp(v->name, "busydetect")) {
- busydetect = ast_true(v->value);
- } else if (!strcasecmp(v->name, "busycount")) {
- busycount = atoi(v->value);
- } else if (!strcasecmp(v->name, "callprogress")) {
- callprogress = ast_true(v->value);
- } else if (!strcasecmp(v->name, "hidecallerid")) {
- hidecallerid = ast_true(v->value);
- } else if (!strcasecmp(v->name, "callreturn")) {
- callreturn = ast_true(v->value);
- } else if (!strcasecmp(v->name, "callwaiting")) {
- callwaiting = ast_true(v->value);
- } else if (!strcasecmp(v->name, "callwaitingcallerid")) {
- callwaitingcallerid = ast_true(v->value);
- } else if (!strcasecmp(v->name, "context")) {
- strncpy(context, v->value, sizeof(context)-1);
- } else if (!strcasecmp(v->name, "language")) {
- strncpy(language, v->value, sizeof(language)-1);
- } else if (!strcasecmp(v->name, "progzone")) {
- strncpy(progzone, v->value, sizeof(progzone) - 1);
- } else if (!strcasecmp(v->name, "musiconhold")) {
- strncpy(musicclass, v->value, sizeof(musicclass)-1);
- } else if (!strcasecmp(v->name, "stripmsd")) {
- stripmsd = atoi(v->value);
- } else if (!strcasecmp(v->name, "group")) {
- cur_group = get_group(v->value);
- } else if (!strcasecmp(v->name, "callgroup")) {
- cur_callergroup = get_group(v->value);
- } else if (!strcasecmp(v->name, "pickupgroup")) {
- cur_pickupgroup = get_group(v->value);
- } else if (!strcasecmp(v->name, "immediate")) {
- immediate = ast_true(v->value);
- } else if (!strcasecmp(v->name, "mailbox")) {
- strncpy(mailbox, v->value, sizeof(mailbox) -1);
- } else if (!strcasecmp(v->name, "rxgain")) {
- if (sscanf(v->value, "%f", &rxgain) != 1) {
- ast_log(LOG_WARNING, "Invalid rxgain: %s\n", v->value);
- }
- } else if (!strcasecmp(v->name, "txgain")) {
- if (sscanf(v->value, "%f", &txgain) != 1) {
- ast_log(LOG_WARNING, "Invalid txgain: %s\n", v->value);
- }
- } else if (!strcasecmp(v->name, "tonezone")) {
- if (sscanf(v->value, "%d", &tonezone) != 1) {
- ast_log(LOG_WARNING, "Invalid tonezone: %s\n", v->value);
- }
- } else if (!strcasecmp(v->name, "callerid")) {
- if (!strcasecmp(v->value, "asreceived"))
- callerid[0] = '\0';
- else
- strncpy(callerid, v->value, sizeof(callerid)-1);
- } else if (!strcasecmp(v->name, "signalling")) {
- if (!strcasecmp(v->value, "em")) {
- cur_signalling = SIG_EM;
- } else if (!strcasecmp(v->value, "em_w")) {
- cur_signalling = SIG_EMWINK;
- } else if (!strcasecmp(v->value, "fxs_ls")) {
- cur_signalling = SIG_FXSLS;
- } else if (!strcasecmp(v->value, "fxs_gs")) {
- cur_signalling = SIG_FXSGS;
- } else if (!strcasecmp(v->value, "fxs_ks")) {
- cur_signalling = SIG_FXSKS;
- } else if (!strcasecmp(v->value, "fxo_ls")) {
- cur_signalling = SIG_FXOLS;
- } else if (!strcasecmp(v->value, "fxo_gs")) {
- cur_signalling = SIG_FXOGS;
- } else if (!strcasecmp(v->value, "fxo_ks")) {
- cur_signalling = SIG_FXOKS;
- } else if (!strcasecmp(v->value, "featd")) {
- cur_signalling = SIG_FEATD;
- } else if (!strcasecmp(v->value, "featdmf")) {
- cur_signalling = SIG_FEATDMF;
- } else if (!strcasecmp(v->value, "e911")) {
- cur_signalling = SIG_E911;
- } else if (!strcasecmp(v->value, "featb")) {
- cur_signalling = SIG_FEATB;
-#ifdef ZAPATA_PRI
- } else if (!strcasecmp(v->value, "pri_net")) {
- cur_signalling = SIG_PRI;
- pritype = PRI_NETWORK;
- } else if (!strcasecmp(v->value, "pri_cpe")) {
- cur_signalling = SIG_PRI;
- pritype = PRI_CPE;
-#endif
- } else {
- ast_log(LOG_ERROR, "Unknown signalling method '%s'\n", v->value);
- }
-#ifdef ZAPATA_PRI
- } else if (!strcasecmp(v->name, "switchtype")) {
- if (!strcasecmp(v->value, "national"))
- switchtype = PRI_SWITCH_NI2;
- else if (!strcasecmp(v->value, "dms100"))
- switchtype = PRI_SWITCH_DMS100;
- else if (!strcasecmp(v->value, "4ess"))
- switchtype = PRI_SWITCH_ATT4ESS;
- else if (!strcasecmp(v->value, "5ess"))
- switchtype = PRI_SWITCH_LUCENT5E;
- else {
- ast_log(LOG_ERROR, "Unknown switchtype '%s'\n", v->value);
- ast_destroy(cfg);
- ast_mutex_unlock(&iflock);
- return -1;
- }
- } else if (!strcasecmp(v->name, "nsf")) {
- if (!strcasecmp(v->value, "sdn"))
- nsf = PRI_NSF_SDN;
- else if (!strcasecmp(v->value, "megacom"))
- nsf = PRI_NSF_MEGACOM;
- else if (!strcasecmp(v->value, "accunet"))
- nsf = PRI_NSF_ACCUNET
- else if (!strcasecmp(v->value, "none"))
- nsf = PRI_NSF_NONE;
- else {
- ast_log(LOG_WARN, "Unknown network-specific facility '%s'\n", v->value);
- nsf = PRI_NSF_NONE;
- }
- } else if (!strcasecmp(v->name, "jitterbuffers")) {
- numbufs = atoi(v->value);
- } else if (!strcasecmp(v->name, "minunused")) {
- minunused = atoi(v->value);
- } else if (!strcasecmp(v->name, "idleext")) {
- strncpy(idleext, v->value, sizeof(idleext) - 1);
- } else if (!strcasecmp(v->name, "idledial")) {
- strncpy(idledial, v->value, sizeof(idledial) - 1);
-#endif
- } else
- ast_log(LOG_WARNING, "Ignoring %s\n", v->name);
- v = v->next;
- }
-
- tmp = iflist;
- prev = NULL;
-
- while (tmp) {
- if (tmp->destroy) {
- if (destroy_channel(prev, tmp, 0)) {
- ast_log(LOG_ERROR, "Unable to destroy chan_zap channel %d\n", tmp->channel);
- ast_mutex_unlock(&iflock);
- return -1;
- }
- tmp = tmp->next;
- } else {
- prev = tmp;
- tmp = tmp->next;
- }
- }
-
- ast_mutex_unlock(&iflock);
-
- ast_destroy(cfg);
- /* And start the monitor for the first time */
-
- restart_monitor();
- return 0;
-}
-#endif
-