How to configure dongle <-> sip?

Please advise how to properly configure Asterisk to:

  1. Route all incoming calls from dongle0 (USB modem) to sip:myuser@sip.linphone.org
  2. Redirect outgoing calls from myuser@sip.linphone.org to dongle0 (I’m not sure yet how to pass the target number to call)
  3. Block everything else

Current config: SIP.CONF - [general]context=incomingregister => server-id:password@sip.lin - Pastebin.com
dongle0 connects to the network, SIP also registers successfully.
No public IP address.

On Friday 13 June 2025 at 23:54:57, and7ey via Asterisk Community wrote:

Please advise how to properly configure Asterisk

Which version are you using?

  1. Route all incoming calls from dongle0 (USB modem) to
    sip:myuser@sip.linphone.org

Define the context for calls from dongle0 to be a trivial one which simply
dials to myuser@sip.linphone.org

  1. Redirect outgoing calls from myuser@sip.linphone.org to dongle0

I’m going to assume that instead of “redirect” you simply mean “dial”, so the
answer here is to define the context for calls from sip;linphone.org to be a
trivial one which simply dials out via dongle0

(I’m not sure yet how to pass the target number to call)

How do you know what number should be called? Is it the same number for
every call (maybe your mobile phone?), or does it differ depending on where the
call came from?

  1. Block everything else

Hangup()

Current config: SIP.CONF - [general]context=incomingregister => server-id:password@sip.lin - Pastebin.com

  1. chan_sip is deprecated and unsupported
  2. I have no idea what “auth=proxmox” is supposed to mean to Asterisk

No public IP address.

That’s going to make it difficult to register with Linphone.

Antony.


The lottery is a tax for people who can’t do maths.

This is a controversial issue at the moment. It’s more accurate to say that these states are in relation to Sangoma’s Asterisk project. See the war currently in progress on the FreePBX support forum.

More significantly, chan_dongle was never supported by the official Asterisk project, and has been abandoned by its developer.

13.21

I thought I did it in my current setup, but it doesn’t work.

How does it work? Should Asterisk has an account on sip.linphone.org to make a call?

This is the question. I would like to make a call from SIP client to mobile phones (gsm) via the dongle. Not sure how to pass the number on this case.

I am trying to build a system to have free roaming for my mobile phone, to make calls: (gsm) - dongle - (sip) - my mobile phone in roaming with sip client and vice versa.

I am able to register as peer.
But I am not sure if I understand the architecture correctly. I consider my Asterisk server as SIP client, not the server and it works without public IP.
If I make it as a server, then the setup will be more simple, but I need the public IP. Can I avoid it?

I assume, from the question you were asked, that Linphone provides their service over the public internet, rather than their providing a dedicated shared or private network connection to you. In that they can only make IP calls to or accept them from public addresses.

(If you don’t have any NAT, and are directly connected to the public internet, you don’t need to fill in the public address, as it is the same as your normal address, but you said you don’t have a public address, which means that you are not on the public internet, and have no connection to it.)

By public IP address I mean the address which is not changed (white IP address). Surely I have the internet connection.

On Saturday 14 June 2025 at 13:12:53, and7ey via Asterisk Community wrote:

By public IP address I mean the address which is not changed (white IP
address). Surely I have the internet connection.

I would normally call that a static IP address. The other sort is a dynamic
address, and can change, from every few hours to every few months, depending
on your provider.

Antony.


“It would appear we have reached the limits of what it is possible to achieve
with computer technology, although one should be careful with such statements;
they tend to sound pretty silly in five years.”

  • John von Neumann (1949)

Right. I don’t have static address.

But what is about my approach? Will it work with Linphone SIP server?

On Saturday 14 June 2025 at 13:56:25, and7ey via Asterisk Community wrote:

But what is about my approach? Will it work with Linphone SIP server?

…and earlier you said…

I am trying to build a system to have free roaming for my mobile phone, to
make calls: (gsm) - dongle - (sip) - my mobile phone in roaming with sip
client and vice versa.

I don’t really see where Linphone comes into this. If you have to place a
call from your mobile phone to Linphone, in order for that call to be passed
to Asterisk, which will then dial out via your USB dongle containing a SIM
card, surely this does not avoid roaming charges for your mobile phone because
you still have to call to Linphone?

If you want to avoid roaming charges then you have to avoid making calls
direct from your mobile phone, and the only way I can think of doing that is
to use a softphone client, but that then needs mobile data (unless you can
rely on having a wireless network connection on the phone wherever you want to
make calls from).

Perhaps I have misunderstood what you’re trying to do, so let’s just assume
that Asterisk and the USB dongle can make and receive calls on the mobile
network for you - how are you going to connect to these from your mobile phone
without roaming charges either for calls or for data?

Antony.


The first fifty percent of an engineering project takes ninety percent of the
time, and the remaining fifty percent takes another ninety percent of the time.

When I am talking about Linphone, I mean their free SIP service. Surely my mobile phone should be connected to internet (free wifi) to have it working.

On Saturday 14 June 2025 at 16:29:26, and7ey via Asterisk Community wrote:

When I am talking about Linphone, I mean their free SIP service. Surely my
mobile phone should be connected to internet (free wifi) to have it
working.

If you have a free connection between your phone and a SIP provider then the
only challenges I see with your design are how to tell Asterisk what number to
dial out through the USB dongle, and how to get Caller ID for incoming calls
through Asterisk to your mobile phone.

After all, if you have a softphone client on your mobile phone, registered
with Linphone, you can probabkly dial any number you like, but any number
other than the one your Asterisk server is registered with will cost you money
from Linphone (and not go through your Asterisk server).

If you do dial the number which Linphone allocates to your Asterisk server,
you would then need some way to tell Asterisk where to dial on to. You might
want to investigate “DISA” for this.

Antony.


Anyone that’s normal doesn’t really achieve much.

  • Mark Blair, Australian rocket engineer

Thanks. I’ve managed to route all incoming GSM call to SIP.
But as I found, the SIP calls don’t work properly even when initiated from the CLI: I receive the call in SIP Linphone client installed on my phone, answer it, but Asterisk doesn’t see it answered

Here is my current sip.conf setup:

[general]
context=incoming
register => user1:user1password@sip.linphone.org/user1 ; what is here after slash?
default_caller_id="Asterisk" <sip:asterisk@example.com>
alwaysauthreject=yes
hidecallerid=no

[user1]
type=peer
host=sip.linphone.org
defaultuser=user1
secret=user1password@
fromuser=user1
fromdomain=sip.linphone.org
insecure=invite,port
context=outbound ; should it be used somewhere else?
transport=udp
qualify=yes
authuser=user1
callerid="user1" <sip:user1@sip.linphone.org>
canreinvite=no
directmedia=no
insecure=invite,port
dtmfmode=rfc2833
callcounter=yes

[user2]
type=peer
host=sip.linphone.org
defaultuser=user2
secret=user2password ; why do I need it?
context=test-sip-out ; should it be used somewhere else?
transport=udp

when I initiate a call
CLI> channel originate SIP/user1/user2 application answer,playback(hello-world)

I get the following:

proxmox-alpine-vm*CLI> channel originate SIP/user1/user2 application answer,playback(hello-world)
[2025-06-14 16:48:40] ERROR[828]: netsock2.c:305 ast_sockaddr_resolve: getaddrinfo("proxmox-alpine-vm", "(null)", ...): Name or service not known
[2025-06-14 16:48:40] WARNING[828]: acl.c:835 resolve_first: Unable to lookup 'proxmox-alpine-vm'
  == Using SIP RTP CoS mark 5
Audio is at 15470
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding codec gsm to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 5.135.215.43:5060:
INVITE sip:user2@sip.linphone.org SIP/2.0
Via: SIP/2.0/UDP 192.168.1.128:5060;branch=z9hG4bK2a946b8a
Max-Forwards: 70
From: "Anonymous" <sip:user1@sip.linphone.org>;tag=as07b77880
To: <sip:user2@sip.linphone.org>
Contact: <sip:user1@192.168.1.128:5060>
Call-ID: 6ee7184045172713700184d728352385@sip.linphone.org
CSeq: 102 INVITE
User-Agent: Asterisk PBX certified/13.21-cert6
Date: Sat, 14 Jun 2025 16:48:40 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 330

v=0
o=root 1421228007 1421228007 IN IP4 192.168.1.128
s=Asterisk PBX certified/13.21-cert6
c=IN IP4 192.168.1.128
t=0 0
m=audio 15470 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=maxptime:150
a=sendrecv

---
    -- Called user1/user2

<--- SIP read from UDP:5.135.215.43:5060 --->
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 192.168.1.128:5060;branch=z9hG4bK2a946b8a;rport=5060
Call-ID: 6ee7184045172713700184d728352385@sip.linphone.org
From: "Anonymous"<sip:user1@sip.linphone.org>;tag=as07b77880
To: <sip:user2@sip.linphone.org>;tag=D7t7HQctKeNDp
CSeq: 102 INVITE
Server: Flexisip/2.4.1-12-g2e25adc8 (sofia-sip-nta/2.0)
Proxy-Authenticate: Digest realm="sip.linphone.org",nonce="aCb46wAAAAAc/5iUAABZM6lzkUYAAAAA",opaque="+GNywA==",algorithm=MD5,qop="auth"
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
Transmitting (no NAT) to 5.135.215.43:5060:
ACK sip:user2@sip.linphone.org SIP/2.0
Via: SIP/2.0/UDP 192.168.1.128:5060;branch=z9hG4bK2a946b8a
Max-Forwards: 70
From: "Anonymous" <sip:user1@sip.linphone.org>;tag=as07b77880
To: <sip:user2@sip.linphone.org>;tag=D7t7HQctKeNDp
Contact: <sip:user1@192.168.1.128:5060>
Call-ID: 6ee7184045172713700184d728352385@sip.linphone.org
CSeq: 102 ACK
User-Agent: Asterisk PBX certified/13.21-cert6
Content-Length: 0


---
Audio is at 15470
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding codec gsm to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 5.135.215.43:5060:
INVITE sip:user2@sip.linphone.org SIP/2.0
Via: SIP/2.0/UDP 192.168.1.128:5060;branch=z9hG4bK1f59dece
Max-Forwards: 70
From: "Anonymous" <sip:user1@sip.linphone.org>;tag=as07b77880
To: <sip:user2@sip.linphone.org>
Contact: <sip:user1@192.168.1.128:5060>
Call-ID: 6ee7184045172713700184d728352385@sip.linphone.org
CSeq: 103 INVITE
User-Agent: Asterisk PBX certified/13.21-cert6
Proxy-Authorization: Digest username="user1", realm="sip.linphone.org", algorithm=MD5, uri="sip:user2@sip.linphone.org", nonce="aCb46wAAAAAc/5iUAABZM6lzkUYAAAAA", response="b03524a1d7d651673e9870e209a0c90d", opaque="+GNywA==", qop=auth, cnonce="38214ebb", nc=00000001
Date: Sat, 14 Jun 2025 16:48:40 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 330

v=0
o=root 1421228007 1421228008 IN IP4 192.168.1.128
s=Asterisk PBX certified/13.21-cert6
c=IN IP4 192.168.1.128
t=0 0
m=audio 15470 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=maxptime:150
a=sendrecv

---

<--- SIP read from UDP:5.135.215.43:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.1.128:5060;branch=z9hG4bK1f59dece;rport=5060
Record-Route: <sip:sip12.linphone.org:5060;lr>
Call-ID: 6ee7184045172713700184d728352385@sip.linphone.org
From: "Anonymous"<sip:user1@sip.linphone.org>;tag=as07b77880
To: <sip:user2@sip.linphone.org>
CSeq: 103 INVITE
Server: Flexisip/2.4.1-12-g2e25adc8 (sofia-sip-nta/2.0)
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---

<--- SIP read from UDP:5.135.215.43:5060 --->
SIP/2.0 110 Push sent
Via: SIP/2.0/UDP 192.168.1.128:5060;branch=z9hG4bK1f59dece;rport=5060
Call-ID: 6ee7184045172713700184d728352385@sip.linphone.org
From: "Anonymous"<sip:user1@sip.linphone.org>;tag=as07b77880
To: <sip:user2@sip.linphone.org>
CSeq: 103 INVITE
Content-Length: 0

<------------->
--- (7 headers 0 lines) ---
    -- SIP/linphone-00000002 is making progress
       > 0x7f7f0400df50 -- Strict RTP learning after remote address set to: 5.135.215.43:11052
       > 0x7f7f0400df50 -- Strict RTP switching to RTP target address 5.135.215.43:11052 as source
       > 0x7f7f0400df50 -- Strict RTP learning complete - Locking on source address 5.135.215.43:11052
Scheduling destruction of SIP dialog '6ee7184045172713700184d728352385@sip.linphone.org' in 6400 ms (Method: INVITE)
Reliably Transmitting (no NAT) to 5.135.215.43:5060:
CANCEL sip:user2@sip.linphone.org SIP/2.0
Via: SIP/2.0/UDP 192.168.1.128:5060;branch=z9hG4bK1f59dece
Max-Forwards: 70
From: "Anonymous" <sip:user1@sip.linphone.org>;tag=as07b77880
To: <sip:user2@sip.linphone.org>
Call-ID: 6ee7184045172713700184d728352385@sip.linphone.org
CSeq: 103 CANCEL
User-Agent: Asterisk PBX certified/13.21-cert6
Content-Length: 0


---
Scheduling destruction of SIP dialog '6ee7184045172713700184d728352385@sip.linphone.org' in 6400 ms (Method: INVITE)

<--- SIP read from UDP:5.135.215.43:5060 --->
SIP/2.0 481 Call/Transaction Does Not Exist
Via: SIP/2.0/UDP 192.168.1.128:5060;branch=z9hG4bK1f59dece;rport=5060
Call-ID: 6ee7184045172713700184d728352385@sip.linphone.org
From: "Anonymous"<sip:user1@sip.linphone.org>;tag=as07b77880
To: <sip:user2@sip.linphone.org>;tag=61Nm30Qjm8XpH
CSeq: 103 CANCEL
Server: Flexisip/2.4.1-12-g2e25adc8 (sofia-sip-nta/2.0)
Content-Length: 0

<------------->
--- (8 headers 0 lines) ---
[2025-06-14 16:49:10] WARNING[52]: chan_sip.c:25061 handle_response: Remote host can't match request CANCEL to call '6ee7184045172713700184d728352385@sip.linphone.org'. Giving up.
Really destroying SIP dialog '6ee7184045172713700184d728352385@sip.linphone.org' Method: INVITE
Reliably Transmitting (no NAT) to 5.135.215.43:5060:
OPTIONS sip:sip.linphone.org SIP/2.0
Via: SIP/2.0/UDP 192.168.1.128:5060;branch=z9hG4bK324e5730
Max-Forwards: 70
From: "asterisk" <sip:user1@192.168.1.128>;tag=as424befc1
To: <sip:sip.linphone.org>
Contact: <sip:user1@192.168.1.128:5060>
Call-ID: 7e2bd7d91ababd82102e82393c938d47@192.168.1.128:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX certified/13.21-cert6
Date: Sat, 14 Jun 2025 16:49:23 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---

<--- SIP read from UDP:5.135.215.43:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.128:5060;branch=z9hG4bK324e5730;rport=5060
Call-ID: 7e2bd7d91ababd82102e82393c938d47@192.168.1.128:5060
From: "asterisk"<sip:user1@192.168.1.128:5060>;tag=as424befc1
To: <sip:sip.linphone.org>;tag=S6Q3gFvtN936g
CSeq: 102 OPTIONS
Content-Length: 0

<------------->
--- (7 headers 0 lines) ---
Really destroying SIP dialog '7e2bd7d91ababd82102e82393c938d47@192.168.1.128:5060' Method: OPTIONS

<--- SIP read from UDP:5.135.215.43:5060 --->
BYE sip:user1@192.168.1.128:5060 SIP/2.0
Via: SIP/2.0/UDP sip12.linphone.org;branch=z9hG4bK.Hy2me158t25j6ZaZD67gQ5U50a;rport,SIP/2.0/TLS [2606:4700:0110:8C75:5F65:A174:8FF3:B639]:34722;branch=z9hG4bK.Tc8BJEIFY;received=2A09:BAC1:61A0:0000:0000:0000:0057:022F;rport=40102
Call-ID: 6ee7184045172713700184d728352385@sip.linphone.org
From: <sip:user2@sip.linphone.org>;tag=SeFmSAl
To: "Anonymous"<sip:user1@sip.linphone.org>;tag=as07b77880
CSeq: 111 BYE
Max-Forwards: 69
Reason: SIP;cause=408;text="no ACK received"
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
Sending to 5.135.215.43:5060 (no NAT)

<--- Transmitting (no NAT) to 5.135.215.43:5060 --->
SIP/2.0 481 Call leg/transaction does not exist
Via: SIP/2.0/UDP sip12.linphone.org;branch=z9hG4bK.Hy2me158t25j6ZaZD67gQ5U50a;received=5.135.215.43;rport=5060,SIP/2.0/TLS [2606:4700:0110:8C75:5F65:A174:8FF3:B639]:34722;branch=z9hG4bK.Tc8BJEIFY;received=2A09:BAC1:61A0:0000:0000:0000:0057:022F;rport=40102
From: <sip:user2@sip.linphone.org>;tag=SeFmSAl
To: "Anonymous"<sip:user1@sip.linphone.org>;tag=as07b77880
Call-ID: 6ee7184045172713700184d728352385@sip.linphone.org
CSeq: 111 BYE
Server: Asterisk PBX certified/13.21-cert6
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


<------------>
[2025-06-14 16:50:14] NOTICE[52]: chan_sip.c:15760 sip_reregister:    -- Re-registration for  user1@sip.linphone.org
REGISTER 12 headers, 0 lines
Reliably Transmitting (no NAT) to 5.135.215.43:5060:
REGISTER sip:sip.linphone.org SIP/2.0
Via: SIP/2.0/UDP 192.168.1.128:5060;branch=z9hG4bK16f09a4e
Max-Forwards: 70
From: <sip:user1@sip.linphone.org>;tag=as17188f83
To: <sip:user1@sip.linphone.org>
Call-ID: 2abacceb41b70f34388a71bb0ec1c97b@192.168.1.128
CSeq: 115 REGISTER
Supported: replaces, timer
User-Agent: Asterisk PBX certified/13.21-cert6
Authorization: Digest username="user1", realm="sip.linphone.org", algorithm=MD5, uri="sip:sip.linphone.org", nonce="1CH46wAAAACQ2pxjAABBGeblyXsAAAAA", response="c9563d2a99ad28461159ac277eee851c", opaque="+GNywA==", qop=auth, cnonce="66457f1c", nc=0000000d
Expires: 120
Contact: <sip:linphone@192.168.1.128:5060>
Content-Length: 0


---

<--- SIP read from UDP:5.135.215.43:5060 --->
SIP/2.0 200 Registration successful
Via: SIP/2.0/UDP 192.168.1.128:5060;branch=z9hG4bK16f09a4e;rport=5060
Call-ID: 2abacceb41b70f34388a71bb0ec1c97b@192.168.1.128
From: <sip:user1@sip.linphone.org>;tag=as17188f83
To: <sip:user1@sip.linphone.org>;tag=DyFtav34rXKtK
CSeq: 115 REGISTER
Contact: <sip:linphone@192.168.1.128:5060>
Expires: 120
Server: Flexisip/2.4.1-12-g2e25adc8 (sofia-sip-nta/2.0)
Supported: path,outbound
Content-Length: 0

<------------->
--- (11 headers 0 lines) ---
[2025-06-14 16:50:14] NOTICE[52]: chan_sip.c:24602 handle_response_register: Outbound Registration: Expiry for sip.linphone.org is 120 sec (Scheduling reregistration in 105 s)
Really destroying SIP dialog '2abacceb41b70f34388a71bb0ec1c97b@192.168.1.128' Method: REGISTER
Reliably Transmitting (no NAT) to 5.135.215.43:5060:
OPTIONS sip:sip.linphone.org SIP/2.0
Via: SIP/2.0/UDP 192.168.1.128:5060;branch=z9hG4bK00c7c543
Max-Forwards: 70
From: "asterisk" <sip:user1@192.168.1.128>;tag=as3d8e75f8
To: <sip:sip.linphone.org>
Contact: <sip:user1@192.168.1.128:5060>
Call-ID: 54760bea4bda53263a6d3c3c5e4d20aa@192.168.1.128:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX certified/13.21-cert6
Date: Sat, 14 Jun 2025 16:50:23 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---

<--- SIP read from UDP:5.135.215.43:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.128:5060;branch=z9hG4bK00c7c543;rport=5060
Call-ID: 54760bea4bda53263a6d3c3c5e4d20aa@192.168.1.128:5060
From: "asterisk"<sip:user1@192.168.1.128:5060>;tag=as3d8e75f8
To: <sip:sip.linphone.org>;tag=HKeBQ6jH9F4ZF
CSeq: 102 OPTIONS
Content-Length: 0

<------------->
--- (7 headers 0 lines) ---
Really destroying SIP dialog '54760bea4bda53263a6d3c3c5e4d20aa@192.168.1.128:5060' Method: OPTIONS

This option is duplicated.

This is also duplicated. Why do you need the port to be insecure?

If Linphone operate anything like as a normal SIP UAS configuration, they will expect a valid phone number where you have “user2”, so I’d expect a valid phone number in:

So you do have a public address that is different from your interface address. You need to specify this. I think chan_sip uses External, rather than Public.

You end up being asked to authenticate yourself, and not responding. I’m not sure if that is because you got a proxy rather tahn a normal authentication request, and you didn’t have a response configured for the proxy realm. I haven’t tried edge case authentication on chan_sip.

You shouldn’t be asking here if you are using a certified version. They are only for people with paid support contracts, and doubt that any paid support contract would be valid without your having updated to a current version.

I use the docker version with chan_dongle support, which I’ve found on GitHub. I got what ‘cert’ means just from your answer.

My network setup is the following: PC (192.168.1.100) - my router (192.168.1.1) - gpon router (some dynamic ip like 46.x.x.x). PC has proxmox installed with Alpine Linux Virtual Machine (192.168.1.128), where Asterisk is running in Docker.
Which IP should I define here?
I don’t understand why some external IP is needed here. I have Linphone client installed on my Android phone and it works perfectly both for incoming and outgoing calls.

The interesting that I am able to receive the call (the client is ringing and I can answer there, but nothing happens after that).

user1 and user2 are just samples, in reality I use accounts registered at sip.linphone.org.

46.x.x.x or you can use a dynamic DNS hostname and push the problem of finding your address to DDNS. If your provider changes your IP address when you are still connected to them, you shouldn’t really be using them if you are running a server, which is what Asterisk is. However, chan_pjsip has better support for this case.

To comply with SIP standards. ITSPs are likely to use workarounds, based on certain assumptions, but it is less confusing top people supporting you when you comply properly. Also without the correct media address, you rely on your system sending media first, in order for the work arounds to work, which can delay media startup, or lead to a a stalemate.

The workarounds don’t always work for the contact address, which can mean that the call sets up correctly but you have difficulty at the end of the call, or several minutes into the call.

It’s also possible that the Linphone app does its own STUN lookups, to dynamically find the correct address. I think Asterisk can be configured to do that, but it isn’t something that many people use.

In your example dialplan, user2 needs to be a valid PSTN number, in a format acceptable to Linphone, not an account. I’m not sure about your sip.conf use of user2.

Finally, I abandoned linphone.org (although I managed to route incoming calls there), did everything locally, and the phone connects to the local network via Zerotier. Also switched to PJSIP (but don’t know why ;).