LCR now runs as a user.
[lcr.git] / apppbx.h
index d0ec28b..6eaf2dd 100644 (file)
--- a/apppbx.h
+++ b/apppbx.h
@@ -1,6 +1,6 @@
 /*****************************************************************************\
 **                                                                           **
-** PBX4Linux                                                                 **
+** Linux Call Router                                                         **
 **                                                                           **
 **---------------------------------------------------------------------------**
 ** Copyright: Andreas Eversberg                                              **
@@ -12,9 +12,9 @@
 
 enum { /* release actions: see epoint.release */
        RELEASE_NONE,
-       RELEASE_CALL,           /* call, hold */
-       RELEASE_PORT_CALLONLY,  /* call, port */
-       RELEASE_ALL,            /* call, hold, port */
+       RELEASE_JOIN,           /* join, hold */
+       RELEASE_PORT_JOINONLY,  /* join, port */
+       RELEASE_ALL,            /* join, hold, port */
 };
 
 enum { /* states as viewed from io port (state of calls are always connected) */
@@ -55,7 +55,7 @@ extern class EndpointAppPBX *apppbx_first;
 class EndpointAppPBX : public EndpointApp
 {
        public:
-       EndpointAppPBX(class Endpoint *epoint);
+       EndpointAppPBX(class Endpoint *epoint, int origin);
        ~EndpointAppPBX();
 
        class EndpointAppPBX    *next;
@@ -64,7 +64,7 @@ class EndpointAppPBX : public EndpointApp
        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 */
@@ -75,7 +75,7 @@ class EndpointAppPBX : public EndpointApp
        struct redir_info       e_redirinfo;            /* info on redirection (to the calling user) */
        struct capa_info        e_capainfo;             /* info on l3,l2 capacity */
        time_t                  e_start, e_stop;        /* time */
-//     int                     e_origin;               /* origin of call */
+       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) */
@@ -92,8 +92,8 @@ class EndpointAppPBX : public EndpointApp
 //     int e_knocking;                         /* true, if knocking */
 //     double e_knocktime;                     /* next time to knock */
 
-//     char e_call_tone[64], e_hold_tone[64];  /* current tone */
-       int e_call_pattern/*, e_hold_pattern*/; /* pattern available */
+//     char e_join_tone[64], e_hold_tone[64];  /* current tone */
+       int e_join_pattern/*, e_hold_pattern*/; /* pattern available */
 
        /* action */
        char e_dialing_queue[32];               /* holds dialing during setup state */
@@ -103,17 +103,17 @@ class EndpointAppPBX : public EndpointApp
        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 */
+       signed int e_cfnr_release;              /* time stamp when to do the release for call forward on no response */
+       signed int e_cfnr_call;         /* time stamp when to do the call for call forward on no response */
+       signed int e_password_timeout;          /* time stamp when to do the release for password timeout */
 
        /* port relation */
        int e_multipoint_cause;                 /* cause value of disconnected multiport calls (highest priority) */
        int e_multipoint_location;              /* location of cause with highest priority */
 
-       /* call relation */
-       int e_call_cause;
-       int e_call_location;    
+       /* join relation */
+       int e_join_cause;
+       int e_join_location;    
 
        /* callback */
        char e_cbdialing[256];                  /* dialing information after callback */
@@ -127,6 +127,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 */
@@ -163,8 +164,8 @@ class EndpointAppPBX : public EndpointApp
        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 */
@@ -190,7 +191,7 @@ class EndpointAppPBX : public EndpointApp
 
        /* 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);
@@ -205,27 +206,28 @@ class EndpointAppPBX : public EndpointApp
        void port_facility(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_call(unsigned long call_id, int message, union parameter *param);
-       void call_crypt(struct port_list *portlist, int message_type, union parameter *param);
-       void call_mISDNsignal(struct port_list *portlist, int message_type, union parameter *param);
-       void call_setup(struct port_list *portlist, int message_type, union parameter *param);
-       void call_information(struct port_list *portlist, int message_type, union parameter *param);
-       void call_overlap(struct port_list *portlist, int message_type, union parameter *param);
-       void call_proceeding(struct port_list *portlist, int message_type, union parameter *param);
-       void call_alerting(struct port_list *portlist, int message_type, union parameter *param);
-       void call_connect(struct port_list *portlist, int message_type, union parameter *param);
-       void call_disconnect_release(struct port_list *portlist, int message_type, union parameter *param);
-       void call_notify(struct port_list *portlist, int message_type, union parameter *param);
-       void call_facility(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_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);
+       void join_proceeding(struct port_list *portlist, int message_type, union parameter *param);
+       void join_alerting(struct port_list *portlist, int message_type, union parameter *param);
+       void join_connect(struct port_list *portlist, int message_type, union parameter *param);
+       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);
 
        /* epoint */
        void new_state(int state);
-       void release(int release, int calllocation, int callcause, int portlocation, int portcause);
+       void release(int release, int joinlocation, int joincause, int portlocation, int portcause);
        void notify_active(void);
        void keypad_function(char digit);
        void set_tone(struct port_list *portlist, char *tone);
        void out_setup(void);
-       char *apply_callerid_display(char *id, int itype, int ntype, int present, int screen, char *h323, char *intern, char *name);
+       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 auth(int job, int bit_num);
 
        /* vbox playback stuff */
@@ -248,13 +250,13 @@ class EndpointAppPBX : public EndpointApp
        struct route_param *routeparam(struct route_action *action, unsigned long long id);
 
        /* init / dialing / hangup */
-       void _action_init_call(int chan);
+       int _action_init_call(char *remote);
        void action_init_call(void);
-       void action_init_chan(void);
+       void action_init_remote(void);
        void action_dialing_internal(void);
        void action_dialing_external(void);
        void action_dialing_h323(void);
-       void action_dialing_chan(void);
+       void action_dialing_remote(void);
        void action_dialing_vbox_record(void);
        void action_init_partyline(void);
        void action_hangup_call(void);
@@ -296,8 +298,8 @@ class EndpointAppPBX : public EndpointApp
        void process_hangup(int cause, int location);
 
        /* facility function */
-       void pick_call(char *extension);
-       void join_call(void);
+       void pick_join(char *extension);
+       void join_join(void);
        void encrypt_shared(void);
        void encrypt_keyex(void);
        void encrypt_off(void);
@@ -344,15 +346,12 @@ class EndpointAppPBX : public EndpointApp
        void cryptman_timeout(int secs);
 
        void message_disconnect_port(struct port_list *portlist, int cause, int location, char *display);
-       void logmessage(struct message *messsage);
+       void logmessage(int message_type, union parameter *param, unsigned int port_id, int dir);
        void trace_header(char *name, int direction);
-       void screen(int out, char *id, int idsize, int *type, int *present);
 };
 
 
-char *nationalize_callerinfo(char *string, int *type);
-char *numberrize_callerinfo(char *string, int type);
-void apply_callerid_restriction(int anon_ignore, int port_type, char *id, int *ntype, int *present, int *screen, char *voip, char *intern, char *name);
+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);