Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

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

[asterisk-users] Asterisk 13.1.0/PJSIP peer IP address issue


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





PostPosted: Thu Jan 08, 2015 11:16 am    Post subject: [asterisk-users] Asterisk 13.1.0/PJSIP peer IP address issue Reply with quote

I am following the instructions in https://wiki.asterisk.org/wiki/display/AST/Basic+PBX+Functionality and I am trying to make a call from extension Alice (6001) to extension for Bob (6002). When I make the call, I can hear the ringing on Alice's phone (caller), but Bob's phone (callee) doesn't ring, or show a call coming in from Alice. My setup and environment is as follows: Alice, Bob and Asterisk all in the same 192.168.1.0/24 network, and they are able to register to the Asterisk server running 13.1.0/PJSIP. The rest of the configuration is the same as the aforementioned wiki page, but is shown here for clarity:


Quote:
root@asterisk13FFP:/var/log/asterisk# more /etc/asterisk/extensions.conf
[from-internal]
exten=>6001,1,Dial(PJSIP/demo-alice)
exten=>6002,1,Dial(PJSIP/demo-bob)
exten=>6003,1,Answer()
same =>6003,n,Playback(hello-world)
same =>6003,n,Hangup()


What I do observe is that I when I request the output of pjsip show endpoints, I get Contact information for the two SIP peers that have registered different from their actual IP addresses. I suspect this has something to do with their calls being routed elsewhere. If my assumption is correct--how do I fix this? Alice should be at 192.168.1.50 and Bob should be at 192.168.1.149, instead, they (both) show IP address 146.115.163.234. Any help is deeply appreciated. Thanks.


Quote:
asterisk13FFP*CLI> pjsip show endpoints


 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri...............................>  <Status....>  <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <ip/cidr.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time(sec)>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
 =========================================================================================


 Endpoint:  demo-alice                                           Unavailable   0 of inf
     InAuth:  demo-alice/demo-alice
        Aor:  demo-alice                                         1
      Contact:  demo-alice/sip:demo-alice@146.115.163.234:38519  Unknown               nan


 Endpoint:  demo-bob                                             Not in use    0 of inf
     InAuth:  demo-bob/demo-bob
        Aor:  demo-bob                                           1
      Contact:  demo-bob/sip:demo-bob@146.115.163.234:38321;tra  Unknown               nan
Back to top
sgriepentrog at digium...
Guest





PostPosted: Thu Jan 08, 2015 11:48 am    Post subject: [asterisk-users] Asterisk 13.1.0/PJSIP peer IP address issue Reply with quote

It would appear that you have the Asterisk server on a public IP address, your two endpoints are behind a NAT, and you have rewrite_contact enabled in pjsip.conf.


In which case, what you are seeing is correct.  In order to be able to send a call to an extension where it is behind NAT, Asterisk must update the contact to have the current IP and port that the phone registered via (i.e. the WAN IP of the NAT, and the WAN port that it is retaining state for).


On Thu, Jan 8, 2015 at 10:15 AM, Sonny Rajagopalan <sonny.rajagopalan@gmail.com (sonny.rajagopalan@gmail.com)> wrote:
Quote:
I am following the instructions in https://wiki.asterisk.org/wiki/display/AST/Basic+PBX+Functionality and I am trying to make a call from extension Alice (6001) to extension for Bob (6002). When I make the call, I can hear the ringing on Alice's phone (caller), but Bob's phone (callee) doesn't ring, or show a call coming in from Alice. My setup and environment is as follows: Alice, Bob and Asterisk all in the same 192.168.1.0/24 network, and they are able to register to the Asterisk server running 13.1.0/PJSIP. The rest of the configuration is the same as the aforementioned wiki page, but is shown here for clarity:


Quote:
root@asterisk13FFP:/var/log/asterisk# more /etc/asterisk/extensions.conf
[from-internal]
exten=>6001,1,Dial(PJSIP/demo-alice)
exten=>6002,1,Dial(PJSIP/demo-bob)
exten=>6003,1,Answer()
same =>6003,n,Playback(hello-world)
same =>6003,n,Hangup()


What I do observe is that I when I request the output of pjsip show endpoints, I get Contact information for the two SIP peers that have registered different from their actual IP addresses. I suspect this has something to do with their calls being routed elsewhere. If my assumption is correct--how do I fix this? Alice should be at 192.168.1.50 and Bob should be at 192.168.1.149, instead, they (both) show IP address 146.115.163.234. Any help is deeply appreciated. Thanks.


Quote:
asterisk13FFP*CLI> pjsip show endpoints


 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri...............................>  <Status....>  <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <ip/cidr.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time(sec)>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
 =========================================================================================


 Endpoint:  demo-alice                                           Unavailable   0 of inf
     InAuth:  demo-alice/demo-alice
        Aor:  demo-alice                                         1
      Contact:  demo-alice/sip:demo-alice@146.115.163.234:38519  Unknown               nan


 Endpoint:  demo-bob                                             Not in use    0 of inf
     InAuth:  demo-bob/demo-bob
        Aor:  demo-bob                                           1
      Contact:  demo-bob/sip:demo-bob@146.115.163.234:38321;tra  Unknown               nan


--
_____________________________________________________________________
-- 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




--
Scott Griepentrog
Digium, Inc · Software Developer
445 Jan Davis Drive NW · Huntsville, AL 35806 · US
direct/fax: +1 256 428 6239 · mobile: +1 256 580 6090
Check us out at: http://digium.com · http://asterisk.org
Back to top
sonny.rajagopalan at g...
Guest





PostPosted: Thu Jan 08, 2015 2:33 pm    Post subject: [asterisk-users] Asterisk 13.1.0/PJSIP peer IP address issue Reply with quote

Thank you for your note, Scott. 


I set rewrite_contact=yes for both contacts, and I also had to do remove_existing=yes because I had to remove the existing contact information (max_contacts = 1 was preventing new contact information) using pjsip qualify demo-alice etc., after which the right IP addresses showed in pjsip show endpoints. Anyway, it works as expected now, I think. My pjsip.conf is now

Quote:
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0
local_net=192.168.1.0/24
;Templates for the necessary config sections

[endpoint_internal](!)
type=endpoint
context=from-internal
disallow=all
allow=ulaw

[auth_userpass](!)
type=auth
auth_type=userpass

[aor_dynamic](!)
type=aor
max_contacts=1
remove_existing=yes
;Definitions for our phones, using the templates above

[demo-alice](endpoint_internal)
auth=demo-alice
aors=demo-alice
mailboxes=box_a
rewrite_contact=yes
[demo-alice](auth_userpass)
password=demo-alice ; put a strong, unique password here instead
username=demo-alice

[demo-alice](aor_dynamic)

[demo-bob](endpoint_internal)
auth=demo-bob
aors=demo-bob
mailboxes=box_b
rewrite_contact=yes
[demo-bob](auth_userpass)
password=demo-bob ; put a strong, unique password here instead
username=demo-bob

[demo-bob](aor_dynamic)


Thank you for your help!


On Thu, Jan 8, 2015 at 11:48 AM, Scott Griepentrog <sgriepentrog@digium.com (sgriepentrog@digium.com)> wrote:
Quote:
It would appear that you have the Asterisk server on a public IP address, your two endpoints are behind a NAT, and you have rewrite_contact enabled in pjsip.conf.


In which case, what you are seeing is correct.  In order to be able to send a call to an extension where it is behind NAT, Asterisk must update the contact to have the current IP and port that the phone registered via (i.e. the WAN IP of the NAT, and the WAN port that it is retaining state for).


On Thu, Jan 8, 2015 at 10:15 AM, Sonny Rajagopalan <sonny.rajagopalan@gmail.com (sonny.rajagopalan@gmail.com)> wrote:


Quote:
I am following the instructions in https://wiki.asterisk.org/wiki/display/AST/Basic+PBX+Functionality and I am trying to make a call from extension Alice (6001) to extension for Bob (6002). When I make the call, I can hear the ringing on Alice's phone (caller), but Bob's phone (callee) doesn't ring, or show a call coming in from Alice. My setup and environment is as follows: Alice, Bob and Asterisk all in the same 192.168.1.0/24 network, and they are able to register to the Asterisk server running 13.1.0/PJSIP. The rest of the configuration is the same as the aforementioned wiki page, but is shown here for clarity:


Quote:
root@asterisk13FFP:/var/log/asterisk# more /etc/asterisk/extensions.conf
[from-internal]
exten=>6001,1,Dial(PJSIP/demo-alice)
exten=>6002,1,Dial(PJSIP/demo-bob)
exten=>6003,1,Answer()
same =>6003,n,Playback(hello-world)
same =>6003,n,Hangup()


What I do observe is that I when I request the output of pjsip show endpoints, I get Contact information for the two SIP peers that have registered different from their actual IP addresses. I suspect this has something to do with their calls being routed elsewhere. If my assumption is correct--how do I fix this? Alice should be at 192.168.1.50 and Bob should be at 192.168.1.149, instead, they (both) show IP address 146.115.163.234. Any help is deeply appreciated. Thanks.


Quote:
asterisk13FFP*CLI> pjsip show endpoints


 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri...............................>  <Status....>  <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <ip/cidr.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time(sec)>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
 =========================================================================================


 Endpoint:  demo-alice                                           Unavailable   0 of inf
     InAuth:  demo-alice/demo-alice
        Aor:  demo-alice                                         1
      Contact:  demo-alice/sip:demo-alice@146.115.163.234:38519  Unknown               nan


 Endpoint:  demo-bob                                             Not in use    0 of inf
     InAuth:  demo-bob/demo-bob
        Aor:  demo-bob                                           1
      Contact:  demo-bob/sip:demo-bob@146.115.163.234:38321;tra  Unknown               nan




--
_____________________________________________________________________
-- 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




--
Scott Griepentrog
Digium, Inc · Software Developer
445 Jan Davis Drive NW · Huntsville, AL 35806 · US
direct/fax: +1 256 428 6239 · mobile: +1 256 580 6090
Check us out at: http://digium.com · http://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
sonny.rajagopalan at g...
Guest





PostPosted: Thu Jan 08, 2015 8:04 pm    Post subject: [asterisk-users] Asterisk 13.1.0/PJSIP peer IP address issue Reply with quote

Well, I thought it worked, but it actually doesn't--I am able to get the caller pick up the phone, but for some reason, I cannot hear anything on either side no matter who does the calling. Again, my two SIP phones are on the local 192.168.1.0/24 network (do not go over the Internet) and the Asterisk server is located in the same network (not accessed over the Internet). Any help is appreciated.

Does the fact that Asterisk is running on a VirtualBox VM on the same machine as one of the SIP phones matter? I am able to access the ARI REST interface of the Asterisk server quite fine on the host machine.


I suspect it has to do with RTP not being set up, but all the codec support is there. Here's a log for the SIP request from 192.168.1.50:


<--- Received SIP request (1229 bytes) from UDP:192.168.1.50:64009 --->
INVITE sip:6002@192.168.1.139 ([email]sip%3A6002@192.168.1.139[/email]);transport=UDP SIP/2.0
Via: SIP/2.0/UDP 146.115.163.234:64009;branch=z9hG4bK-d8754z-5803642ad92cbd00-1---d8754z-
Max-Forwards: 70
Contact: <sip:demo-alice@146.115.163.234:64009;transport=UDP>
To: <sip:6002@192.168.1.139 ([email]sip%3A6002@192.168.1.139[/email]);transport=UDP>
From: <sip:demo-alice@192.168.1.139 ([email]sip%3Ademo-alice@192.168.1.139[/email]);transport=UDP>;tag=b661670b
Call-ID: YmZiODE4Yzc2NmJmNzY5NDhkM2Y2ZDNhM2U4NTZmZmE.
CSeq: 2 INVITE
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Content-Type: application/sdp
Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri
User-Agent: Z 3.3.21933 r21903

Authorization: Digest username="demo-alice",realm="asterisk",nonce="[removed]",uri="sip:6002@192.168.1.139 ([email]sip%3A6002@192.168.1.139[/email]);transport=UDP",response="[removed]",cnonce="[removed]",nc=00000001,qop=auth,algorithm=md5,opaque="[removed]"

Allow-Events: presence, kpml
Content-Length: 245


v=0
o=Z 0 0 IN IP4 146.115.163.234
s=Z
c=IN IP4 146.115.163.234
t=0 0
m=audio 8000 RTP/AVP 0 3 110 8 98 101
a=rtpmap:110 speex/8000
a=rtpmap:98 iLBC/8000
a=fmtp:98 mode=20
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv


<--- Transmitting SIP response (319 bytes) to UDP:192.168.1.50:64009 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 146.115.163.234:64009;rport=64009;received=192.168.1.50;branch=z9hG4bK-d8754z-5803642ad92cbd00-1---d8754z-
Call-ID: YmZiODE4Yzc2NmJmNzY5NDhkM2Y2ZDNhM2U4NTZmZmE.
From: <sip:demo-alice@192.168.1.139 ([email]sip%3Ademo-alice@192.168.1.139[/email])>;tag=b661670b
To: <sip:6002@192.168.1.139 ([email]sip%3A6002@192.168.1.139[/email])>
CSeq: 2 INVITE
Content-Length:  0

Any help is appreciated. A topology is shown below in ASCII.




                      < ( Big bad Internet ) >


                         GW/NAPT/Router
                                |
      ----------------------------------------------------------
     /                                                           \           
    |                                                            |
   Host A                                                       Host B
-----------------                                               -----------------
| Alice         |                                               | Bob           |
| 192.168.1.50  |                                               | 192.168.1.149 |
|---------------|                                               |---------------|
| Asterisk sr   |
|    (VM)       |
| 192.168.1.239 |
|---------------|


On Thu, Jan 8, 2015 at 2:32 PM, Sonny Rajagopalan <sonny.rajagopalan@gmail.com (sonny.rajagopalan@gmail.com)> wrote:
Quote:
Thank you for your note, Scott. 


I set rewrite_contact=yes for both contacts, and I also had to do remove_existing=yes because I had to remove the existing contact information (max_contacts = 1 was preventing new contact information) using pjsip qualify demo-alice etc., after which the right IP addresses showed in pjsip show endpoints. Anyway, it works as expected now, I think. My pjsip.conf is now

Quote:
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0
local_net=192.168.1.0/24
;Templates for the necessary config sections

[endpoint_internal](!)
type=endpoint
context=from-internal
disallow=all
allow=ulaw

[auth_userpass](!)
type=auth
auth_type=userpass

[aor_dynamic](!)
type=aor
max_contacts=1
remove_existing=yes
;Definitions for our phones, using the templates above

[demo-alice](endpoint_internal)
auth=demo-alice
aors=demo-alice
mailboxes=box_a
rewrite_contact=yes
[demo-alice](auth_userpass)
password=demo-alice ; put a strong, unique password here instead
username=demo-alice

[demo-alice](aor_dynamic)

[demo-bob](endpoint_internal)
auth=demo-bob
aors=demo-bob
mailboxes=box_b
rewrite_contact=yes
[demo-bob](auth_userpass)
password=demo-bob ; put a strong, unique password here instead
username=demo-bob

[demo-bob](aor_dynamic)


Thank you for your help!


On Thu, Jan 8, 2015 at 11:48 AM, Scott Griepentrog <sgriepentrog@digium.com (sgriepentrog@digium.com)> wrote:
Quote:
It would appear that you have the Asterisk server on a public IP address, your two endpoints are behind a NAT, and you have rewrite_contact enabled in pjsip.conf.


In which case, what you are seeing is correct.  In order to be able to send a call to an extension where it is behind NAT, Asterisk must update the contact to have the current IP and port that the phone registered via (i.e. the WAN IP of the NAT, and the WAN port that it is retaining state for).


On Thu, Jan 8, 2015 at 10:15 AM, Sonny Rajagopalan <sonny.rajagopalan@gmail.com (sonny.rajagopalan@gmail.com)> wrote:


Quote:
I am following the instructions in https://wiki.asterisk.org/wiki/display/AST/Basic+PBX+Functionality and I am trying to make a call from extension Alice (6001) to extension for Bob (6002). When I make the call, I can hear the ringing on Alice's phone (caller), but Bob's phone (callee) doesn't ring, or show a call coming in from Alice. My setup and environment is as follows: Alice, Bob and Asterisk all in the same 192.168.1.0/24 network, and they are able to register to the Asterisk server running 13.1.0/PJSIP. The rest of the configuration is the same as the aforementioned wiki page, but is shown here for clarity:


Quote:
root@asterisk13FFP:/var/log/asterisk# more /etc/asterisk/extensions.conf
[from-internal]
exten=>6001,1,Dial(PJSIP/demo-alice)
exten=>6002,1,Dial(PJSIP/demo-bob)
exten=>6003,1,Answer()
same =>6003,n,Playback(hello-world)
same =>6003,n,Hangup()


What I do observe is that I when I request the output of pjsip show endpoints, I get Contact information for the two SIP peers that have registered different from their actual IP addresses. I suspect this has something to do with their calls being routed elsewhere. If my assumption is correct--how do I fix this? Alice should be at 192.168.1.50 and Bob should be at 192.168.1.149, instead, they (both) show IP address 146.115.163.234. Any help is deeply appreciated. Thanks.


Quote:
asterisk13FFP*CLI> pjsip show endpoints


 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri...............................>  <Status....>  <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <ip/cidr.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time(sec)>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
 =========================================================================================


 Endpoint:  demo-alice                                           Unavailable   0 of inf
     InAuth:  demo-alice/demo-alice
        Aor:  demo-alice                                         1
      Contact:  demo-alice/sip:demo-alice@146.115.163.234:38519  Unknown               nan


 Endpoint:  demo-bob                                             Not in use    0 of inf
     InAuth:  demo-bob/demo-bob
        Aor:  demo-bob                                           1
      Contact:  demo-bob/sip:demo-bob@146.115.163.234:38321;tra  Unknown               nan




--
_____________________________________________________________________
-- 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




--
Scott Griepentrog
Digium, Inc · Software Developer
445 Jan Davis Drive NW · Huntsville, AL 35806 · US
direct/fax: +1 256 428 6239 · mobile: +1 256 580 6090
Check us out at: http://digium.com · http://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
sonny.rajagopalan at g...
Guest





PostPosted: Fri Jan 09, 2015 9:48 am    Post subject: [asterisk-users] Asterisk 13.1.0/PJSIP peer IP address issue Reply with quote

Solved!


The issue was that RTP flows were being established to the wrong IP address.


I figured out this issue--I had to disable STUN in both SIP phones for this to work correctly.

Still, I wish a working configuration for Asterisk, and two SIP phones in the same 192.168.1.0/24 network would have helped me tremendously.


On Thu, Jan 8, 2015 at 8:03 PM, Sonny Rajagopalan <sonny.rajagopalan@gmail.com (sonny.rajagopalan@gmail.com)> wrote:
Quote:
Well, I thought it worked, but it actually doesn't--I am able to get the caller pick up the phone, but for some reason, I cannot hear anything on either side no matter who does the calling. Again, my two SIP phones are on the local 192.168.1.0/24 network (do not go over the Internet) and the Asterisk server is located in the same network (not accessed over the Internet). Any help is appreciated.

Does the fact that Asterisk is running on a VirtualBox VM on the same machine as one of the SIP phones matter? I am able to access the ARI REST interface of the Asterisk server quite fine on the host machine.


I suspect it has to do with RTP not being set up, but all the codec support is there. Here's a log for the SIP request from 192.168.1.50:


<--- Received SIP request (1229 bytes) from UDP:192.168.1.50:64009 --->
INVITE sip:6002@192.168.1.139 ([email]sip%3A6002@192.168.1.139[/email]);transport=UDP SIP/2.0
Via: SIP/2.0/UDP 146.115.163.234:64009;branch=z9hG4bK-d8754z-5803642ad92cbd00-1---d8754z-
Max-Forwards: 70
Contact: <sip:demo-alice@146.115.163.234:64009;transport=UDP>
To: <sip:6002@192.168.1.139 ([email]sip%3A6002@192.168.1.139[/email]);transport=UDP>
From: <sip:demo-alice@192.168.1.139 ([email]sip%3Ademo-alice@192.168.1.139[/email]);transport=UDP>;tag=b661670b
Call-ID: YmZiODE4Yzc2NmJmNzY5NDhkM2Y2ZDNhM2U4NTZmZmE.
CSeq: 2 INVITE
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Content-Type: application/sdp
Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri
User-Agent: Z 3.3.21933 r21903

Authorization: Digest username="demo-alice",realm="asterisk",nonce="[removed]",uri="sip:6002@192.168.1.139 ([email]sip%3A6002@192.168.1.139[/email]);transport=UDP",response="[removed]",cnonce="[removed]",nc=00000001,qop=auth,algorithm=md5,opaque="[removed]"

Allow-Events: presence, kpml
Content-Length: 245


v=0
o=Z 0 0 IN IP4 146.115.163.234
s=Z
c=IN IP4 146.115.163.234
t=0 0
m=audio 8000 RTP/AVP 0 3 110 8 98 101
a=rtpmap:110 speex/8000
a=rtpmap:98 iLBC/8000
a=fmtp:98 mode=20
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv


<--- Transmitting SIP response (319 bytes) to UDP:192.168.1.50:64009 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 146.115.163.234:64009;rport=64009;received=192.168.1.50;branch=z9hG4bK-d8754z-5803642ad92cbd00-1---d8754z-
Call-ID: YmZiODE4Yzc2NmJmNzY5NDhkM2Y2ZDNhM2U4NTZmZmE.
From: <sip:demo-alice@192.168.1.139 ([email]sip%3Ademo-alice@192.168.1.139[/email])>;tag=b661670b
To: <sip:6002@192.168.1.139 ([email]sip%3A6002@192.168.1.139[/email])>
CSeq: 2 INVITE
Content-Length:  0

Any help is appreciated. A topology is shown below in ASCII.




                      < ( Big bad Internet ) >


                         GW/NAPT/Router
                                |
      ----------------------------------------------------------
     /                                                           \           
    |                                                            |
   Host A                                                       Host B
-----------------                                               -----------------
| Alice         |                                               | Bob           |
| 192.168.1.50  |                                               | 192.168.1.149 |
|---------------|                                               |---------------|
| Asterisk sr   |
|    (VM)       |
| 192.168.1.239 |
|---------------|


On Thu, Jan 8, 2015 at 2:32 PM, Sonny Rajagopalan <sonny.rajagopalan@gmail.com (sonny.rajagopalan@gmail.com)> wrote:
Quote:
Thank you for your note, Scott. 


I set rewrite_contact=yes for both contacts, and I also had to do remove_existing=yes because I had to remove the existing contact information (max_contacts = 1 was preventing new contact information) using pjsip qualify demo-alice etc., after which the right IP addresses showed in pjsip show endpoints. Anyway, it works as expected now, I think. My pjsip.conf is now

Quote:
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0
local_net=192.168.1.0/24
;Templates for the necessary config sections

[endpoint_internal](!)
type=endpoint
context=from-internal
disallow=all
allow=ulaw

[auth_userpass](!)
type=auth
auth_type=userpass

[aor_dynamic](!)
type=aor
max_contacts=1
remove_existing=yes
;Definitions for our phones, using the templates above

[demo-alice](endpoint_internal)
auth=demo-alice
aors=demo-alice
mailboxes=box_a
rewrite_contact=yes
[demo-alice](auth_userpass)
password=demo-alice ; put a strong, unique password here instead
username=demo-alice

[demo-alice](aor_dynamic)

[demo-bob](endpoint_internal)
auth=demo-bob
aors=demo-bob
mailboxes=box_b
rewrite_contact=yes
[demo-bob](auth_userpass)
password=demo-bob ; put a strong, unique password here instead
username=demo-bob

[demo-bob](aor_dynamic)


Thank you for your help!


On Thu, Jan 8, 2015 at 11:48 AM, Scott Griepentrog <sgriepentrog@digium.com (sgriepentrog@digium.com)> wrote:
Quote:
It would appear that you have the Asterisk server on a public IP address, your two endpoints are behind a NAT, and you have rewrite_contact enabled in pjsip.conf.


In which case, what you are seeing is correct.  In order to be able to send a call to an extension where it is behind NAT, Asterisk must update the contact to have the current IP and port that the phone registered via (i.e. the WAN IP of the NAT, and the WAN port that it is retaining state for).


On Thu, Jan 8, 2015 at 10:15 AM, Sonny Rajagopalan <sonny.rajagopalan@gmail.com (sonny.rajagopalan@gmail.com)> wrote:


Quote:
I am following the instructions in https://wiki.asterisk.org/wiki/display/AST/Basic+PBX+Functionality and I am trying to make a call from extension Alice (6001) to extension for Bob (6002). When I make the call, I can hear the ringing on Alice's phone (caller), but Bob's phone (callee) doesn't ring, or show a call coming in from Alice. My setup and environment is as follows: Alice, Bob and Asterisk all in the same 192.168.1.0/24 network, and they are able to register to the Asterisk server running 13.1.0/PJSIP. The rest of the configuration is the same as the aforementioned wiki page, but is shown here for clarity:


Quote:
root@asterisk13FFP:/var/log/asterisk# more /etc/asterisk/extensions.conf
[from-internal]
exten=>6001,1,Dial(PJSIP/demo-alice)
exten=>6002,1,Dial(PJSIP/demo-bob)
exten=>6003,1,Answer()
same =>6003,n,Playback(hello-world)
same =>6003,n,Hangup()


What I do observe is that I when I request the output of pjsip show endpoints, I get Contact information for the two SIP peers that have registered different from their actual IP addresses. I suspect this has something to do with their calls being routed elsewhere. If my assumption is correct--how do I fix this? Alice should be at 192.168.1.50 and Bob should be at 192.168.1.149, instead, they (both) show IP address 146.115.163.234. Any help is deeply appreciated. Thanks.


Quote:
asterisk13FFP*CLI> pjsip show endpoints


 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri...............................>  <Status....>  <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <ip/cidr.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time(sec)>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
 =========================================================================================


 Endpoint:  demo-alice                                           Unavailable   0 of inf
     InAuth:  demo-alice/demo-alice
        Aor:  demo-alice                                         1
      Contact:  demo-alice/sip:demo-alice@146.115.163.234:38519  Unknown               nan


 Endpoint:  demo-bob                                             Not in use    0 of inf
     InAuth:  demo-bob/demo-bob
        Aor:  demo-bob                                           1
      Contact:  demo-bob/sip:demo-bob@146.115.163.234:38321;tra  Unknown               nan




--
_____________________________________________________________________
-- 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




--
Scott Griepentrog
Digium, Inc · Software Developer
445 Jan Davis Drive NW · Huntsville, AL 35806 · US
direct/fax: +1 256 428 6239 · mobile: +1 256 580 6090
Check us out at: http://digium.com · http://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
sgriepentrog at digium...
Guest





PostPosted: Fri Jan 09, 2015 2:24 pm    Post subject: [asterisk-users] Asterisk 13.1.0/PJSIP peer IP address issue Reply with quote

​To sort out RTP problems, I would recommend:


1) on all endpoints use codec of allow=!all,ulaw  -- this is or should be supported by all endpoints and eliminates any issues of mismatch, translation, etc., and can be adjusted later once everything is working


2) add an Echo() application to your dialplan so you can call it and check ​RTP to and from Asterisk


3) start with direct_media=no to run all the RTP through Asterisk first


4) packet capture at/on the asterisk server, as well as at endpoints if need be, to identfy if and where RTP streams are being sent and received.


The goal being to get two way audio calls up through Asterisk, and then change one thing at a time towards your desired configuration and retest.




On Thu, Jan 8, 2015 at 7:03 PM, Sonny Rajagopalan <sonny.rajagopalan@gmail.com (sonny.rajagopalan@gmail.com)> wrote:
Quote:
Well, I thought it worked, but it actually doesn't--I am able to get the caller pick up the phone, but for some reason, I cannot hear anything on either side no matter who does the calling. Again, my two SIP phones are on the local 192.168.1.0/24 network (do not go over the Internet) and the Asterisk server is located in the same network (not accessed over the Internet). Any help is appreciated.

Does the fact that Asterisk is running on a VirtualBox VM on the same machine as one of the SIP phones matter? I am able to access the ARI REST interface of the Asterisk server quite fine on the host machine.


I suspect it has to do with RTP not being set up, but all the codec support is there. Here's a log for the SIP request from 192.168.1.50:


<--- Received SIP request (1229 bytes) from UDP:192.168.1.50:64009 --->
INVITE sip:6002@192.168.1.139 ([email]sip%3A6002@192.168.1.139[/email]);transport=UDP SIP/2.0
Via: SIP/2.0/UDP 146.115.163.234:64009;branch=z9hG4bK-d8754z-5803642ad92cbd00-1---d8754z-
Max-Forwards: 70
Contact: <sip:demo-alice@146.115.163.234:64009;transport=UDP>
To: <sip:6002@192.168.1.139 ([email]sip%3A6002@192.168.1.139[/email]);transport=UDP>
From: <sip:demo-alice@192.168.1.139 ([email]sip%3Ademo-alice@192.168.1.139[/email]);transport=UDP>;tag=b661670b
Call-ID: YmZiODE4Yzc2NmJmNzY5NDhkM2Y2ZDNhM2U4NTZmZmE.
CSeq: 2 INVITE
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Content-Type: application/sdp
Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri
User-Agent: Z 3.3.21933 r21903

Authorization: Digest username="demo-alice",realm="asterisk",nonce="[removed]",uri="sip:6002@192.168.1.139 ([email]sip%3A6002@192.168.1.139[/email]);transport=UDP",response="[removed]",cnonce="[removed]",nc=00000001,qop=auth,algorithm=md5,opaque="[removed]"

Allow-Events: presence, kpml
Content-Length: 245


v=0
o=Z 0 0 IN IP4 146.115.163.234
s=Z
c=IN IP4 146.115.163.234
t=0 0
m=audio 8000 RTP/AVP 0 3 110 8 98 101
a=rtpmap:110 speex/8000
a=rtpmap:98 iLBC/8000
a=fmtp:98 mode=20
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv


<--- Transmitting SIP response (319 bytes) to UDP:192.168.1.50:64009 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 146.115.163.234:64009;rport=64009;received=192.168.1.50;branch=z9hG4bK-d8754z-5803642ad92cbd00-1---d8754z-
Call-ID: YmZiODE4Yzc2NmJmNzY5NDhkM2Y2ZDNhM2U4NTZmZmE.
From: <sip:demo-alice@192.168.1.139 ([email]sip%3Ademo-alice@192.168.1.139[/email])>;tag=b661670b
To: <sip:6002@192.168.1.139 ([email]sip%3A6002@192.168.1.139[/email])>
CSeq: 2 INVITE
Content-Length:  0

Any help is appreciated. A topology is shown below in ASCII.




                      < ( Big bad Internet ) >


                         GW/NAPT/Router
                                |
      ----------------------------------------------------------
     /                                                           \           
    |                                                            |
   Host A                                                       Host B
-----------------                                               -----------------
| Alice         |                                               | Bob           |
| 192.168.1.50  |                                               | 192.168.1.149 |
|---------------|                                               |---------------|
| Asterisk sr   |
|    (VM)       |
| 192.168.1.239 |
|---------------|


On Thu, Jan 8, 2015 at 2:32 PM, Sonny Rajagopalan <sonny.rajagopalan@gmail.com (sonny.rajagopalan@gmail.com)> wrote:
Quote:
Thank you for your note, Scott. 


I set rewrite_contact=yes for both contacts, and I also had to do remove_existing=yes because I had to remove the existing contact information (max_contacts = 1 was preventing new contact information) using pjsip qualify demo-alice etc., after which the right IP addresses showed in pjsip show endpoints. Anyway, it works as expected now, I think. My pjsip.conf is now

Quote:
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0
local_net=192.168.1.0/24
;Templates for the necessary config sections

[endpoint_internal](!)
type=endpoint
context=from-internal
disallow=all
allow=ulaw

[auth_userpass](!)
type=auth
auth_type=userpass

[aor_dynamic](!)
type=aor
max_contacts=1
remove_existing=yes
;Definitions for our phones, using the templates above

[demo-alice](endpoint_internal)
auth=demo-alice
aors=demo-alice
mailboxes=box_a
rewrite_contact=yes
[demo-alice](auth_userpass)
password=demo-alice ; put a strong, unique password here instead
username=demo-alice

[demo-alice](aor_dynamic)

[demo-bob](endpoint_internal)
auth=demo-bob
aors=demo-bob
mailboxes=box_b
rewrite_contact=yes
[demo-bob](auth_userpass)
password=demo-bob ; put a strong, unique password here instead
username=demo-bob

[demo-bob](aor_dynamic)


Thank you for your help!


On Thu, Jan 8, 2015 at 11:48 AM, Scott Griepentrog <sgriepentrog@digium.com (sgriepentrog@digium.com)> wrote:
Quote:
It would appear that you have the Asterisk server on a public IP address, your two endpoints are behind a NAT, and you have rewrite_contact enabled in pjsip.conf.


In which case, what you are seeing is correct.  In order to be able to send a call to an extension where it is behind NAT, Asterisk must update the contact to have the current IP and port that the phone registered via (i.e. the WAN IP of the NAT, and the WAN port that it is retaining state for).


On Thu, Jan 8, 2015 at 10:15 AM, Sonny Rajagopalan <sonny.rajagopalan@gmail.com (sonny.rajagopalan@gmail.com)> wrote:


Quote:
I am following the instructions in https://wiki.asterisk.org/wiki/display/AST/Basic+PBX+Functionality and I am trying to make a call from extension Alice (6001) to extension for Bob (6002). When I make the call, I can hear the ringing on Alice's phone (caller), but Bob's phone (callee) doesn't ring, or show a call coming in from Alice. My setup and environment is as follows: Alice, Bob and Asterisk all in the same 192.168.1.0/24 network, and they are able to register to the Asterisk server running 13.1.0/PJSIP. The rest of the configuration is the same as the aforementioned wiki page, but is shown here for clarity:


Quote:
root@asterisk13FFP:/var/log/asterisk# more /etc/asterisk/extensions.conf
[from-internal]
exten=>6001,1,Dial(PJSIP/demo-alice)
exten=>6002,1,Dial(PJSIP/demo-bob)
exten=>6003,1,Answer()
same =>6003,n,Playback(hello-world)
same =>6003,n,Hangup()


What I do observe is that I when I request the output of pjsip show endpoints, I get Contact information for the two SIP peers that have registered different from their actual IP addresses. I suspect this has something to do with their calls being routed elsewhere. If my assumption is correct--how do I fix this? Alice should be at 192.168.1.50 and Bob should be at 192.168.1.149, instead, they (both) show IP address 146.115.163.234. Any help is deeply appreciated. Thanks.


Quote:
asterisk13FFP*CLI> pjsip show endpoints


 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri...............................>  <Status....>  <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <ip/cidr.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time(sec)>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
 =========================================================================================


 Endpoint:  demo-alice                                           Unavailable   0 of inf
     InAuth:  demo-alice/demo-alice
        Aor:  demo-alice                                         1
      Contact:  demo-alice/sip:demo-alice@146.115.163.234:38519  Unknown               nan


 Endpoint:  demo-bob                                             Not in use    0 of inf
     InAuth:  demo-bob/demo-bob
        Aor:  demo-bob                                           1
      Contact:  demo-bob/sip:demo-bob@146.115.163.234:38321;tra  Unknown               nan




--
_____________________________________________________________________
-- 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




--
Scott Griepentrog
Digium, Inc · Software Developer
445 Jan Davis Drive NW · Huntsville, AL 35806 · US
direct/fax: +1 256 428 6239 · mobile: +1 256 580 6090
Check us out at: http://digium.com · http://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












--
_____________________________________________________________________
-- 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




--
Scott Griepentrog
Digium, Inc · Software Developer
445 Jan Davis Drive NW · Huntsville, AL 35806 · US
direct/fax: +1 256 428 6239 · mobile: +1 256 580 6090
Check us out at: http://digium.com · http://asterisk.org
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