Solved -- Incoming calls from Sipgate

Hello everyone,

I am running asterisk (1.4.21.2~dfsg-3) on Debian stable.  I have SFLphone on my workstation to make calls through.  I have a ipcop gateway that the asterisk server and the workstation are behind.  I got a sipgate account to make calls with.

So far I have got SLFphone connected to asterisk and it can make outgoing calls.  But I can't get incoming calls.  Sipgate always shows my phone as offline and test calls do not show up in sip debug or on my gateway.  I configured my NAT setup according to [forums.digium.com/viewtopic.php?t=7854](http://forums.digium.com/viewtopic.php?t=7854)

My ipcop configuration looks like:

UDP 	DEFAULT IP :5060 - 5082 	=> 	192.168.0.47 : 5060 - 5082 	 Asterisk --- SIP signaling 	
UDP 	DEFAULT IP :10000 - 20000 	=> 	192.168.0.47 :10000 - 20000 	 Asterisk --- RTP traffic 		
TCP 	DEFAULT IP :5060 - 5082 	=> 	192.168.0.47 : 5060 - 5082 	 Asterisk --- SIP signaling 	

I have a file called sip_nat.conf

 NAT=Yes
 externip=24.113.159.168
 localnet=192.168.0.0/255.255.255.0

In my sip.conf I have:

[general]

 NAT=Yes
 externip=24.113.159.168
 localnet=192.168.0.0/255.255.255.0

[1000]
type=friend
context=phones
host=dynamic
secret=its_passtastic


     register => my-sip-id:my-sip-password@sipgate/my-sip-id
     [sipgate]
     type=peer
   nat=yes
   canreinvite=no
;   nat=1
;   externip=24.113.159.168
     secret=my-sip-password
     insecure=invite
     username=my-sip-id
     defaultuser=my-sip-id
     fromuser=my-sip-id
     context=sipgate_in
     ;context=incoming_calls
     fromdomain=sipgate.com
     host=sipgate.com
     outboundproxy=proxy.live.sipgate.com
     qualify=yes
     disallow=all
     allow=ulaw          
     dtmfmode=rfc2833
     
     
;#include sip_nat.conf

In my extensions.conf I have:

[globals]

[general]
static=yes

; NAT=Yes
; externip=24.113.159.168
; externip=***.***.***.*** 
; localnet=192.168.0.0/255.255.255.0


[default]
exten => s,1,Verbose(1|Unrouted call handler)
exten => s,n,Answer()
exten => s,n,Wait(1)
exten => s,n,Playback(tt-weasels)
exten => s,n,Hangup()

[incoming_calls]
exten => _X.,1.NoOp()
exten => _X.,n,Dial(SIP/1000)
;sexten => my-sip-id,1,Dial(SIP/1000)

[outgoing_calls]
;exten => _X.,1,NoOp()
;exten => _X.,n,Dial(SIP/my_service_provider/${EXTEN})
exten => _X.,1,Set(CALLERID(num)=SIP-ID)
exten => _X.,2,Dial(SIP/${EXTEN}@sipgate,30,trg)

[internal]
exten => 500,1,Verbose(1|Echo test application)
exten => 500,n,Echo()
exten => 500,n,Hangup()

exten => 1000,1,Verbose(1|Extension 1000)
exten => 1000,n,Dial(SIP/1000,30)
exten => 1000,n,Hangup()

[phones]
include => internal
include => outgoing_calls


;  Stuff from sipgate
 [sipgate_in]
 exten => my-sip-id,1,Dial(SIP/1000); <-- instead of extension you should define the corresponding peer
 exten => my-sip-id,n,Hangup
; [sipgate_out]
; exten => _X.,1,Set(CALLERID(num)=SIP-ID)
; exten => _X.,2,Dial(SIP/${EXTEN}@sipgate,30,trg)
; exten => _X.,3,Hangup

Whenever asterisk starts it gives messages like:

[Sep 14 18:05:46] NOTICE[29237] cdr.c: CDR simple logging enabled.
[Sep 14 18:05:46] NOTICE[29237] loader.c: 160 modules will be loaded.
[Sep 14 18:05:46] WARNING[29237] res_smdi.c: No SMDI interfaces are available to listen on, not starting SMDI listener.
[Sep 14 18:05:46] NOTICE[29237] res_odbc.c: Adding ENV var: INFORMIXSERVER=my_special_database
[Sep 14 18:05:46] NOTICE[29237] res_odbc.c: Adding ENV var: INFORMIXDIR=/opt/informix
[Sep 14 18:05:46] NOTICE[29237] res_odbc.c: res_odbc loaded.
[Sep 14 18:05:46] NOTICE[29237] pbx_ael.c: Starting AEL load process.
[Sep 14 18:05:46] NOTICE[29237] pbx_ael.c: AEL load process: calculated config file name '/etc/asterisk/extensions.ael'.
[Sep 14 18:05:46] NOTICE[29237] pbx_ael.c: File /etc/asterisk/extensions.ael not found; AEL declining load
[Sep 14 18:05:46] WARNING[29237] chan_iax2.c: Unable to open IAX timing interface: No such file or directory
[Sep 14 18:05:46] ERROR[29237] chan_vpb.cc: No Voicetronix cards detected
[Sep 14 18:05:46] NOTICE[29248] chan_sip.c: Peer 'sipgate' is now Reachable. (78ms / 2000ms)

With sip debugging on I get messages in the console like:

<--- SIP read from 204.155.28.10:5060 --->
SIP/2.0 200 OK                            
Record-Route: <sip:204.155.28.10;lr=on;ftag=as41100537>
Via: SIP/2.0/UDP 24.113.159.168:5060;branch=z9hG4bK4eb124d1;rport=5060
From: "asterisk" <sip:asterisk@24.113.159.168>;tag=as41100537         
To: <sip:sipgate.com>;tag=ddf9a9f0de4595ec12441b9d8d3ee250.00b0       
Call-ID: 2197a5e855066ec040ff95e04c51897e@24.113.159.168
CSeq: 102 OPTIONS
Accept: */*
Accept-Encoding:
Accept-Language: en
Supported:
Content-Length: 0


<------------->
--- (12 headers 0 lines) ---
Really destroying SIP dialog '2197a5e855066ec040ff95e04c51897e@24.113.159.168' Method: OPTIONS
Reliably Transmitting (NAT) to 204.155.28.10:5060:
OPTIONS sip:sipgate.com SIP/2.0
Via: SIP/2.0/UDP 24.113.159.168:5060;branch=z9hG4bK70c65f61;rport
From: "asterisk" <sip:asterisk@24.113.159.168>;tag=as5c8af6a9
To: <sip:sipgate.com>
Contact: <sip:asterisk@24.113.159.168>
Call-ID: 787c25a77625508a4de5fbbe08a721f3@24.113.159.168
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX
Max-Forwards: 70
Date: Tue, 15 Sep 2009 04:42:00 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Length: 0

Edit: Fixed. My register command was not in the general section.