Dynamic Ip address

I’m making a call with the same IP address. If I want to make a call from one IP address to another, how is it possible?
I want to make the IP address dynamic, so that a call can be made from one extension to another, regardless of the IP address. For example, if extension 1 is connected to an IP address, suppose 123.456.51, and the second extension is connected to another IP address, suppose 145.543.68, I want to be able to make a call between them. Currently, the call is only possible if both extensions have the same IP address. How can this be made possible?

[167]
auth_type=userpass
type=auth
username=167
password=167

[167]
type=aor
qualify_frequency=60
max_contacts=1
remove_existing=yes
qualify_timeout=3.0
authenticate_qualify=no

[167]
context=internal
auth=167
aors=167
type=endpoint
language=en
deny=0.0.0.0/0.0.0.0
trust_id_inbound=yes
send_rpid=no
transport=tcp_transport
rtcp_mux=no
call_group=
pickup_group=
disallow=all
allow=ulaw,alaw,gsm
mailboxes=300
permit=0.0.0.0/0.0.0.0
ice_support=no
use_avpf=no
dtls_cert_file=
dtls_private_key=
dtls_ca_file=
dtls_setup=actpass
dtls_verify=no
media_encryption=no
message_context=
subscribe_context=
allow_subscribe=yes
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
direct_media=no
media_use_received_transport=no
callerid=“linuxhelp” <167>

[168]
auth_type=userpass
type=auth
username=168
password=168

[168]
type=aor
qualify_frequency=60
max_contacts=1
remove_existing=yes
qualify_timeout=3.0
authenticate_qualify=no

[168]
context=internal
auth=168
aors=168
type=endpoint
language=en
deny=0.0.0.0/0.0.0.0
trust_id_inbound=yes
send_rpid=no
transport=tcp_transport
rtcp_mux=no
call_group=
pickup_group=
disallow=all
allow=ulaw,alaw,gsm
mailboxes=300
permit=0.0.0.0/0.0.0.0
ice_support=no
use_avpf=no
dtls_cert_file=
dtls_private_key=
dtls_ca_file=
dtls_setup=actpass
dtls_verify=no
media_encryption=no
message_context=
subscribe_context=
allow_subscribe=yes
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
direct_media=no
media_use_received_transport=no
callerid=“linuxhelp2” <168>

[tcp_transport]
type=transport ; Must be of type ‘transport’
protocol=tcp
bind=0.0.0.0
tos=cs3
cos=3
allow_reload=false
[udp_transport]
type=transport ; Must be of type ‘transport’
protocol=udp
bind=0.0.0.0
tos=cs3
cos=3
allow_reload=false

They are already set up to be dynamic. Each has to register to Asterisk so it knows the IP address, after which calling:

Dial(PJSIP/167)

Or:

Dial(PJSIP/168)

In the dialplan would call them respectively.

If this isn’t working, then you’ll need to be more detailed and specific about what is happening and show logging and SIP trace (pjsip set logger on).

I am running Asterisk on my local device, and the call connects successfully when using the same Wi-Fi network. However, if the internet IP is different, the call does not go through, and softphones also fail to register to the server.

Then you’d need to troubleshoot further. Are the REGISTER attempts even reaching Asterisk? If not, then you have network or issues outside of Asterisk.

If the Asterisk server and your softphone devices are connected to the same internet, it connects the call. If the device and server are connected to different internets, it doesn’t register the softphone. Meaning, if they are connected to the same internet, it connects and also makes the call. For example, if my server is connected to one internet and the devices are connected to another, it won’t connect.
I want the devices and server to be on different internet networks, and I want to be able to call from one server extension to another server extension.

Linux is trying quite hard to connect to THE Internet. If you have two disjoint internets, things get difficult, although there is good support for when one is THE internet, the other an intranet, and the address ranges are disjoint.

Although “internet” in IP means a connected set of networks, most people read it as THE Internet, so your reference to two internets is confusing, and you probably need to find a different term, and or give very detailed network diagrams.

(It’s also possible that you are talking of broken multi-homing, where you connect to THE Internet on two addresses, but don’t have the autonomous system number and border gateway protocol support to make that work smoothly.)

For example, I have two servers. I want to make a call from an extension on Server A to an extension on Server B. How is this possible? Can you provide an example?

On Monday 26 February 2024 at 10:31:54, zaryabgithub via Asterisk Community
wrote:

For example, I have two servers. I want to make a call from an extension on
Server A to an extension on Server B. How is this possible? Can you
provide an example?

I would create an IAX connection between the two machines, choose a naming or
numbering convention for the users on each (for example, 1xxx means the users
on server A and 2xxx means the users on server B), and then in the dialplan on
A, numbers 1xxx are simply dialled locally, 2xxx are sent over IAX. Do the
opposite on server B.

If you have more questions about how to implement any particular part of this,
please give more detail and describe the specific problem you’re running into.

Antony.


“Hi, I’ve found a fault with the English language and I need an entomologist.”
“I think you mean an etymologist.”
“No. It’s a bug, not a feature.”

                                               Please reply to the list;
                                                     please *don't* CC me.

I am new to learning Asterisk, and I don’t know how to configure the iax2.conf file. I am also not finding any proper documentation with example configuration files, and even if there are videos, they are very old. If you could provide me with proper configuration with proper explanation or any reference where there are proper examples so that I can learn asterisk from there.

You can also do it with SIP.

Certainly for SIP, and probably for IAX, the calling Asterisk client user agent treats the call like a call to an ITSP, and the called Asterisk server user agent treats it like an incoming call from an ITSP.

As with an external provider at least one Asterisk must have a static address, as REGISTER requires a static registrar address.

The easiest setup to simulate is “IP authentication”, but that requires both sides to have static addresses. For that. you just need to remove the registration and authentication information from both sides in the example ITSP configuration.

If only one side is static, you need to use a phone type type=aor section on the side with the static address, and to keep the type=registration entry on the other side. You will generally need outbound authentication on the registering side

In both cases, you have the option of authenticating both ways (although registration is always outbound).

PS. I think you mean phone, not extension, in Asterisk terminology.

[167]
auth_type=userpass
type=auth
username=167
password=167

[167]
type=aor
qualify_frequency=60
max_contacts=1
remove_existing=yes
qualify_timeout=3.0
authenticate_qualify=no

[167]
context=internal
auth=167
aors=167
type=endpoint
language=en
deny=0.0.0.0/0.0.0.0
trust_id_inbound=yes
send_rpid=no
transport=tcp_transport
rtcp_mux=no
call_group=
pickup_group=
disallow=all
allow=ulaw,alaw,gsm
mailboxes=300
permit=0.0.0.0/0.0.0.0
ice_support=no
use_avpf=no
dtls_cert_file=
dtls_private_key=
dtls_ca_file=
dtls_setup=actpass
dtls_verify=no
media_encryption=no
message_context=
subscribe_context=
allow_subscribe=yes
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
direct_media=no
media_use_received_transport=no
callerid=“linuxhelp” <167>

[168]
auth_type=userpass
type=auth
username=168
password=168

[168]
type=aor
qualify_frequency=60
max_contacts=1
remove_existing=yes
qualify_timeout=3.0
authenticate_qualify=no

[168]
context=internal
auth=168
aors=168
type=endpoint
language=en
deny=0.0.0.0/0.0.0.0
trust_id_inbound=yes
send_rpid=no
transport=tcp_transport
rtcp_mux=no
call_group=
pickup_group=
disallow=all
allow=ulaw,alaw,gsm
mailboxes=300
permit=0.0.0.0/0.0.0.0
ice_support=no
use_avpf=no
dtls_cert_file=
dtls_private_key=
dtls_ca_file=
dtls_setup=actpass
dtls_verify=no
media_encryption=no
message_context=
subscribe_context=
allow_subscribe=yes
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
direct_media=no
media_use_received_transport=no
callerid=“linuxhelp2” <168>

[tcp_transport]
type=transport ; Must be of type ‘transport’
protocol=tcp
bind=0.0.0.0
tos=cs3
cos=3
allow_reload=false
[udp_transport]
type=transport ; Must be of type ‘transport’
protocol=udp
bind=0.0.0.0
tos=cs3
cos=3
allow_reload=false

this is my pjsip.conf file

[internal]
exten => 167,1,Dial(PJSIP/167)
exten => 168,2,Dial(PJSIP/168)

this is my
extensions.conf file

What changes should I make in the configuration file on the both server so that I can call an extension from Server A to Server B?

Add endpoint, identify and aor sections for the other Asterisk machine. Optionally add auth section(s). Optionally add registration to one side (you are out of luck if you need it on both sides).
Endpoints need to be in a context that can dial the final destination.

Add a dialplan extension that forwards the call to the endpoint for the other machine. with the final extension number as the dialled digits. (Note that traditional practice is to structure numbers, so that the prefix determines the final machine. That could be a like a long distance code on the PSTN, or it could be be grouping extensions into ranges and always including the prefix.)

If you want more specific details, I’d suggest using the Jobs section to hire a consultant.

PS you configuration file is very noisy. People could easily miss an important wrong setting. It is best to just include the options you really need.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.