Setting of P-Asserted-Identity for transferred calls

Hi Group

My extensions.conf is a little different to most in that I use Local Channels extensively via subroutines.
This allows me to have a single included dial plan file containing all my used number patterns.

The format of the dialplan is something like:
[dialplan]
exten => _1XX,1,Gosub(subDial-Extension,start,1(${EXTEN}))

[subDial-Extension]
exten => start,1,NoOp(Start of subroutine)

Now this all works fine however one issue that I am having is the Connected ID number after a transferred call just shows ‘start’.

For example:
Ext A calls Ext B - all CID and Connected ID is fine
Ext B performs an attended transfer of the call to Ext C - Ext B CID and Connected ID is fine but Ext A see’s the correct Connected ID name but shows ‘start’ for the number.

This problem can be solved by branching to the actual extension in the subroutine as follows:
[dialplan]
exten => _1XX,1,Gosub(subDial-Extension,{EXTEN},1({EXTEN}))

[subDial-Extension]
exten => _XX.,1,NoOp(Start of subroutine)

So my questions are:
How is the P-Asserted-Identity updated for transferred calls?
Is this the only way to make it work correctly for the way I am doing it?

Thanks so much all.

Regards
Michael Knill

I’d suggest reading https://wiki.asterisk.org/wiki/display/AST/Manipulating+Party+ID+Information and seeing if any of that helps.

Thanks David

Yes I did look at that and tried setting the REDIRECTING variable. Interestingly after setting this, a From and Via value appears on the screen of the phones (Yealink).
The problem is that the Connected ID update happens after the Dial command so it does not appear to be affected by any variables set.

Regards
Mike

I fixed it with a workaround:

[subDial-Extension]
exten => start,1,NoOp(${ARG1})
same => n,Set(NumbersOnly=${FILTER(0-9,${ARG1})})
same => n,GotoIf($["${NumbersOnly}" = ""]?9999,1:${NumbersOnly},1)
;Jump to here
exten => _XX.,1,NoOp()

Seems to work well.

Thanks
Mike

This wiki don’t work already and I solving simitilar problem :frowning:

https://docs.asterisk.org/Configuration/Functions/Manipulating-Party-ID-Information/

Otherwise you would need to state your problem.

Hello,

thanks, firstly everything worked me, but now before test with my carrier I found, what PAI again not work and I absolutely no understnad why. (diversion header remain work fine)

in pjsip.conf in type endpoint I am defined send_pai=yes

Important line from my kontext for forward call:

; Get P-Asserted-Identity if present
same => n,Set(PAI=${PJSIP_HEADER(read,P-Asserted-Identity)})
; Extract the number from PAI
same => n,ExecIf($[“${PAI}” != “”]?Set(PAI_NUM=${CUT(CUT(PAI,:,2),@,1)}))

…(absolutely no important lines with dubug info, diversion settup, obtain trunk,sip_ip)…

; Set P-Asserted-Identity using CONNECTEDLINE
same => n,ExecIf($[“${PAI_NUM}” != “”]?Set(CONNECTEDLINE(num,i)=${PAI_NUM}))
same => n,ExecIf($[“${PAI_NUM}” != “”]?Set(CONNECTEDLINE(num-pres)=allowed))
same => n,Dial(PJSIP/${TRUNK_NAME}/sip:${FORWARD_NUMBER}@${SIP_IP},30,I)

If this line will forward call from Anonymous number, my script correctly load real number from received P-Asserted-Identity, I am also see in asterisk log correct settup this value back

– Executing [790368xxx@incoming-calls:66] ExecIf(“PJSIP/nordictelecom_trunk-00000042”, “1?Set(CONNECTEDLINE(num,i)=774884xxx)”) in new stack
– Executing [790368xxx@incoming-calls:67] ExecIf(“PJSIP/nordictelecom_trunk-00000042”, “1?Set(CONNECTEDLINE(num-pres)=allowed)”) in new stack
– Executing [790368xxx@incoming-calls:68] Dial(“PJSIP/nordictelecom_trunk-00000042”, “PJSIP/nordictelecom_trunk/sip:731222xxx@94.241.x.x,30,I”) in new stack

but in Invite on wireshark I can see PAI as “P-Asserted-Identity: sip:Anonymous@193.86.x.x”. I am sure , what last week it worked, I don’t have absolutely clue which workaround can cause, what it stopped work and it ignore my PAI inserted into CONNECTEDLINE

can somebody help me understand why this happened?

You are actually requesting connected line be sent on the A side, but you intended caller ID to be sent on the B side. You need to do this with CALLER ID functions…

Also, if you trust PAI on the incoming side, I think the only manipulation you need to do is to force the caller ID presentation to allowed, unconditionally. I’m assuming that from user is already being forced in the endpoint definition. (I I understand PAI correctly, I’m not actually sure that that should be necessary, but I think it is.)

If I get a call from party A to my B number which I want to forward to C number, the invite from A number to my B number in case of anonymous call contains from entry as “sip:Anonymous@IP” and in P-Asserted-Identity I am got real number of caller “sip:realnumber@IP” - this setup mean, what receiver of call will not see number for caller, but for respect our live is realidentity for operator anounced in P-Asserted-Identity.

So for forward call to number C, I must again send call with from “sip:Anonymous@IP” and with P-Asserted-Identity with real number which I got…

If I remove line or I keep lines (no depend)
same => n,ExecIf($[“${PAI_NUM}” != “”]?Set(CONNECTEDLINE(num,i)=${PAI_NUM}))
same => n,ExecIf($[“${PAI_NUM}” != “”]?Set(CONNECTEDLINE(num-pres)=allowed))

Asterisk rewrite somewhere in background PAI to “sip:Anonymous@IP” … but I need keep here received “sip:realnumber@IP” for announce real caller to other operator, but not visible for owner for handsed C (he will se just From information about anonyme number)

Whilst there may also be issues to do with how Asterisk handles presentation prohibitions, I’ve already told you that you are setting the wrong thing.