For the complete documentation index, see llms.txt. This page is also available as Markdown.

How do I configure Asterisk to set an individual caller ID?

Instructions for setting individual caller IDs in Asterisk via the P-Preferred-Identity header with sipgate trunking.

Note: This function can only be used in conjunction with sipgate trunking.

A prerequisite is an existing phone number contract and the corresponding definition of a fallback caller ID number in the account under account management, Trunks and Fallback caller ID number.

The caller ID number must be set as an additional header P-Preferred-Identity in international format (E.164) must be set. Modify the file extensions.conf as follows:

extensions.conf
[sipout]
exten => _X.,1,Set(CALLERID(number)=SIPID)
exten => _X.,n,Dial(SIP/${EXTEN}@sipgate-out,30,trgb(sipout-hook^${EXTEN}^1))
exten => _X.,n,Hangup

[sipout-hook]
exten => _X.,1,Set(PJSIP_HEADER(add,P-Preferred-Identity)=<sip:4921158000000@sipconnect.sipgate.de>)

Instead of 4921158000000 enter the desired sender number. It is important to use the correct international format, but without leading zeros or plus signs.

If you want to suppress the caller ID, enter the following:

SipAddHeader(P-Preferred-Identity: <sip:492111234567@sipconnect.sipgate.de>)

SipAddHeader(Privacy: id)

Last updated