1 /*****************************************************************************\
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg **
8 ** call 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 call
29 * the call will have a relation to the calling endpoint
31 CallAsterisk::CallAsterisk(unsigned long serial) : Call()
33 PDEBUG(DEBUG_CALL, "Constructor(new call)");
35 c_type = CALL_TYPE_ASTERISK;
39 PDEBUG(DEBUG_CALL, "New call connected to endpoint id %lu\n", c_epoint_id);
46 CallAsterisk::~CallAsterisk()
52 /* call process is called from the main loop
53 * it processes the current calling state.
54 * returns 0 if call nothing was done
56 int CallAsterisk::handler(void)
62 void CallAsterisk::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 calls\n");
75 if (message_type == MESSAGE_RELEASE)
82 void CallAsterisk::message_asterisk(unsigned long callref, 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, callref)))
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, CALL_TO_EPOINT, message_type);
98 memcpy(&message->param, param, sizeof(message->param));
101 if (message_type == MESSAGE_RELEASE)