/*****************************************************************************\
** **
-** PBX4Linux **
+** Linux Call Router **
** **
**---------------------------------------------------------------------------**
** Copyright: Andreas Eversberg **
{
struct message *message;
unsigned long tosend;
- unsigned char buffer[ISDN_TRANSMIT<<3];
+ unsigned char buffer[ISDN_TRANSMIT];
time_t currenttime;
class Endpoint *epoint;
int ret;
/* start recording, if not already */
if (p_vbox_mode == VBOX_MODE_NORMAL)
{
- /* send recording start message */
- message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_VBOX_RECORD);
- message_put(message);
+ /* recording start */
+ open_record(p_vbox_ext.vbox_codec, 2, 0, p_vbox_ext.number, p_vbox_ext.anon_ignore, p_vbox_ext.vbox_email, p_vbox_ext.vbox_email_file);
} else // else!!
if (p_vbox_mode == VBOX_MODE_ANNOUNCEMENT)
{
}
} else
{
+ if (p_record)
+ record(buffer, tosend, 0); // from down
message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_DATA);
- message->param.data.port_type = p_type;
- message->param.data.port_id = p_serial;
message->param.data.len = tosend;
memcpy(message->param.data.data, buffer, tosend);
message_put(message);
struct message *message;
class Endpoint *epoint;
char filename[256], *c;
- class EndpointAppPBX *eapp;
if (Port::message_epoint(epoint_id, message_id, param))
return(1);
switch(message_id)
{
+ case MESSAGE_DATA:
+ record(param->data.data, param->data.len, 1); // from up
+ return(1);
+
case MESSAGE_DISCONNECT: /* call has been disconnected */
PDEBUG(DEBUG_VBOX, "PORT(%s) vbox port with (caller id %s) received disconnect cause=%d\n", p_name, p_callerinfo.id, param->disconnectinfo.cause);
case MESSAGE_SETUP: /* dial-out command received from epoint, answer with connect */
/* get apppbx */
- memcpy(&p_vbox_ext, ((class EndpointAppPBX *)(epoint->ep_app))->e_ext, sizeof(p_vbox_ext));
+ memcpy(&p_vbox_ext, &((class EndpointAppPBX *)(epoint->ep_app))->e_ext, sizeof(p_vbox_ext));
/* extract optional announcement file */
- if ((c = strchr(param->setup.dialinginfo.number, ',')))
+ if ((c = strchr(param->setup.dialinginfo.id, ',')))
{
if (c[1] == '/')
SPRINT(filename, c+1);
{
SPRINT(filename, "%s/%s/%s/vbox/announcement", INSTALL_DATA, options.extensions_dir, p_vbox_ext.number);
}
- PDEBUG(DEBUG_VBOX, "PORT(%s) vbox port received setup from '%s' to '%s'\n", p_name, param->setup.callerinfo.id, param->setup.dialinginfo.number);
+ PDEBUG(DEBUG_VBOX, "PORT(%s) vbox port received setup from '%s' to '%s'\n", p_name, param->setup.callerinfo.id, param->setup.dialinginfo.id);
memcpy(&p_callerinfo, ¶m->setup.callerinfo, sizeof(p_callerinfo));
memcpy(&p_redirinfo, ¶m->setup.redirinfo, sizeof(p_redirinfo));
/* link relation */
if (p_epointlist)
- {
- PERROR("PORT(%s) software error: epoint pointer is set in idle state, how bad!! exitting.\n", p_name);
- exit(-1);
- }
- if (!(epointlist_new(epoint_id)))
- {
- PERROR("no memory for epointlist\n");
- exit(-1);
- }
+ FATAL("PORT(%s) Epoint pointer is set in idle state, how bad!!\n", p_name);
+ epointlist_new(epoint_id);
/* copy setup infos to port */
- SCPY(p_vbox_extension, param->setup.dialinginfo.number);
+ SCPY(p_vbox_extension, param->setup.dialinginfo.id);
/* create connect info */
SCPY(p_connectinfo.id, p_vbox_extension);
new_state(PORT_STATE_IN_ALERTING);
}
- /* start recording during announcement */
- /* start parallel recording if desired */
- p_vbox_mode = p_vbox_ext.vbox_mode;
- p_vbox_record_limit = p_vbox_ext.vbox_time;
/* play the announcement */
if ((p_vbox_announce_fh = open_tone(filename, &p_vbox_announce_codec, &p_vbox_announce_size, &p_vbox_announce_left)) >= 0)
{
fhuse++;
}
+ /* start recording if desired */
+ p_vbox_mode = p_vbox_ext.vbox_mode;
+ p_vbox_record_limit = p_vbox_ext.vbox_time;
if (!p_vbox_announce_fh || p_vbox_mode==VBOX_MODE_PARALLEL)
{
PDEBUG(DEBUG_VBOX, "PORT(%s) parallel mode OR no announcement found at: '%s' so we start recording now.\n", p_name, filename);