PJSIP Trunk CLI Presentation

I have successfully set up a PJSIP trunk to my provider, Gamma. Inbound and outbound calls are working great except the CLI presentation for outbound calls which is using a number assigned by Gamma rather than the number I want.

The following instructions have been provided but I am unsure how to do this in FreePBX ( I have tried entering the desired number in “Outbound CallerID” and “From User” for the trunk but neither changes the assigned number.

Gamma tell me that I am sending “asterisk” as the CallerId but I’m not sure how/where this is set.

Can anyone help?


Test 10 – 13: CLI Presentation
In order to successfully present an ‘A Number’ we expect this to be sent to Gamma in either of the following formats in the FROM header of the SIP INVITE:

10 Digits without leading zero:
From: sip:[email protected];tag=1234567890-123456

E164 Format (+44)
From: sip:[email protected];tag=1234567890-123456

The A-number is checked against a database on the Gamma network of geographic numbers that are allocated to the SIP trunk endpoint. If the number presented does not meet the above criteria, the A-Number CLI presented will be a default CLI, which is the first number in the allocated Geographic DDI range.

Using CLI for Caller ID Always confuses me. CLI is “Command Line Interpreter” and is the term we’ve historically used for the Command Line in “asterisk -r”.

Check the logs in ‘/var/log/asterisk/full’ and you should see how the system is setting the Caller ID Field. In most cases (unless the reference is specified as “CID Name” or “CID Number”) you should create a consolidated CID in the format “Caller Name” <NUMBERXXXX>. Note that the quotation marks and GT/LT signs should be included for all Caller IDs.

There are at least three places where the Caller ID can be set:

  1. In the Trunk Defintion (“NAME” <NUM>).
  2. In the Outbound Route (same as above).
  3. In the specific extensions (same as above).
  4. (Sometimes) In the Phone itself (format dependent on phone).
1 Like

Gamma is telling you that they only allow you to send numbers that you have with them, so what you are trying to do won’t work.

If you are trying to send a number that you have with another provider, ask them to add the number(s) to their database. Retest, if you still have trouble post a SIP trace (redact phone numbers, account numbers, public IP addresses and anything else you feel is personal).

If you are trying to send a number that’s not yours, e.g. to forward a call to your mobile and display the number of the original caller, you can try negotiating that with Gamma but IMO you will have to find another provider for that. My recommendations are Voxbeam (Platinum route) and AnveoDirect (Prime routes). Both companies offer a small credit at signup so you can test without making a payment.

Thanks for the response. The number I am using is registered with Gamma. However, when I spoke to them earlier they said the header they receive includes “asterisk” instead of the number.

At the Asterisk command line, do
pjsip set logger on
and make a failing call. Post the (redacted) outgoing INVITE and screenshots of your trunk settings.

Details as requested:-

<--- Transmitting SIP request (950 bytes) to UDP:GAM.MA.IP.ADDR:5060 --->
INVITE sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP FREE.PBX.IP.ADDR:5060;rport;branch=v0qW4nLLjca1de220-4265-449a-9a09-a637fb9251d0
From: "01987654321" <sip:[email protected]>;tag=9c0a842b-bbba-4dae-9e70-1059015e2d5d
To: <sip:[email protected]>
Contact: <sip:[email protected]:5060>
Call-ID: be85d5d8-6f78-4b06-97b7-af4fb672bc29
CSeq: 22459 INVITE
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: FPBX-
Content-Type: application/sdp
Content-Length:   259

o=- 449266547 449266547 IN IP4 FREE.PBX.IP.ADDR
t=0 0
m=audio 19308 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16

And the screenshots (all settings in the Advanced are set to defaults):-

If a given trunk should always send the same caller ID (your present setup), just change the Outbound CallerID for the trunk to a format that Gamma will accept. Try
"01987654321" <+441987654321>
"01987654321" <1987654321>

If you want to change caller ID dynamically, e.g. to send the number that is local or closest to the person being called, you can use one of the above formats as caller ID for an Outbound Route or an Extension.

To send numbers that are not yours, e.g. when forwarding calls to your mobile, you will need a separate provider for those calls.

Hi Stewart1,

You were correct. I was testing during the porting process. As soon as it completed I was able to present the ported number I wanted.

In my case, the Outbound CallerId didn’t do the trick it was the “From User” I needed to change:
Connectivity > Trunks > [Trunk] > pjsip Settings > Advanced > From User

Thank you for your help.


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