[Home]

Summary:ASTERISK-07531: Codec Selection Issues Causes Garbled Audio
Reporter:damin (damin)Labels:
Date Opened:2006-08-14 14:41:30Date Closed:2011-06-07 14:07:56
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:I have a pair of Asterisk 1.2 boxes talking to each other. A Ulaw call inbound from a Linksys PAP2NA using Ulaw is accepted on Asterisk Server 1, which sends the call to Asterisk Server 2 for PSTN completion via a TE407P.

The two servers are setup w/ identical peering definitions w/ explicit dis/allow rules as such:

jitterbuffer=no
forcejitterbuffer=no
trunktimestamps=yes
disallow=all
allow=ulaw
allow=g726
allow=g729
allow=gsm

A "show channels" on Server 1 indicates that the call is Ulaw format.
A "show channels" on Server 2 indicates that the call is Slin format.

The resulting audio is garbled.

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

Here is an IAX2 Debug / CLI Capture on Server 2.

Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: NEW    
  Timestamp: 00017ms  SCall: 00030  DCall: 00000 [207.166.192.188:4569]
  VERSION         : 2
  CALLED NUMBER   : 17177676602
  CODEC_PREFS     : (ulaw|g726|g729|gsm)
  CALLING NUMBER  : 2169203110
  CALLING PRESNTN : 0
  CALLING TYPEOFN : 0
  CALLING TRANSIT : 0
  CALLING NAME    : Bonzi Pipeline
  LANGUAGE        : en
  USERNAME        : pbx1
  FORMAT          : 4
  CAPABILITY      : 63766
  ADSICPE         : 0
  DATE TIME       : 2006-08-14  15:20:30

   -- Accepting AUTHENTICATED call from 207.166.192.188:
      > requested format = ulaw,
      > requested prefs = (ulaw|g726|g729|gsm),
      > actual format = ulaw,
      > host prefs = (ulaw|g726|g729|gsm),
      > priority = mine

All looks good to me. Seems that we should choose Ulaw at this point.

Tx-Frame Retry[000] -- OSeqno: 001 ISeqno: 002 Type: IAX     Subclass: ACCEPT
  Timestamp: 00018ms  SCall: 00008  DCall: 00030 [207.166.192.188:4569]
  FORMAT          : 4

   -- Executing Goto("IAX2/pbx1-8", "outbound|7177676602|1") in new stack
   -- Goto (outbound,7177676602,1)
   -- Executing Macro("IAX2/pbx1-8", "dial|Zap/g3/7177676602") in new stack
   -- Executing NoOp("IAX2/pbx1-8", "") in new stack
   -- Executing Dial("IAX2/pbx1-8", "Zap/g3/7177676602|60") in new stack
   -- Requested transfer capability: 0x00 - SPEECH

Call is sent out via Dialplan to the PRI and answered.

Rx-Frame Retry[ No] -- OSeqno: 002 ISeqno: 002 Type: IAX     Subclass: ACK    
  Timestamp: 00018ms  SCall: 00030  DCall: 00008 [207.166.192.188:4569]
   -- Called g3/7177676602
Rx-Frame Retry[ No] -- OSeqno: 002 ISeqno: 003 Type: IAX     Subclass: ACK    
  Timestamp: 00060ms  SCall: 00030  DCall: 00008 [207.166.192.188:4569]
Rx-Frame Retry[ No] -- OSeqno: 002 ISeqno: 003 Type: VOICE   Subclass: 4
  Timestamp: 00110ms  SCall: 00030  DCall: 00008 [207.166.192.188:4569]
Tx-Frame Retry[-01] -- OSeqno: 003 ISeqno: 003 Type: IAX     Subclass: ACK

Comments:By: damin (damin) 2006-08-14 14:51:29

Per Kevin's suggesion on IRC, I am including the relevant portion of the Dial macro to show the dialplan logic in use:

[macro-dial]
exten => s,1,NoOp
exten => s,2,Dial(${ARG1},60)
exten => s,3,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Hangup
exten => s-BUSY,1,Busy(45)
exten => s-BUSY,2,Hangup
exten => s-CONGESTION,1,NoOp
exten => s-CHANUNAVAIL,1,NoOp
exten => s-.,1,Goto(s-NOANSWER,1)

By: damin (damin) 2006-08-23 09:57:45

File asked me to get a show channels on both sides of a call while it was going on, so he could see the channel structure. Per his reccomendation I have the following capture:

Server 1 (Inbound SIP, Outbound IAX to Server 2)
asterisk*CLI> show channel IAX2/tdm-1-25
-- General --
          Name: IAX2/tdm-1-25
          Type: IAX2
      UniqueID: 1156344809.15756
     Caller ID: 7177676602
Caller ID Name: (N/A)
   DNID Digits: (N/A)
         State: Ringing (5)
         Rings: 0
  NativeFormat: 4
   WriteFormat: 4
    ReadFormat: 4
1st File Descriptor: -1
     Frames in: 177
    Frames out: 114
Time to Hangup: 0
  Elapsed Time: N/A
 Direct Bridge: <none>
Indirect Bridge: <none>
--   PBX   --
       Context: default
     Extension: s
      Priority: 1
    Call Group: 0
  Pickup Group: 0
   Application: AppDial
          Data: (Outgoing Line)
   Blocking in: ast_waitfor_nandfds
     Variables:
DIALEDPEERNUMBER=pbx1@tdm-1/17177676602

   -- IAX2/tdm-1-25 stopped sounds
   -- Local/7177676602@default-16ea,1 stopped sounds
   -- IAX2/tdm-1-25 answered Local/7177676602@default-16ea,2
   -- Local/7177676602@default-16ea,1 answered SIP/3110-09703824
 == Spawn extension (default, 7177676602, 2) exited non-zero on 'Local/7177676602@default-16ea,2'
asterisk*CLI>


Server 2 (Inbound IAX2)
tdm-1*CLI> show channel IAX2/pbx1-23
-- General --
          Name: IAX2/pbx1-23
          Type: IAX2
      UniqueID: 1156344732.6606
     Caller ID: 2169203110
Caller ID Name: Bonzi Pipeline
   DNID Digits: (N/A)
         State: Up (6)
         Rings: 0
  NativeFormat: 4
   WriteFormat: 4
    ReadFormat: 4
1st File Descriptor: -1
     Frames in: 1150
    Frames out: 1736
Time to Hangup: 0
  Elapsed Time: 0h0m34s
 Direct Bridge: Zap/74-1
Indirect Bridge: Zap/74-1
--   PBX   --
       Context: macro-dial
     Extension: s
      Priority: 2
    Call Group: 0
  Pickup Group: 0
   Application: Dial
          Data: Zap/g3/7177676602|60
   Blocking in: ast_waitfor_nandfds
     Variables:
BRIDGEPEER=Zap/74-1
DIALEDPEERNUMBER=g3/7177676602
DIALEDPEERNAME=Zap/74-1
MACRO_DEPTH=1
ARG1=Zap/g3/7177676602
MACRO_PRIORITY=1
MACRO_CONTEXT=outbound
MACRO_EXTEN=7177676602

 CDR Variables:
level 1: clid="Bonzi Pipeline" <2169203110>
level 1: src=2169203110
level 1: dst=7177676602
level 1: dcontext=outbound
level 1: channel=IAX2/pbx1-23
level 1: dstchannel=Zap/74-1
level 1: lastapp=Dial
level 1: lastdata=Zap/g3/7177676602|60
level 1: start=2006-08-23 10:52:12
level 1: answer=2006-08-23 10:52:15
level 1: end=2006-08-23 10:52:15
level 1: duration=0
level 1: billsec=0
level 1: disposition=ANSWERED
level 1: amaflags=DOCUMENTATION
level 1: uniqueid=1156344732.6606

By: damin (damin) 2006-08-23 10:03:00

And now for the redo..

Server 1
asterisk*CLI> iax2 show channels
Channel               Peer             Username    ID (Lo/Rem)  Seq (Tx/Rx)  Lag      Jitter  JitBuf  Format
IAX2/tdm-1-4          207.166.192.174  tdm-1       00004/00007  00008/00005  00000ms  -0001ms  0000ms  ulaw  
IAX2/tdm-1-5          207.166.192.174  pbx1        00005/00026  00011/00014  00040ms  -0001ms  0000ms  ulaw  
IAX2/tdm-1-8          207.166.192.174  pbx1        00008/00014  00055/00056  00040ms  -0001ms  0000ms  ulaw  
(None)                207.166.200.210  (None)      00019/00000  00002/00000  00000ms  -0001ms  0000ms  unknow
IAX2/tdm-1-23         207.166.192.174  tdm-1       00023/00021  00020/00018  00040ms  -0001ms  0000ms  ulaw  
IAX2/tdm-1-32         207.166.192.174  pbx1        00032/00004  00021/00018  00040ms  -0001ms  0000ms  ulaw  
IAX2/recordsdepo-33   192.168.111.254  recordsdep  00033/00006  00018/00012  00000ms  -0001ms  0000ms  ulaw  
IAX2/tdm-1-35         207.166.192.174  tdm-1       00035/00040  00005/00005  00000ms  -0001ms  0000ms  ulaw  
IAX2/tdm-1-37         207.166.192.174  pbx1        00037/00041  00004/00008  00000ms  -0001ms  0000ms  ulaw  
(None)                207.166.192.187  (None)      00040/00000  00001/00000  00000ms  -0001ms  0000ms  unknow
IAX2/recordsdepo-42   192.168.111.254  recordsdep  00042/00004  00007/00003  00000ms  -0001ms  0000ms  ulaw  
IAX2/tdm-1-47         207.166.192.174  pbx1        00047/00001  00012/00017  00040ms  -0001ms  0000ms  ulaw  
IAX2/tdm-1-52         207.166.192.174  pbx1        00052/00029  00004/00006  00000ms  -0001ms  0000ms  ulaw  
13 active IAX channels
   -- SIP/4402555900-0977179c answered IAX2/tdm-1-35
asterisk*CLI>

Server 2
tdm-1*CLI> iax2 show channels
Channel               Peer             Username    ID (Lo/Rem)  Seq (Tx/Rx)  Lag      Jitter  JitBuf  Format
IAX2/pbx1-1           207.166.192.188  pbx1        00001/00047  00023/00018  00040ms  -0001ms  0000ms  ulaw  
IAX2/pbx1-4           207.166.192.188  pbx1        00004/00032  00025/00028  00040ms  -0001ms  0000ms  ulaw  
IAX2/pbx1-7           207.166.192.188  tdm-1       00007/00004  00011/00014  00040ms  -0001ms  0000ms  ulaw  
IAX2/gw2-9            207.166.192.186  tdm-1       00009/00010  00182/00183  00040ms  -0001ms  0000ms  ulaw  
IAX2/pbx1-14          207.166.192.188  pbx1        00014/00008  00062/00061  00040ms  -0001ms  0000ms  ulaw  
IAX2/gw2-16           207.166.192.186  tdm-1       00016/00004  00075/00075  00040ms  -0001ms  0000ms  ulaw  
IAX2/gw2-17           207.166.192.186  tdm-1       00017/00003  00018/00018  00040ms  -0001ms  0000ms  ulaw  
IAX2/pbx1-21          207.166.192.188  tdm-1       00021/00023  00025/00027  00040ms  -0001ms  0000ms  ulaw  
IAX2/gw2-22           207.166.192.186  tdm-1       00022/00012  00012/00011  00040ms  -0001ms  0000ms  ulaw  
IAX2/pbx1-26          207.166.192.188  pbx1        00026/00005  00020/00017  00040ms  -0001ms  0000ms  ulaw  
IAX2/pbx1-29          207.166.192.188  pbx1        00029/00052  00013/00010  00040ms  -0001ms  0000ms  ulaw  
IAX2/gw2-30           207.166.192.186  gw2         00030/00002  00032/00028  00040ms  -0001ms  0000ms  ulaw  
IAX2/pbx1-40          207.166.192.188  tdm-1       00040/00035  00009/00012  00040ms  -0001ms  0000ms  ulaw  
IAX2/pbx1-41          207.166.192.188  pbx1        00041/00037  00014/00010  00040ms  -0001ms  0000ms  slin  
14 active IAX channels

By: Joshua C. Colp (jcolp) 2006-08-23 13:38:28

if chan_local is involved here too, then it would be nice to have the show channel output for that as well, and also try adding /n to the end of it.

By: damin (damin) 2006-09-07 13:34:47

Sorry this took so long to get a status update on. I was on vacation.. finally..

So.. this solved our problem:

763c769
< exten => _1NXXNXXXXXX,1,Dial(LOCAL/${EXTEN:1}@default)
---
> exten => _1NXXNXXXXXX,1,Goto(default,${EXTEN:1},1)

So I can definitely say that the problem seems to be related to the use of the Local channel. Unfortunately, I do not have the opportunity to debug this much further, but if you would like to Lab it up, the config is the following:

SIP Phone -> Asterisk -> IAX2 -> Asterisk -> Zap - PSTN

If you need more information about our Dial Plan, please feel free to ask.



By: Joshua C. Colp (jcolp) 2006-09-07 20:41:00

This issue is the long running chan_local signed linear issue. Closing since we already have a bug open on it.