Thu Mar 6 07:00:01 CET 2003
authorMatteo Brancaleoni <mbrancaleoni@espia.it>
Thu, 6 Mar 2003 06:00:17 +0000 (06:00 +0000)
committerMatteo Brancaleoni <mbrancaleoni@espia.it>
Thu, 6 Mar 2003 06:00:17 +0000 (06:00 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@633 65c4cc65-6c06-0410-ace0-fbb531ad65f3

CHANGES
apps/app_voicemail.c
asterisk.c
channels/chan_sip.c
channels/chan_zap.c
manager.c

diff --git a/CHANGES b/CHANGES
index 1a443ca..ae932be 100755 (executable)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,4 @@
+ -- Add contributed "*80" support to blacklist numbers (Thanks James!)
  -- Add "NAT" option to sip user, peer, friend
  -- Add experimental "IAX2" protocol
  -- Add "Enhanced" AGI with audio pass-through (voice recognition anyone?)
index 4af888f..191b21a 100755 (executable)
@@ -993,11 +993,8 @@ static int adsi_load_vmail(struct ast_channel *chan, int *useadsi)
 static void adsi_begin(struct ast_channel *chan, int *useadsi)
 {
        int x;
-       if(!strcasecmp(chan->type, "sip")){
-         *useadsi = 0;
+       if (!adsi_available(chan))
           return;
-        }
-
        x = adsi_load_session(chan, adapp, adver, 1);
        if (x < 0)
                return;
@@ -1309,9 +1306,7 @@ static void adsi_goodbye(struct ast_channel *chan)
 {
        char buf[256];
        int bytes=0;
-       if(!strcasecmp(chan->type, "sip")){
-          return;
-        }
+
        if (!adsi_available(chan))
                return;
        bytes += adsi_logo(buf + bytes);
index ddfa058..c7093a1 100755 (executable)
@@ -670,7 +670,8 @@ static int ast_el_read_char(EditLine *el, char *cp)
                                write(STDOUT_FILENO, "\r", 1);
                        write(STDOUT_FILENO, buf, res);
                        if ((buf[res-1] == '\n') || (buf[res-2] == '\n')) {
-                               break;
+                               *cp = CC_REFRESH;
+                               return(1);
                        } else {
                                lastpos = 1;
                        }
index c4e0d20..726218f 100755 (executable)
@@ -937,6 +937,7 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, char *title)
                ast_setstate(tmp, state);
                if (state == AST_STATE_RING)
                        tmp->rings = 1;
+               tmp->adsicpe = AST_ADSI_UNAVAILABLE;
                tmp->writeformat = fmt;
                tmp->pvt->rawwriteformat = fmt;
                tmp->readformat = fmt;
index cffaf3e..8654823 100755 (executable)
@@ -161,6 +161,8 @@ static int echocanbridged = 0;
 
 static int busydetect = 0;
 
+static int busycount = 3;
+
 static int callprogress = 0;
 
 static char accountcode[20] = "";
@@ -398,6 +400,7 @@ static struct zt_pvt {
        int outgoing;
        int dnd;
        int busydetect;
+       int busycount;
        int callprogress;
        struct ast_dsp *dsp;
        int cref;                                       /* Call reference number */
@@ -3326,6 +3329,9 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
                                if (i->dsp) {
                                        ast_dsp_set_features(i->dsp, features);
                                        ast_dsp_digitmode(i->dsp, DSP_DIGITMODE_DTMF | i->dtmfrelax);
+                                       if (i->busydetect && CANBUSYDETECT(i)) {
+                                               ast_dsp_set_busy_count(i->dsp, i->busycount);
+                                               }
                                }
                        }
                }
@@ -3806,6 +3812,15 @@ static void *ss_thread(void *data)
                                if (option_verbose > 2)
                                        ast_verbose(VERBOSE_PREFIX_3 "Parking call to '%s'\n", chan->name);
                                break;
+                       } else if (strlen(p->lastcallerid) && !strcmp(exten, "*80")) {
+                               if (option_verbose > 2)
+                                       ast_verbose(VERBOSE_PREFIX_3 "Blacklisting number %s\n", p->lastcallerid);
+                               res = ast_db_put("blacklist", p->lastcallerid, "1");
+                               if (!res) {
+                                       res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);
+                                       memset(exten, 0, sizeof(exten));
+                                       len = 0;
+                               }
                        } else if (p->hidecallerid && !strcmp(exten, "*82")) {
                                if (option_verbose > 2) 
                                        ast_verbose(VERBOSE_PREFIX_3 "Enabling Caller*ID on %s\n", chan->name);
@@ -4685,6 +4700,7 @@ static struct zt_pvt *mkintf(int channel, int signalling, int radio)
                tmp->echocancel = echocancel;
                tmp->echocanbridged = echocanbridged;
                tmp->busydetect = busydetect;
+               tmp->busycount = busycount;
                tmp->callprogress = callprogress;
                tmp->cancallforward = cancallforward;
                tmp->dtmfrelax = relaxdtmf;
@@ -6086,6 +6102,8 @@ int load_module()
                        echocanbridged = 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, "echocancel")) {
@@ -6404,6 +6422,7 @@ static int reload_zt(void)
        stripmsd = 0;
        callwaiting = 0;
        busydetect = 0;
+       busycount = 3;
        callprogress = 0;
        callwaitingcallerid = 0;
        hidecallerid = 0;
@@ -6516,6 +6535,8 @@ static int reload_zt(void)
                        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")) {
index a0c06f5..638c951 100755 (executable)
--- a/manager.c
+++ b/manager.c
@@ -530,6 +530,10 @@ static void *accept_thread(void *ignore)
        struct sockaddr_in sin;
        int sinlen;
        struct mansession *s;
+       pthread_attr_t attr;
+
+       pthread_attr_init(&attr);
+       pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
        for (;;) {
                sinlen = sizeof(sin);
                as = accept(asock, &sin, &sinlen);
@@ -550,9 +554,10 @@ static void *accept_thread(void *ignore)
                s->next = sessions;
                sessions = s;
                ast_pthread_mutex_unlock(&sessionlock);
-               if (pthread_create(&t, NULL, session_do, s))
+               if (pthread_create(&t, &attr, session_do, s))
                        destroy_session(s);
        }
+       pthread_attr_destroy(&attr);
        return NULL;
 }