--- a/ifcico/call.c
+++ b/ifcico/call.c
@@ -40,7 +40,127 @@ extern int hangup(node*);
 extern void rdoptions(node*);
 extern int nodelock(faddr*);
 extern int nodeulock(faddr*);
-extern void setproctitle(char*);
+
+#ifdef HIDDEN
+
+extern fa_list *Hidden;
+extern fa_list *Override;
+
+#define MAXLINES 16
+
+struct s_hidden {
+		 char *phone;
+		 char *txy;
+		};
+
+int parsehidden(char *str,struct s_hidden *hidden)
+{
+ char *tmp,*p;
+
+ hidden->phone=NULL;
+ hidden->txy=NULL;
+
+ debug(6,"Hidden string %s\n",str);
+
+ tmp=strdup(str);
+ p=strtok(tmp," ");
+  if(p)
+   {
+     if(p[0]!='-') hidden->phone=strdup(p);
+     p=strtok(NULL," ");
+     if(p) hidden->txy=strdup(p);
+   }
+   free(tmp); 
+   return 1;
+}
+
+int override(faddr *addr,node *nlent,fa_list *FromWhere)
+{
+ int i;
+ static char TXY[3];
+ struct s_hidden hidden;
+
+ hidden.phone=NULL;
+ hidden.txy=NULL;
+
+ parsehidden(FromWhere->addr->name,&hidden);
+ if(hidden.phone) strncpy(nlent->phone,hidden.phone,strlen(nlent->phone));
+  if(hidden.txy)
+    if(strcasecmp(hidden.txy,"CM")==0) nlent->flags |= CM;
+    else
+     {
+      strncpy(TXY,hidden.txy,3);
+      if(nlent->flags & CM)
+       {
+        i=0;while(nlent->uflags[i] && i<MAXUFLAGS) i++;
+        if(i<MAXUFLAGS) nlent->uflags[i]=TXY;
+        if(i+1<MAXUFLAGS) nlent->uflags[i+1]=NULL;
+        nlent->flags&=~CM;
+       }
+      else
+       {
+        i=0;
+        while(nlent->uflags[i] && i<MAXUFLAGS)
+         {
+          if(nlent->uflags[i][0]=='T' ||
+	     (nlent->uflags[i][0]=='U' && nlent->uflags[i][1]=='T'))
+	   {
+	    nlent->uflags[i]=TXY;
+	    i=MAXUFLAGS+1;
+	   }
+	   i++;
+	  }
+	   if(i<=MAXUFLAGS)
+	    {
+	     if(i<MAXUFLAGS) nlent->uflags[i]=TXY;
+	      else loginf("Can't change call time for %s",ascinode(addr,0x1f));
+	      if(i+1<MAXUFLAGS) nlent->uflags[i+1]=NULL;
+            }
+          }
+      } /* Not CM */
+ free(hidden.phone);
+ free(hidden.txy);
+ return 0;
+}
+
+int setline(faddr *addr,node *nlent,callstat *st)
+{
+ fa_list *tmp,*Lines[MAXLINES];
+ int i,TryLine,LineCount=1;
+
+ Lines[0]=NULL;	/* First Line - from nodelist. May be override */
+
+ for (tmp=Override;tmp;tmp=tmp->next)
+  if ((tmp->addr->net == addr->net) &&
+	    (tmp->addr->node == addr->node)) Lines[0]=tmp;
+
+ for (tmp=Hidden;tmp;tmp=tmp->next)
+  if ((tmp->addr->net == addr->net) && (tmp->addr->node == addr->node))
+    if(LineCount<MAXLINES) { Lines[LineCount]=tmp; LineCount++; }
+
+ TryLine = st->tryno % LineCount;
+
+ debug(6,"--- First TryLine = %d from %d lines --- \n", TryLine,LineCount);
+
+ for(i=TryLine;i<LineCount;i++)
+   {
+    nlent=getnlent(addr);
+    if(Lines[i]) override(addr,nlent,Lines[i]);
+    debug(6,"Check Line %d\n",i);
+    if(!not_work_time_now(nlent)) return 1;
+   }
+
+ for(i=0;i<TryLine;i++)
+   {
+    nlent=getnlent(addr);
+    if(Lines[i]) override(addr,nlent,Lines[i]);
+    debug(6,"Check Line %d\n",i);
+    if(!not_work_time_now(nlent)) return 1;
+   }
+ return 0;
+}
+
+#endif
 
 int checkretry(st)
 callstat *st;
@@ -67,6 +187,9 @@ faddr *addr;
 	}
 
 	st=getstatus(addr);
+#ifdef HIDDEN
+        setline(addr,nlent,st);
+#endif	
 	if (!forcedcalls) {
 		if ((rc=checkretry(st))) {
 			loginf("cannot call %s: %s",
