1 /*****************************************************************************\
3 ** Linux Call Router **
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg **
8 ** join header file for pbx joins **
10 \*****************************************************************************/
15 * joins connect interfaces together
16 * joins are linked in a chain
17 * interfaces can have 0, 1 or more references to a join
18 * the join can have many references to interfaces
19 * joins receive and send messages
22 #define RECORD_BUFFER_SIZE 16000
24 enum { /* relation types */
25 RELATION_TYPE_CALLING, /* initiator of a join */
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 join 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 join_relation { /* relation to an interface */
44 struct join_relation *next; /* next node */
45 int type; /* type of relation */
46 unsigned long epoint_id; /* interface to link join 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 JoinPBX : public Join
55 JoinPBX(class Endpoint *epoint);
57 void message_epoint(unsigned long epoint_id, int message, union parameter *param);
59 int release(struct join_relation *relation, int location, int cause);
61 char j_caller[32]; /* caller number */
62 char j_caller_id[32]; /* caller id to signal */
63 char j_dialed[1024]; /* dial string of (all) number(s) */
64 char j_todial[32]; /* overlap dialing (part not signalled yet) */
65 int j_multicause, j_multilocation;
67 int j_pid; /* pid of join to generate bridge id */
68 int j_updatebridge; /* bridge must be updated */
69 struct join_relation *j_relation; /* list of endpoints that are related to the join */
71 int j_partyline; /* if set, join is conference room */
72 int j_partyline_jingle; /* also play jingle on join/leave */
75 void bridge_data(unsigned long epoint_from, struct join_relation *relation_from, union parameter *param);
76 void remove_relation(struct join_relation *relation);
77 struct join_relation *add_relation(void);
78 int out_setup(unsigned long epoint_id, int message, union parameter *param, char *newnumber);
79 void play_jingle(int in);
82 void joinpbx_debug(class JoinPBX *joinpbx, char *function);
83 int joinpbx_countrelations(unsigned long join_id);
84 int track_notify(int oldstate, int notify);