From: Super User Date: Sat, 12 Jan 2008 11:28:22 +0000 (+0100) Subject: moved timeout settings from extenion to interface.conf X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=commitdiff_plain;h=31aff20175a3bc9b4bb41d080452ae1d063e267a moved timeout settings from extenion to interface.conf modified: README modified: apppbx.cpp modified: default/interface.conf modified: dss1.cpp modified: extension.c modified: extension.h modified: genext.c modified: interface.c modified: interface.h modified: port.h modified: todo.txt --- diff --git a/README b/README index 8c5098f..f0dd00e 100644 --- a/README +++ b/README @@ -409,5 +409,7 @@ Changes in Version 0.3 - Fixed VBox, also added trace debugging. - Nice 'Beep' after the announcement. - Special announcement recording without beep. - +- Filters now work for interface.conf +- Fixed minor audio gain bug. +- Moved timeout setting from extension to interface.conf. diff --git a/apppbx.cpp b/apppbx.cpp index 3a39524..e59bbea 100644 --- a/apppbx.cpp +++ b/apppbx.cpp @@ -40,13 +40,6 @@ EndpointAppPBX::EndpointAppPBX(class Endpoint *epoint, int origin) : EndpointApp memset(&e_ext, 0, sizeof(struct extension)); // *************** NOTE: also change value in read_extension() ************** e_ext.rights = 4; /* international */ - e_ext.tout_setup = 120; - e_ext.tout_dialing = 120; - e_ext.tout_proceeding = 120; - e_ext.tout_alerting = 120; - e_ext.tout_disconnect = 120; -// e_ext.tout_hold = 900; -// e_ext.tout_park = 900; e_ext.rxvol = e_ext.txvol = 0; e_state = EPOINT_STATE_IDLE; e_ext.number[0] = '\0'; @@ -860,13 +853,6 @@ void EndpointAppPBX::out_setup(void) SCPY(port_settings.tones_dir, e_ext.tones_dir); else SCPY(port_settings.tones_dir, options.tones_dir); - port_settings.tout_setup = e_ext.tout_setup; - port_settings.tout_dialing = e_ext.tout_dialing; - port_settings.tout_proceeding = e_ext.tout_proceeding; - port_settings.tout_alerting = e_ext.tout_alerting; - port_settings.tout_disconnect = e_ext.tout_disconnect; -// port_settings.tout_hold = e_ext.tout_hold; -// port_settings.tout_park = e_ext.tout_park; port_settings.no_seconds = e_ext.no_seconds; /* NOTE: currently the try_card feature is not supported. it should be used later to try another card, if the outgoing call fails on one port */ diff --git a/default/interface.conf b/default/interface.conf index be5b669..bd00e41 100644 --- a/default/interface.conf +++ b/default/interface.conf @@ -83,11 +83,14 @@ # Example of an ISDN interface that runs in NT-mode, but provides tones during # setup. Also we provide tones during setup also. # This is usefull to interconnect to another PBX. +# Additinally the timeout values for the different call states are adjusted to 60 seconds. +# They are: setup, dialing, proceeding, alerting, disconnect #[PBX] #nt #port 5 #earlyb yes #tones yes +#timeouts 60 60 60 60 60 # Hint: Enter "lcr interface" for quick help on interface options. diff --git a/dss1.cpp b/dss1.cpp index e64ccce..82b09bb 100644 --- a/dss1.cpp +++ b/dss1.cpp @@ -1926,45 +1926,43 @@ void Pdss1::new_state(int state) class Endpoint *epoint; /* set timeout */ - epoint = find_epoint_id(ACTIVE_EPOINT(p_epointlist)); - if (epoint && p_m_d_ntmode) + if (state == PORT_STATE_IN_OVERLAP) + { + p_m_timeout = p_m_mISDNport->ifport->tout_dialing; + time(&p_m_timer); + } + if (state != p_state) { - if (state == PORT_STATE_IN_OVERLAP) + if (state == PORT_STATE_IN_SETUP + || state == PORT_STATE_OUT_SETUP + || state == PORT_STATE_IN_OVERLAP + || state == PORT_STATE_OUT_OVERLAP) { - p_m_timeout = p_settings.tout_dialing; + p_m_timeout = p_m_mISDNport->ifport->tout_setup; time(&p_m_timer); } - if (state != p_state) + if (state == PORT_STATE_IN_PROCEEDING + || state == PORT_STATE_OUT_PROCEEDING) { - if (state == PORT_STATE_IN_SETUP - || state == PORT_STATE_IN_OVERLAP) - { - p_m_timeout = p_settings.tout_setup; - time(&p_m_timer); - } - if (state == PORT_STATE_IN_PROCEEDING - || state == PORT_STATE_OUT_PROCEEDING) - { - p_m_timeout = p_settings.tout_proceeding; - time(&p_m_timer); - } - if (state == PORT_STATE_IN_ALERTING - || state == PORT_STATE_OUT_ALERTING) - { - p_m_timeout = p_settings.tout_alerting; - time(&p_m_timer); - } - if (state == PORT_STATE_CONNECT - || state == PORT_STATE_CONNECT_WAITING) - { - p_m_timeout = 0; - } - if (state == PORT_STATE_IN_DISCONNECT - || state == PORT_STATE_OUT_DISCONNECT) - { - p_m_timeout = p_settings.tout_disconnect; - time(&p_m_timer); - } + p_m_timeout = p_m_mISDNport->ifport->tout_proceeding; + time(&p_m_timer); + } + if (state == PORT_STATE_IN_ALERTING + || state == PORT_STATE_OUT_ALERTING) + { + p_m_timeout = p_m_mISDNport->ifport->tout_alerting; + time(&p_m_timer); + } + if (state == PORT_STATE_CONNECT + || state == PORT_STATE_CONNECT_WAITING) + { + p_m_timeout = 0; + } + if (state == PORT_STATE_IN_DISCONNECT + || state == PORT_STATE_OUT_DISCONNECT) + { + p_m_timeout = p_m_mISDNport->ifport->tout_disconnect; + time(&p_m_timer); } } @@ -2769,7 +2767,8 @@ void Pdss1::message_release(unsigned long epoint_id, int message_id, union param * we may only release during incomming disconnect state. * this means that the endpoint doesnt require audio anymore */ - if (p_state == PORT_STATE_IN_DISCONNECT) + if (p_state == PORT_STATE_IN_DISCONNECT + || p_state == PORT_STATE_OUT_DISCONNECT) { /* sending release */ dmsg = create_l3msg(CC_RELEASE | REQUEST, MT_RELEASE, p_m_d_l3id, sizeof(RELEASE_t), p_m_d_ntmode); diff --git a/extension.c b/extension.c index 470cf15..d8d17b4 100644 --- a/extension.c +++ b/extension.c @@ -64,13 +64,6 @@ int read_extension(struct extension *ext, char *num) 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; @@ -491,64 +484,6 @@ int read_extension(struct extension *ext, char *num) 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")) - { - ext->tout_dialing = atoi(param); - if (ext->tout_dialing < 0) - ext->tout_dialing = 0; - - PDEBUG(DEBUG_CONFIG, "timeout dialing: %d\n",ext->tout_dialing); - } else - if (!strcmp(option,"tout_proceeding")) - { - ext->tout_proceeding = atoi(param); - if (ext->tout_proceeding < 0) - ext->tout_proceeding = 0; - - PDEBUG(DEBUG_CONFIG, "timeout proceeding: %d\n",ext->tout_proceeding); - } 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; @@ -1191,45 +1126,6 @@ int write_extension(struct extension *ext, char *number) 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,"# 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"); diff --git a/extension.h b/extension.h index 692906e..f9f7f67 100644 --- a/extension.h +++ b/extension.h @@ -162,13 +162,6 @@ struct extension { int vbox_email_file; /* set, if also the audio fille will be attached */ int vbox_free; /* if vbox shall connect after announcment */ - int tout_setup; - int tout_dialing; - int tout_proceeding; - int tout_alerting; - int tout_disconnect; -// int tout_hold; -// int tout_park; int own_setup; int own_proceeding; int own_alerting; diff --git a/genext.c b/genext.c index 447c675..0cbea25 100644 --- a/genext.c +++ b/genext.c @@ -79,13 +79,6 @@ int main(int argc, char *argv[]) memset(&ext, 0, sizeof(ext)); ext.rights = 4; - 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; UCPY(ext.interfaces, argv[2]); diff --git a/interface.c b/interface.c index b2995ff..4acc514 100644 --- a/interface.c +++ b/interface.c @@ -434,6 +434,55 @@ static int inter_channel_in(struct interface *interface, char *filename, int lin } return(0); } +static int inter_timeouts(struct interface *interface, char *filename, int line, char *parameter, char *value) +{ + struct interface_port *ifport; + struct select_channel *selchannel, **selchannelp; + int val; + char *p, *el; + + /* port in chain ? */ + if (!interface->ifport) + { + SPRINT(interface_error, "Error in %s (line %d): parameter '%s' expects previous 'port' definition.\n", filename, line, parameter); + return(-1); + } + /* goto end of chain */ + ifport = interface->ifport; + while(ifport->next) + ifport = ifport->next; + p = value; + if (!*p) + { + nofive: + SPRINT(interface_error, "Error in %s (line %d): parameter '%s' expects five timeout values.\n", filename, line, parameter); + return(-1); + } + el = p; + p = get_seperated(p); + ifport->tout_setup = atoi(el); + if (!*p) + goto nofive; + el = p; + p = get_seperated(p); + ifport->tout_dialing = atoi(el); + if (!*p) + goto nofive; + el = p; + p = get_seperated(p); + ifport->tout_proceeding = atoi(el); + if (!*p) + goto nofive; + el = p; + p = get_seperated(p); + ifport->tout_alerting = atoi(el); + if (!*p) + goto nofive; + el = p; + p = get_seperated(p); + ifport->tout_disconnect = atoi(el); + return(0); +} static int inter_msn(struct interface *interface, char *filename, int line, char *parameter, char *value) { struct interface_msn *ifmsn, **ifmsnp; @@ -821,6 +870,11 @@ struct interface_param interface_param[] = { " [,...] - List of channels to accept.\n" " free - Accept any free channel"}, + {"timeouts", &inter_timeouts, " ", + "Timeout values for call states. They are both for incomming and outgoing states.\n" + "The default is 120 seconds for all states. Use 0 to disable.\n" + "This parameter must follow a 'port' parameter.\n"}, + {"msn", &inter_msn, ",[[,...]]", "Incomming caller ID is checked against given MSN numbers.\n" "If the caller ID is not found in this list, it is overwritten by the first MSN"}, diff --git a/interface.h b/interface.h index f97c28b..da0ee20 100644 --- a/interface.h +++ b/interface.h @@ -56,6 +56,13 @@ struct interface_port { struct select_channel *out_channel; /* list of channels to select */ struct select_channel *in_channel; /* the same for incoming channels */ int block; /* set if interface is blocked */ + int tout_setup; + int tout_dialing; + int tout_proceeding; + int tout_alerting; + int tout_disconnect; +// int tout_hold; +// int tout_park; }; struct interface_msn { diff --git a/port.h b/port.h index 8f9cc04..48f6ffa 100644 --- a/port.h +++ b/port.h @@ -116,14 +116,7 @@ inline unsigned long INACTIVE_EPOINT(struct epoint_list *epointlist) /* structure of port settings */ struct port_settings { char tones_dir[256]; /* directory of current tone */ - int tout_setup; - int tout_dialing; - int tout_proceeding; - int tout_alerting; - int tout_disconnect; -// int tout_hold; -// int tout_park; - int no_seconds; /* don't send seconds with time information element */ + int no_seconds; }; /* generic port class */ diff --git a/todo.txt b/todo.txt index 12e6620..b35d9a0 100644 --- a/todo.txt +++ b/todo.txt @@ -1,6 +1,7 @@ fuer asterisk: dejitter tx_buffer in dsp.o +doku: tout in interface.conf layer-2-hold interface feature