NFON Trunk

Hello Everyone :slight_smile:

i’m trying to register my freepbx instance to connect to nfon.
I’ve successfully registered the trunk, but have problems by dialing out.

Does anyone have experience with nfon?

Best regards,

In general (not speaking specifically about any specific carrier here), it’s important to look at the SIP trace and the Asterisk logs (or CLI) output when you try to make a call. Doing that and then providing some additional details here (longer blocks of text should use a pastebin service) will help give us the information needed to help you solve the problem.

Thank you very much for your help in advance.
Here is a link to the log file:

This is most likely a number formatting issue. I know nothing about NFON, but most providers require calling and called numbers in the same format.

So, perhaps the called number should be 01702955562 or 491702955562, or the caller ID may need to be 4989219098370 or +4989219098370.

If NFON doesn’t provide good documentation about this, it’s a good bet that what they send you on incoming calls will be accepted for outgoing calls. At the Asterisk command prompt, type
pjsip set logger on
and call in from your mobile. The SIP trace will appear in the Asterisk log along with the regular entries.

Set up your outbound calling to use the same number formats and retest. If you still have trouble, post another log, including the SIP trace.

Please use – the CentOS pastes expire after one day, which would prevent a future reader with the same problem from benefiting from your posts.

Thank you Stewart.
I’ll try it out. (for the future i’ll use pastebin.freepbx- wasn’t aware of it) :slight_smile:

Hi Stewart,

yesterday i made some progress but due to the fact, that i’m really new to this stuff, I’m stuck again.
I was able to mangage it that we can receive calls now and also forward them to the regarding extension.
Outbound is still a compelling event for me.
Therefore i’ve included two links to pastebin:



i also found (with a lot of research) an old pdf showing some interesting values about NFONs SIP Header. But don’t know how to handle it right

Outbound Call from extension 0049123456782 to 0041234567899
INVITE sip:[email protected] SIP/2.0
To: sip:[email protected]
From: sip:[email protected]:5060
Contact: sip:[email protected]:5060
P-Asserted-Identity: sip:[email protected]:5060
Alternativ kann auch das “+” für Telefonnummern verwendet werden
INVITE sip:[email protected] SIP/2.0
To: sip:[email protected]
From: sip:[email protected]:5060
Contact: sip:[email protected]:5060
P-Asserted-Identity: sip:[email protected]:5060

Maybe you could take a look at it?

Does exten 66 have a valid CallerID set as per your carriers instructions?

Perhaps something like

"Phoner Lite" <004989219098370>

or maybe just need your national number <89219098370>

I’ve tried to set the CallerID in several ways, but still only inbound is working.

just a question (hopefully not dumb)…

this is how nfon wants it as an example:

INVITE sip:[email protected] SIP/2.0
To: sip:[email protected]
From: sip:[email protected]:5060
Contact: sip:[email protected]:5060
P-Asserted-Identity: sip:[email protected]:5060

when i look at the log output then i see the following:
is it the one wich should look like the above one?

<— Transmitting SIP request (1027 bytes) to TCP: —>
Via: SIP/2.0/TCP;rport;branch=z9hG4bKPjee1a1c54-bd0f-4dfc-9b11-cb85017bcdae;alias
From: sip:[email protected];tag=a68f5c0b-ed9d-4254-8061-2c31cb0ebf50
To: sip:[email protected]
Contact: sip:[email protected]:5060;transport=TCP

Call-ID: a48063a2-c79c-4e2e-8f6b-8dc26e954b6c
CSeq: 32110 INVITE
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Route: sip:[email protected]:5060
Max-Forwards: 70
User-Agent: FPBX-
Content-Type: application/sdp
Content-Length: 259

if it is the right one, then is there any way to modify the outgoing sip-header like nfon wants it?

Best regards

Hello again :slight_smile:

tonight i was testing our trunk with StarTrinity SIP Tester.
Tried several things and i found out that i have to add

headers=“P-Asserted-Identity=sip:[email protected]:5060”

Now my question:
i use pjsip in asterisk configuration.
How can i add this Header to the OUTBOUND Sip-Header??

Help appreciated :slight_smile:

best regards

Thank you for helping me so much in my Case!! it was amazing to look, how you were able to handle it! Both thumbs up for that big favour!!

Best regards

1 Like

Hello @felonmuc and @danielf :

Seeing confirmation that Daniel resolved this issue, I scrolled back to find his post so I could mark it as a solution. Unfortunately, I see that Daniel has chosen not to contribute to this thread, but I do see he contacted you privately presumably to solicit some business.

As a service to fellow and future forum participants, I would expect the solution to be posted here for all. Likewise, I would expect all forum participants (including Daniel) to post publicly with offers of assistance, again to the benefit of the community.

1 Like

Hi :slight_smile:
i’ll will write down the solution and post it here… we changed from pjsip to chansip. then it was working… but i will post a detailed solution, when the extension are working :slight_smile:
hope that is okay?


That’s the type of thing I was afraid of, and more or less what I would expect for these circumstances. Obviously you need to do what works for you, but abandoning the supported driver in favor of a deprecated one is more of a band-aid than a solution.

Hi to everyone :slight_smile:

i hope this will help other nfon users as well. Just ask, if the information here is not enough for you.

btw: i’m really new to FreePBX. so forgive me if i missed something in advance.

First of all again a big “THANK YOU” to Daniel @danielf . Supporting me with a remote session and explaining the steps was really helpful!!

First i tried to set it up with pjsip, but this didn’t really work out.
The extensions are still pjsip… maybe i change this in the future. but it works for now.

In Asterisk-SIP settings:
in General: (there were not many changes / depends on your network setup a lot)
only in codecs alaw+ulaw rest disabled
Allow Anonymous=Yes
Allow SIP Guests=No

in chansip:
reinvite behavior=No

In Trunk config set _chansip:
Asterisk Trunk Dial Options: B(custom-sip-header^s^1) (override system if needed)

in sip Settings- Outgoing (peer details)

in sip Settings- Incomming (only register string / rest empty)


; Add B(custom-sip-header^s^1) to the dial options of a trunk in addition to the defaults already there
; This only affects calls on specific trunks
exten => s,1,Noop(entering user defined context custom-sip-header in extensions_custom.conf)
exten => s,n,Set(HASH(__SIPHEADERS,P-Asserted-Identity)=sip:*yourNUMBERinternationalformat*
exten => s,n,Return

Extension just as normal with DID Number = yourNUMBERinternationalformat

Good luck,

1 Like

Okay, so the problem you were trying to solve was you need to add a custom SIP header to outgoing calls to a specific trunk. The supportable way to do that is to use the dialplan hook, check for the trunk name, and then add the header using an existing subroutine. No chan_sip required and no hack using dial options. I will whack it together at some point when time permits if someone doesn’t beat me to it.

Here is generic dialpllan that will add a custom header to all outbound calls using a specific trunk regardless of whether it’s chan_sip or pjsip:

exten => s,1,Noop(Entering user defined context macro-dialout-trunk-predial-hook in extensions_custom.conf)
exten => s,n,ExecIF($["${OUT_${DIAL_TRUNK}_SUFFIX}"!=""]?Set(trunk_name=${OUT_${DIAL_TRUNK}_SUFFIX}):Set(trunk_name=${OUT_${DIAL_TRUNK}}))
exten => s,n,Noop(Trunk Name: ${trunk_name})
exten => s,n,GoSubIf($["${trunk_name}"="<< trunk name >>>"]?func-set-sipheader,s,1(P-Asserted-Identity,sip:[email protected]:5060))
exten => s,n,MacroExit

Edit to fill in the actual name of the trunk.

1 Like

What? No! PJSIP is the current supported SIP driver and chan_sip is deprecated. Everything in Asterisk is moving slowly but permanently to PJSIP such as this announcement yesterday of a tool for mass converting extensions to PJSIP: New blog post - New tool for helping move from SIP to PJSIP

hi :slight_smile:
my assumption was that the pjsip extensions “might” not be the best combination with chan_sip.

Thank you for the tipps and hints :slight_smile:
I will test ist tomorrow or on the weekend.

Best regards,

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