Directmedia=yes NOT working!

Hi,

[Asterisk version 1.8]
I want to transfer directmedia between two clients each connected to one server.

server1(10.0.17.57/24) <-----> client1(10.0.16.18/24)
|
|
server2(10.0.17.52/24) <-----> client2(10.0.16.16/24)

Although in different subnets, client1 and client2 can ping each other directly. However, rtp packets are NOT flowing directly between them.
I have used the following configuration:

---------------------- Server 1: sip.conf----------------------------
[trunk]
type=friend
host=10.0.17.52 ; mask=24bits
trunk=yes
disallow=all
allow=gsm
qualify=yes
directmedia=yes
context=default

[client1]
disallow=all
allow=alaw
host=10.0.16.18 ;mask=24bits
type=friend
dtmfmode=rfc2833
qualify=yes
directmedia=yes
insecure=port
context=default
--------------------------server 2: sip.conf-------------------------

[trunk]
trunk=yes
type=friend
host=10.0.17.57
disallow=all
allow=gsm
qualify=yes
directmedia=yes
context=local-dial

[client2]
disallow=all
host= 10.0.18.37
type=friend
allow=alaw
qualify=yes
directmedia=yes
insecure=port
context=local-dial

I have also tried using “canreinvite=update,nonat” instead of “directmedia=yes” but no success.
Is it because different subnet(s) are involved in this call ? If yes, can this situation be overcome and direct media(rtp packets) allowed to flow between the clients ?

Please suggest.

Regards,
Chetan Dua

Your codecs are ncompatible. One of the conditions for direct media is that compatible codecs must have been negotiated.

canreinvite is deprecated in favour of directmedia.

; is a comment delimiter. You must list every possible peer separately or use allowguest. In fact you may be using allowguest already, but not have directmedia in the general section.

One of your clients must actually be a server. They are peers not clients in SIP terms.

You haven’t specified a version of Asterisk, but there is a bug in older versions that prevents multi-stage direct meida re-invites.

Settings in features.conf and extensions.conf can conflict with directmedia, but you haven’t included those files.

Hi David,

Thanks for the prompt reply.

I made some changes to the old configuration and its working fine.

  • made the codecs common,
  • declared the asterisk servers as ‘type=peer’ instead of ‘type=friend’ in sip.conf
  • declaring directmedia=yes in [general] section doesnt help.
  • default settings were used for features.conf
  • no canges made to existing extensions.conf

---------------------- Server 1: sip.conf----------------------------
[trunk]
type=peer
host=10.0.17.52 ; mask=24bits
disallow=all
allow=alaw
allow=ulaw
allow=gsm
qualify=yes
directmedia=yes
context=default

[client1]
disallow=all
allow=alaw
allow=ulaw
allow=gsm
host=10.0.16.18 ;mask=24bits
type=friend
dtmfmode=rfc2833
qualify=yes
directmedia=yes
insecure=port
context=default
--------------------------server 2: sip.conf-------------------------

[trunk]
type=peer
host=10.0.17.57
disallow=all
allow=alaw
allow=ulaw
allow=gsm
qualify=yes
directmedia=yes
context=local-dial

[client2]
disallow=all
allow=alaw
allow=ulaw
allow=gsm
host= 10.0.18.37
type=friend
qualify=yes
directmedia=yes
insecure=port
context=local-dial

Thanks !
-Chetan