Ports can now be specified by number or by name.
[lcr.git] / extension.c
index 391bb88..3a34914 100644 (file)
@@ -13,7 +13,7 @@
 
 /* extension */
 
-char *ext_rights[] = {
+const char *ext_rights[] = {
        "none",
        "internal",
        "local",
@@ -22,7 +22,7 @@ char *ext_rights[] = {
        NULL
 };
 
-char *ext_yesno[] = {
+const char *ext_yesno[] = {
        "no",
        "yes",
        NULL
@@ -151,7 +151,7 @@ int read_extension(struct extension *ext, char *num)
                        SCPY(ext->name, param);
                        if (param2[0])
                        {
-                               SCAT(ext->name, " ");
+                               SCAT(ext->name, (char *)" ");
                                SCAT(ext->name, param2);
                        }
 
@@ -396,24 +396,6 @@ int read_extension(struct extension *ext, char *num)
                                PDEBUG(DEBUG_CONFIG, "unknown parameter given keypad: %s\n", param);
                        }
                } else
-               if (!strcmp(option,"centrex"))
-               {
-                       i=0;
-                       while(ext_yesno[i])
-                       {
-                               if (!strcasecmp(param,ext_yesno[i]))
-                                       break;
-                               i++;
-                       }
-                       if (ext_yesno[i])
-                       {
-                               ext->centrex = i;
-                               PDEBUG(DEBUG_CONFIG, "use centrex to display name %s\n", ext_yesno[i]);
-                       } else
-                       {
-                               PDEBUG(DEBUG_CONFIG, "unknown parameter given centrex: %s\n", param);
-                       }
-               } else
                if (!strcmp(option,"rights"))
                {
                        i=0;
@@ -966,7 +948,7 @@ int write_extension(struct extension *ext, char *number)
 
        fprintf(fp,"# Interface(s) to ring on calls to extension (as named in interface.conf)\n");
        fprintf(fp,"# Seperate multiple interfaces by using komma without spaces\n");
-       fprintf(fp,"# Example: Int would ring on the interface with the name \"Int\"");
+       fprintf(fp,"# Example: Int would ring on the interface with the name \"Int\"\n");
        fprintf(fp,"#          Int1,Int2 would ring incoming calls on both interfaces Int1 and Int2.\n");
        fprintf(fp,"interfaces      %s\n\n",ext->interfaces);
 
@@ -1094,11 +1076,6 @@ int write_extension(struct extension *ext, char *number)
        fprintf(fp,"# DTMF tone, but the digit is transmitted via D-channel diaing info.\n");
        fprintf(fp,"keypad          %s\n\n",(ext->keypad)?"yes":"no");
 
-       fprintf(fp,"# Called Name Identification Presentation (CNIP/CONP)\n");
-       fprintf(fp,"# If supported by telephone, special information element on the d-channel are\n");
-       fprintf(fp,"# used to show name of caller. It is supported by newer Siemens telephones\n# (Centrex).\n");
-       fprintf(fp,"centrex         %s  #this is currently not working!!!\n\n",(ext->centrex)?"yes":"no");
-
        fprintf(fp,"# Ignore restriction of COLP and CLIP\n");
        fprintf(fp,"# In this case even restricted numbers are presented to this extension.\n");
        fprintf(fp,"# This also works for incoming external anonymous calls IF:\n");
@@ -1352,13 +1329,13 @@ int write_extension(struct extension *ext, char *number)
  */
 int write_log(char *number, char *callerid, char *calledid, time_t start, time_t stop, int aoce, int cause, int location)
 {
-       char *mon[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
+       const char *mon[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
        FILE *fp=NULL;
        char filename[256];
        struct tm *tm;
 
        if (callerid[0] == '\0')
-               callerid = "<unknown>";
+               callerid = (char *)"<unknown>";
 
        SPRINT(filename, "%s/%s/%s/log", INSTALL_DATA, options.extensions_dir, number);
 
@@ -1371,7 +1348,7 @@ int write_log(char *number, char *callerid, char *calledid, time_t start, time_t
        tm = localtime(&start);
        fprintf(fp,"%s %2d %04d %02d:%02d:%02d %s", mon[tm->tm_mon], tm->tm_mday, tm->tm_year+1900, tm->tm_hour, tm->tm_min, tm->tm_sec, number);
        if (stop)
-               fprintf(fp," %2ld:%02ld:%02ld", (stop-start)/3600, (((unsigned long)(stop-start))/60)%60, ((unsigned long)(stop-start))%60);
+               fprintf(fp," %2ld:%02d:%02d", (stop-start)/3600, (((unsigned int)(stop-start))/60)%60, ((unsigned int)(stop-start))%60);
        else
                fprintf(fp," --:--:--");
        fprintf(fp," %s -> %s", callerid, calledid);