Forward to Mobile Number with Provider SipCall (Clip no Screening)

Hi together,

The base problem is, how to prober setup forwarding calls to mobile phones so that the “ring” works and also the mobile phone display display’s the origin phone number and not the number of the outgoing trunk.

So this is a combination question.I had a freepbx with multiple trunks from swiss provider sipcall. To determined on the outbound routes the affected extensions in the callerid like “123XX” . so the 123 is the prefix for the specific group of extensions which shoul’d use this route for the outbound trunk. So force the trunk i added also the “*991” outbound route and leave the callerid empty. (we had some very small companies with 2-3 people which woul’d like to have a pbx but not wan’t one inhouse or rent a complete virtual server)

I also enabled “clip no screening” on the provider side.

On FreePBX 14 (with sip and not pjsip trunks) i configured an extension which has always “Follow me” enabled. and uses *99107XXXXXX" to the mobile number. this extension is in a dummy ringgroup with a ringtime of 1 second and a “Destination if no answer” to the extension with the forced “Follow me” . This is not a nice setup, but it worked on the FreePBX 14.

Now i switched to FreePBX and all trunks are now pjsip only. The problem now is, that the “clip no screening” seems not to work anymore. The mobile phone see’s only the number of the trunk. Sipcall told me, that the problem on their side the PBX do a new phone call without set the specific origin phone number.

So i tried different other setup’s. So i tried the “misc. destination” to the mobile number. But also their was not the origin phone number visible. Also was their the problem that no “ring” was hearable and also when the phone call is picked up. Both sides don’t hear each other.

Because i tried different approches. Is now my questions, has someone a working call forward to mobile number on a freepbx with pjsip trunks with the provider sipcall with “clip no screening” to see the origin phone number of the caller? And when yes, how is the setup?

Wouldn’t it be a simplier solution to install a sip-phone-app on the mobile-phone, allow more than on connects to the respective extension and do some security restrictions on the extension or even within the freePBx firewall?

Yes it woul’d be simpler und easier (i use it myself) but is no option the affected users.

They tried different mobile (and desktop sip apps) but are not happy with it and so they want this mobile forward now.

Clip no screening does not have a precise meaning. Providers differ in their requirements for From, P-Asserted-Identity, etc.

Please post an example of a successful INVITE (using chan_sip) for the outbound leg of a forwarded call, as well an an example of the failing INVITE using pjsip. If you redact phone numbers, replace the last six digits with xxxxxx but leave the rest intact so we can see format, carrier, etc. If you redact IP addresses, make it clear what each represents (your public IP, provider’s IP, etc.)

i needed some time to reactive the old freepbx for testing purpose. / (External IP of the PBX)
00417XXXXXXXX or 07XXXXXXXX (Mobile Number where the Forward goes)
4144YYYYYYY (external number of test number on pbx)
021ZZZZZZZ (number of the real caller)

Old PBX 14 (chan_sip)

INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP;branch=z9hG4bK21ba55d1;rport
Max-Forwards: 70
From: <sip:[email protected]:5160>;tag=as6d2ac2b8
To: <sip:[email protected]>
Contact: <sip:[email protected]:5160>
Call-ID: [email protected]
CSeq: 102 INVITE
User-Agent: FPBX-
Date: Wed, 14 Jun 2023 14:29:47 GMT
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 330

New PBX 16 (chan_pjsip)

INVITE sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP;rport;branch=z9hG4bKPjd590905a-cd29-4dbf-af4a-c58a62c5b76e
From: <sip:[email protected]>;tag=1af4493e-936c-4c35-9474-34d50fd6aa2b
To: <sip:[email protected]>
Contact: <sip:[email protected]:5060>
Call-ID: 39c79741-de3e-4073-ba85-b725e34e1fa7
CSeq: 31088 INVITE
Supported: 100rel, timer, replaces, norefersub, histinfo
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: FPBX-
Content-Type: application/sdp
Content-Length:   285

The working example shows that SipCall accepts CLI in the From header and does not require any of P-Asserted-Identity, Remote-Party-ID or Diversion.

In the failing example, From contains the trunk number. Possible causes:

  1. From User is set in the trunk. If so, try seting it blank and retest.
  2. CID Options for the trunk does not allow the caller ID to pass. Try setting to Allow Any CID.
  3. The Outbound Route being used has Override Extension set. Try setting it to No.
  4. In the active Follow Me, Change External CID Configuration is forcing a CID. Try setting it to Default.

If none of the above are relevant, paste the Asterisk log for a failing call at and post the link here.

From User is set in the trunk. If so, try seting it blank and retest.

Do you mean the “Outbound CallerID” of the trunk? or the Username in the PJSIP Settings Tab?
If i leave Username empty and only set “Auth username” the Provider Reject the Authentication.

So i checked the logs and see that, when i leave “Username” empty Asterisk Uses the “Trunk Name” (Which hat the Description “Descriptive Name for this Trunk”) so i think their is also something wrong on the Freepbx Side, or the description of the Field is wrong? Because it looks like it’s not only “Descriptive”.

When i change the name of it to the “Auth username” (and so lost some important informations) the registrations works again. But this has no effect to the phone number information.

Also when i don’t set the “Outbound CallerID” on the trunk, this setting has no effect.

CID Options for the trunk does not allow the caller ID to pass. Try setting to Allow Any CID.

Is already set to “Allow Any CID”

The Outbound Route being used has Override Extension set. Try setting it to No.

Is already set to “No”

In the active Follow Me, Change External CID Configuration is forcing a CID. Try setting it to Default.

Is already set to “Default”

If none of the above are relevant, paste the Asterisk log for a failing call at and post the link here.

I will try need to wait here until nighttime, because otherwise too much log information of other calls, extensions, trunks, etc. I will add this later today. (currently morning here)

In the trunk settings, pjsip Settings tab, Advanced sub tab, there is a field “From User”, which (if not blank) overrides the user field of the From header on outbound INVITE. It does not affect registration. If your provider wants the calling number in the From header, this field must be blank.

If that’s not your issue, please paste the Asterisk log for a failing call, with pjsip logger on, at and post the link here.

The “From Users” is blank but the issue still presists.

I tried to generate yesterday night a logfile for the call when not so many users are avaible, but the log is still huge and i need to redact many informations. I need some time to redact each username, extension id, ip, etc. this takes some time. (and hope i don’t replace something wrong, i currently are around a hour to search and replace stuff) So if their is a securer way to send you the log, without pastebin, perhaps this is easier.

I had a similar problem on a freePBX 15 system and added this code to extensions_override_freePBX. In my case the phone numbers (CIDs) of all incoming calls are edited in freePBX and to be able to forward them, I had to remove the changes (remove 0 and add +43, etc). I found a script here

and adapted it…but I am no pro…yet, forwarding works now with an Austrian provider (special setting, needs a “u” in front of the number)…don’t know, if it’s applicable to your problem…but it seems expects a special format (international?) for CID…and you can adjust the format with this code…EDIT: Just realized that my code for the adjustment of the number format doesn’t work in all cases…but you get the idea :wink:

exten => s,1,ExecIf($[ "${CALLERID(name):0:2}" = "01" ]?Set(CALLERID(name)=+431${CALLERID(name):1}))
exten => s,n,ExecIf($[ "${CALLERID(num):0:2}" = "01" ]?Set(CALLERID(num)=+431${CALLERID(num):1}))
exten => s,n,ExecIf($[ "${CALLERID(name):0:2}" = "00" ]?Set(CALLERID(name)=+${CALLERID(name):1}))
exten => s,n,ExecIf($[ "${CALLERID(num):0:2}" = "00" ]?Set(CALLERID(num)=+${CALLERID(num):1}))
exten => s,n,ExecIf($[ "${CALLERID(name):0:1}" = "0" ]?Set(CALLERID(name)=+43${CALLERID(name):1}))
exten => s,n,ExecIf($[ "${CALLERID(num):0:1}" = "0" ]?Set(CALLERID(num)=+43${CALLERID(num):1}))
exten => s,n,Set(__CLIP=${CALLERID(num)})
exten => s,n,Set(CALLERID(name)=${CLIP})
exten => s,n,Set(CALLERID(number)=${CLIP})

exten => s,1,Set(KANALKURZ=${CHANNEL:0:13})
exten => s,n,Noop(Applying SIP Headers to channel)
exten => s,n,While($["${SET(sipkey=${SHIFT(SIPHEADERKEYS)})}" != ""])
exten => s,n,Set(sipheader=${HASH(SIPHEADERS,${sipkey})})
exten => s,n,SIPAddHeader(${sipkey}: ${sipheader})
exten => s,n,Set(PJSIP_HEADER(add,${sipkey})=${sipheader})
exten => s,n,EndWhile
exten => s,n,Set(CALLERID(num)=${CLIP})
exten => s,n(telekom),Set(PJSIP_HEADER(add,P-Preferred-Identity)=<sip:u${CLIP}>)
exten => s,n,Set(PJSIP_HEADER(add,P-Asserted-Identity)=<sip:u${CLIP}>)
exten => s,n,Goto(Ende)
exten => s,n(Ende),Return()

The forwarding I do with a custom-extension…dial local/destination-phone-number@outbound-allroutes

During the redacting the complete log for pastebin i found something, which i oversee the whole time. The outgoing route used a different trunk for dialing out and don’t used the trunk with the empty “From User” and so on. After i changed the trunk to the mentioned above it worked all as expected.

Thanks Stewart for your help!

@Charles_Darwin. Thanks for your input but the Swiss Sip Provider “SipCall” don’t use P-Prefferred-Identity and P-Asserted-Identity for the Caller Identification. This Fields are ignored. I already know your source and used an other script from there for a customer with the german voip provider Sipgate. :wink: (I only have now there the problem that now the number on forwarded calls to mobile numbers works, but the internal phones display something completly wrong, but this is another issue)

1 Like

You are completely right…yesterday, I tried to implement the script above on a freePBX system using a trunk to They really ignore it :wink:

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