Home Landine to Freepbx Sip Trunk

I subscribe to our ftth provider with internet package that comes with telephone landine via gpon ont.I bypass and bridge mode gpon ont and let my pfsense do the pppoe authentication .II then connect my yealink T2IP and it register and can make regular calls.Can anyone help me set up it with my freepbx, please see below dumps and screenshot from yealink config

20.46.136.239.5060 > 10.200.42.121.5060: [udp sum ok] SIP, length: 615
REGISTER sip:fmc.stc.com.sa:5060 SIP/2.0
Via: SIP/2.0/UDP 20.46.136.239:5060;branch=z9hG4bK3273383826
From: “+96611239XXXX” sip:[email protected]:5060;tag=2832441398
To: “+96611239XXXX” sip:[email protected]:5060
Call-ID: [email protected]
CSeq: 1 REGISTER
Contact: sip:[email protected]:5060
Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE
Max-Forwards: 70
User-Agent: Yealink SIP-T21P_E2 52.84.0.15
Expires: 3600
Allow-Events: talk,hold,conference,refer,check-sync
Content-Length: 0

There is something strange about your having a public address and the proxy having a private one. Also you have a VoIP line, not a landline.

There isn’t enough information about how to identify incoming calls.

Otherwise:

Obviously use PJSIP
client URI is sip:[email protected]:5060
server URI is sip:fmc.stc.com.sa:5060
server name is fmc.stc.com.sa
transport is UDP
contact user is +96611239XXXX
username is +96611239XXXX
from_user is +96611239XXXX
password is ********
Authentication and registration are outbound
proxy is sip:10.200.42.121\;lr\;hide
match/permit - insufficient information
DID name is +96611239XXXX
callerid - insufficient information, although they may well not accept any explicit caller ID, and from user may be enough

Note the wiki is still down so I’m unable to double check some details.

thank you for helping me… but still trunk doesnt register

Connected to Asterisk 13.33.0 currently running on dns (pid = 13951)
<— Transmitting SIP request (512 bytes) to UDP:10.200.42.121:5060 —>
OPTIONS sip:10.200.42.121 SIP/2.0
Via: SIP/2.0/UDP 22.6.120.2:5060;rport;branch=z9hG4bKPj8891973b-82c8-4bea-8c24-d82381c594e6
From: sip:[email protected];tag=5b5f34bc-7f77-4865-961b-09dfda9f7fc6
To: sip:[email protected]
Contact: sip:X ��@22.6.120.2:5060
Call-ID: c1be7ce9-dc52-45ca-a78e-34f1aaa3dcec
CSeq: 53311 OPTIONS
Route: sip:[email protected]:5060
Max-Forwards: 70
User-Agent: FPBX-13.33.0(13.33.0)
Content-Length: 0

[2023-02-21 17:56:15] ERROR[14005]: res_pjsip.c:4081 endpt_send_request: Error 120001 ‘Operation not permitted’ sending OPTIONS request to endpoint +966112390XXX

The ability to send OPTIONS or to act on responses to it has nothing to do with the registration status.

The error is coming from the PJProject code. Do you have a route to proxy?

You are sending a garbled Contact header, and I cannot think what would cause that, unless the reverse host lookup failed.

You haven’t set the \;lr parameter on the outbound proxy.

To the original list, I would add:

Codecs - insufficient information (probably alaw)

I dont have any issues on network side…
PING 10.200.42.121 (10.200.42.121) 56(84) bytes of data.
64 bytes from 10.200.42.121: icmp_seq=1 ttl=252 time=100 ms
64 bytes from 10.200.42.121: icmp_seq=2 ttl=252 time=100 ms

I think my issue here is the garbled CALL ID

Call-ID: d165c497-eb2f-4de7-8fd1-48829c8742d1

The first issue is not specifying a least routing proxy. The \ was lost (garbled by the forum software) when I first specified this, but I did correct that.

The call-ID is perfectly valid. There is no requirement that it contain a domain name, only that it be globally unique.

I’m pretty sure that the 120001 error is happening before the request has been sent to the wire, and not a response from the far end.

The user part of the Contact header looks gibberish here, although maybe it was uploaded in the wrong font encoding.

You appear to be using an unsupported version of Asterisk, as line 4081 does not exist in any currently supported version. My guess is you are using 13, but you could be using an even older one.

my asterisk version is 13.33.ill try to update it

sip:10.200.42.121\;lr\;hide

hi thank you for your support…it was firewall problem on my pfsense, my bad…
one last issue is i cant hear a ringback tone when calling my voip line from my cellphone…i set my inbound to my ivr and i hear also nothing

They might be sending it as early media, in which case you will need to call Progress() before dialling. This assumes that you don’t prematurely answer.

Sorry. That was the pure Asterisk answer, although I think there is an equivalent option.

Try playing with the “Signal RINGING” and “Force Answer” options under Connectivity > Inbound Routes > [YOUR ROUTE] > Advanced.

Try Signal RINGING first, but if you’re still not hearing anything, you can try Force Answer, which will force your PBX to pick up the call and generate the ringing itself

Now that the wiki is back, I can’t actually find an option that controls the use of Progress.

However, Signal Ringing is going to give you ringback tone even if the call never gets to the point of ringing anyone, so, for outgoing calls makes little sense. It may be useful for incoming calls, to give the caller confidence, but for outgoing calls, it means the caller gets a false indication of partial success.

Sounds like the issue they are having is with with incoming calls, as they mentioned they’re not getting ringback when calling the VoIP line from their cell.

That would suggest they are sending it as early media, which should not happen by default.

i can hear ringback tone when setting my inbound route directly to my sip extensjon but no with ivr , ringroup or custom destination

You will have to answer for IVRs to work, as the mobile network is unlikely to allow early media. I wouldn’t expect the IVR itself to generate an Alerting status on the mobile network, even if it does answer, but if it does answer, I would expect any ringback indication it receives to be passed back as in band audio.

Are the ring group and the misc destination behind the IVR? If not what is the general nature of the misc destination?

i dont hear any thing at all even the ivr announcement,dead silent but i can press digits upon call on ivr .i tried to change codecs(alaw, ulaw g729) under sip trunk but the same issue…misc destination was caller id digits announcement

In your firewall, confirm that you have forwarded the RTP port range (default is UDP 10000-20000) to the LAN address of the PBX. Also confirm that you have disabled source port rewriting; see

If no luck, in the Inbound Route, try setting Signal Ringing and/or setting Pause Before Answer to 2.

If still no luck, paste the Asterisk log for a problematic call (with pjsip logger on) at pastebin.freepbx.org and post the link here.

This does seem like your provider is one for which Signal RINGING is needed, when using IVRs.

If the provider isn’t broken in this way, it is better not to use it, as it gives a false indication to the caller that a phone is actually ringing.

can i use chan_sip for this trunk?i