Re: [asterisk-users] Little t38 bug?

2010-05-25 Thread Tilghman Lesher
On Tuesday 25 May 2010 08:28:57 Steve Underwood wrote:
> On 05/25/2010 07:54 PM, Kevin P. Fleming wrote:
> > On 05/25/2010 05:48 AM, Alexandru Oniciuc wrote:
> >> if ((sscanf(a, "T38FaxMaxBuffer:%30u",&x) == 1)) {
> >>
> >>  ast_debug(3, "MaxBufferSize:%d\n", x);
> >>
> >>  found = TRUE;
> >>
> >>  } else if ((sscanf(a, "T38MaxBitRate:%30u",&x) == 1) ||
> >> (sscanf(a, "T38FaxMaxRate:%30u",&x) == 1)) {
> >>
> >>  ast_debug(3, "T38MaxBitRate: %d\n", x);
> >>
> >> Shouldn’t it be
> >>
> >> if((sscanf(a, "T38FaxMaxBuffer:%30u",&x) == 1)&&  ((sscanf(a,
> >> "T38MaxBitRate:%30u",&x) == 0) || (sscanf(a, "T38FaxMaxRate:%30u",&x)
> >> == 0))) ??
> >
> > No. You aren't understanding the code :-) It's comparing a string buffer
> > against various patterns, and the string can't match all the patterns at
> > the same time.
> >
> > This code is executed as each line of the SDP is processed, and each one
> > will match one of the branches of this tree, and it's values will be
> > extracted and stored for later use.
> >
> > In other words... this is not the cause of your problem.
>
> Quite true, but the space in "T38MaxBitRate: %d\n" might be a problem,
> as the number doesn't necessarily have a space in front of it.

That's a debug statement, not an sscanf, so it's superfluous to the problem.

-- 
Tilghman Lesher
Digium, Inc. | Senior Software Developer
twitter: Corydon76 | IRC: Corydon76-dig (Freenode)
Check us out at: www.digium.com & www.asterisk.org

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Little t38 bug?

2010-05-25 Thread Steve Underwood
On 05/25/2010 07:54 PM, Kevin P. Fleming wrote:
> On 05/25/2010 05:48 AM, Alexandru Oniciuc wrote:
>
>> Hello List,
>>
>>
>>
>>  I think I’ve discovered a little bug in t.38 bug in
>> 1.6.0.22 regarding the speed (T38MaxBitRate) used to send the faxes.
>>
>>
>>
>>  Asterisk always responds  with a=T38MaxBitRate:2400.
>> I’ve tried with Patton and Grandstream devices and the result is always
>> the same.
>>
>>  Patton ignores the parameter and sends the fax at 9600.
>>
>>  Grandstream doesn’t, and all the faxes are going in and
>> out at 2400.
>>
>>
>>
>>  Looking at the code I found this in chan_sip.c (line 7736):
>>
>>
>>
>> if ((sscanf(a, "T38FaxMaxBuffer:%30u",&x) == 1)) {
>>
>>  ast_debug(3, "MaxBufferSize:%d\n", x);
>>
>>  found = TRUE;
>>
>>  } else if ((sscanf(a, "T38MaxBitRate:%30u",&x) == 1) ||
>> (sscanf(a, "T38FaxMaxRate:%30u",&x) == 1)) {
>>
>>  ast_debug(3, "T38MaxBitRate: %d\n", x);
>>
>>  switch (x) {
>>
>>  case 14400:
>>
>>  p->t38.their_parms.rate = AST_T38_RATE_14400;
>>
>>  break;
>>
>>  case 12000:
>>
>>  p->t38.their_parms.rate = AST_T38_RATE_12000;
>>
>>  break;
>>
>>  case 9600:
>>
>>  p->t38.their_parms.rate = AST_T38_RATE_9600;
>>
>>  break;
>>
>>  case 7200:
>>
>>  p->t38.their_parms.rate = AST_T38_RATE_7200;
>>
>>  break;
>>
>>  case 4800:
>>
>>  p->t38.their_parms.rate = AST_T38_RATE_4800;
>>
>>  break;
>>
>>  case 2400:
>>
>>  p->t38.their_parms.rate = AST_T38_RATE_2400;
>>
>>  break;
>>
>>  }
>>
>>  found = TRUE;
>>
>> else if {…
>>
>>
>>
>>
>>
>>
>>
>> If I’m not misteaking the second “if else” condition will never be true
>> if the other device sends “T38FaxMaxBuffer” (wich they all usually do).
>>
>>
>>
>> Shouldn’t it be
>>
>>
>>
>> if((sscanf(a, "T38FaxMaxBuffer:%30u",&x) == 1)&&  ((sscanf(a,
>> "T38MaxBitRate:%30u",&x) == 0) || (sscanf(a, "T38FaxMaxRate:%30u",&x)
>> == 0))) ??
>>  
> No. You aren't understanding the code :-) It's comparing a string buffer
> against various patterns, and the string can't match all the patterns at
> the same time.
>
> This code is executed as each line of the SDP is processed, and each one
> will match one of the branches of this tree, and it's values will be
> extracted and stored for later use.
>
> In other words... this is not the cause of your problem.
>
Quite true, but the space in "T38MaxBitRate: %d\n" might be a problem, 
as the number doesn't necessarily have a space in front of it.

Steve


-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Little t38 bug?

2010-05-25 Thread Miguel Amez
Hi Kevin,

Thanks for your quick reply.
I have been trying to find a good configuration for T38modem + hylafax +
asterisk for almost 1 month, and the issue is allways the same: just syncs
at 2400 bpps.
Help on this issue would be apreciated.

Regards,
Miguel Amez

2010/5/25 Kevin P. Fleming 

> On 05/25/2010 05:48 AM, Alexandru Oniciuc wrote:
> > Hello List,
> >
> >
> >
> > I think I’ve discovered a little bug in t.38 bug in
> > 1.6.0.22 regarding the speed (T38MaxBitRate) used to send the faxes.
> >
> >
> >
> > Asterisk always responds  with a=T38MaxBitRate:2400.
> > I’ve tried with Patton and Grandstream devices and the result is always
> > the same.
> >
> > Patton ignores the parameter and sends the fax at 9600.
> >
> > Grandstream doesn’t, and all the faxes are going in and
> > out at 2400.
> >
> >
> >
> > Looking at the code I found this in chan_sip.c (line
> 7736):
> >
> >
> >
> > if ((sscanf(a, "T38FaxMaxBuffer:%30u", &x) == 1)) {
> >
> > ast_debug(3, "MaxBufferSize:%d\n", x);
> >
> > found = TRUE;
> >
> > } else if ((sscanf(a, "T38MaxBitRate:%30u", &x) == 1) ||
> > (sscanf(a, "T38FaxMaxRate:%30u", &x) == 1)) {
> >
> > ast_debug(3, "T38MaxBitRate: %d\n", x);
> >
> > switch (x) {
> >
> > case 14400:
> >
> > p->t38.their_parms.rate = AST_T38_RATE_14400;
> >
> > break;
> >
> > case 12000:
> >
> > p->t38.their_parms.rate = AST_T38_RATE_12000;
> >
> > break;
> >
> > case 9600:
> >
> > p->t38.their_parms.rate = AST_T38_RATE_9600;
> >
> > break;
> >
> > case 7200:
> >
> > p->t38.their_parms.rate = AST_T38_RATE_7200;
> >
> > break;
> >
> > case 4800:
> >
> > p->t38.their_parms.rate = AST_T38_RATE_4800;
> >
> > break;
> >
> > case 2400:
> >
> > p->t38.their_parms.rate = AST_T38_RATE_2400;
> >
> > break;
> >
> > }
> >
> > found = TRUE;
> >
> > else if {…
> >
> >
> >
> >
> >
> >
> >
> > If I’m not misteaking the second “if else” condition will never be true
> > if the other device sends “T38FaxMaxBuffer” (wich they all usually do).
> >
> >
> >
> > Shouldn’t it be
> >
> >
> >
> > if((sscanf(a, "T38FaxMaxBuffer:%30u", &x) == 1) && ((sscanf(a,
> > "T38MaxBitRate:%30u", &x) == 0) || (sscanf(a, "T38FaxMaxRate:%30u", &x)
> > == 0))) ??
>
> No. You aren't understanding the code :-) It's comparing a string buffer
> against various patterns, and the string can't match all the patterns at
> the same time.
>
> This code is executed as each line of the SDP is processed, and each one
> will match one of the branches of this tree, and it's values will be
> extracted and stored for later use.
>
> In other words... this is not the cause of your problem.
>
> --
> Kevin P. Fleming
> Digium, Inc. | Director of Software Technologies
> 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
> skype: kpfleming | jabber: kflem...@digium.com
> Check us out at www.digium.com & www.asterisk.org
>
> --
> _
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>   http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Little t38 bug?

2010-05-25 Thread Kevin P. Fleming
On 05/25/2010 05:48 AM, Alexandru Oniciuc wrote:
> Hello List,
> 
>  
> 
> I think I’ve discovered a little bug in t.38 bug in
> 1.6.0.22 regarding the speed (T38MaxBitRate) used to send the faxes.
> 
>  
> 
> Asterisk always responds  with a=T38MaxBitRate:2400.
> I’ve tried with Patton and Grandstream devices and the result is always
> the same.
> 
> Patton ignores the parameter and sends the fax at 9600.
> 
> Grandstream doesn’t, and all the faxes are going in and
> out at 2400.
> 
>  
> 
> Looking at the code I found this in chan_sip.c (line 7736):
> 
>  
> 
> if ((sscanf(a, "T38FaxMaxBuffer:%30u", &x) == 1)) {
> 
> ast_debug(3, "MaxBufferSize:%d\n", x);
> 
> found = TRUE;
> 
> } else if ((sscanf(a, "T38MaxBitRate:%30u", &x) == 1) ||
> (sscanf(a, "T38FaxMaxRate:%30u", &x) == 1)) {
> 
> ast_debug(3, "T38MaxBitRate: %d\n", x);
> 
> switch (x) {
> 
> case 14400:
> 
> p->t38.their_parms.rate = AST_T38_RATE_14400;
> 
> break;
> 
> case 12000:
> 
> p->t38.their_parms.rate = AST_T38_RATE_12000;
> 
> break;
> 
> case 9600:
> 
> p->t38.their_parms.rate = AST_T38_RATE_9600;
> 
> break;
> 
> case 7200:
> 
> p->t38.their_parms.rate = AST_T38_RATE_7200;
> 
> break;
> 
> case 4800:
> 
> p->t38.their_parms.rate = AST_T38_RATE_4800;
> 
> break;
> 
> case 2400:
> 
> p->t38.their_parms.rate = AST_T38_RATE_2400;
> 
> break;
> 
> }
> 
> found = TRUE;
> 
> else if {…
> 
>  
> 
>  
> 
>  
> 
> If I’m not misteaking the second “if else” condition will never be true
> if the other device sends “T38FaxMaxBuffer” (wich they all usually do).
> 
>  
> 
> Shouldn’t it be
> 
>  
> 
> if((sscanf(a, "T38FaxMaxBuffer:%30u", &x) == 1) && ((sscanf(a,
> "T38MaxBitRate:%30u", &x) == 0) || (sscanf(a, "T38FaxMaxRate:%30u", &x)
> == 0))) ??

No. You aren't understanding the code :-) It's comparing a string buffer
against various patterns, and the string can't match all the patterns at
the same time.

This code is executed as each line of the SDP is processed, and each one
will match one of the branches of this tree, and it's values will be
extracted and stored for later use.

In other words... this is not the cause of your problem.

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kflem...@digium.com
Check us out at www.digium.com & www.asterisk.org

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Little t38 bug?

2010-05-25 Thread Miguel Amez
You are completely right!
You are my hero!
I'm experiencing the same error with hylafax + t38modem implementation, and
t38modem ALLWAYS sends out at 2400!!!
I have 1.6.0.22 too, so this is definetly what's happening!

1 month looking for the error and now Alexandru has it...whoa!

regards,

Miguel Amez

2010/5/25 Alexandru Oniciuc 

>  Hello List,
>
>
>
> I think I’ve discovered a little bug in t.38 bug in
> 1.6.0.22 regarding the speed (T38MaxBitRate) used to send the faxes.
>
>
>
> Asterisk always responds  with a=T38MaxBitRate:2400. I’ve
> tried with Patton and Grandstream devices and the result is always the same.
>
> Patton ignores the parameter and sends the fax at 9600.
>
> Grandstream doesn’t, and all the faxes are going in and out
> at 2400.
>
>
>
> Looking at the code I found this in chan_sip.c (line 7736):
>
>
>
> if ((sscanf(a, "T38FaxMaxBuffer:%30u", &x) == 1)) {
>
> ast_debug(3, "MaxBufferSize:%d\n", x);
>
> found = TRUE;
>
> } else if ((sscanf(a, "T38MaxBitRate:%30u", &x) == 1) || (sscanf(a,
> "T38FaxMaxRate:%30u", &x) == 1)) {
>
> ast_debug(3, "T38MaxBitRate: %d\n", x);
>
> switch (x) {
>
> case 14400:
>
> p->t38.their_parms.rate = AST_T38_RATE_14400;
>
> break;
>
> case 12000:
>
> p->t38.their_parms.rate = AST_T38_RATE_12000;
>
> break;
>
> case 9600:
>
> p->t38.their_parms.rate = AST_T38_RATE_9600;
>
> break;
>
> case 7200:
>
> p->t38.their_parms.rate = AST_T38_RATE_7200;
>
> break;
>
> case 4800:
>
> p->t38.their_parms.rate = AST_T38_RATE_4800;
>
> break;
>
> case 2400:
>
> p->t38.their_parms.rate = AST_T38_RATE_2400;
>
> break;
>
> }
>
> found = TRUE;
>
> else if {…
>
>
>
>
>
>
>
> If I’m not misteaking the second “if else” condition will never be true if
> the other device sends “T38FaxMaxBuffer” (wich they all usually do).
>
>
>
> Shouldn’t it be
>
>
>
> if((sscanf(a, "T38FaxMaxBuffer:%30u", &x) == 1) && ((sscanf(a,
> "T38MaxBitRate:%30u", &x) == 0) || (sscanf(a, "T38FaxMaxRate:%30u", &x) ==
> 0))) ??
>
>
>
> Thanks,
>
> Alex
>
> --
> _
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>   http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

[asterisk-users] Little t38 bug?

2010-05-25 Thread Alexandru Oniciuc
Hello List,

I think I've discovered a little bug in t.38 bug in 1.6.0.22 
regarding the speed (T38MaxBitRate) used to send the faxes.

Asterisk always responds  with a=T38MaxBitRate:2400. I've tried 
with Patton and Grandstream devices and the result is always the same.
Patton ignores the parameter and sends the fax at 9600.
Grandstream doesn't, and all the faxes are going in and out at 
2400.

Looking at the code I found this in chan_sip.c (line 7736):

if ((sscanf(a, "T38FaxMaxBuffer:%30u", &x) == 1)) {
ast_debug(3, "MaxBufferSize:%d\n", x);
found = TRUE;
} else if ((sscanf(a, "T38MaxBitRate:%30u", &x) == 1) || (sscanf(a, 
"T38FaxMaxRate:%30u", &x) == 1)) {
ast_debug(3, "T38MaxBitRate: %d\n", x);
switch (x) {
case 14400:
p->t38.their_parms.rate = AST_T38_RATE_14400;
break;
case 12000:
p->t38.their_parms.rate = AST_T38_RATE_12000;
break;
case 9600:
p->t38.their_parms.rate = AST_T38_RATE_9600;
break;
case 7200:
p->t38.their_parms.rate = AST_T38_RATE_7200;
break;
case 4800:
p->t38.their_parms.rate = AST_T38_RATE_4800;
break;
case 2400:
p->t38.their_parms.rate = AST_T38_RATE_2400;
break;
}
found = TRUE;
else if {...



If I'm not misteaking the second "if else" condition will never be true if the 
other device sends "T38FaxMaxBuffer" (wich they all usually do).

Shouldn't it be

if((sscanf(a, "T38FaxMaxBuffer:%30u", &x) == 1) && ((sscanf(a, 
"T38MaxBitRate:%30u", &x) == 0) || (sscanf(a, "T38FaxMaxRate:%30u", &x) == 0))) 
??

Thanks,
Alex
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users