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

Sonny Rajagopalan sonny.rajagopalan at gmail.com
Thu Jan 8 13:32:43 CST 2015


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

[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 at digium.com>
wrote:

> 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 at gmail.com> wrote:
>
>> 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:
>>
>> root at 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.
>>
>> 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
>>
>
>
>
> --
> [image: Digium logo]
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20150108/ced0d1c0/attachment.html>


More information about the asterisk-users mailing list