1 /*****************************************************************************\
3 ** Linux Call Router **
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg **
8 ** join functions for channel driver **
10 \*****************************************************************************/
17 //#include <sys/types.h>
18 //#include <sys/stat.h>
21 //#define __u8 unsigned char
22 //#define __u16 unsigned short
23 //#define __u32 unsigned long
24 //#include "linux/isdnif.h"
28 * constructor for a new join
29 * the join will have a relation to the calling endpoint
31 JoinAsterisk::JoinAsterisk(unsigned long serial) : Join()
33 PDEBUG(DEBUG_JOIN, "Constructor(new join)");
35 c_type = JOIN_TYPE_ASTERISK;
39 PDEBUG(DEBUG_JOIN, "New join connected to endpoint id %lu\n", c_epoint_id);
46 JoinAsterisk::~JoinAsterisk()
52 /* join process is called from the main loop
53 * it processes the current calling state.
54 * returns 0 if join nothing was done
56 int JoinAsterisk::handler(void)
62 void JoinAsterisk::message_epoint(unsigned long epoint_id, int message_type, union parameter *param)
64 /* if endpoint has just been removed, but still a message in the que */
65 if (epoint_id != c_epoint_id)
68 /* look for asterisk's interface */
69 if (admin_message_from_join(epoint_id, message_type, param)<0)
71 PERROR("No socket with asterisk found, this shall not happen. Closing socket shall cause release of all asterisk joins\n");
75 if (message_type == MESSAGE_RELEASE)
82 void JoinAsterisk::message_asterisk(unsigned long ref, int message_type, union parameter *param)
84 struct message *message;
86 /* create relation if no relation exists */
89 class Endpoint *epoint;
91 if (!(epoint = new Endpoint(0, c_serial, ref)))
92 FATAL("No memory for Endpoint instance\n");
93 if (!(epoint->ep_app = new DEFAULT_ENDPOINT_APP(epoint)))
94 FATAL("No memory for Endpoint Application instance\n");
97 message = message_create(c_serial, c_epoint_id, JOIN_TO_EPOINT, message_type);
98 memcpy(&message->param, param, sizeof(message->param));
101 if (message_type == MESSAGE_RELEASE)