1 /*****************************************************************************\
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg **
8 ** call header file for pbx calls **
10 \*****************************************************************************/
15 * calls connect interfaces together
16 * calls are linked in a chain
17 * interfaces can have 0, 1 or more references to a call
18 * the call can have many references to interfaces
19 * calls receive and send messages
22 #define RECORD_BUFFER_SIZE 16000
24 enum { /* relation types */
25 RELATION_TYPE_CALLING, /* initiator of a call */
26 RELATION_TYPE_SETUP, /* interface which is to be set up */
27 RELATION_TYPE_CONNECT, /* interface is connected */
30 enum { /* relation audio state */
31 CHANNEL_STATE_CONNECT, /* endpoint is connected to the call voice transmission in both dirs */
32 CHANNEL_STATE_HOLD, /* endpoint is on hold state, no audio */
35 enum { /* states that results from last notification */
36 NOTIFY_STATE_ACTIVE, /* just the normal case, the party is active */
37 NOTIFY_STATE_SUSPEND, /* the party is inactive, because she has parked */
38 NOTIFY_STATE_HOLD, /* the party is inactive, because she holds the line */
39 NOTIFY_STATE_CONFERENCE, /* the parties joined a conference */
43 struct call_relation { /* relation to an interface */
44 struct call_relation *next; /* next node */
45 int type; /* type of relation */
46 unsigned long epoint_id; /* interface to link call to */
47 int channel_state; /* if audio is available */
48 int rx_state; /* current state of what we received from endpoint */
49 int tx_state; /* current state of what we sent to endpoint */
52 class CallPBX : public Call
55 CallPBX(class Endpoint *epoint);
57 void message_epoint(unsigned long epoint_id, int message, union parameter *param);
59 void release(unsigned long epoint_id, int hold, int location, int cause);
61 char c_caller[32]; /* caller number */
62 char c_caller_id[32]; /* caller id to signal */
63 char c_dialed[1024]; /* dial string of (all) number(s) */
64 char c_todial[32]; /* overlap dialing (part not signalled yet) */
66 int c_mixer; /* mixer must be updated */
67 struct call_relation *c_relation; /* list of endpoints that are related to the call */
69 int c_partyline; /* if set, call is conference room */
72 void call_mixer(unsigned long epoint_from, struct call_relation *relation_from, union parameter *param);
73 void remove_relation(struct call_relation *relation);
74 struct call_relation *add_relation(void);
75 int out_setup(unsigned long epoint_id, int message, union parameter *param, char *newnumber);
78 void callpbx_debug(class CallPBX *callpbx, char *function);
79 int callpbx_countrelations(unsigned long call_id);
80 int track_notify(int oldstate, int notify);