Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[asterisk-users] Connecting 2 asterisks, one with PJSIP and other SIP returning 401


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users
View previous topic :: View next topic  
Author Message
gmc at gmc.uy
Guest





PostPosted: Wed Apr 16, 2014 4:26 pm    Post subject: [asterisk-users] Connecting 2 asterisks, one with PJSIP and Reply with quote

It's my first post here, so I'll cut to the chase


I have 2 Asterisk servers and want to connect them using sip on one and pjsip on the other one. One is running at home and another at a VPS. The first one will be the client (with dynamic ip) and the 2nd the server.
The client uses sip and the server pjsip.
This is the client's sip.conf
Quote:
[general]
context = default
allowguest = no
realm = myrealm.com
udpbindaddr = 0.0.0.0
qualify = yes
subscribecontext = default
localnet=192.168.1.0/255.255.255.0
externhost=myhost.com
externrefresh=30
dtmfmode = auto
canreinvite = no
jbenable = no
sendrpid = yes
trustrpid = no
disallow=all
allow=ulaw
allow=alaw
register => myuser:mypass@vpsserver

[vpsserver]
type=friend
secret=myuser
defaultuser=mypass
host=vpsserver.domain.com
context=inbound
canreinvite=no
insecure=port,invite

And this is the server's pjsip.conf
Quote:
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0

[home]
type=endpoint
context=trusted
disallow=all
allow=ulaw
allow=alaw
transport=transport-udp
auth=home
aors=home

[home]
type=auth
auth_type=userpass
password=mypass
username=myuser

[home]
type=aor
max_contacts=10

When I check on the client, executing sip show registry I get
Quote:
Host dnsmgr Username Refresh State Reg.Time
vpsserver:5060 N myuser 104 Registered Tue, 15 Apr 2014 22:57:34

which I guess means everything is ok... on the client side, I have on my extensions.conf
Quote:
exten => 66,1,Dial(SIP/1@vpsserver)

and on the server's extensions.conf (in the trusted context) I have
Quote:
exten => 1,1,Playback(hello-world)

So far so good... but when I dial 66 on my client Asterisk, I see the following SIP dialog on the server... the only weird thing is that I see some From: 192.168.1.112 (that's my home Asterisk's internal IP... the externhost works fine for all the providers I'm using, so I doubt that's an issue)
http://pastebin.com/hkFezB8j

Thanks in advance!
Back to top
gmc at gmc.uy
Guest





PostPosted: Wed Apr 16, 2014 6:03 pm    Post subject: [asterisk-users] Connecting 2 asterisks, one with PJSIP and Reply with quote

Just a heads up... Enabled NOTICEs on the server and I see this every 10 seconds or so
Quote:
[Apr 16 18:58:28] NOTICE[2138]: res_pjsip/pjsip_distributor.c:246 log_unidentified_request: Request from '"asterisk" <sip:asterisk@179.25.158.95 ([email]sip%3Aasterisk@179.25.158.95[/email])>' failed for '179.25.158.95:5060' (callid: 477ca2fd0db3a5542dcf2afd50673b89@179.25.158.95:5060) - No matching endpoint found
Thanks in advance for any help / ideas / clues or something! I'm scratching my head around this and at this point




On Wed, Apr 16, 2014 at 6:26 PM, Gervasio Marchand Cassataro <gmc@gmc.uy (gmc@gmc.uy)> wrote:
Quote:
It's my first post here, so I'll cut to the chase


I have 2 Asterisk servers and want to connect them using sip on one and pjsip on the other one. One is running at home and another at a VPS. The first one will be the client (with dynamic ip) and the 2nd the server.
The client uses sip and the server pjsip.
This is the client's sip.conf
Quote:
[general]
context = default
allowguest = no
realm = myrealm.com
udpbindaddr = 0.0.0.0
qualify = yes
subscribecontext = default
localnet=192.168.1.0/255.255.255.0
externhost=myhost.com
externrefresh=30
dtmfmode = auto
canreinvite = no
jbenable = no
sendrpid = yes
trustrpid = no
disallow=all
allow=ulaw
allow=alaw
register => myuser:mypass@vpsserver

[vpsserver]
type=friend
secret=myuser
defaultuser=mypass
host=vpsserver.domain.com
context=inbound
canreinvite=no
insecure=port,invite

And this is the server's pjsip.conf
Quote:
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0

[home]
type=endpoint
context=trusted
disallow=all
allow=ulaw
allow=alaw
transport=transport-udp
auth=home
aors=home

[home]
type=auth
auth_type=userpass
password=mypass
username=myuser

[home]
type=aor
max_contacts=10

When I check on the client, executing sip show registry I get
Quote:
Host dnsmgr Username Refresh State Reg.Time
vpsserver:5060 N myuser 104 Registered Tue, 15 Apr 2014 22:57:34

which I guess means everything is ok... on the client side, I have on my extensions.conf
Quote:
exten => 66,1,Dial(SIP/1@vpsserver)

and on the server's extensions.conf (in the trusted context) I have
Quote:
exten => 1,1,Playback(hello-world)

So far so good... but when I dial 66 on my client Asterisk, I see the following SIP dialog on the server... the only weird thing is that I see some From: 192.168.1.112 (that's my home Asterisk's internal IP... the externhost works fine for all the providers I'm using, so I doubt that's an issue)
http://pastebin.com/hkFezB8j

Thanks in advance!

Back to top
gmc at gmc.uy
Guest





PostPosted: Fri Apr 18, 2014 7:24 am    Post subject: [asterisk-users] Connecting 2 asterisks, one with PJSIP and Reply with quote

I'm not exactly nailing it in participation on my thread, so I swear this is my last message if no one replies Wink

I went ahead and enabled full debugging, and got some interesting results (available at http://pastebin.com/KiY6DMHi)


What I see is:
  1. The registration works fine
  2. When the client tries to establish a call to the server, the server looks into either the From or Contact headers... but the client sends the caller id in that place and that's when the INVITE gets rejected
I guess a proper question would be "Is there any way on the sip.conf to specify the contact (I think that s@ip would work, as that's registered on the client) or on the pjsip.conf to whitelist the ip of a registered contact? something like insecure=invite"



Thanks!



On Wed, Apr 16, 2014 at 8:02 PM, Gervasio Marchand Cassataro <gmc@gmc.uy (gmc@gmc.uy)> wrote:
Quote:
Just a heads up... Enabled NOTICEs on the server and I see this every 10 seconds or so
Quote:
[Apr 16 18:58:28] NOTICE[2138]: res_pjsip/pjsip_distributor.c:246 log_unidentified_request: Request from '"asterisk" <sip:asterisk@179.25.158.95 ([email]sip%3Aasterisk@179.25.158.95[/email])>' failed for '179.25.158.95:5060' (callid: 477ca2fd0db3a5542dcf2afd50673b89@179.25.158.95:5060) - No matching endpoint found
Thanks in advance for any help / ideas / clues or something! I'm scratching my head around this and at this point




On Wed, Apr 16, 2014 at 6:26 PM, Gervasio Marchand Cassataro <gmc@gmc.uy (gmc@gmc.uy)> wrote:
Quote:
It's my first post here, so I'll cut to the chase


I have 2 Asterisk servers and want to connect them using sip on one and pjsip on the other one. One is running at home and another at a VPS. The first one will be the client (with dynamic ip) and the 2nd the server.
The client uses sip and the server pjsip.
This is the client's sip.conf
Quote:
[general]
context = default
allowguest = no
realm = myrealm.com
udpbindaddr = 0.0.0.0
qualify = yes
subscribecontext = default
localnet=192.168.1.0/255.255.255.0
externhost=myhost.com
externrefresh=30
dtmfmode = auto
canreinvite = no
jbenable = no
sendrpid = yes
trustrpid = no
disallow=all
allow=ulaw
allow=alaw
register => myuser:mypass@vpsserver

[vpsserver]
type=friend
secret=myuser
defaultuser=mypass
host=vpsserver.domain.com
context=inbound
canreinvite=no
insecure=port,invite

And this is the server's pjsip.conf
Quote:
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0

[home]
type=endpoint
context=trusted
disallow=all
allow=ulaw
allow=alaw
transport=transport-udp
auth=home
aors=home

[home]
type=auth
auth_type=userpass
password=mypass
username=myuser

[home]
type=aor
max_contacts=10

When I check on the client, executing sip show registry I get
Quote:
Host dnsmgr Username Refresh State Reg.Time
vpsserver:5060 N myuser 104 Registered Tue, 15 Apr 2014 22:57:34

which I guess means everything is ok... on the client side, I have on my extensions.conf
Quote:
exten => 66,1,Dial(SIP/1@vpsserver)

and on the server's extensions.conf (in the trusted context) I have
Quote:
exten => 1,1,Playback(hello-world)

So far so good... but when I dial 66 on my client Asterisk, I see the following SIP dialog on the server... the only weird thing is that I see some From: 192.168.1.112 (that's my home Asterisk's internal IP... the externhost works fine for all the providers I'm using, so I doubt that's an issue)
http://pastebin.com/hkFezB8j

Thanks in advance!






Back to top
gmc at gmc.uy
Guest





PostPosted: Fri Apr 18, 2014 7:48 am    Post subject: [asterisk-users] Connecting 2 asterisks, one with PJSIP and Reply with quote

I know I promised it... but... I FIGURED IT OUT!!!

So, I'll just reply so that the next one with this issue can find this


The only bit of information was using fromuser instead of defaultuser... that only thing did the trick... so


[vpsserver]
type=friend
host=vpsserver.domain.com
context=inbound
fromuser=myuser
secret=mypass



on the client's sip.conf did the trick



On Fri, Apr 18, 2014 at 9:24 AM, Gervasio Marchand Cassataro <gmc@gmc.uy (gmc@gmc.uy)> wrote:
Quote:
I'm not exactly nailing it in participation on my thread, so I swear this is my last message if no one replies Wink

I went ahead and enabled full debugging, and got some interesting results (available at http://pastebin.com/KiY6DMHi)


What I see is:
  1. The registration works fine
  2. When the client tries to establish a call to the server, the server looks into either the From or Contact headers... but the client sends the caller id in that place and that's when the INVITE gets rejected
I guess a proper question would be "Is there any way on the sip.conf to specify the contact (I think that s@ip would work, as that's registered on the client) or on the pjsip.conf to whitelist the ip of a registered contact? something like insecure=invite"



Thanks!



On Wed, Apr 16, 2014 at 8:02 PM, Gervasio Marchand Cassataro <gmc@gmc.uy (gmc@gmc.uy)> wrote:
Quote:
Just a heads up... Enabled NOTICEs on the server and I see this every 10 seconds or so
Quote:
[Apr 16 18:58:28] NOTICE[2138]: res_pjsip/pjsip_distributor.c:246 log_unidentified_request: Request from '"asterisk" <sip:asterisk@179.25.158.95 ([email]sip%3Aasterisk@179.25.158.95[/email])>' failed for '179.25.158.95:5060' (callid: 477ca2fd0db3a5542dcf2afd50673b89@179.25.158.95:5060) - No matching endpoint found
Thanks in advance for any help / ideas / clues or something! I'm scratching my head around this and at this point




On Wed, Apr 16, 2014 at 6:26 PM, Gervasio Marchand Cassataro <gmc@gmc.uy (gmc@gmc.uy)> wrote:
Quote:
It's my first post here, so I'll cut to the chase


I have 2 Asterisk servers and want to connect them using sip on one and pjsip on the other one. One is running at home and another at a VPS. The first one will be the client (with dynamic ip) and the 2nd the server.
The client uses sip and the server pjsip.
This is the client's sip.conf
Quote:
[general]
context = default
allowguest = no
realm = myrealm.com
udpbindaddr = 0.0.0.0
qualify = yes
subscribecontext = default
localnet=192.168.1.0/255.255.255.0
externhost=myhost.com
externrefresh=30
dtmfmode = auto
canreinvite = no
jbenable = no
sendrpid = yes
trustrpid = no
disallow=all
allow=ulaw
allow=alaw
register => myuser:mypass@vpsserver

[vpsserver]
type=friend
secret=myuser
defaultuser=mypass
host=vpsserver.domain.com
context=inbound
canreinvite=no
insecure=port,invite

And this is the server's pjsip.conf
Quote:
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0

[home]
type=endpoint
context=trusted
disallow=all
allow=ulaw
allow=alaw
transport=transport-udp
auth=home
aors=home

[home]
type=auth
auth_type=userpass
password=mypass
username=myuser

[home]
type=aor
max_contacts=10

When I check on the client, executing sip show registry I get
Quote:
Host dnsmgr Username Refresh State Reg.Time
vpsserver:5060 N myuser 104 Registered Tue, 15 Apr 2014 22:57:34

which I guess means everything is ok... on the client side, I have on my extensions.conf
Quote:
exten => 66,1,Dial(SIP/1@vpsserver)

and on the server's extensions.conf (in the trusted context) I have
Quote:
exten => 1,1,Playback(hello-world)

So far so good... but when I dial 66 on my client Asterisk, I see the following SIP dialog on the server... the only weird thing is that I see some From: 192.168.1.112 (that's my home Asterisk's internal IP... the externhost works fine for all the providers I'm using, so I doubt that's an issue)
http://pastebin.com/hkFezB8j

Thanks in advance!











Back to top
jcolp at digium.com
Guest





PostPosted: Fri Apr 18, 2014 8:46 am    Post subject: [asterisk-users] Connecting 2 asterisks, one with PJSIP and Reply with quote

Gervasio Marchand Cassataro wrote:
Quote:
I know I promised it... but... I FIGURED IT OUT!!!

So, I'll just reply so that the next one with this issue can find this

The only bit of information was using fromuser instead of defaultuser...
that only thing did the trick... so

[vpsserver]
type=friend
host=vpsserver.domain.com <http://vpsserver.domain.com>
context=inbound
fromuser=myuser
secret=mypass

on the client's sip.conf did the trick

I don't know why I didn't see this earlier but yes, the currently
available endpoint identifiers do not include a mechanism to match based
on the information a device may have registered with to an AOR. As
you've figured out using fromuser does allow the user endpoint
identifier to find the endpoint and then it works happily.

Cheers,

--
Joshua Colp
Digium, Inc. | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services