/* extension */
-char *ext_rights[] = {
+const char *ext_rights[] = {
"none",
"internal",
"local",
NULL
};
-char *ext_yesno[] = {
+const char *ext_yesno[] = {
"no",
"yes",
NULL
*
* reads extension from given extension number and fills structure
*/
-int read_extension(struct extension *ext, char *number)
+int read_extension(struct extension *ext, char *num)
{
FILE *fp=NULL;
+ char number[32];
char filename[256];
char *p;
char option[32];
char buffer[1024];
int last_in_count = 0, last_out_count = 0;
+ /* save number, so &ext and ext.number can be given as parameters - without overwriting itself */
+ SCPY(number, num);
+
if (number[0] == '\0')
return(0);
/* default values */
memset(ext, 0, sizeof(struct extension));
+ SCPY(ext->number, number);
+// ********** NOTE: also change value in apppbx constructor
ext->rights = 4; /* international */
- ext->tout_setup = 120;
- ext->tout_dialing = 120;
- ext->tout_proceeding = 120;
- ext->tout_alerting = 120;
- ext->tout_disconnect = 120;
-// ext->tout_hold = 900;
-// ext->tout_park = 900;
ext->cfnr_delay = 20;
ext->vbox_codec = CODEC_MONO;
SCPY(ext->name, param);
if (param2[0])
{
- SCAT(ext->name, " ");
+ SCAT(ext->name, (char *)" ");
SCAT(ext->name, param2);
}
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;
PDEBUG(DEBUG_CONFIG, "given noknocking param unknown: %s\n", param);
}
} else
- if (!strcmp(option,"rxvol"))
- {
- ext->rxvol = atoi(param);
- if (ext->rxvol<-8 || ext->rxvol>8)
- ext->rxvol = 0;
-
- PDEBUG(DEBUG_CONFIG, "receive volume: %d\n",ext->rxvol);
- } else
- if (!strcmp(option,"txvol"))
- {
- ext->txvol = atoi(param);
- if (ext->txvol<-8 || ext->txvol>8)
- ext->txvol = 0;
-
- PDEBUG(DEBUG_CONFIG, "transmit volume: %d\n",ext->txvol);
- } else
- if (!strcmp(option,"tout_setup"))
- {
- ext->tout_setup = atoi(param);
- if (ext->tout_setup < 0)
- ext->tout_setup = 0;
-
- PDEBUG(DEBUG_CONFIG, "timeout setup: %d\n",ext->tout_setup);
- } else
- if (!strcmp(option,"tout_dialing"))
+ if (!strcmp(option,"rx_gain")
+ || !strcmp(option,"rxvol"))
{
- ext->tout_dialing = atoi(param);
- if (ext->tout_dialing < 0)
- ext->tout_dialing = 0;
+ ext->rx_gain = atoi(param);
+ if (ext->rx_gain<-8 || ext->rx_gain>8)
+ ext->rx_gain = 0;
- PDEBUG(DEBUG_CONFIG, "timeout dialing: %d\n",ext->tout_dialing);
+ PDEBUG(DEBUG_CONFIG, "receive volume: %d\n",ext->rx_gain);
} else
- if (!strcmp(option,"tout_proceeding"))
+ if (!strcmp(option,"tx_gain")
+ || !strcmp(option,"txvol"))
{
- ext->tout_proceeding = atoi(param);
- if (ext->tout_proceeding < 0)
- ext->tout_proceeding = 0;
+ ext->tx_gain = atoi(param);
+ if (ext->tx_gain<-8 || ext->tx_gain>8)
+ ext->tx_gain = 0;
- PDEBUG(DEBUG_CONFIG, "timeout proceeding: %d\n",ext->tout_proceeding);
+ PDEBUG(DEBUG_CONFIG, "transmit volume: %d\n",ext->tx_gain);
} else
- if (!strcmp(option,"tout_alerting"))
- {
- ext->tout_alerting = atoi(param);
- if (ext->tout_alerting < 0)
- ext->tout_alerting = 0;
-
- PDEBUG(DEBUG_CONFIG, "timeout alerting: %d\n",ext->tout_alerting);
- } else
- if (!strcmp(option,"tout_disconnect"))
- {
- ext->tout_disconnect = atoi(param);
- if (ext->tout_disconnect < 0)
- ext->tout_disconnect = 0;
-
- PDEBUG(DEBUG_CONFIG, "timeout disconnect: %d\n",ext->tout_disconnect);
- } else
-#if 0
- if (!strcmp(option,"tout_hold"))
- {
- ext->tout_hold = atoi(param);
- if (ext->tout_hold < 0)
- ext->tout_hold = 0;
-
- PDEBUG(DEBUG_CONFIG, "timeout hold: %d\n",ext->tout_hold);
- } else
- if (!strcmp(option,"tout_park"))
- {
- ext->tout_park = atoi(param);
- if (ext->tout_park < 0)
- ext->tout_park = 0;
-
- PDEBUG(DEBUG_CONFIG, "timeout park: %d\n",ext->tout_park);
- } else
-#endif
if (!strcmp(option,"own_setup"))
{
i=0;
PDEBUG(DEBUG_CONFIG, "given display_int param unknown: %s\n", param);
}
} else
- if (!strcmp(option,"display_voip"))
- {
- i=0;
- while(ext_yesno[i])
- {
- if (!strcasecmp(param,ext_yesno[i]))
- break;
- i++;
- }
- if (ext_yesno[i])
- {
- ext->display_voip = i;
- PDEBUG(DEBUG_CONFIG, "display voip %s\n", ext_yesno[i]);
- } else
- {
- PDEBUG(DEBUG_CONFIG, "given display_voip param unknown: %s\n", param);
- }
- } else
if (!strcmp(option,"display_fake"))
{
i=0;
// fprintf(fp,"# Set up alarm message after prefix is dialed and connection is established\n");
// fprintf(fp,"alarm %s\n\n",ext->alarm);
- fprintf(fp,"# Ports to ring on calls to extension (starting from 1)\n");
- fprintf(fp,"# Seperate ports by using komma. (example: 1,3 would ring incoming calls on\n# port 1 and 3)\n");
+ 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\"\n");
+ fprintf(fp,"# Int1,Int2 would ring incoming calls on both interfaces Int1 and Int2.\n");
fprintf(fp,"interfaces %s\n\n",ext->interfaces);
fprintf(fp,"# Call Forward Unconditional (CFU)\n");
}
fprintf(fp,"# CLIP Prefix\n");
- fprintf(fp,"# Adds a prefix to incomming caller IDs, so telephones will be able to respond\n");
+ fprintf(fp,"# Adds a prefix to incoming caller IDs, so telephones will be able to respond\n");
fprintf(fp,"# to unanswered calls from their list. The prefix must be the digit(s) to get\n");
fprintf(fp,"# an external line. The caller ID will then be extendet so that they can be\n");
fprintf(fp,"# dialed from internal telephones. Many telephones have this feature, but some\n");
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");
fprintf(fp,"# 1 = double, 2 = quadrupel, 8 = 256 times (amplitude)\n");
fprintf(fp,"# -1 = half, -2 = quarter, 8 = 1/256th (amplitude)\n");
fprintf(fp,"# Audio data is limited to the maximum value when exceeds limit.\n");
- fprintf(fp,"txvol %d\n\n",ext->txvol);
+ fprintf(fp,"tx_gain %d\n\n",ext->tx_gain);
fprintf(fp,"# Receive volume (-8 .. 8)\n");
- fprintf(fp,"# (see txvol)\n");
- fprintf(fp,"rxvol %d\n\n",ext->rxvol);
-
- fprintf(fp,"# Timeout values\n# The keywords specify the following timeouts:\n");
- fprintf(fp,"# tout_setup: after pickup before dialing anything. (default 60 seconds)\n");
- fprintf(fp,"# tout_dialing: after dialing last digit of uncomplete number (default 15)\n");
- fprintf(fp,"# tout_proceeding: after start proceeding (default 120)\n");
- fprintf(fp,"# tout_alerting: after start ringing (default 120)\n");
- fprintf(fp,"# tout_disconnect: after disconnect (default 120)\n");
-// fprintf(fp,"# tout_hold: maximum time to hold a call (default 900)\n");
-// fprintf(fp,"# tout_park: maximum time to park a call (default 900)\n");
- fprintf(fp,"# All timeouts may be disabled by using keyword 'off' instead of seconds.\n");
- fprintf(fp,"# All timeouts refer to internal ports only. External timeouts are controlled\n");
- fprintf(fp,"# by external line.\n");
- if (ext->tout_setup)
- fprintf(fp,"tout_setup %d\n",ext->tout_setup);
- else
- fprintf(fp,"tout_setup off\n");
- if (ext->tout_dialing)
- fprintf(fp,"tout_dialing %d\n",ext->tout_dialing);
- else
- fprintf(fp,"tout_dialing off\n");
- if (ext->tout_proceeding)
- fprintf(fp,"tout_proceeding %d\n",ext->tout_proceeding);
- else
- fprintf(fp,"tout_proceeding off\n");
- if (ext->tout_alerting)
- fprintf(fp,"tout_alerting %d\n",ext->tout_alerting);
- else
- fprintf(fp,"tout_alerting off\n");
- if (ext->tout_disconnect)
- fprintf(fp,"tout_disconnect %d\n\n",ext->tout_disconnect);
- else
- fprintf(fp,"tout_disconnect off\n\n");
-// if (ext->tout_hold)
-// fprintf(fp,"tout_hold %d\n",ext->tout_hold);
-// else
-// fprintf(fp,"tout_hold off\n");
-// if (ext->tout_park)
-// fprintf(fp,"tout_park %d\n\n",ext->tout_park);
-// else
-// fprintf(fp,"tout_park off\n\n");
+ fprintf(fp,"# (see tx_gain)\n");
+ fprintf(fp,"rx_gain %d\n\n",ext->rx_gain);
+
fprintf(fp,"# Force to use tones and announcements generated by the pbx.\n");
fprintf(fp,"# For internal calls always own tones are used. You may specify own tones for\n");
fprintf(fp,"# example: \"200 (int)\"\n");
fprintf(fp,"display_int %s\n\n",(ext->display_int)?"yes":"no");
- fprintf(fp,"# Display H323 caller ids using display override (yes or no)\n");
- fprintf(fp,"# example: \"15551212 jolly@192.168.0.3\"\n");
- fprintf(fp,"display_voip %s\n\n",(ext->display_voip)?"yes":"no");
-
fprintf(fp,"# Display if calls are anonymous using display override (yes or no)\n");
fprintf(fp,"# This makes only sense if the anon-ignore feature is enabled.\n");
fprintf(fp,"# example: \"15551212 anon\"\n");
*/
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);
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);