Asterisk through a VPN is not working

10.45.220.57 will be the network address translated address that the phone is seeing. Ideally, you should configure the phone so that it knows its real address, but failing that you might have to rely on enabling comedia. However comedia will not lock onto the proper address until Asterisk has received valid incoming media. Maybe the 4G network is deliberately blocking RTP, although, if they wanted to discourage third party VoIP, you would expect them to block SIP, as it easier to recognize.

In some circumstances, Asterisk will use heuristics to detect that there is NAT at the other end, and automatically enable comedia (at least for chan_sip), but this may not have happened here I repeat, though, that comedia does require incoming traffic, so Asterisk must be sending the correct media address for this to work.

I don’t have any IP options on the softphone.
Have you an app to recommand to get it fixed ?
By the way, which format should I use for MOH?
I work with g722 codec actually.

You may have a STUN setting.

I’m not sure if there is a format module for G.722, otherwise use slin16. Note that large parts of the PSTN are still 3.1kHz audio (G.711).

Thanks a lot, I will experiment it tomorrow.
I configured voip.ms trunk for outbound calls with g711 u/alaw and it works too.

Hello again,
I tried to enable STUN on my softphone app but it doesn’t change anything.
If I leave the STUN server blank, it doesn’t change anything. If I put my public asterisk IP, I can not register the endpoint.

I haven’t used STUN myself, but you need to specify the address of something that is running a STUN server that is prepared to serve you. I assume you are not running one on the machine in question.

Okay so I have to install a STUN server to get calls working with mobile data / 4G, right?

There is nothing about 4G that implies that. The recommendation was based on the stated limitations of your soft phone.

The spanner in the works is probably that the network operator is using NAT rather than dynamically allocating a public address , but I don’t believe that 4G implies that part of the infrastructure.

Thanks for the precision.
How can I bypass this limitation ? Using a OpenVPN on the phone and connect it to the server ?

And anther question, how can I optimize my extension.conf ?

Here is the file :

[None] ; No calls are possible

[Internal] ; Calls are only allowed endpoint by endpoint
exten => _10.,1,Dial(PJSIP/${EXTEN},20)

[All] ; Calls are allowed everywhere, internal and external
exten => _10.,1,Dial(PJSIP/${EXTEN},20)
exten => _+.,1,Dial(PJSIP/${EXTEN}@voipms)

[French Numbers] ; Calls are only allowed to French numbers via voip.ms
exten => _10.,1,Dial(PJSIP/${EXTEN},20)
exten => _+33.,1,Dial(PJSIP/${EXTEN}@voipms)
[FrenchLandLine] ; Calls are only allowed to Landline French Numbers
exten => _10.,1,Dial(PJSIP/${EXTEN},20)
exten => _+331.,1,Dial(PJSIP/${EXTEN}@voipms)
exten => _+332.,1,Dial(PJSIP/${EXTEN}@voipms)
exten => _+333.,1,Dial(PJSIP/${EXTEN}@voipms)
exten => _+334.,1,Dial(PJSIP/${EXTEN}@voipms)
exten => _+335.,1,Dial(PJSIP/${EXTEN}@voipms)
exten => _+339.,1,Dial(PJSIP/${EXTEN}@voipms)

I have now more endpoints like 1092, 10213, and some other.
Is this way correct to allow/disallow endpoints calling numbers or not?

Best practice is use “include =>”, rather than repeating the less restricted destinations.

You can shorten the FrenchLandLine context by using “_+33[123459].” as the pattern. Alternatively you could route all the non-landline numbers to an explicit rejection and fall back to including the French Numbers one.

Or

_+33[1-59].

which may seem insignificant, but it eliminates having to confirm 2, 3, and 4 are accounted for.

Thanks for your answers.
So If I do this :

[None]

[Internal]
exten => _10.,1,Dial(PJSIP/${EXTEN},30)

[All]
include => Internal
exten => _+.,1,Dial(PJSIP/${EXTEN}@voipms)
[FrenchNumbers]
include => Internal
exten => _+33.,1,Dial(PJSIP/${EXTEN}@voipms)
[FrenchLandline]
include => Internal
exten => _+33[1-59].,1,Dial(PJSIP/${EXTEN}@voipms)

is that correct ?
How can I create a number (666) to call all endpoints contained in “All” extension and keep it ringing even if someone from the extension answers (to make a conference) ?
I guess I can play an audio file for the None extension, how can I do the same for all unallowed numbers from other extension ?
Should I just do :

exten => _+33[1-59].,1,Dial(PJSIP/${EXTEN}@voipms)
; if the number is not +33[1-59] :
exten => _.,1,Playback(/var/lib/asterisk/sounds/mysound.wav)

Am I right?

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