Send_pai and P-Preferred-Identity

Hi there,

I use a Mikopbx (v2021.4.175) and have the following problem. I have a provider who transmits the phone number in the P-Preferred-Identity.

At the provider, the phone number = username for the login
This is also transmitted for an outgoing call.

According to the provider, I can change this with P-Preferred-Identity, but his information does not work. Can someone help me.

In provider-profil must change the config additional
send_pai = no

and in extensions.conf i should expand the following
thats the original part
exten => _[0-9*#+a-zA-Z][0-9*#+a-zA-Z]!,1,Set(number=0049${EXTEN:2})
same => n,Set(number=${FILTER(*#+1234567890,${number})})
same => n,ExecIf($["${EXTEN}" != “${number}”]?Goto(${CONTEXT},${number},$[${PRIORITY} + 1]))
same => n,ExecIf($["${number}x" == “x”]?Hangup())
same => n,Set(ROUTFOUND=1)
same => n,Gosub(${ISTRANSFER}dial,${EXTEN},1)
same => n,ExecIf($["${EXTERNALPHONE}" == “${src_number}”]?Set(DOPTIONS=tk))
same => n,Set(DIAL_COMMAND=PJSIP/${number}@SIP-1641311195)
same => n,GosubIf($["${DIALPLAN_EXISTS(SIP-1641311195-outgoing-custom,${EXTEN},1)}" == “1”]?SIP-1641311195-outgoing-custom,${EXTEN},1)
same => n,Set(_OUT_NEED_ANNONCE=1)
same => n,Dial(${DIAL_COMMAND},600,${DOPTIONS}TKU(${ISTRANSFER}dial_answer)b(dial_create_chan,s,1))
same => n,GosubIf($["${DIALPLAN_EXISTS(SIP-1641311195-outgoing-after-dial-custom,${EXTEN}),1}" == “1”]?SIP-1641311195-outgoing-after-dial-custom,${EXTEN},1)
same => n,ExecIf($["${ISTRANSFER}x" != “x”]?Gosub(transfer_dial_hangup,${EXTEN},1))
same => n,ExecIf($["${DIALSTATUS}" = “ANSWER”]?Hangup())
same => n,ExecIf($["${DIALSTATUS}" = “BUSY”]?Busy())
same => n,Set(pt1c_UNIQUEID=${EMPTY_VALUE})
same => n,return

and the expand from miko-support
exten => _X!,1,Set(PJSIP_HEADER(add,P-Preferred-Identity)=“”)
same => n,return

But the number (035814212345) won´t transmitt.

Can somebody help me.


you need to use Dial option “b” to add PJSIP_HEADER on the outgoing channel

same => n,Set(PJSIP_HEADER(add,P-Preferred-Identity)=“”)


thanks for your answer. Unfortunately it didn’t work.
Do I have to keep or remove the endpoint (send_pai = no) when setting the provider? Or would this not play a role at all in the variant.

this is the original part under dial crate chan, maybe it is helpful for you
exten => s,1,Gosub(lua_${ISTRANSFER}dial_create_chan,${EXTEN},1)
same => n,Set(pt1c_is_dst=1)
same => n,ExecIf($["${PT1C_SIP_HEADER}x" != “x”]?Set(PJSIP_HEADER(add,${CUT(PT1C_SIP_HEADER,:,1)})=${CUT(PT1C_SIP_HEADER,:,2)}))
same => n,Set(__PT1C_SIP_HEADER=${UNDEFINED})
same => n,Set(CHANNEL(hangup_handler_wipe)=hangup_handler,s,1)
same => n,return

Maybe you have another idea,

yes keep that one, so there is only the one that you manually add in dial_create_chan

testing on “x” that is really really ugly, try this instead


or atleast use this

ExecIf($["${number}" == “”]?
ExecIf($["${PT1C_SIP_HEADER}" != “”]?

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