FreePBX | Register | Issues | Wiki | Portal | Support

Call forwarding on SIP trunk | Original CallerID not being transmitted

(Sip Sepp) #1

Hi FreePBX users and admins!

Running FreePBX with Asterisk 13.19.1.

Enabling call forwarding on my extension 123 by *72<CF_destination_number># is being accepted by the PBX, but both internal and external calls to the extension 123 are not being forwarded.

The Asterisk CLI tells me the following:

[2018-04-11 15:42:27] NOTICE[20580][C-0000017b]: app_dial.c:1000 do_forward: Not accepting call completion offers from call-forward recipient Local/<CF_destination_number>@from-internal-0000036b;1

Google doesn’t help searching with these info.

Anyone an idea?

Thanks in advance!

Best Regards,


The NOTICE is not an error and is most likely unrelated to your issue; see .

When forwarding an incoming call to an external destination, displaying the original caller’s number (the default) requests your outbound trunking provider to send a caller ID that is not yours. Because such “spoofing” capability is often abused, many providers don’t allow it.

If you have a trunk that does permit sending an arbitrary caller ID, check that your settings match the provider’s specifications. Some will accept the caller ID in the From header, while others want a main or account number in From and the desired caller ID in Remote-Party-ID or P-Asserted-Identity. Also, some are fussy about the format, e.g. (in US) 212-555-1212 may need to be sent as 12125551212 or as +12125551212.

To test a simpler case, temporarily set the Outbound CID for your extension to a valid number that is not on your system, then make a call to an ANI test number such as 1 800 437 7950 (or to your mobile).

If you still have trouble, post what country you are in and which outbound trunking provider(s) you have.

(Sip Sepp) #3

Hi Stewart,

thanks a lot for your explanation.

Our provider is Vodafone and they explained that they do support the arbitrary caller ID.

They also explained, that they use the “From user” option for the CID transmission and the P-Asserted-Identity.

You have to configure your SIP header so that the fields “Contact”, “From” and “To”, respectively, meet the format, where +49 is your country code (Germany), 4321 is your area code and 998877 is the number of your SIP trunk. Or the format, where 04321 is your area code.

So, in the SIP trunk configuration of FreePBX webinterface, I filled the field “From user” and the field “Contact user” at pjsip Settings > Advanced with

I cannot identify the “To” field mentioned by Vodafone in the FreePBX webinterface. Do you know where to find it?

On the “Advanced” tab of pjsip Settings, I also selected at “Send RPID/PAI” the option “Send P-Asserted-Identity header”. Vodafone told me that you have to assemble the PAI of the area code, the SIP trunk number and the DID. Unfortunately, in FreePBX webinterface you can only enable or disable the PAI option, but you cannot define the PAI number. BTW the notation Vodafone requires doesn’t make sense to me, because if you define also the DID, there will be sent always this hard-coded number and not the DID of the appropriate caller, or not?

Further Caller ID settings are at trunk configuration > General at Outbound CallerID. This is set to <04321998877>
The “CID Option” below is set to “Allow Any CID”.

At “Outbound Routes” > Route settings the field “Route CID” is left blank, the option “Override Extension” is set to “No”.

Finally the configuration of the extensions include at “General” Outbound CID the format 04321998877123, where 123 is my extension.
The extension’s tab “Advanced” offers the option “Send RPID” which is set to “Send P-Asserted-Identity header”.

I changed the Caller ID setting in the extension’s configuration - as you proposed to do - to a different number, which doesn’t match my correct number (04321998877123). I guess it is meant to test, if the provider transmits any CID and not only CIDs from within your SIP trunk number range.
The result is a voice saying that “all circuits are busy now”.


Your setup seems correct to me (though I may have missed something important). Don’t worry about the To header – it contains the called number and if your calls are being completed correctly (when not spoofing the caller ID), then it is set correctly.

The ‘all circuits are busy now’ message indicates that Vodafone rejected your call attempt and there were no remaining trunks specified in the Outbound Route. Possibly this is because the number was invalid. For example, 04321998877123 would not be valid because it has 13 digits (not counting the initial zero); the maximum length in Germany is 11 digits. It’s possible that they do stricter checks such as knowing the allowable number ranges based on area code or based on area code and exchange.

I suggest that you check that nothing is broken by first setting the Caller ID for the extension to its normal value and making a successful call. For example, try calling 0 69 257385876 (an iNum gateway). You should hear a “welcome to iNum” prompt, then dial 000 000 093 # and you should hear your caller ID read back to you. Next, change the Caller ID setting to e.g. your mobile number (or other working number). Try the caller ID test number again. If you hear your mobile number, set your extension Caller ID back to normal and with luck Follow Me should be working. If not, at the Asterisk command prompt type pjsip set logger on and try another (failing) test. The SIP requests and responses should appear in the Asterisk log. If you have trouble interpreting it, post the SIP trace for the failing call (masking any phone numbers, account numbers, public IP addresses or any other data that you consider personal).

(Sip Sepp) #5

Here’s the relevant data from ‘full’ log having switched pjsip logging on and conducted the test call with wrong CID set (to mobile number 01701213434).

Two points suspicious to me:

  1. Occurence of leading ‘0’ at dialed number ‘00692575632’. We do not use leading ‘0’ for external calls.

  2. Section at lines 288-297. Authentication error on INVITE. At FreePBX Webinterface > Connectivity > Trunks > edit my trunk > pjsip Settings > General > Authentication we selected option Outbound. Perhaps the cause of the problem? But why?full.tgz (4,4 KB)


According to the log, the Grandstream phone really did send the 00692575632. Did you dial it manually on the keypad? If not (it was dialed from history, contacts, speed dial, etc.) then the entry may have been corrupted by a previous problem. Please repeat the test, dialing manually and watching the display to be sure the 0 key doesn’t bounce. If it still sends the extra 0, the phone’s dial plan is probably mangling the number. Log into the device and check Call Settings for the account in question. Dial Plan Prefix should be blank and Dial Plan should not do any unwanted modifications. See page 36.

I suspect that the Forbidden was because Vodafone expects the From header to contain the main trunk number (essentially used as an account number). In the trunk config, try setting From User to 04321998877 (use just the digits of your actual number). If that’s what you already have, I’m quite puzzled.

If you still have trouble, first confirm that nothing has been broken (if you set the caller ID for the extension back to normal, you can call out ok). Then, go back to the failing case and post another log (same as your last post) and screenshots of your trunk settings (with personal data blanked out).

(Sip Sepp) #7

Here are the logs:

Outbound Caller ID on extension’s settings is set to a mobile number.
One log with “From User” blank, the second with “From User” set to my SIP trunk number (what Vodafone told me to insert there).

Second attachments with my SIP trunk settings.Logs.tgz (4,7 KB)
TrunkSettings.tgz (440,0 KB)


Unfortunately, the SIP trace is missing from both logs. Please try again, doing
pjsip set logger on
before making the test calls.

When From User is filled in but Oubound Caller ID for the extension is normal (not spoofing), do calls complete ok? If so, please post two logs, one for a successful call without spoofing and one for a failed call when attempting to spoof (both with From User filled in).

If filling From User causes calls to fail, even when not spoofing, then also post the log for a successful call with From User blank.

(Sip Sepp) #9

No, the call never is being established, no matter if FROM USER is filled in or blank.

Here’s the log including the SIP trace this time.

full.tgz (4,9 KB)

(Sip Sepp) #10

Finally got news from Vodafone having sent a TCPDUMP SIP trace to them:

“Configure DIVERSION HEADER or PAI HEADER or CONTACT HEADER to include your full telephone number!”

So, the DIVERSION HEADER setting (‘Generate Diversion Headers’) in FreePBX can be set to YES or NO (at Settings > Advanced Settings > Dialplan and Operational). But it cannot be defined (how ithas to bee assembled).
From the description text we learn:

If this value is set to true, then calls going out your outbound routes that originate from outside your PBX and were subsequently forwarded through a call forward, ring group, follow-me or other means, will have a SIP diversion header added to the call with the original incoming DID assuming there is a DID available. This is useful with some carriers that may require this under certain circumstances.

So we should assume that FreePBX sets the diversion header only to the DID (123), not the full telephone number (04321987123). Having set the Diversion Header option to YES and made a test call, our assumption seems to be correct:


So, how to configure FreePBX to assemble the diversion header to use the full telephone number?

The alternative, according to Vodafone: Setting the CONTACT HEADER to the full telephone number.

The TCPDUMP tells us, that currently the value of this header is:

Contact: sip:asterisk@

But it should be: Contact: sip:+494321987123@

So, where to configure it?

The second alternative, the PAI HEADER can’t be configured either in FreePBX. You can only enable or disable it at Connectivity > Trunks > edit my trunk > pjsip Settings > Advanced > Send RPID/PAI .
Can also be enabled at Applications > Extensions > edit my extension > Advanced > Edit Extension > Send RPID .

But how to tell FreePBX how to assemble the PAI?

(Sip Sepp) #11

Aked my provider if Contact Header would be sufficient (i.e. disabling Diversion and PAI headers in the PBX) for the routing of the call.
They told me that it is sufficient.

So, the hopefully simple question is, how to configure the Contact Header individually in FreePBX?


I’m having trouble understanding your last two posts, because they only refer to one number.

There are three phone numbers involved: The number you are calling, the caller ID you wish to display and the company number.

It is clear that the number you are calling goes into the SIP URI and the To: header – there are no questions about that.

However, the Vodafone documentation doesn’t seem to show what combinations of headers are permitted for the other two numbers and what formats are allowed. For example, if the company number is in Contact: and the caller ID number is in From:, will that work? Perhaps they have examples of a valid INVITE request.

Or, can you post a link to (or a copy of) the relevant Vodafone documentation? (I can read German fairly well, if it’s not available in English.)