[asterisk-bugs] [Asterisk 0008391]: IAX2 trunking not enabled in one direction for 'user' rather than 'friend'

noreply at bugs.digium.com noreply at bugs.digium.com
Mon Aug 6 10:52:04 CDT 2007


The following issue has been RESOLVED. 
====================================================================== 
http://bugs.digium.com/view.php?id=8391 
====================================================================== 
Reported By:                candlerb
Assigned To:                file
====================================================================== 
Project:                    Asterisk
Issue ID:                   8391
Category:                   Channels/chan_iax2
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     resolved
Asterisk Version:            SVN 
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 47654 
Disclaimer on File?:        No 
Request Review:              
Resolution:                 no change required
Fixed in Version:           
====================================================================== 
Date Submitted:             11-21-2006 03:47 CST
Last Modified:              08-06-2007 10:52 CDT
====================================================================== 
Summary:                    IAX2 trunking not enabled in one direction for
'user' rather than 'friend'
Description: 
Consider the following setup for combining SIP calls into an IAX2 trunk and
then breaking them back out again as SIP.

SIP ATA ----->               IAX2                 ------> SIP provider
SIP ATA -----> Asterisk1 =============> Asterisk2 ------> SIP provider
SIP ATA ----->                                    ------> SIP provider

192.168.   192.168.  10.69.         10.69.
1.x        1.1       255.245        255.251

The configuration (defined below) only needs to permit outbound calls. So
the SIP ATAs do not register with Asterisk1, Asterisk1 does not register
with Asterisk2, and Asterisk2 does not register with the SIP provider.

In this scenario, audio is trunked in one direction only. Running tcpdump
on the IAX2 link when two G729 calls are in progress shows:

15:53:33.364129 IP 10.69.255.245.4569 > 10.69.255.251.4569: UDP, length
60
15:53:33.368300 IP 10.69.255.251.4569 > 10.69.255.245.4569: UDP, length
24
15:53:33.372985 IP 10.69.255.251.4569 > 10.69.255.245.4569: UDP, length
24
15:53:33.384124 IP 10.69.255.245.4569 > 10.69.255.251.4569: UDP, length
60
15:53:33.388250 IP 10.69.255.251.4569 > 10.69.255.245.4569: UDP, length
24
15:53:33.392928 IP 10.69.255.251.4569 > 10.69.255.245.4569: UDP, length
24
15:53:33.404125 IP 10.69.255.245.4569 > 10.69.255.251.4569: UDP, length
60
15:53:33.408715 IP 10.69.255.251.4569 > 10.69.255.245.4569: UDP, length
24
15:53:33.412851 IP 10.69.255.251.4569 > 10.69.255.245.4569: UDP, length
24

However, if I modify the setup so that Asterisk1 registers with Asterisk2,
then it works, and audio is trunked both ways (all packets UDP payload
length 60). So I believe there is some wrong logic when checking for the
IAX_TRUNK flag.

How to replicate
================

My test rig is as follows.

Asterisk1 is 1.2.13. My device is actually rather esoteric: it's an Asus
WL500g Deluxe running OpenWrt WhiteRussian RC6 (kernel 2.4.30), Asterisk
binaries from http://zandbelt.dyndns.org/asterisk.html and using ztdummy +
usb-uhci as the timing source. However, this side works. As you can see
from the tcpdump it's combining the RTP streams into a single trunked
packet. You should be able to substitute any Asterisk server with a zaptel
timing source.

Asterisk2 is SVN trunk r47654, running under CentOS 4.4. The machine has a
real Digium TDM400P as its timing source. I know this works because
trunking can be made to work under some circumstances, as described later.

Configuration files - Asterisk1
===============================

-------------------- sip.conf ------------------
; This is purposely an "insecure" configuration which allows any SIP user
; to place outbound calls through us without authentication!
[general]
context=outbound
allowexternaldomains=yes
bindport=5060
bindaddr=192.168.1.1
disallow=all
allow=g729
allow=gsm

-------------------- iax.conf ------------------
[general]
bandwidth=low
allow=g729
allow=gsm
tos=lowdelay
autokill=yes
jitterbuffer=no
forcejitterbuffer=no
trunktimestamps=yes

[upstream]
type=peer
username=venue
secret=PPPPPPPP
auth=md5
host=10.69.255.251
qualify=yes
trunk=yes

-------------------- extensions.conf -----------
[general]
autofallthrough=no

[outbound]
exten => _X.,1,Dial(iax2/upstream/${EXTEN},45)

Configuration files - Asterisk2
===============================

-------------------- sip.conf ------------------
[general]
context=default
canreinvite=no
srvlookup=yes
disallow=all
allow=g729
allow=gsm

[authentication]

[sipgate-out]
type=peer
host=sipgate.co.uk
username=NNNNNNN
secret=XXXXXXXX
fromuser=NNNNNNN
fromdomain=sipgate.co.uk
insecure=invite

-------------------- iax.conf ------------------
[general]
bandwidth=low
disallow=lpc10
allow=g729
allow=gsm
tos=ef
autokill=yes
jitterbuffer=no
forcejitterbuffer=no
trunktimestamps=yes
trunk=yes

[venue]
type=user
secret=PPPPPPPP
auth=md5
context=outbound
qualify=yes
trunk=yes

-------------------- extensions.conf -----------
[general]
autofallthrough=no

[outbound]
exten => _X.,1,Dial(SIP/${EXTEN}@sipgate-out,45)

Replicating the problem
=======================

You need two or more SIP devices to place an outbound call via Asterisk1.
The only configuration needed is to set the SIP proxy to Asterisk1's IP;
you don't even need to set a username and password.

When this happens, and you run tcpdump on the IAX2 link, you see that
packets from Asterisk1->Asterisk2 are trunked, but packets from
Asterisk2->Asterisk1 are not trunked.

Workaround
==========

The problem goes away if you modify the configuration so that Asterisk1
registers with Asterisk2.

PATCH TO ASTERISK1:

--- iax.conf.orig       2006-11-21 09:31:52.000000000 +0000
+++ iax.conf    2006-11-21 09:31:52.000000000 +0000
@@ -1,4 +1,5 @@
 [general]
+register=>venue:PPPPPPPP at 10.69.255.251
 bandwidth=low
 allow=g729
 allow=gsm

PATCH TO ASTERISK2:

--- iax.conf.orig       2006-11-21 09:29:25.000000000 +0000
+++ iax.conf    2006-11-21 09:29:13.000000000 +0000
@@ -11,7 +11,9 @@
 trunk=yes

 [venue]
-type=user
+;type=user
+type=friend
+host=dynamic
 secret=xyzzy
 auth=md5
 context=outbound

tcpdump now shows 50pps and UDP payload size 60 bytes in both directions.

However, I don't think this should be required. If I understand correctly,
registration is a function of locating a device for placing inbound calls,
and should not affect the processing of outbound calls.

[In my particular scenario, I want to have multiple 'Asterisk1' machines
in a hub-and-spoke arrangement, and to keep things simple I want them all
to use the same IAX2 'user' entry on Asterisk2. If they all have to
register then they will need separate entries.]

====================================================================== 

---------------------------------------------------------------------- 
 file - 08-06-07 10:52  
---------------------------------------------------------------------- 
This is actually a configuration issue. You must have both a peer and a
user when doing trunking, you can't just have a user. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
08-06-07 10:52  file           Status                   new => resolved     
08-06-07 10:52  file           Resolution               open => no change
required
08-06-07 10:52  file           Assigned To               => file            
08-06-07 10:52  file           Note Added: 0068492                          
======================================================================




More information about the asterisk-bugs mailing list