How do I configure Asterisk to set an individual sender number?

Guide to setting individual sender numbers in Asterisk via the P-Preferred-Identity header with sipgate trunking.

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

Prerequisite is an existing phone number contract and the corresponding setting of a fallback sender number in the account under account management, Trunks and Fallback sender number.

The sender 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:[email protected]>)

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

If you want to suppress the number, enter the following:

SipAddHeader(P-Preferred-Identity: <sip:[email protected]>)

SipAddHeader(Privacy: id)

Last updated