For the complete documentation index, see llms.txt. This page is also available as Markdown.
Add P-Preferred-Identity and Remote-Party-ID header
Some providers require sending an additional SIP header when initiating an outgoing call. In this article we will describe a way to install it.
To solve the problem, additional contexts should be described through the System File Customization menu.
System File Customization menu
We will edit the extensions.conf file.
Extensions.conf file
Add the following text to the end of the file:
Code for extrensions.conf
Pay attention:
Replace all occurrences of "SIP-TRUNK-A2DDBADA" with your provider ID. You can find it in the browser address bar when editing the provider account in the MikoPBX web interface.
The provider ID format depends on the MikoPBX version: current versions use SIP-TRUNK-XXXX, older ones use SIP-PROVIDER-XXXX or SIP-XXXX. That is why the example does not extract the provider from the context name but takes it from the ${PROVIDER_ID} variable, which MikoPBX sets before calling the context. Versions earlier than 2024.1.114 do not set this variable — replace ${PROVIDER_ID} with your provider ID explicitly.
When using the "User Groups" module:
The peculiarity of this option is that the value "OUTGOING_CID" will be taken from the settings of user groups. For each group, you can assign your own value of the outgoing caller id. For example, the Westcall provider thus allows you to control the value of the callerid that the client sees.
Last updated
Was this helpful?
Was this helpful?
[SIP-TRUNK-A2DDBADA-outgoing-custom]
exten => _X!,1,Dial(PJSIP/${number}@${PROVIDER_ID},600,${DOPTIONS}TKU(dial_answer)b(dial_create_chan_${PROVIDER_ID}_custom,s,1))
same => n,ExecIf($["${DIALSTATUS}" = "ANSWER"]?Hangup())
same => n,ExecIf($["${DIALSTATUS}" = "BUSY"]?Busy(2))
same => n,return
[dial_create_chan_SIP-TRUNK-A2DDBADA_custom]
exten => s,1,Gosub(lua_${ISTRANSFER}dial_create_chan,${EXTEN},1)
same => n,Set(pt1c_is_dst=1)
same => n,Set(OUTGOING_CID=32672293042)
same => n,ExecIf($["${OUTGOING_CID}x" != "x"]?Set(PJSIP_HEADER(add,P-Preferred-Identity)=<sip:${OUTGOING_CID}@127.0.0.1>))
same => n,ExecIf($["${OUTGOING_CID}x" != "x"]?Set(PJSIP_HEADER(add,Remote-Party-ID)=<sip:${OUTGOING_CID}@127.0.0.1>))
same => n,Set(__PT1C_SIP_HEADER=${UNDEFINED})
same => n,Set(CHANNEL(hangup_handler_wipe)=hangup_handler,s,1)
same => n,return
[SIP-TRUNK-A2DDBADA-outgoing-ug-custom]
exten => _X!,1,Dial(PJSIP/${number}@${PROVIDER_ID},600,${DOPTIONS}TKU(dial_answer)b(dial_create_chan_custom,s,1))
same => n,ExecIf($["${DIALSTATUS}" = "ANSWER"]?Hangup())
same => n,ExecIf($["${DIALSTATUS}" = "BUSY"]?Busy(2))
same => n,return
[dial_create_chan_custom]
exten => s,1,Gosub(lua_${ISTRANSFER}dial_create_chan,${EXTEN},1)
same => n,Set(pt1c_is_dst=1)
same => n,Set(GR_VARS=${DB(UsersGroups/${FROM_PEER})})
same => n,Set(tmpName=${CUT(GR_VARS,\,,2)})
same => n,Set(tmpName=${CUT(tmpName,\_,3)})
same => n,ExecIf($["${GR_VARS}x" != "x"]?Exec(Set(${GR_VARS})))
same => n,ExecIf($["${GR_PERM_ENABLE}" == "1" && "${GR_ID_${tmpName}}" != "1"]?return)
same => n,ExecIf($["${GR_PERM_ENABLE}" == "1" && "${GR_CID_${tmpName}}x" != "x"]?MSet(GR_OLD_CALLERID=${CALLERID(num)},OUTGOING_CID=${GR_CID_${tmpName}}))
same => n,ExecIf($["${OUTGOING_CID}x" != "x"]?Set(PJSIP_HEADER(add,P-Preferred-Identity)=<sip:${OUTGOING_CID}@127.0.0.1>))
same => n,ExecIf($["${OUTGOING_CID}x" != "x"]?Set(PJSIP_HEADER(add,Remote-Party-ID)=<sip:${OUTGOING_CID}@127.0.0.1>))
same => n,Set(__PT1C_SIP_HEADER=${UNDEFINED})
same => n,Set(CHANNEL(hangup_handler_wipe)=hangup_handler,s,1)
same => n,return