[Home]

Summary:ASTERISK-05133: [patch] voice mail cuts off on freebsd in agi
Reporter:Leif Neland (lenne_dk)Labels:
Date Opened:2005-09-23 04:47:13Date Closed:2011-06-07 14:03:23
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Resources/res_agi
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) res_agi.patch
Description:This bug http://bugs.digium.com/view.php?id=3101 also happens in AGI

My patch duplicates the bugfix from say.c to res/res_agi.c

(It appears many things which can be done in both dialplan and agi does not use the same routines, but have duplicate routines.)


****** ADDITIONAL INFORMATION ******

*** work/asterisk-1.0.9/res/res_agi.c   Tue Jun 14 22:24:38 2005
--- /root/res_agi.c     Fri Sep 23 11:24:55 2005
***************
*** 449,455 ****
               else
                       return RESULT_FAILURE;
       }
!       res = ast_waitstream_full(chan, argv[3], agi->audio, agi->ctrl);
       /* this is to check for if ast_waitstream closed the stream, we probably are at
        * the end of the stream, return that amount, else check for the amount */
       sample_offset = (chan->stream)?ast_tellstream(fs):max_length;
--- 449,459 ----
               else
                       return RESULT_FAILURE;
       }
!       if ( agi->audio > -1 && agi->ctrl > -1)
!               res = ast_waitstream_full(chan, argv[3], agi->audio, agi->ctrl);
!       else
!               res = ast_waitstream(chan, argv[3]);
!
       /* this is to check for if ast_waitstream closed the stream, we probably are at
        * the end of the stream, return that amount, else check for the amount */
       sample_offset = (chan->stream)?ast_tellstream(fs):max_length;
Comments:By: Russell Bryant (russell) 2005-09-23 06:00:32

Please attach a patch in "cvs diff -u" format.

Do you have a disclaimer on file?

By: Russell Bryant (russell) 2005-09-23 06:00:32

Please attach a patch in "cvs diff -u" format.

Do you have a disclaimer on file?

By: Leif Neland (lenne_dk) 2005-09-23 07:42:44

No disclaimer on file, do what you want with it.

By: Mark Spencer (markster) 2005-09-24 10:30:50

It would seem as though we need to fix ast_waitstream_full...  What is apparent here is that waitstream_full is not working on BSD and it's required for certain features to operate properly.  Any chance of getting together on IRC to try to debug?

By: Thorsten Lockert (tholo) 2005-10-11 20:35:17

Can you list the exact steps needed to reproduce the problem you are seeing?  Including the involved VM config, the dial plan entries involved etc.?

Also, can you verify that this problem also exists in HEAD (1.1dev)?

By: Olle Johansson (oej) 2005-10-25 09:49:03

lenne_dk!
We are waiting for your reply!

/Housekeeping

By: Mark Spencer (markster) 2005-10-25 12:28:57

Closing due to lack of response.

By: Leif Neland (lenne_dk) 2005-10-25 14:45:25

I can not comment if it works for HEAD, as I do not dare compiling it under FreeBSD...

I don't think the AGI is relevant, but anyway, here it is:

#!/usr/bin/perl
use strict;
use RRDp;
RRDp::start "/usr/local/bin/rrdtool";

$|=1;

# Setup some variables
my %AGI; my $tests = 0; my $fail = 0; my $pass = 0;

while(<STDIN>) {
       chomp;
       last unless length($_);
       if (/^agi_(\w+)\:\s+(.*)$/) {
               $AGI{$1} = $2;
       }
}

print STDERR "AGI Environment Dump:\n";
foreach my $i (sort keys %AGI) {
       print STDERR " -- $i = $AGI{$i}\n";
}

sub checkresult {
       my ($res) = @_;
       my $retval;
       $tests++;
       chomp $res;
       if ($res =~ /^200/) {
               $res =~ /result=(-?\d+)/;
               if (!length($1)) {
                       print STDERR "FAIL ($res)\n";
                       $fail++;
               } else {
                       print STDERR "PASS ($1)\n";
                       $pass++;
               }
       } else {
               print STDERR "FAIL (unexpected result '$res')\n";
               $fail++;
       }
}

sub sendcmd {
       my ($cmd) = @_;
       print $cmd;
       my $result = <STDIN>;
       &checkresult($result);
}

sub saydecimal {
       my ($number) = @_;
       my $numberstring = sprintf("%5.1f\n",abs($number));

       sendcmd ("STREAM FILE  digits/minus \"\" \n") if ($number lt 0);

       my (@parts) = split('\.',$numberstring);
       sendcmd(sprintf("SAY NUMBER %d \"\"\n",$parts[0]));
       sendcmd("STREAM FILE digits/, \"\" \n");
sendcmd("EXEC SETLANGUAGE da\n");

RRDp::cmd       qw(graph /dev/null
    --start end-5min
    --end now-2min
    DEF:t=/usr/local/www/data/temperatur/temp2.rrd:temp5:AVERAGE
    DEF:t1=/usr/local/www/data/temperatur/temp2.rrd:temp1:AVERAGE
    DEF:t2=/usr/local/www/data/temperatur/temp2.rrd:temp2:AVERAGE
    DEF:t4=/usr/local/www/data/temperatur/temp2.rrd:temp4:AVERAGE
    CDEF:tk=t1,t2,t4,MAX,MAX
    PRINT:t:AVERAGE:%lf
    PRINT:tk:AVERAGE:%lf);

my $answer = RRDp::read;
my $sted = "";
my $nr = 0;
while (<$$answer>)
{
next if !($nr++);
sendcmd("STREAM FILE temp_temperaturen_i \"\" \n");

sendcmd("STREAM FILE temp_sens_$nr \"\" \n");

sendcmd("STREAM FILE temp_er \"\" \n");

&saydecimal($_);

sendcmd("STREAM FILE temp_grader \"\" \n");


}
vmstat

procs      memory      page                    disks     faults      cpu
r b w     avm    fre  flt  re  pi  po  fr  sr ad1 da0   in   sy  cs us sy id
0 5 0  325596  17208  470   0   0   0 539  96   0   0 2169  649 2128  9 12 79

By: Olle Johansson (oej) 2005-10-25 14:49:18

I do CVS HEAD *development* on FreeBSD, so it compiles all right! Go ahead and test, please :-)



By: Olle Johansson (oej) 2005-10-25 14:50:21

tholo asked for dialplan as well, thank you for a quick answer so we can locate this.

By: Leif Neland (lenne_dk) 2005-10-26 04:08:51

Trying to build CVS-v1-0-10/26/05-10:57:04, but got build-error, see
http://bugs.digium.com/view.php?id=5517

By: Leif Neland (lenne_dk) 2005-10-26 04:10:43

Relevant entry in dialplan is simply:

Exten => 79,1,SetLanguage(da)
Exten => 79,2,Playback(beep);
Exten => 79,3,agi,koldtemp.agi
Exten => 79,4,Goto(default,79,2)

By: Kevin P. Fleming (kpfleming) 2005-10-31 18:58:47.000-0600

If this problem does not occur with CVS HEAD, then we are not going to fix it at this point unless the fix is very simple and will not risk breaking other platforms. The 1.0.x series is in 'stable' mode now, we don't make any significant changes unless they are absolutely necessary.

If you can reproduce this problem using CVS HEAD Asterisk then please re-open the bug and we'll try to address it.

By: Leif Neland (lenne_dk) 2005-11-11 03:08:44.000-0600

Can't reproduce in HEAD