2 NIC's on Asterisk Outgoing problem

Hi,
I am new to Asterisk and recently I was able to set up local calls and External incoming calls.
My problem is making outgoing calls to the world.
My VoIP provider authenticates me with caller ID and the IP address.
My set up is as follows:

Asterisk 1.6
2 ethernet cards one with real IP 85.130.104.19 and local net 192.168.10.0/255.255.255.0

sip.conf
[general]
defaultip = 85.130.104.19
localnet = 192.168.10.0/255.255.255.0
externrefresh = 60
nat = no
canreinvite = no
srvlookup=yes
musicclass=default
realm = asterisk

[100]
type=friend
username=100
secret=100
host=dynamic
disallow=all
allow=ulaw
allow=alaw
allow=g729
allow=g723.1
context=users

[101]
type=friend
username=101
secret=101
host=dynamic
context=users

[spnet] ;my VoIP Provide
type=peer
host = 87.227.149.115
fromdomain = 85.130.104.19
fromuser =102109
incominglimit = 3
canreinvite=yes
qualify=no
dtmfmode=RFC2833
port=5060
insecure=very
disallow=all
allow = all
;allow=g729
;allow=gsm
;allow=ulaw
;allow=alaw
;allow=speex
context = incoming

extensions.conf
[users]
exten=>100,1,Dial(SIP/100,20)
exten=>101,1,Dial(SIP/101,20)
exten => _X.,1,Dial(SIP/102109359${EXTEN}@87.227.149.115)

[incoming]
exten => 10210935924218592,1,Dial(SIP/100,60)
exten => 10210935924218592,n,Hangup()

[outgoing]
exten => _X.,1,Dial(SIP/102109359${EXTEN}@87.227.149.115)

;[users]
;include => office
;include => incoming
;include => outgoing

Output
Asterisk*CLI>
<— SIP read from UDP:192.168.10.4:51009 —>
INVITE sip:888775869@192.168.10.199:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.10.4:51009;branch=z9hG4bK-d8754z-4a11071da61f3b12-1—d8754z-;rport
Max-Forwards: 70
Contact: sip:100@192.168.10.4:51009;rinstance=8143804d6a081477
To: sip:888775869@192.168.10.199:5060
From: "100"sip:100@192.168.10.199:5060;tag=95177749
Call-ID: Njg5NjdlNzAwNTQyYzAxNTI2MGNlNDhlZjNhZWNlMzI.
CSeq: 1 INVITE
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REGISTER, SUBSCRIBE, NOTIFY, REFER, INFO, MESSAGE
Content-Type: application/sdp
Supported: replaces
User-Agent: 3CXPhone 6.0.20943.0
Content-Length: 280

v=0
o=3cxVCE 101710455 400064415 IN IP4 192.168.10.4
s=3cxVCE Audio Call
c=IN IP4 192.168.10.4
t=0 0
m=audio 40008 RTP/AVP 3 8 0 100
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:100 telephone-event/8000
a=fmtp:100 0-15
a=ptime:20
a=sendrecv

<------------->
— (13 headers 13 lines) —
== Using SIP RTP CoS mark 5
Sending to 192.168.10.4 : 51009 (no NAT)
Using INVITE request as basis request - Njg5NjdlNzAwNTQyYzAxNTI2MGNlNDhlZjNhZWNlMzI.
Found peer ‘100’ for ‘100’ from 192.168.10.4:51009

<— Reliably Transmitting (no NAT) to 192.168.10.4:51009 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.10.4:51009;branch=z9hG4bK-d8754z-4a11071da61f3b12-1—d8754z-;received=192.168.10.4;rport=51009
From: "100"sip:100@192.168.10.199:5060;tag=95177749
To: sip:888775869@192.168.10.199:5060;tag=as4554d5c7
Call-ID: Njg5NjdlNzAwNTQyYzAxNTI2MGNlNDhlZjNhZWNlMzI.
CSeq: 1 INVITE
Server: Asterisk PBX 1.6.2.11
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="327340ec"
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘Njg5NjdlNzAwNTQyYzAxNTI2MGNlNDhlZjNhZWNlMzI.’ in 32000 ms (Method: INVITE)

<— SIP read from UDP:192.168.10.4:51009 —>
ACK sip:888775869@192.168.10.199:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.10.4:51009;branch=z9hG4bK-d8754z-4a11071da61f3b12-1—d8754z-;rport
Max-Forwards: 70
To: sip:888775869@192.168.10.199:5060;tag=as4554d5c7
From: "100"sip:100@192.168.10.199:5060;tag=95177749
Call-ID: Njg5NjdlNzAwNTQyYzAxNTI2MGNlNDhlZjNhZWNlMzI.
CSeq: 1 ACK
Content-Length: 0

<------------->
— (8 headers 0 lines) —

<— SIP read from UDP:192.168.10.4:51009 —>
INVITE sip:888775869@192.168.10.199:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.10.4:51009;branch=z9hG4bK-d8754z-3e065e0a6328b93f-1—d8754z-;rport
Max-Forwards: 70
Contact: sip:100@192.168.10.4:51009;rinstance=8143804d6a081477
To: sip:888775869@192.168.10.199:5060
From: "100"sip:100@192.168.10.199:5060;tag=95177749
Call-ID: Njg5NjdlNzAwNTQyYzAxNTI2MGNlNDhlZjNhZWNlMzI.
CSeq: 2 INVITE
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REGISTER, SUBSCRIBE, NOTIFY, REFER, INFO, MESSAGE
Content-Type: application/sdp
Supported: replaces
User-Agent: 3CXPhone 6.0.20943.0
Authorization: Digest username=“100”,realm=“asterisk”,nonce=“327340ec”,uri=“sip:888775869@192.168.10.199:5060”,response=“2400a91e1eafd17b7cde2e9acb0b4c6d”,algorithm=MD5
Content-Length: 280

v=0
o=3cxVCE 101710455 400064415 IN IP4 192.168.10.4
s=3cxVCE Audio Call
c=IN IP4 192.168.10.4
t=0 0
m=audio 40008 RTP/AVP 3 8 0 100
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:100 telephone-event/8000
a=fmtp:100 0-15
a=ptime:20
a=sendrecv

<------------->
— (14 headers 13 lines) —
Sending to 192.168.10.4 : 51009 (no NAT)
Using INVITE request as basis request - Njg5NjdlNzAwNTQyYzAxNTI2MGNlNDhlZjNhZWNlMzI.
Found peer ‘100’ for ‘100’ from 192.168.10.4:51009
Found RTP audio format 3
Found RTP audio format 8
Found RTP audio format 0
Found RTP audio format 100
Found audio description format GSM for ID 3
Found audio description format PCMA for ID 8
Found audio description format PCMU for ID 0
Found audio description format telephone-event for ID 100
Capabilities: us - 0x10d (g723|ulaw|alaw|g729), peer - audio=0xe (gsm|ulaw|alaw)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0xc (ulaw|alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event), peer - 0x1 (telephone-event), combined - 0x1 (telephone-event)
Peer audio RTP is at port 192.168.10.4:40008
Looking for 888775869 in users (domain 192.168.10.199)
list_route: hop: sip:100@192.168.10.4:51009;rinstance=8143804d6a081477

<— Transmitting (no NAT) to 192.168.10.4:51009 —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.10.4:51009;branch=z9hG4bK-d8754z-3e065e0a6328b93f-1—d8754z-;received=192.168.10.4;rport=51009
From: "100"sip:100@192.168.10.199:5060;tag=95177749
To: sip:888775869@192.168.10.199:5060
Call-ID: Njg5NjdlNzAwNTQyYzAxNTI2MGNlNDhlZjNhZWNlMzI.
CSeq: 2 INVITE
Server: Asterisk PBX 1.6.2.11
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Contact: sip:888775869@192.168.10.199
Content-Length: 0

<------------>
– Executing [888775869@users:1] Dial(“SIP/100-00000042”, “SIP/102109359888775869@87.227.149.115”) in new stack
== Using SIP RTP CoS mark 5
Audio is at 85.130.104.19 port 17966
Adding codec 0x4 (ulaw) to SDP
Adding codec 0x2 (gsm) to SDP
Adding codec 0x8 (alaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 87.227.149.115:5060:
INVITE sip:102109359888775869@87.227.149.115 SIP/2.0
Via: SIP/2.0/UDP 85.130.104.19:5060;branch=z9hG4bK1971da51;rport
Max-Forwards: 70
From: “100” sip:100@85.130.104.19;tag=as5f51b0e2
To: sip:102109359888775869@87.227.149.115
Contact: sip:100@85.130.104.19
Call-ID: 353689932fe158380f51f40a005efe63@85.130.104.19
CSeq: 102 INVITE
ser-Agent: Asterisk PBX 1.6.2.11
Date: Mon, 05 Dec 2011 11:16:00 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 286

v=0
o=root 1440014089 1440014089 IN IP4 85.130.104.19
s=Asterisk PBX 1.6.2.11
c=IN IP4 85.130.104.19
t=0 0
m=audio 17966 RTP/AVP 0 3 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv


-- Called 102109359888775869@87.227.149.115

Retransmitting #1 (no NAT) to 87.227.149.115:5060:
INVITE sip:102109359888775869@87.227.149.115 SIP/2.0
Via: SIP/2.0/UDP 85.130.104.19:5060;branch=z9hG4bK1971da51;rport
Max-Forwards: 70
From: “100” sip:100@85.130.104.19;tag=as5f51b0e2
To: sip:102109359888775869@87.227.149.115
Contact: sip:100@85.130.104.19
Call-ID: 353689932fe158380f51f40a005efe63@85.130.104.19
CSeq: 102 INVITE
User-Agent: Asterisk PBX 1.6.2.11
Date: Mon, 05 Dec 2011 11:16:00 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 286

v=0
o=root 1440014089 1440014089 IN IP4 85.130.104.19
s=Asterisk PBX 1.6.2.11
c=IN IP4 85.130.104.19
t=0 0
m=audio 17966 RTP/AVP 0 3 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv


<— SIP read from UDP:192.168.10.4:51009 —>
CANCEL sip:888775869@192.168.10.199:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.10.4:51009;branch=z9hG4bK-d8754z-3e065e0a6328b93f-1—d8754z-;rport
Max-Forwards: 70
To: sip:888775869@192.168.10.199:5060
From: "100"sip:100@192.168.10.199:5060;tag=95177749
Call-ID: Njg5NjdlNzAwNTQyYzAxNTI2MGNlNDhlZjNhZWNlMzI.
CSeq: 2 CANCEL
User-Agent: 3CXPhone 6.0.20943.0
Authorization: Digest username=“100”,realm=“asterisk”,nonce=“327340ec”,uri=“sip:888775869@192.168.10.199:5060”,response=“b154d8da2798ff765a2bb68c319d6d2f”,algorithm=MD5
Content-Length: 0

<------------->
— (10 headers 0 lines) —
Sending to 192.168.10.4 : 51009 (no NAT)

<— Reliably Transmitting (no NAT) to 192.168.10.4:51009 —>
SIP/2.0 487 Request Terminated
Via: SIP/2.0/UDP 192.168.10.4:51009;branch=z9hG4bK-d8754z-3e065e0a6328b93f-1—d8754z-;received=192.168.10.4;rport=51009
From: "100"sip:100@192.168.10.199:5060;tag=95177749
To: sip:888775869@192.168.10.199:5060;tag=as4f5e1aa9
Call-ID: Njg5NjdlNzAwNTQyYzAxNTI2MGNlNDhlZjNhZWNlMzI.
CSeq: 2 INVITE
Server: Asterisk PBX 1.6.2.11
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Length: 0

<------------>

<— Transmitting (no NAT) to 192.168.10.4:51009 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.10.4:51009;branch=z9hG4bK-d8754z-3e065e0a6328b93f-1—d8754z-;received=192.168.10.4;rport=51009
From: "100"sip:100@192.168.10.199:5060;tag=95177749
To: sip:888775869@192.168.10.199:5060;tag=as4f5e1aa9
Call-ID: Njg5NjdlNzAwNTQyYzAxNTI2MGNlNDhlZjNhZWNlMzI.
CSeq: 2 CANCEL
Server: Asterisk PBX 1.6.2.11
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘353689932fe158380f51f40a005efe63@85.130.104.19’ in 32000 ms (Method: INVITE)
== Spawn extension (users, 888775869, 1) exited non-zero on ‘SIP/100-00000042’

<— SIP read from UDP:192.168.10.4:51009 —>
ACK sip:888775869@192.168.10.199:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.10.4:51009;branch=z9hG4bK-d8754z-3e065e0a6328b93f-1—d8754z-;rport
Max-Forwards: 70
To: sip:888775869@192.168.10.199:5060;tag=as4f5e1aa9
From: "100"sip:100@192.168.10.199:5060;tag=95177749
Call-ID: Njg5NjdlNzAwNTQyYzAxNTI2MGNlNDhlZjNhZWNlMzI.
CSeq: 2 ACK
Content-Length: 0

<------------->

Thank you in advance.

fromuser appears ineffective. Are you sure your dialplan is referring to SIP/spnet, rather than using its IP address directly?

Thank you for your reply. It makes no difference. As far as I understand it takes the long distance number like external.

Here is sip show settings when I add externip = 85.130.104.19 internalip = 192.168.10.199 in my sip.conf

Global Settings:

UDP SIP Port: 5060
UDP Bindaddress: 0.0.0.0
TCP SIP Port: Disabled
TLS SIP Port: Disabled
Videosupport: No
Textsupport: No
Ignore SDP sess. ver.: No
AutoCreate Peer: No
Match Auth Username: No
Allow unknown access: Yes
Allow subscriptions: Yes
Allow overlap dialing: Yes
Allow promsic. redir: No
Enable call counters: No
SIP domain support: No
Realm. auth: No
Our auth realm asterisk
Call to non-local dom.: Yes
URI user is phone no: No
Always auth rejects: No
Direct RTP setup: No
User Agent: Asterisk PBX 1.6.2.11
SDP Session Name: Asterisk PBX 1.6.2.11
SDP Owner Name: root
Reg. context: (not set)
Regexten on Qualify: No
Caller ID: asterisk
From: Domain:
Record SIP history: Off
Call Events: Off
Auth. Failure Events: Off
T.38 support: No
T.38 EC mode: Unknown
T.38 MaxDtgrm: -1
SIP realtime: Disabled
Qualify Freq : 60000 ms

Network QoS Settings:

IP ToS SIP: CS0
IP ToS RTP audio: CS0
IP ToS RTP video: CS0
IP ToS RTP text: CS0
802.1p CoS SIP: 4
802.1p CoS RTP audio: 5
802.1p CoS RTP video: 6
802.1p CoS RTP text: 5
Jitterbuffer enabled: No
Jitterbuffer forced: No
Jitterbuffer max size: -1
Jitterbuffer resync: -1
Jitterbuffer impl:
Jitterbuffer log: No

Network Settings:

SIP address remapping: Enabled using externip
Externhost:
Externip: 85.130.104.19:5060
Externrefresh: 60
Internal IP: 85.130.104.19:5060
Localnet: 192.168.10.0/255.255.255.0
STUN server: 0.0.0.0:0

Global Signalling Settings:

Codecs: 0x8000e (gsm|ulaw|alaw|h263)
Codec Order: none
Relax DTMF: No
RFC2833 Compensation: No
Compact SIP headers: No
RTP Keepalive: 0 (Disabled)
RTP Timeout: 0 (Disabled)
RTP Hold Timeout: 0 (Disabled)
MWI NOTIFY mime type: application/simple-message-summary
DNS SRV lookup: Yes
Pedantic SIP support: No
Reg. min duration 60 secs
Reg. max duration: 3600 secs
Reg. default duration: 120 secs
Outbound reg. timeout: 20 secs
Outbound reg. attempts: 0
Notify ringing state: Yes
Include CID: No
Notify hold state: No
SIP Transfer mode: open
Max Call Bitrate: 384 kbps
Auto-Framing: No
Outb. proxy:
Session Timers: Accept
Session Refresher: uas
Session Expires: 1800 secs
Session Min-SE: 90 secs
Timer T1: 500
Timer T1 minimum: 100
Timer B: 32000
No premature media: Yes

Default Settings:

Allowed transports: UDP
Outbound transport: UDP
Context: default
Nat: RFC3581
DTMF: rfc2833
Qualify: 0
Use ClientCode: No
Progress inband: Never
Language:
MOH Interpret: default
MOH Suggest:
Voice Mail Extension: asterisk
Forward Detected Loops: Yes

I don’t understand.

Admittedly, no response doesn’t look like fromuser being set wrong.

Is that the way my VoIP provider settings should look once I am authenticated with caller ID and IP?

No one has Asterisk config with two NICs?

Yep we have lots of customers with them

[quote]
My VoIP provider authenticates me with caller ID and the IP address[/quote]

so calls fails , where do you set the callerID , cant see it in your configs

What do they say the problem is ?

are you 100% sure teh call is going out via the correct NIC.

what does route have t say about your routing and if you do a traceroute to 87.227.149.115 what nic does it use ?

ianplain, thank you for you reply!

On this machine I have only Astersik, 2 NIC’s i.e. real IP and a local network and nothing else.
The scheme is as follows:

Internet--------------My VoIP Privider
|
Real IP
|
My Asterisk Linux Box (no NAT etc.:wink:
|
Local net
| |
Soft1 Soft2

when I make an autbound call w/o sip debugigng it says like following:
------------------------
localhostCLI>
== Using SIP RTP CoS mark 5
– Executing [888775869@users:1] Dial(“SIP/100-0000002a”, “SIP/102109359888775869@87.227.149.115”) in new stack
== Using SIP RTP CoS mark 5
– Called 102109359888775869@87.227.149.115
== Spawn extension (users, 888775869, 1) exited non-zero on 'SIP/100-0000002a’
localhost
CLI>
------------------------

According my humble knowledge that looks OK. But obviously it is not.
I am getting a ringing signal and that is all.

and somewhere in the debug output I am getting this:
------------------------------
<— SIP read from UDP:192.168.10.4:50050 —>
INVITE sip:888775869@192.168.10.199:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.10.4:50050;branch=z9hG4bK-d8754z-7032a340141b5c7d-1—d8754z-;rport
Max-Forwards: 70
Contact: sip:100@192.168.10.4:50050;rinstance=110939d7465fc2c1
To: sip:888775869@192.168.10.199:5060
From: "100"sip:100@192.168.10.199:5060;tag=756c0451
---------------------------------
which should say that I am calling to an extension into the local realm!?!
I am missing something for sure!
My questions are:

  1. Do I need to set NAT?
  2. Am I assumed to be behind NAT according to the above presented scheme when using Asterisk only?
  3. How should I tell Asterisk that is an outbound call?

Thank you in advance guys!

No one has a clue about what should be done?

You have never answered my questions.

[quote]so calls fails , where do you set the callerID , cant see it in your configs

What do they say the problem is ?

are you 100% sure teh call is going out via the correct NIC.

what does route have t say about your routing and if you do a traceroute to 87.227.149.115 what nic does it use ?[/quote]

You need to speak to your itsp and see why they are faining the call also do a pcap capture and use cloudshark to see the call flow.