Problem setting SIP incoming/outgoing

Hi

I am a newbie to * and I am having a problem which appears strange as I did not find any mention of it in any forums.

Simply speaking, I have an external SIP proxy server which I am trying to configure for incoming and outgoing calls from my asterisk installation. So here is my configuration in sip.conf

[general]
register => user:secret:user@sipserver.com:8080

as long as I have just the above entry, I am able to receive incoming calls. Now I would like to setup outgoing calls too. So I create a new section in sip.conf

[sipserverout]
type=peer
secret=secret
username=user
fromuser=user
fromdomain=sipserver.com
host=sipserver.com
port=8080
context=default

with the above configuration I can successfully dial out using dial(SIP/{$EXTEN}@sipserverout)

but now when I call my incoming number, I get a busy or invalid number signal. If I coment out sipserverout section, I could receive incoming calls again.

So I turned on sip debug on * CLI. and it appears to me that the following is happening. astreisk takes the incoming call and tries to match it with a section with the same hostname. Now the reverse Ip lookup on 109.147.41.48 return sipserver.com (which is correct), so it is trying to send the call to sipserverout which is essentially back to the same server where it came from (Notice the statement “Found peer ‘sipserverout’” in the sip debug logs below). This creates an endless loop and the equipment at the other end terminates the call.

According to all the examples I have seen, my setup is the correct setup and everyone seems to be using it. but it does not work for me. I am deperately looking for a solution. Please help.

I am using asterisk 1.2.0 beta 1 on FC1.

Here is the sip debug dump when a call is coming.

<-- SIP read from 109.147.41.48:8080:
INVITE sip:s@66.197.70.80:5050 SIP/2.0
Record-Route: sip:209.47.41.48:80;ftag=2C996308-10F9;lr=on
Via: SIP/2.0/UDP 209.47.41.48:80;branch=z9hG4bK03a4.da6a926.0
Via: SIP/2.0/UDP 209.47.41.61:5060;rport=53084;x-route-tag=“tgrp:sroutetor1”;branch=z9hG4bK4BB6EA6
From: sip:0000123456@209.47.41.61;tag=2C996308-10F9
To: sip:16166739282@209.47.41.48
Date: Thu, 06 Oct 2005 08:13:58 GMT
Call-ID: FADDE365-357711DA-80F5C727-E0F535F0@209.47.41.61
Supported: timer
Min-SE: 1800
Cisco-Guid: 4208765565-896995802-2793406481-2459445924
User-Agent: Cisco-SIPGateway/IOS-12.x
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, NOTIFY, INFO, UPDATE, REGISTER
CSeq: 101 INVITE
Max-Forwards: 4
Remote-Party-ID: sip:0000123456@109.147.41.48;party=calling;screen=yes;privacy=off
Timestamp: 1128586438
Contact: sip:0000123456@109.147.41.48:53084
Expires: 180
Allow-Events: telephone-event
Content-Type: application/sdp
Content-Length: 369
hint: NAThelper
hint: SDP rewritten
hint: usrloc applied
hint: NAT…

v=0
o=CiscoSystemsSIP-GW-UserAgent 5168 3221 IN IP4 209.47.41.61
s=SIP Call
c=IN IP4 109.147.41.48
t=0 0
m=audio 53870 RTP/AVP 0 8 18 3 101
c=IN IP4 109.147.41.48
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=yes
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=direction:passive
a=nortpproxy:yes

— (26 headers 16 lines)—
Using INVITE request as basis request - FADDE365-357711DA-80F5C727-E0F535F0@209.47.41.61
Sending to 109.147.41.48 : 80 (non-NAT)
Found peer 'sipserverout’
Reliably Transmitting (no NAT) to 209.47.41.48:80:
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 209.47.41.48:80;branch=z9hG4bK03a4.da6a926.0
Via: SIP/2.0/UDP 209.47.41.61:5060;x-route-tag=“tgrp:sroutetor1”;branch=z9hG4bK4BB6EA6
From: <sip:0000123456@109.147.41.48 >;tag=2C996308-10F9
To: <sip:16166739282@109.147.41.48 >;tag=as1b7fff99
Call-ID: FADDE365-357711DA-80F5C727-E0F535F0@209.47.41.61
CSeq: 101 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY
Contact: sip:s@66.197.70.80:5050
Proxy-Authenticate: Digest realm=“asterisk”, nonce="6d00a83d"
Content-Length: 0


Scheduling destruction of call ‘FADDE365-357711DA-80F5C727-E0F535F0@209.47.41.61’ in 15000 ms

<-- SIP read from 109.147.41.48:8080:
ACK sip:s@66.197.70.80:5050 SIP/2.0
Via: SIP/2.0/UDP 109.147.41.48:8080;branch=z9hG4bK03a4.da6a926.0
From: sip:0000123456@109.147.41.48;tag=2C996308-10F9
Call-ID: FADDE365-357711DA-80F5C727-E0F535F0@209.47.41.61
To: sip:16166739282@109.147.41.48;tag=as1b7fff99
CSeq: 101 ACK
User-Agent: Phone Server 1
Content-Length: 0

any comments on this problem are appreciated.

I believe there is a recommendaiton out there, that suggests you use two contexts, one for incoming and one for outgoing.

Just because you are registered with the sip server doe snot mean that * will know what to do with an incoming call. Especially if you do not put at the end of your registration statement an extension for the incoming call to go to:

register => bluesip/comcentrixs:5UDotAZ2@bluesip.net/453 <—all incoming calls go to this extension

; Test of seperate SIP configs for in and out
[sip-in]
type=user
context=sipin
dtmfmode=rfc2833
disallow=all
allow=ulaw
allow=alaw
nat=no
;
[sip-out]
type=peer
context=sipout
qualify=yes
host=sip.net
fromuser=xxxxx
username=xxxxx
fromdomain=xxxxx
secret=xxxxx
insecure=very
dtmfmode=rfc2833
disallow=all
allow=ulaw
allow=alaw
nat=no

Let me know how you progress.

Joe