[asterisk-users] AGI Record File / what does randomerror mean? res_agi.c / line 2377

Thorsten Göllner tg at ovm-group.com
Thu Jul 31 04:24:10 CDT 2014


Hi,

I have a question about this here:

Asterisk-Version: 11.10.2
File: res/res_agi.c
Line: 2377

[...]
  static int handle_recordfile(struct ast_channel *chan, AGI *agi, int 
argc, const char * const argv[])
2304 {
2305         struct ast_filestream *fs;
2306         struct ast_frame *f;
2307         struct timeval start;
2308         long sample_offset = 0;
2309         int res = 0;
2310         int ms;
[...]
2365         /* backward compatibility, if no offset given, arg[6] would 
have been
2366          * caught below and taken to be a beep, else if it is a 
digit then it is a
2367          * offset */
2368         if ((argc >6) && (sscanf(argv[6], "%30ld", &sample_offset) 
!= 1) && (!strchr(argv[6], '=')))
2369                 res = ast_streamfile(chan, "beep", 
ast_channel_language(chan));
2370
2371         if ((argc > 7) && (!strchr(argv[7], '=')))
2372                 res = ast_streamfile(chan, "beep", 
ast_channel_language(chan));
2373
2374         if (!res)
2375                 res = ast_waitstream(chan, argv[4]);
2376         if (res) {
2377                 ast_agi_send(agi->fd, chan, "200 result=%d 
(randomerror) endpos=%ld\n", res, sample_offset);
2378         } else {
2379                 fs = ast_writefile(argv[2], argv[3], NULL, O_CREAT 
| O_WRONLY | (sample_offset ? O_APPEND : 0), 0, AST_FILE_MODE);
2380                 if (!fs) {
2381                         res = -1;
2382                         ast_agi_send(agi->fd, chan, "200 result=%d 
(writefile)\n", res);
2383                         if (sildet)
2384                                 ast_dsp_free(sildet);
2385                         return RESULT_FAILURE;
2386                 }

In line 2377 I find "randomerror". And in fact I get this "error" 
sometimes in my AGI-Scripts but can not reproduce them by my own.

Can anybody tell me please, when this message will be fired? I do not 
really understand this source at this point. The message will be sent, 
when "res" is true (or larger 0). "res" should be set in the lines 
before. MAYBE "res" is 0 in line 2377 when the call hangs up at this point?

Best regards
-Thorsten-



More information about the asterisk-users mailing list