[Home]

Summary:ASTERISK-14366: [patch] Milliwatt() is off by -11dbm
Reporter:dan williams (rue_mohr)Labels:
Date Opened:2009-06-23 20:15:59Date Closed:2009-08-02 20:19:47
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Applications/app_milliwatt
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) issue_15386.rev2.diff
Description:Confirmed on asterisk 1.4.25.1 and 1.6.1.1 that the milliwatt is about -11dbm

Standard PC system, T100P T1 card, to Newbridge Mainstreet 3624
using dahdi-linux-complete-2.1.0.4+2.1.0.2
Debian kernel linux-2.6.28
measured with dbm meter from channelbank

its -11dbm at 1.000kHz, and at 1.004kHz

This can be confirmed because it worked perfectly on same hardware before software upgrade ( kernel-2.6.15  asterisk-1.2.15  zaptel-1.2.13).

suspect slinear<->ulaw conversion process, can't confirm.


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

documented in more detail as
http://eds.dyndns.org/~ircjunk/asterisk/missing_11db.html
happy to provide more information on request.
Comments:By: dan williams (rue_mohr) 2009-06-23 20:54:56

As per russell, the following was discovered:

; -00.42dbm (close enough!)
exten => 406,1,Answer()
exten => 406,n,milliwatt(o)

; -11dbm
exten => 407,1,Answer()
exten => 407,n,PlayTones(1000/1000)
exten => 407,n,Wait(3600);

; -11dbm
exten => 408,1,Answer();
exten => 408,n,milliwatt()

By: dan williams (rue_mohr) 2009-06-23 21:15:59

issue_15386.rev1.diff results:

-3.7dbm  application required a wait() after it, and there is a slight bit of noise in the background (repeated buffer not quite aligned right?)

By: dan williams (rue_mohr) 2009-06-23 21:37:21

Trail and error on the amplitude, the magic number is extremely close to 23255 (less we have gained the other issues I mentioned)

By: Russell Bryant (russell) 2009-06-24 13:11:47

To clarify the intent of the patch, I realized after looking at this issue that the change in behavior of the Milliwatt() application was likely the cause of this issue.  By default, the tone generation code in Asterisk (what Playtones() uses internally), puts a -8dB gain on the generated signal (according to a comment in the code, anyway).  This is where the loss was coming from that was observed in this bug.

So, I hacked up a quick patch to switch to using the ast_playtones_start() API call directly, so that we could control the volume.

By: dan williams (rue_mohr) 2009-06-24 19:49:32

so was milliwatt or playtones in the wrong? I had tried changing
.dtmf_high_level = -10,
.dtmf_low_level = -10,
.mfr1_level = -10,
.mfr2_level = -8,

in zonedata.c all to 0, and didn't see any change in the level. Wrong one? another -8db?

By: Russell Bryant (russell) 2009-07-02 14:20:00

Playtones() was what was wrong.  The default volume setting was -8db.  The values you mention in the last update shouldn't have any affect on playtones in this case.

By: Russell Bryant (russell) 2009-07-02 14:39:27

I have uploaded a new patch.  Give this one a try.

By: dan williams (rue_mohr) 2009-07-06 01:50:31

ouch, rev2 patch puts output at about 1.2db (positive)
I don't know the notes are in order, but I can tell you by trial and error (as of yet I cant work out what the code is doing with the signal) the number your looking for is in the order of 23255.

By: Digium Subversion (svnbot) 2009-08-01 05:59:18

Repository: asterisk
Revision: 209838

U   branches/1.4/apps/app_milliwatt.c

------------------------------------------------------------------------
r209838 | russell | 2009-08-01 05:59:18 -0500 (Sat, 01 Aug 2009) | 13 lines

Modify how Playtones() is used in Milliwatt() to resolve gain issue.

When Milliwatt() was changed internally to use Playtones() so that the proper
tone was used, it introduced a drop in gain in the output signal.  So, use
the playtones API directly and specify a volume argument such that the output
matches the gain of the original Milliwatt() code.

(closes issue ASTERISK-14366)
Reported by: rue_mohr
Patches:
     issue_15386.rev2.diff uploaded by russell (license 2)
Tested by: rue_mohr

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=209838

By: Digium Subversion (svnbot) 2009-08-01 06:02:20

Repository: asterisk
Revision: 209839

_U  trunk/
U   trunk/apps/app_milliwatt.c

------------------------------------------------------------------------
r209839 | russell | 2009-08-01 06:02:20 -0500 (Sat, 01 Aug 2009) | 20 lines

Merged revisions 209838 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
 r209838 | russell | 2009-08-01 05:59:05 -0500 (Sat, 01 Aug 2009) | 13 lines
 
 Modify how Playtones() is used in Milliwatt() to resolve gain issue.
 
 When Milliwatt() was changed internally to use Playtones() so that the proper
 tone was used, it introduced a drop in gain in the output signal.  So, use
 the playtones API directly and specify a volume argument such that the output
 matches the gain of the original Milliwatt() code.
 
 (closes issue ASTERISK-14366)
 Reported by: rue_mohr
 Patches:
       issue_15386.rev2.diff uploaded by russell (license 2)
 Tested by: rue_mohr
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=209839

By: Digium Subversion (svnbot) 2009-08-01 06:03:30

Repository: asterisk
Revision: 209840

_U  branches/1.6.0/
U   branches/1.6.0/apps/app_milliwatt.c

------------------------------------------------------------------------
r209840 | russell | 2009-08-01 06:03:30 -0500 (Sat, 01 Aug 2009) | 27 lines

Merged revisions 209839 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r209839 | russell | 2009-08-01 06:02:07 -0500 (Sat, 01 Aug 2009) | 20 lines
 
 Merged revisions 209838 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r209838 | russell | 2009-08-01 05:59:05 -0500 (Sat, 01 Aug 2009) | 13 lines
   
   Modify how Playtones() is used in Milliwatt() to resolve gain issue.
   
   When Milliwatt() was changed internally to use Playtones() so that the proper
   tone was used, it introduced a drop in gain in the output signal.  So, use
   the playtones API directly and specify a volume argument such that the output
   matches the gain of the original Milliwatt() code.
   
   (closes issue ASTERISK-14366)
   Reported by: rue_mohr
   Patches:
         issue_15386.rev2.diff uploaded by russell (license 2)
   Tested by: rue_mohr
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=209840

By: Digium Subversion (svnbot) 2009-08-01 06:04:05

Repository: asterisk
Revision: 209841

_U  branches/1.6.1/
U   branches/1.6.1/apps/app_milliwatt.c

------------------------------------------------------------------------
r209841 | russell | 2009-08-01 06:04:05 -0500 (Sat, 01 Aug 2009) | 27 lines

Merged revisions 209839 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r209839 | russell | 2009-08-01 06:02:07 -0500 (Sat, 01 Aug 2009) | 20 lines
 
 Merged revisions 209838 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r209838 | russell | 2009-08-01 05:59:05 -0500 (Sat, 01 Aug 2009) | 13 lines
   
   Modify how Playtones() is used in Milliwatt() to resolve gain issue.
   
   When Milliwatt() was changed internally to use Playtones() so that the proper
   tone was used, it introduced a drop in gain in the output signal.  So, use
   the playtones API directly and specify a volume argument such that the output
   matches the gain of the original Milliwatt() code.
   
   (closes issue ASTERISK-14366)
   Reported by: rue_mohr
   Patches:
         issue_15386.rev2.diff uploaded by russell (license 2)
   Tested by: rue_mohr
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=209841

By: Digium Subversion (svnbot) 2009-08-01 06:04:48

Repository: asterisk
Revision: 209842

_U  branches/1.6.2/
U   branches/1.6.2/apps/app_milliwatt.c

------------------------------------------------------------------------
r209842 | russell | 2009-08-01 06:04:47 -0500 (Sat, 01 Aug 2009) | 27 lines

Merged revisions 209839 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r209839 | russell | 2009-08-01 06:02:07 -0500 (Sat, 01 Aug 2009) | 20 lines
 
 Merged revisions 209838 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r209838 | russell | 2009-08-01 05:59:05 -0500 (Sat, 01 Aug 2009) | 13 lines
   
   Modify how Playtones() is used in Milliwatt() to resolve gain issue.
   
   When Milliwatt() was changed internally to use Playtones() so that the proper
   tone was used, it introduced a drop in gain in the output signal.  So, use
   the playtones API directly and specify a volume argument such that the output
   matches the gain of the original Milliwatt() code.
   
   (closes issue ASTERISK-14366)
   Reported by: rue_mohr
   Patches:
         issue_15386.rev2.diff uploaded by russell (license 2)
   Tested by: rue_mohr
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=209842

By: Jared Smith (jsmith) 2009-08-02 16:51:35

Re-opening and re-assigning back to Russell at original poster's request (on IRC), as the patch apparently wasn't 100% correct.  

<rue_mohr> russellb, you know the r2 patch of my issue did NOT resolve the problem?
<rue_mohr> kinda worred, cause it looks like it got smunched into a realease
<rue_mohr> which isn't good, it outputs 1.2dbm, not 0

By: Russell Bryant (russell) 2009-08-02 20:19:47

The issue wasn't actually reopened, but I'm not sure that it needs to.

Even though the commit message said the rev2 patch got committed, it wasn't exactly that.  I modified the volume arg down to what was suggested by the reporter from testing.