1 /*****************************************************************************\
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg **
10 \*****************************************************************************/
15 #include <sys/types.h>
24 //#define MIXER_DEBUG /* debug mixer buffer overflow and underrun */
26 class Port *port_first = NULL;
28 unsigned long port_serial = 1; /* must be 1, because 0== no port */
31 /* free epointlist relation
33 void Port::free_epointlist(struct epoint_list *epointlist)
35 struct epoint_list *temp, **tempp;
38 tempp = &p_epointlist;
41 if (temp == epointlist)
49 PERROR("SOFTWARE ERROR: epointlist not in port's list.\n");
56 PDEBUG(DEBUG_EPOINT, "PORT(%d) removed epoint from port\n", p_serial);
57 memset(temp, 0, sizeof(struct epoint_list));
63 void Port::free_epointid(unsigned long epoint_id)
65 struct epoint_list *temp, **tempp;
68 tempp = &p_epointlist;
71 if (temp->epoint_id == epoint_id)
79 PERROR("epoint_id not in port's list, exitting.\n");
86 PDEBUG(DEBUG_EPOINT, "PORT(%d) removed epoint from port\n", p_serial);
87 memset(temp, 0, sizeof(struct epoint_list));
93 /* create new epointlist relation
95 struct epoint_list *Port::epointlist_new(unsigned long epoint_id)
97 struct epoint_list *epointlist, **epointlistpointer;
99 /* epointlist structure */
100 epointlist = (struct epoint_list *)calloc(1, sizeof(struct epoint_list));
103 PERROR("no mem for allocating epoint_list\n");
107 PDEBUG(DEBUG_EPOINT, "PORT(%d) allocating epoint_list.\n", p_serial);
108 memset(epointlist, 0, sizeof(struct epoint_list));
110 /* add epoint_list to chain */
111 epointlist->next = NULL;
112 epointlistpointer = &p_epointlist;
113 while(*epointlistpointer)
114 epointlistpointer = &((*epointlistpointer)->next);
115 *epointlistpointer = epointlist;
118 epointlist->epoint_id = epoint_id;
119 epointlist->active = 1;
128 Port::Port(int type, char *portname, struct port_settings *settings)
130 class Port *temp, **tempp;
132 PDEBUG(DEBUG_PORT, "new port of type %d, name '%s'\n", type, portname);
134 /* initialize object */
136 memcpy(&p_settings, settings, sizeof(struct port_settings));
139 memset(&p_settings, 0, sizeof(p_settings));
140 SCPY(p_settings.tones_dir, options.tones_dir);
142 SCPY(p_name, portname);
143 SCPY(p_tone_dir, p_settings.tones_dir); // just to be sure
146 p_serial = port_serial++;
147 p_debug_nothingtosend = 0;
149 p_tone_fetched = NULL;
150 p_tone_name[0] = '\0';
152 // p_knock_fetched = NULL;
153 p_state = PORT_STATE_IDLE;
155 memset(&p_callerinfo, 0, sizeof(p_callerinfo));
156 memset(&p_dialinginfo, 0, sizeof(p_dialinginfo));
157 memset(&p_connectinfo, 0, sizeof(p_connectinfo));
158 memset(&p_redirinfo, 0, sizeof(p_redirinfo));
159 memset(&p_capainfo, 0, sizeof(p_capainfo));
160 memset(p_mixer_buffer, 0, sizeof(p_mixer_buffer));
161 memset(p_record_buffer, 0, sizeof(p_record_buffer));
162 memset(p_stereo_buffer, 0, sizeof(p_stereo_buffer));
170 p_record_filename[0] = '\0';
172 /* append port to chain */
191 struct mixer_relation *relation, *rtemp;
192 class Port *temp, **tempp;
193 struct message *message;
200 PDEBUG(DEBUG_PORT, "removing port of type %d, name '%s'\n", p_type, p_name);
202 /* free mixer relation chain */
203 relation = p_mixer_rel;
207 relation = relation->next;
208 memset(rtemp, 0, sizeof(struct mixer_relation));
212 p_mixer_rel = NULL; /* beeing paranoid */
214 /* disconnect port from endpoint */
217 /* send disconnect */
218 message = message_create(p_serial, p_epointlist->epoint_id, PORT_TO_EPOINT, MESSAGE_RELEASE);
219 message->param.disconnectinfo.cause = 16;
220 message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
221 message_put(message);
222 /* remove endpoint */
223 free_epointlist(p_epointlist);
226 /* remove port from chain */
238 PERROR("PORT(%s) port not in port's list.\n", p_name);
244 /* close open tones file */
251 p_tone_fetched = NULL;
256 /* set new endpoint state
258 void Port::new_state(int state)
260 PDEBUG(DEBUG_PORT, "PORT(%s) new state %s --> %s\n", p_name, state_name[p_state], state_name[state]);
266 * find the port with port_id
268 class Port *find_port_id(unsigned long port_id)
270 class Port *port = port_first;
274 //printf("comparing: '%s' with '%s'\n", name, port->name);
275 if (port->p_serial == port_id)
287 void Port::set_echotest(int echotest)
289 p_echotest = echotest;
294 * set the file in the tone directory with the given name
296 void Port::set_tone(char *dir, char *name)
304 /* no counter, no eof, normal speed */
308 p_tone_codec = CODEC_LAW;
316 p_tone_fetched = NULL;
322 SPRINT(p_tone_name, "%s", name);
323 p_tone_dir[0] = '\0';
326 SCPY(p_tone_dir, dir);
327 SCPY(p_tone_name, name);
331 p_tone_name[0]= '\0';
336 if (!!strncmp(name,"cause_",6))
339 /* now we check if the cause exists, otherwhise we use error tone. */
340 if ((p_tone_fetched=open_tone_fetched(p_tone_dir, p_tone_name, &p_tone_codec, 0, 0)))
342 p_tone_fetched = NULL;
345 SPRINT(filename, "%s_loop", p_tone_name);
346 if ((p_tone_fetched=open_tone_fetched(p_tone_dir, filename, &p_tone_codec, 0, 0)))
348 p_tone_fetched = NULL;
351 SPRINT(filename, "%s/%s/%s", INSTALL_DATA, p_tone_dir, p_tone_name);
352 if ((fh=open_tone(filename, &p_tone_codec, 0, 0)) >= 0)
357 SPRINT(filename, "%s/%s/%s_loop", INSTALL_DATA, p_tone_dir, p_tone_name);
358 if ((fh=open_tone(filename, &p_tone_codec, 0, 0)) >= 0)
364 if (!strcmp(name,"cause_00") || !strcmp(name,"cause_10"))
366 PDEBUG(DEBUG_PORT, "PORT(%s) Given Cause 0x%s has no tone, using release tone\n", p_name, name+6);
367 SPRINT(p_tone_name,"release");
369 if (!strcmp(name,"cause_11"))
371 PDEBUG(DEBUG_PORT, "PORT(%s) Given Cause 0x%s has no tone, using busy tone\n", p_name, name+6);
372 SPRINT(p_tone_name,"busy");
375 PDEBUG(DEBUG_PORT, "PORT(%s) Given Cause 0x%s has no tone, using error tone\n", p_name, name+6);
376 SPRINT(p_tone_name,"error");
382 * set the file in the tone directory for vbox playback
383 * also set the play_eof-flag
385 void Port::set_vbox_tone(char *dir, char *name)
391 p_tone_codec = CODEC_LAW;
400 p_tone_fetched = NULL;
402 SPRINT(p_tone_dir, dir);
403 SPRINT(p_tone_name, name);
405 /* now we check if the cause exists, otherwhise we use error tone. */
408 if ((p_tone_fetched=open_tone_fetched(p_tone_dir, p_tone_name, &p_tone_codec, &p_tone_size, &p_tone_left)))
410 PDEBUG(DEBUG_PORT, "PORT(%s) opening fetched tone: %s\n", p_name, p_tone_name);
413 SPRINT(filename, "%s/%s/%s", INSTALL_DATA, p_tone_dir, p_tone_name);
414 if ((p_tone_fh=open_tone(filename, &p_tone_codec, &p_tone_size, &p_tone_left)) >= 0)
417 PDEBUG(DEBUG_PORT, "PORT(%s) opening tone: %s\n", p_name, filename);
422 SPRINT(filename, "%s", p_tone_name);
423 if ((p_tone_fh=open_tone(filename, &p_tone_codec, &p_tone_size, &p_tone_left)) >= 0)
426 PDEBUG(DEBUG_PORT, "PORT(%s) opening tone: %s\n", p_name, filename);
434 * set the file in the given directory for vbox playback
435 * also set the eof-flag
436 * also set the counter-flag
438 void Port::set_vbox_play(char *name, int offset)
441 struct message *message;
443 /* use ser_box_tone() */
444 set_vbox_tone("", name);
454 /* send message with counter value */
455 if (p_tone_size>=0 && ACTIVE_EPOINT(p_epointlist))
457 message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_TONE_COUNTER);
458 message->param.counter.current = offset;
459 message->param.counter.max = size;
460 message_put(message);
467 * set the playback speed (for recording playback with different speeds)
469 void Port::set_vbox_speed(int speed)
471 /* enable vbox play mode */
472 p_tone_speed = speed;
476 * read from the given file as specified in port_set_tone and return sample data
478 int Port::read_audio(unsigned char *buffer, int length)
482 int nodata=0; /* to detect 0-length files and avoid endless reopen */
484 int tone_left_before; /* temp variable to determine the change in p_tone_left */
491 codec_in = p_tone_codec;
493 /* if there is no tone set, use silence */
494 if (p_tone_name[0] == 0)
497 memset(buffer, (options.law=='a')?0x2a:0xff, len); /* silence */
501 /* if the file pointer is not open, we open it */
502 if (p_tone_fh<0 && p_tone_fetched==NULL)
506 SPRINT(filename, "%s", p_tone_name);
507 /* if file does not exist */
508 if (!(p_tone_fetched=open_tone_fetched(p_tone_dir, filename, &p_tone_codec, &p_tone_size, &p_tone_left)))
510 SPRINT(filename, "%s/%s/%s", INSTALL_DATA, p_tone_dir, p_tone_name);
511 /* if file does not exist */
512 if ((p_tone_fh=open_tone(filename, &p_tone_codec, &p_tone_size, &p_tone_left)) < 0)
514 PDEBUG(DEBUG_PORT, "PORT(%s) no tone: %s\n", p_name, filename);
521 SPRINT(filename, "%s", p_tone_name);
522 /* if file does not exist */
523 if ((p_tone_fh=open_tone(filename, &p_tone_codec, &p_tone_size, &p_tone_left)) < 0)
525 PDEBUG(DEBUG_PORT, "PORT(%s) no tone: %s\n", p_name, filename);
530 PDEBUG(DEBUG_PORT, "PORT(%s) opening %stone: %s\n", p_name, p_tone_fetched?"fetched ":"", filename);
534 /* file descriptor is open read data */
535 tone_left_before = p_tone_left;
538 l = read_tone(p_tone_fh, buffer, p_tone_codec, len, p_tone_size, &p_tone_left, p_tone_speed);
539 if (l<0 || l>len) /* paranoia */
546 l = read_tone_fetched(&p_tone_fetched, buffer, len, p_tone_size, &p_tone_left, p_tone_speed);
547 if (l<0 || l>len) /* paranoia */
553 /* if counter is enabled, we check if we have a change */
554 if (p_tone_counter && p_tone_size>=0 && ACTIVE_EPOINT(p_epointlist))
556 /* if we jumed to the next second */
557 if (((p_tone_size-p_tone_left)/8000) != (p_tone_size-tone_left_before)/8000)
559 //printf("\nsize=%d left=%d\n\n",p_tone_size,p_tone_left);
560 struct message *message;
561 message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_TONE_COUNTER);
562 message->param.counter.current = (p_tone_size-p_tone_left)/8000;
563 message->param.counter.max = -1;
564 message_put(message);
577 p_tone_fetched = NULL;
582 /* if the file has 0-length */
585 PDEBUG(DEBUG_PORT, "PORT(%s) 0-length loop: %s\n", p_name, filename);
588 goto rest_is_silence;
591 /* if eof is reached, or if the normal file cannot be opened, continue with the loop file if possible */
593 if (p_tone_eof && ACTIVE_EPOINT(p_epointlist))
595 struct message *message;
596 message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_TONE_EOF);
597 message_put(message);
602 /* if file does not exist */
603 SPRINT(filename, "%s_loop", p_tone_name);
604 if (!(p_tone_fetched=open_tone_fetched(p_tone_dir, filename, &p_tone_codec, &p_tone_size, &p_tone_left)))
606 SPRINT(filename, "%s/%s/%s_loop", INSTALL_DATA, p_tone_dir, p_tone_name);
607 /* if file does not exist */
608 if ((p_tone_fh=open_tone(filename, &p_tone_codec, &p_tone_size, &p_tone_left)) < 0)
610 PDEBUG(DEBUG_PORT, "PORT(%s) no tone loop: %s\n",p_name, filename);
611 p_tone_dir[0] = '\0';
612 p_tone_name[0] = '\0';
613 // codec_in = CODEC_LAW;
614 goto rest_is_silence;
620 SPRINT(filename, "%s_loop", p_tone_name);
621 /* if file does not exist */
622 if ((p_tone_fh=open_tone(filename, &p_tone_codec, &p_tone_size, &p_tone_left)) < 0)
624 PDEBUG(DEBUG_PORT, "PORT(%s) no tone loop: %s\n",p_name, filename);
625 p_tone_dir[0] = '\0';
626 p_tone_name[0] = '\0';
627 // codec_in = CODEC_LAW;
628 goto rest_is_silence;
633 PDEBUG(DEBUG_PORT, "PORT(%s) opening %stone: %s\n", p_name, p_tone_fetched?"fetched ":"", filename);
635 /* now we have opened the loop */
644 * process transmission clock */
645 int Port::handler(void)
652 /* endpoint sends messages to the port
653 * this is called by the message_epoint inherited by child classes
654 * therefor a return=1 means: stop, no more processing
656 //extern struct message *dddebug;
657 int Port::message_epoint(unsigned long epoint_id, int message_id, union parameter *param)
659 /* check if we got audio data from one remote port */
662 case MESSAGE_TONE: /* play tone */
663 PDEBUG(DEBUG_PORT, "PORT(%s) isdn port with (caller id %s) setting tone '%s' dir '%s'\n", p_name, p_callerinfo.id, param->tone.name, param->tone.dir);
664 set_tone(param->tone.dir,param->tone.name);
668 //printf("port=%s, epoint=%d\n",p_cardname, epoint->e_serial);
672 case MESSAGE_VBOX_TONE: /* play tone of answering machine */
673 PDEBUG(DEBUG_PORT, "PORT(%s) set answering machine tone '%s' '%s'\n", p_name, param->tone.dir, param->tone.name);
674 set_vbox_tone(param->tone.dir, param->tone.name);
677 case MESSAGE_VBOX_PLAY: /* play recording of answering machine */
678 PDEBUG(DEBUG_PORT, "PORT(%s) set answering machine file to play '%s' (offset %d seconds)\n", p_name, param->play.file, param->play.offset);
679 set_vbox_play(param->play.file, param->play.offset);
682 case MESSAGE_VBOX_PLAY_SPEED: /* set speed of playback (recording of answering machine) */
683 PDEBUG(DEBUG_PORT, "PORT(%s) set answering machine playback speed %d (times)\n", p_name, param->speed);
684 set_vbox_speed(param->speed);
694 * special function generate individual isdn debug logs
696 void Port::printisdn(char *fmt, ...)
704 VUNPRINT(buffer,sizeof(buffer)-1,fmt,args);
705 buffer[sizeof(buffer)-1]=0;
708 PDEBUG_RUNTIME(NULL, 0, DEBUG_PORT, "PORT(%s serial=%ld): %s\n", p_name, p_serial, buffer);
709 if (options.deb & DEBUG_LOG)
711 SPRINT(name, "%s/debug_%s.log", INSTALL_DATA, p_name);
712 if (!(fp = fopen(name, "a")))
715 fprintf(fp, "%04d.%02d.%02d %02d:%02d:%02d %s(%ld): %s", now_tm->tm_year+1900, now_tm->tm_mon+1, now_tm->tm_mday, now_tm->tm_hour, now_tm->tm_min, now_tm->tm_sec, p_name, p_serial, buffer);
721 /* wave header structure */
723 unsigned short stereo; /* 1 = mono, 2 = stereo */
724 unsigned short channels; /* number of channels */
725 unsigned long sample_rate; /* sample rate */
726 unsigned long data_rate; /* data rate */
727 unsigned short bytes_sample; /* bytes per sample (all channels) */
728 unsigned short bits_sample; /* bits per sample (one channel) */
733 * open record file (actually a wave file with empty header which will be
734 * written before close, because we do not know the size yet)
735 * type=1 record annoucement, type=0 record audio stream, type=2 record vbox
737 int Port::open_record(int type, int vbox, int skip, char *terminal, int anon_ignore, char *vbox_email, int vbox_email_file)
739 /* RIFFxxxxWAVEfmt xxxx(fmt-size)dataxxxx... */
740 char dummyheader[8+4+8+sizeof(fmt)+8];
745 PERROR("Port(%d) not a terminal\n", p_serial);
748 SCPY(p_record_extension, terminal);
749 p_record_anon_ignore = anon_ignore;
750 SCPY(p_record_vbox_email, vbox_email);
751 p_record_vbox_email_file = vbox_email_file;
755 PERROR("Port(%d) already recording\n", p_serial);
760 SPRINT(filename, "%s/%s/%s/vbox", INSTALL_DATA, options.extensions_dir, p_record_extension);
762 SPRINT(filename, "%s/%s/%s/recordings", INSTALL_DATA, options.extensions_dir, p_record_extension);
763 if (mkdir(filename, 0755) < 0)
767 PERROR("Port(%d) cannot create directory '%s'\n", p_serial, filename);
773 UPRINT(strchr(filename,'\0'), "/announcement");
775 UPRINT(strchr(filename,'\0'), "/%04d-%02d-%02d_%02d%02d%02d", now_tm->tm_year+1900, now_tm->tm_mon+1, now_tm->tm_mday, now_tm->tm_hour, now_tm->tm_min, now_tm->tm_sec);
778 p_record_vbox_year = now_tm->tm_year;
779 p_record_vbox_mon = now_tm->tm_mon;
780 p_record_vbox_mday = now_tm->tm_mday;
781 p_record_vbox_hour = now_tm->tm_hour;
782 p_record_vbox_min = now_tm->tm_min;
785 /* check, if file exists (especially when an extension calls the same extension) */
787 if ((p_record = fopen(filename, "r")))
790 SCAT(filename, "_2nd");
793 p_record = fopen(filename, "w");
796 PERROR("Port(%d) cannot record because file cannot be opened '%s'\n", p_serial, filename);
801 p_record_type = type;
802 p_record_vbox = vbox;
803 p_record_skip = skip;
805 switch(p_record_type)
810 fwrite(dummyheader, sizeof(dummyheader), 1, p_record);
816 UCPY(p_record_filename, filename);
818 PDEBUG(DEBUG_PORT, "Port(%d) recording started with file name '%s'\n", p_serial, filename);
824 * close the recoding file, put header in front and rename
826 void Port::close_record(int beep)
828 static signed long beep_mono[] = {-10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000, -10000, 10000};
829 static unsigned char beep_8bit[] = {48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208, 48, 208};
830 unsigned long size, wsize;
832 char filename[512], indexname[512];
835 char number[256], callerid[256];
837 struct caller_info callerinfo;
838 char *valid_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-!$%&/()=+*;~";
843 memcpy(&callerinfo, &p_callerinfo, sizeof(struct caller_info));
844 apply_callerid_restriction(p_record_anon_ignore, -1, callerinfo.id, &callerinfo.ntype, &callerinfo.present, &callerinfo.screen, callerinfo.voip, callerinfo.intern, callerinfo.name);
846 SCPY(number, p_dialinginfo.number);
847 SCPY(callerid, numberrize_callerinfo(callerinfo.id, callerinfo.ntype));
848 if (callerid[0] == '\0')
850 if (callerinfo.present == INFO_PRESENT_RESTRICTED)
851 UCPY(callerid,"anonymous");
853 UCPY(callerid,"unknown");
856 /* change verboten digits */
858 while((p=strchr(p,'*')))
861 while((p=strchr(p,'/')))
864 while((p=strchr(p,'*')))
867 while((p=strchr(p,'/')))
870 ii = strlen(callerid);
873 if (!strchr(valid_chars, callerid[i]))
881 if (!strchr(valid_chars, number[i]))
886 /* add beep to the end of recording */
888 switch(p_record_type)
894 fwrite(beep_mono, sizeof(beep_mono), 1, p_record);
895 i += sizeof(beep_mono);
896 p_record_length += sizeof(beep_mono);
903 fwrite(beep_8bit, sizeof(beep_8bit), 1, p_record);
904 i += sizeof(beep_8bit);
905 p_record_length += sizeof(beep_8bit);
913 fwrite(beep_law, sizeof(beep_law), 1, p_record);
914 i += sizeof(beep_law);
915 p_record_length += sizeof(beep_law);
920 PERROR("codec %d not supported for beep adding\n", p_record_type);
923 /* complete header */
924 switch(p_record_type)
930 fprintf(p_record, "cue %c%c%c%c%c%c%c%c", 4, 0, 0, 0, 0,0,0,0);
933 fprintf(p_record, "LIST%c%c%c%cadtl", 4, 0, 0, 0);
936 fseek(p_record, 0, SEEK_SET);
938 /* WAVEfmt xxxx(fmt-size)dataxxxx[data]cue xxxx0000LISTxxxxadtl*/
939 size = p_record_length;
940 wsize = 4+8+sizeof(fmt)+8+size+8+4+8+4;
943 fprintf(p_record, "RIFF%c%c%c%c", (unsigned char)(wsize&0xff), (unsigned char)((wsize>>8)&0xff), (unsigned char)((wsize>>16)&0xff), (unsigned char)(wsize>>24));
946 fprintf(p_record, "WAVE");
949 fprintf(p_record, "fmt %c%c%c%c", sizeof(fmt), 0, 0, 0);
950 switch(p_record_type)
955 fmt.sample_rate = 8000; /* samples/sec */
956 fmt.data_rate = 16000; /* full data rate */
957 fmt.bytes_sample = 2; /* all channels */
958 fmt.bits_sample = 16; /* one channel */
964 fmt.sample_rate = 8000; /* samples/sec */
965 fmt.data_rate = 32000; /* full data rate */
966 fmt.bytes_sample = 4; /* all channels */
967 fmt.bits_sample = 16; /* one channel */
973 fmt.sample_rate = 8000; /* samples/sec */
974 fmt.data_rate = 8000; /* full data rate */
975 fmt.bytes_sample = 1; /* all channels */
976 fmt.bits_sample = 8; /* one channel */
979 fwrite(&fmt, sizeof(fmt), 1, p_record);
982 fprintf(p_record, "data%c%c%c%c", (unsigned char)(size&0xff), (unsigned char)((size>>8)&0xff), (unsigned char)((size>>16)&0xff), (unsigned char)(size>>24));
985 if (p_record_vbox == 1)
986 SPRINT(filename, "%s.wav", p_record_filename);
988 SPRINT(filename, "%s_%s-%s.wav", p_record_filename, callerid, number);
993 if (p_record_vbox == 1)
994 SPRINT(filename, "%s.isdn", p_record_filename);
996 SPRINT(filename, "%s_%s-%s.isdn", p_record_filename, callerid, number);
1000 if (p_record_vbox == 1)
1001 SPRINT(filename, "%s.unknown", p_record_filename);
1003 SPRINT(filename, "%s_%s-%s.unknown", p_record_filename, callerid, number);
1010 if (rename(p_record_filename, filename) < 0)
1012 PERROR("Port(%d) cannot rename from '%s' to '%s'\n", p_serial, p_record_filename, filename);
1016 PDEBUG(DEBUG_PORT, "Port(%d) recording is written and renamed to '%s' and must have the following size:%lu raw:%lu samples:%lu\n", p_serial, filename, wsize+8, size, size>>1);
1018 if (p_record_vbox == 2)
1020 SPRINT(indexname, "%s/%s/%s/vbox/index", INSTALL_DATA, options.extensions_dir, p_record_extension);
1021 if ((fp = fopen(indexname,"a")))
1025 /* remove path from file name */
1027 while(strchr(p, '/'))
1028 p = strchr(p, '/')+1;
1029 fprintf(fp, "%s %d %d %d %d %d %s\n", p, p_record_vbox_year, p_record_vbox_mon, p_record_vbox_mday, p_record_vbox_hour, p_record_vbox_min, callerid);
1035 PERROR("Port(%d) cannot open index file '%s' to append.\n", p_serial, indexname);
1038 /* send email with sample*/
1039 if (p_record_vbox_email[0])
1041 send_mail(p_record_vbox_email_file?filename:(char *)"", callerid, callerinfo.intern, callerinfo.name, p_record_vbox_email, p_record_vbox_year, p_record_vbox_mon, p_record_vbox_mday, p_record_vbox_hour, p_record_vbox_min, p_record_extension);