X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=apppbx.h;h=1bbe8bab1355dca28a1bc18be05a51313d8001bb;hp=070bce5ec1086db233f50cac6b17c5c451968208;hb=04fc928a2c5f0262e85c09cced1ef20a9fd15f3d;hpb=14f76f1e81f0a4e7a63e83136d1ac958bf85c8a5 diff --git a/apppbx.h b/apppbx.h index 070bce5..1bbe8ba 100644 --- a/apppbx.h +++ b/apppbx.h @@ -33,7 +33,7 @@ enum { /* states as viewed from io port (state of calls are always connected) */ }; #define EPOINT_STATE_NAMES \ -static char *state_name[] = { \ +static const char *state_name[] = { \ "EPOINT_STATE_IDLE", \ "EPOINT_STATE_IN_SETUP", \ "EPOINT_STATE_OUT_SETUP", \ @@ -49,6 +49,8 @@ static char *state_name[] = { \ }; \ int state_name_num = sizeof(state_name) / sizeof(char *); +int vbox_refresh(struct lcr_timer *timer, void *instance, int index); + extern class EndpointAppPBX *apppbx_first; /* structure of an EndpointAppPBX */ @@ -59,12 +61,11 @@ class EndpointAppPBX : public EndpointApp ~EndpointAppPBX(); class EndpointAppPBX *next; - int handler(void); int e_hold; /* is this endpoint on hold ? */ char e_tone[256]; /* save tone for resuming ports */ - unsigned long e_adminid; + unsigned int e_adminid; /* states */ int e_state; /* state of endpoint */ @@ -72,16 +73,15 @@ class EndpointAppPBX : public EndpointApp struct caller_info e_callerinfo; /* information about the caller */ struct dialing_info e_dialinginfo; /* information about dialing */ struct connect_info e_connectinfo; /* information about connected line */ - struct redir_info e_redirinfo; /* info on redirection (to the calling user) */ - struct capa_info e_capainfo; /* info on l3,l2 capacity */ + struct redir_info e_redirinfo; /* info about redirection (to the calling user) */ + struct capa_info e_capainfo; /* info about l3,l2 capacity */ + struct rtp_info e_rtpinfo; /* info about rtp port forwarding and payload type */ time_t e_start, e_stop; /* time */ int e_origin; /* origin of call 0=incoming 1=outgoing */ struct route_ruleset *e_ruleset; /* current ruleset pointer (NULL=no ruleset) */ struct route_rule *e_rule; /* current rule pointer (NULL=no rule) */ struct route_action *e_action; /* current action pointer (NULL=no action) */ - double e_action_timeout; /* when to timeout */ int e_rule_nesting; /* 'goto'/'menu' recrusion counter to prevent infinie loops */ - double e_match_timeout; /* set for the next possible timeout time */ struct route_action *e_match_to_action; /* what todo when timeout */ char *e_match_to_extdialing; /* dialing after matching timeout rule */ int e_select; /* current selection for various selector options */ @@ -97,15 +97,11 @@ class EndpointAppPBX : public EndpointApp /* action */ char e_dialing_queue[32]; /* holds dialing during setup state */ - double e_redial; /* time when redialing 0=off */ - double e_powerdialing; /* on disconnect redial! 0=off, >0=redial time, -1=on */ double e_powerdelay; /* delay when to redial */ int e_powercount; /* power count */ int e_powerlimit; /* power limit */ - double e_callback; /* time when callback (when idle reached) 0=off */ - signed long e_cfnr_release; /* time stamp when to do the release for call forward on no response */ - signed long e_cfnr_call; /* time stamp when to do the call for call forward on no response */ - signed long e_password_timeout; /* time stamp when to do the release for password timeout */ + struct lcr_timer e_action_timeout; + struct lcr_timer e_match_timeout; /* port relation */ int e_multipoint_cause; /* cause value of disconnected multiport calls (highest priority) */ @@ -120,6 +116,13 @@ class EndpointAppPBX : public EndpointApp char e_cbcaller[256]; /* extension for the epoint which calls back */ char e_cbto[32]; /* override callerid to call back to */ struct caller_info e_callbackinfo; /* information about the callback caller */ + struct lcr_timer e_redial_timeout; + int e_powerdial_on; + struct lcr_timer e_powerdial_timeout; + struct lcr_timer e_cfnr_timeout; + struct lcr_timer e_cfnr_call_timeout; + struct lcr_timer e_callback_timeout; + struct lcr_timer e_password_timeout; /* dtmf stuff */ int e_connectedmode; /* if the port should stay connected if the enpoint disconnects or releases (usefull for callback) */ @@ -127,6 +130,7 @@ class EndpointAppPBX : public EndpointApp /* read doc/keypad.txt for more information */ int e_dtmf_time; /* time when the last key was received. */ int e_dtmf_last; /* last dtmf key */ + int e_enablekeypad; /* remote app requests dtmf */ /* transmit and receive state */ int e_tx_state; /* current endpoint's state */ @@ -137,7 +141,7 @@ class EndpointAppPBX : public EndpointApp int e_vbox_state; /* state of vbox during playback */ int e_vbox_menu; /* currently selected menu using '*' and '#' */ char e_vbox_display[128]; /* current display message */ - int e_vbox_display_refresh; /* display must be refreshed du to change */ + struct lcr_timer e_vbox_refresh; /* display must be refreshed du to change */ int e_vbox_counter; /* current playback counter in seconds */ int e_vbox_counter_max; /* size of file in seconds */ int e_vbox_counter_last; /* temp variable to recognise a change in seconds */ @@ -156,15 +160,16 @@ class EndpointAppPBX : public EndpointApp /* efi */ int e_efi_state; /* current spoken sample */ int e_efi_digit; /* current spoken digit */ - + +#ifdef WITH_CRYPT /* crypt states and vars */ int e_crypt; /* current user level crypt state */ int e_crypt_state; /* current crypt manager state */ char e_crypt_info[33]; /* last information text */ int e_crypt_timeout_sec; /* timer */ int e_crypt_timeout_usec; /* timer */ - unsigned long e_crypt_random; /* current random number for ident */ - unsigned long e_crypt_bogomips; /* bogomips for ident */ + unsigned int e_crypt_random; /* current random number for ident */ + unsigned int e_crypt_bogomips; /* bogomips for ident */ unsigned char e_crypt_key[256]; /* the session key */ int e_crypt_key_len; unsigned char e_crypt_ckey[256]; /* the encrypted session key */ @@ -187,10 +192,12 @@ class EndpointAppPBX : public EndpointApp int e_crypt_rsa_iqmp_len; int e_crypt_keyengine_busy; /* current job and busy state */ int e_crypt_keyengine_return; /* return */ + struct lcr_timer e_crypt_handler; /* poll timer for crypt events */ +#endif /* messages */ void hookflash(void); - void ea_message_port(unsigned long port_id, int message, union parameter *param); + void ea_message_port(unsigned int port_id, int message, union parameter *param); void port_setup(struct port_list *portlist, int message_type, union parameter *param); void port_information(struct port_list *portlist, int message_type, union parameter *param); void port_dtmf(struct port_list *portlist, int message_type, union parameter *param); @@ -202,12 +209,16 @@ class EndpointAppPBX : public EndpointApp void port_disconnect_release(struct port_list *portlist, int message_type, union parameter *param); void port_timeout(struct port_list *portlist, int message_type, union parameter *param); void port_notify(struct port_list *portlist, int message_type, union parameter *param); + void port_progress(struct port_list *portlist, int message_type, union parameter *param); void port_facility(struct port_list *portlist, int message_type, union parameter *param); + void port_3pty(struct port_list *portlist, int message_type, union parameter *param); void port_suspend(struct port_list *portlist, int message_type, union parameter *param); void port_resume(struct port_list *portlist, int message_type, union parameter *param); - void ea_message_join(unsigned long join_id, int message, union parameter *param); + void port_enablekeypad(struct port_list *portlist, int message_type, union parameter *param); + void ea_message_join(unsigned int join_id, int message, union parameter *param); void join_crypt(struct port_list *portlist, int message_type, union parameter *param); void join_mISDNsignal(struct port_list *portlist, int message_type, union parameter *param); + void join_bridge(struct port_list *portlist, int message_type, union parameter *param); void join_setup(struct port_list *portlist, int message_type, union parameter *param); void join_information(struct port_list *portlist, int message_type, union parameter *param); void join_overlap(struct port_list *portlist, int message_type, union parameter *param); @@ -217,31 +228,30 @@ class EndpointAppPBX : public EndpointApp void join_disconnect_release(int message_type, union parameter *param); void join_notify(struct port_list *portlist, int message_type, union parameter *param); void join_facility(struct port_list *portlist, int message_type, union parameter *param); + void join_dtmf(struct port_list *portlist, int message_type, union parameter *param); /* epoint */ void new_state(int state); - void release(int release, int joinlocation, int joincause, int portlocation, int portcause); + void release(int release, int joinlocation, int joincause, int portlocation, int portcause, int force); void notify_active(void); void keypad_function(char digit); - void set_tone(struct port_list *portlist, char *tone); - void out_setup(void); - struct mISDNport *hunt_port(char *ifname, int *channel); - char *apply_callerid_display(char *id, int itype, int ntype, int present, int screen, char *extension, char *name); + void set_tone(struct port_list *portlist, const char *tone); + void out_setup(int cfnr); + char *apply_callerid_display(const char *id, int itype, int ntype, int present, int screen, const char *extension, const char *name); void auth(int job, int bit_num); /* vbox playback stuff */ void vbox_init(void); void vbox_index_read(int num); void vbox_index_remove(int num); - void vbox_handler(void); void efi_message_eof(void); void vbox_message_eof(void); - void set_tone_vbox(char *tone); - void set_play_vbox(char *file, int offset); + void set_tone_vbox(const char *tone); + void set_play_vbox(const char *file, int offset); void set_play_speed(int speed); /* efi */ - void set_tone_efi(char *tone); + void set_tone_efi(const char *tone); /* routing */ struct route_ruleset *rulesetbyname(char *name); @@ -249,13 +259,10 @@ class EndpointAppPBX : public EndpointApp struct route_param *routeparam(struct route_action *action, unsigned long long id); /* init / dialing / hangup */ - void _action_init_call(char *remote); void action_init_call(void); - void action_init_remote(void); void action_dialing_internal(void); void action_dialing_external(void); void action_dialing_h323(void); - void action_dialing_remote(void); void action_dialing_vbox_record(void); void action_init_partyline(void); void action_hangup_call(void); @@ -285,29 +292,33 @@ class EndpointAppPBX : public EndpointApp void action_dialing_goto(void); void action_dialing_menu(void); void action_dialing_disconnect(void); + void action_dialing_release(void); void action_dialing_help(void); void action_dialing_deflect(void); void action_dialing_setforward(void); + void action_init_execute(void); void action_hangup_execute(void); + void action_execute(void); void action_hangup_file(void); void action_init_pick(void); void action_dialing_password(void); void action_dialing_password_wr(void); - void process_dialing(void); + void process_dialing(int timeout); void process_hangup(int cause, int location); /* facility function */ void pick_join(char *extension); - void join_join(void); + int join_join(void); + int join_3pty(void); + int split_3pty(void); void encrypt_shared(void); void encrypt_keyex(void); void encrypt_off(void); void encrypt_result(int message, char *text); - int check_external(char **errstr, class Port **port); + int check_external(const char **errstr, class Port **port); /* crypt */ void cryptman_keyengine(int job); - void cryptman_handler(void); void cr_ident(int message, unsigned char *param, int len); void cr_activate(int message, unsigned char *param, int len); void cr_deactivate(int message, unsigned char *param, int len); @@ -339,19 +350,16 @@ class EndpointAppPBX : public EndpointApp int cryptman_sizeofinf(unsigned char *buf, int element); unsigned char *cryptman_getinf(unsigned char *buf, int element, unsigned char *to); void cryptman_msg2peer(unsigned char *buf); - void cryptman_msg2user(int msg, char *text); + void cryptman_msg2user(int msg, const char *text); void cryptman_msg2crengine(int msg, unsigned char *buf, int len); void cryptman_state(int state); void cryptman_timeout(int secs); - - void message_disconnect_port(struct port_list *portlist, int cause, int location, char *display); - void logmessage(int message_type, union parameter *param, unsigned long port_id, int dir); - void trace_header(char *name, int direction); + void message_disconnect_port(struct port_list *portlist, int cause, int location, const char *display); + void logmessage(int message_type, union parameter *param, unsigned int port_id, int dir); + void trace_header(const char *name, int direction); }; -char *nationalize_callerinfo(char *string, int *type); -char *numberrize_callerinfo(char *string, int type); void apply_callerid_restriction(struct extension *ext, char *id, int *ntype, int *present, int *screen, char *extension, char *name); void send_mail(char *filename, char *callerid, char *callerintern, char *callername, char *vbox_email, int vbox_year, int vbox_mon, int vbox_mday, int vbox_hour, int vbox_min, char *terminal);