SIP Dialing without using register string

Hi

I would like to know if i can dial a sip peer without using registration string. I having following scenario. I have a user [abc] registered on my asterisk server (nasir.server.com).

now from client system i want to use this user as peer so that anyone that calls on my client asterisk will eventually dial nasir.server.com using [abc]. the problem is when i use register string on my client system call goes fine in proper context at nasir.server.com, but if i remove registration strin in sip.conf at client then call to nasir.server.com lands in [default] context.

how can i dial without using register string. or is there any way to include registeration information in dial string ? please help

here is my config…

1- nasir.server.com

[abc]
username=abc
type=friend
secret=mysecret
nat=yes
mailbox=12234568
incominglimit=2
outgoinglimit=2
host=dynamic
dtmfmode=rfc2833
context=payasyougo
canreinvite=yes
callerid=“Nasir Qazi” <12234>
accountcode=6:0:abc
amaflags=default
disallow=all
allow=ulaw
allow=alaw
allow=g729
allow=gsm

2- 192.168.0.254 (client system)

[abc]
type=peer
username=abc
secret=mysecret
host=nasir.server.com
context=default
dtmfmode=rfc2833
canreinvite=yes
insecure=very
disallow=all
allow=ulaw
allow=alaw
allow=g729
allow=gsm
nat=yes
;qualify=yes

[caller]
type=friend
secret=123456
host=dynamic
callerid="caller <12129887777>"
context=out
nat=yes
dtmfmode=rfc2833
canreinvite=yes
insecure=no
disallow=all
allow=ulaw
allow=alaw
allow=g729
allow=gsm
t38_udptl=yes
qualify=yes

I have registered [caller] on xlite at client system and dialing following
context in local system that will dial [abc]

[out]
exten=> _X.,1,Dial(SIP/${EXTEN}@abc,30,1) ; i also tried Dial(SIP/abc/${EXTEN},30,1)
exten=> _X.,n,Hangup

as you can see above *highlighted that context of abc is
payasyougo.*problem is that i want the call to land in that context on
nasir.server.com, which works if i use register string. but without register
string call goes to default context on nasir.server.com

regards,

Nasir Javaid

You will either have to make the client a peer, with static IP address, or make the abc a peer.

(I can’t remember for certain whether peer matches have precedence over user matches.)

yes david

i m using abc as peer. i have tried all things but stuck. here is the trance from * cli

currently using 192.168.0.20 on LAN instead of nasir.server.com

*CLI> [May 14 20:56:37]
<— SIP read from 192.168.0.12:5060 —>
INVITE sip:17185594743@192.168.0.20 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.12:5060;branch=z9hG4bK0d982b0c;rport
Max-Forwards: 70
From: “caller” sip:12129887777@192.168.0.12;tag=as3df8cfa5
To: sip:17185594743@192.168.0.20
Contact: sip:12129887777@192.168.0.12
Call-ID: 1fbc3260763c09e26a2b37755ee8feee@192.168.0.12
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Date: Fri, 14 May 2010 15:55:44 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 308

v=0
o=root 233797198 233797198 IN IP4 192.168.0.12
s=Asterisk PBX 1.6.2.0
c=IN IP4 192.168.0.12
t=0 0
m=audio 16226 RTP/AVP 0 8 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

<------------->
[May 14 20:56:37] — (14 headers 14 lines) —
[May 14 20:56:37] Sending to 192.168.0.12 : 5060 (NAT)
[May 14 20:56:37] Using INVITE request as basis request - 1fbc3260763c09e26a2b37755ee8feee@192.168.0.12
[May 14 20:56:37] Found no matching peer or user for ‘192.168.0.12:5060’
[May 14 20:56:37] Found RTP audio format 0
[May 14 20:56:37] Found RTP audio format 8
[May 14 20:56:37] Found RTP audio format 3
[May 14 20:56:37] Found RTP audio format 101
[May 14 20:56:37] Peer audio RTP is at port 192.168.0.12:16226
[May 14 20:56:37] Found description format PCMU for ID 0
[May 14 20:56:37] Found description format PCMA for ID 8
[May 14 20:56:37] Found description format GSM for ID 3
[May 14 20:56:37] Found description format telephone-event for ID 101
[May 14 20:56:37] Capabilities: us - 0x10e (gsm|ulaw|alaw|g729), peer - audio=0xe (gsm|ulaw|alaw)/video=0x0 (nothing), combined - 0xe (gsm|ulaw|alaw)
[May 14 20:56:37] Non-codec capabilities (dtmf): us - 0x1 (telephone-event), peer - 0x1 (telephone-event), combined - 0x1 (telephone-event)
[May 14 20:56:37] Peer audio RTP is at port 192.168.0.12:16226
[May 14 20:56:37] Looking for 17185594743 in default (domain 192.168.0.20)
[May 14 20:56:37] WARNING[3389]: chan_sip.c:3930 sip_new: setting callerid number to 12129887777
[May 14 20:56:37] list_route: hop: sip:12129887777@192.168.0.12
[May 14 20:56:37]
<— Transmitting (NAT) to 192.168.0.12:5060 —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.0.12:5060;branch=z9hG4bK0d982b0c;received=192.168.0.12;rport=5060
From: “caller” sip:12129887777@192.168.0.12;tag=as3df8cfa5
To: sip:17185594743@192.168.0.20
Call-ID: 1fbc3260763c09e26a2b37755ee8feee@192.168.0.12
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Contact: sip:17185594743@192.168.0.20
Content-Length: 0

You are using it as a friend in the place you will need to change.

tried changing friend to peer but result is same

do you think adding SIP Headers in INVITE can help

like SipAddHeader(Authorization: username=“abc”, realm=“192.168.0.20” …etc

???

I think there is no one that can help in this regard. :frowning:

I have found the solution. may be i can help anyone facing this problem

we need to change “From” and “Contact” header fields in the first INVITE sent to peer. in my case i changed them to [abc] and my problem is solved.

this is working on asterisk systems connected on LAN . have to test it on WAN. hope it works there too.

Nasir Javaid