Problems with codec negotiation


#1

Hi everyone

I am having trouble with codec negotiation. I have Asterisk running at the office and a SIP phone at home. In my sip.conf, I have allow ordered as follows:
alaw ulaw g729 and gsm

On all my office extensions, I have no allow, or disallow entries. My Cisco gateway is setup to do alaw ulaw g729 and gsm

My home phone does g729 alaw and ulaw. In sip.conf, I have disallow all
and allow g729. In all my extensions and cisco gateway I have canreinvite set to yes and my dial commands don’t have the t option, so all sip endpoints can talk directly to each other (rtp).

If I call from home to the office, calls go through fine. SIP show channels, shows that the call is g729 as one would expect.

If I get a call from Office to home, or from PSTN (via Cisco) to home, the phone rings, but as soon as I answer it hangs up.

Asterisk says:

May 29 05:45:49 WARNING[7514]: channel.c:2115 ast_channel_make_compatible: No path to translate from SIP/390-8a3b(256) to SIP/192.168.44.23-08acccf0(8)
– SIP/390-8a3b is ringing
– SIP/390-8a3b answered SIP/192.168.44.23-08acccf0
May 29 05:45:55 WARNING[7514]: channel.c:2115 ast_channel_make_compatible: No path to translate from SIP/192.168.44.23-08acccf0(8) to SIP/390-8a3b(256)
May 29 05:45:55 WARNING[7514]: app_dial.c:1006 dial_exec: Had to drop call because I couldn’t make SIP/192.168.44.23-08acccf0 compatible with SIP/390-8a3b
== Spawn extension (default, 390, 1) exited non-zero on ‘SIP/192.168.44.23-08acccf0’

No I am pretty sure what is happening is that as I have no g.729 licences running in Asterisk it can’t bridge the call. When Digium get back to me with my 9.729 licence keys this might work, but why does Asterisk not force a call to be initiated with G.729 at both ends? Other SIP servers find a common codec and send this as an allowed codec to both parties to setup the call in the invite sequence. It appears that Asterisk simply bridges the call and then lets the endpoints sort out codecs on a reinvite. Problem here is that Asterisk needs enough licences and uses CPU cycles bridging calls to start with.

Is there a dial program switch that forces Asterisk to negotiate compatible codecs right from the beginning?

Thanks to the gurus who might no the answer to this one.

Cheers

Mark


#2

hello Mark can you please reply with the content of your sip.conf.

Thanks
Matt


#3

Sure thing Matt. I will remove the standard help stuff and just put in the non commented lines.

Some notes. The Cisco and SOX are gateways. Cisco is my ISDN gateway to PSTN.

I want all calls normally to be alaw, except where I have a remote handset like extension 390. I want all calls to and from 390 to be negotiated to g729.

All devices have g.729 enabled and Asterisk has a couple of g.729 licences for moh, etc.

Mark

[general]
context=default ; Default context for incoming calls
;recordhistory=yes ; Record SIP history by default
; (see sip history / sip no history)
realm=datamerge.local ; Realm for digest authentication
; defaults to “asterisk”
; Realms MUST be globally unique according to RFC 3261
; Set this to your host name or domain name
port=5060 ; UDP Port to bind to (SIP standard port is 5060)
bindaddr=0.0.0.0 ; IP address to bind to (0.0.0.0 binds to all)
srvlookup=yes ; Enable DNS SRV lookups on outbound calls
; Note: Asterisk only uses the first host
; in SRV records
; Disabling DNS SRV lookups disables the
; ability to place SIP calls based on domain
; names to some other SIP users on the Internet

disallow=all ; First disallow all codecs
allow=alaw ; Allow codecs in order of preference
allow=ulaw ; Note: codec order is respected only in allow=g729
allow=gsm

[390]
username=390
type=friend
secret=0000
qualify=no
port=5060
pickupgroup=
nat=never
mailbox=
host=dynamic
dtmfmode=rfc2833
context=international
canreinvite=yes
callgroup=
callerid=Reception <390>
disallow=all
allow=g729

[391]
username=391
type=friend
secret=0000
qualify=no
port=5060
pickupgroup=
nat=never
mailbox=
host=dynamic
dtmfmode=rfc2833
context=longdistance
canreinvite=yes
callgroup=
callerid=Matthew Price <391>
mailbox=391

[392]
username=392
type=friend
secret=0000
qualify=no
port=5060
pickupgroup=
nat=never
mailbox=
host=dynamic
dtmfmode=rfc2833
context=longdistance
canreinvite=yes
callgroup=
callerid=Grandstream Demo <392>
mailbox=392

[393]
username=393
type=friend
secret=0000
qualify=no
port=5060
pickupgroup=
nat=never
mailbox=
host=dynamic
dtmfmode=rfc2833
context=longdistance
canreinvite=yes
callgroup=
callerid=Boss Softphone <393>

[350]
username=350
type=friend
secret=0000
qualify=no
port=5060
pickupgroup=
nat=never
mailbox=
host=dynamic
dtmfmode=rfc2833
context=longdistance
canreinvite=yes
callgroup=
callerid=Datamerge Fax <350>

[cisco]
type=friend
port=5060
host=192.168.44.23
context=default
insecure=yes
canreinvite=yes