/* free */
PDEBUG(DEBUG_EPOINT, "PORT(%d) removed epoint from port\n", p_serial);
- memset(temp, 0, sizeof(struct epoint_list));
- free(temp);
+ FREE(temp, sizeof(struct epoint_list));
ememuse--;
}
}
if (temp == 0)
{
- PERROR("epoint_id not in port's list, exitting.\n");
+ PERROR("epoint_id not in port's list.\n");
return;
}
/* detach */
/* free */
PDEBUG(DEBUG_EPOINT, "PORT(%d) removed epoint from port\n", p_serial);
- memset(temp, 0, sizeof(struct epoint_list));
- free(temp);
+ FREE(temp, sizeof(struct epoint_list));
ememuse--;
}
struct epoint_list *epointlist, **epointlistpointer;
/* epointlist structure */
- epointlist = (struct epoint_list *)calloc(1, sizeof(struct epoint_list));
+ epointlist = (struct epoint_list *)MALLOC(sizeof(struct epoint_list));
if (!epointlist)
- {
- PERROR("no mem for allocating epoint_list\n");
- return(0);
- }
+ FATAL("No memory for epointlist\n");
ememuse++;
PDEBUG(DEBUG_EPOINT, "PORT(%d) allocating epoint_list.\n", p_serial);
- memset(epointlist, 0, sizeof(struct epoint_list));
/* add epoint_list to chain */
epointlist->next = NULL;
}
SCPY(p_name, portname);
SCPY(p_tone_dir, p_settings.tones_dir); // just to be sure
- p_last_tv_sec = 0;
- p_last_tv_msec = 0;
p_type = type;
p_serial = port_serial++;
- p_debug_nothingtosend = 0;
p_tone_fh = -1;
p_tone_fetched = NULL;
p_tone_name[0] = '\0';
temp = temp->next;
}
if (temp == NULL)
- {
- PERROR("PORT(%s) port not in port's list.\n", p_name);
- exit(-1);
- }
+ FATAL("PORT(%s) port not in port's list.\n", p_name);
/* detach */
*tempp=this->next;
/*
* read from the given file as specified in port_set_tone and return sample data
- * silence is appended if sample ends, but only the number of samples with tones are returned
+ * if the tone ends, the result may be less samples than requested
*/
int Port::read_audio(unsigned char *buffer, int length)
{
len = length;
/* if there is no tone set, use silence */
- if (p_tone_name[0] == 0)
- {
-rest_is_silence:
- memset(buffer, (options.law=='a')?0x2a:0xff, len); /* silence */
- goto done;
- }
+ if (!p_tone_name[0])
+ return(0);
/* if the file pointer is not open, we open it */
if (p_tone_fh<0 && p_tone_fetched==NULL)
}
if (len==0)
- goto done;
+ return(length-len);
if (p_tone_fh >= 0)
{
PDEBUG(DEBUG_PORT, "PORT(%s) 0-length loop: %s\n", p_name, filename);
p_tone_name[0]=0;
p_tone_dir[0]=0;
- goto rest_is_silence;
+ return(length-len);
}
/* if eof is reached, or if the normal file cannot be opened, continue with the loop file if possible */
PDEBUG(DEBUG_PORT, "PORT(%s) no tone loop: %s\n",p_name, filename);
p_tone_dir[0] = '\0';
p_tone_name[0] = '\0';
- goto rest_is_silence;
+ return(length-len);
}
fhuse++;
}
PDEBUG(DEBUG_PORT, "PORT(%s) no tone loop: %s\n",p_name, filename);
p_tone_dir[0] = '\0';
p_tone_name[0] = '\0';
- goto rest_is_silence;
+ return(length-len);
}
fhuse++;
}
/* now we have opened the loop */
goto read_more;
-
-done:
- return(length-len);
}
PDEBUG(DEBUG_PORT, "data still in record buffer: %d (dir %d)\n", (p_record_buffer_writep - p_record_buffer_readp) & RECORD_BUFFER_MASK, p_record_buffer_dir);
memcpy(&callerinfo, &p_callerinfo, sizeof(struct caller_info));
- apply_callerid_restriction(p_record_anon_ignore, -1, callerinfo.id, &callerinfo.ntype, &callerinfo.present, &callerinfo.screen, NULL/*callerinfo.voip*/, callerinfo.extension, callerinfo.name);
+ apply_callerid_restriction(p_record_anon_ignore, callerinfo.id, &callerinfo.ntype, &callerinfo.present, &callerinfo.screen, callerinfo.extension, callerinfo.name);
- SCPY(number, p_dialinginfo.number);
+ SCPY(number, p_dialinginfo.id);
SCPY(callerid, numberrize_callerinfo(callerinfo.id, callerinfo.ntype));
if (callerid[0] == '\0')
{