Pjsip diversion

Hello

I was testing a FreePbx 13 with pjSip and I have some strange behavior.
On call forwarding, there is no diversion header, I have enabled diversion in advanced settings and i can see in dial plan that context [sub-diversion-header] is executed (PJSIP_HEADER(add,Diversion)=;privacy=off;screen=no;reason=unconditional)), but in sip trace is missing.

INVITE sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.148.9:5060;rport;branch=z9hG4bKPj502tghnXQSuXRPhSv3RLN0yeHhv4vOmo
From: sip:[email protected];tag=BEUrTEUcYKh3whPGHhEx5IYIOuYjdJ.1
To: sip:[email protected]
Contact: sip:[email protected]:5060
Call-ID: Utl9Q1tX0PtiMkMQkC8Mk-1F.JQDe7gp
CSeq: 29621 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, REFER, MESSAGE
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
P-Asserted-Identity: sip:[email protected]
Remote-Party-ID: sip:[email protected];privacy=off;screen=no
Max-Forwards: 70
User-Agent: Asterisk PBX 13.12.1
Content-Type: application/sdp
Content-Length: 263

v=0
o=- 1008816852 1008816852 IN IP4 192.168.148.9
s=Asterisk
c=IN IP4 192.168.148.9
t=0 0
m=audio 15088 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

Until now I was using chan_sip and it was working with no problems

BR
Mitja

Hi,
did you manage to solve it?
I have the same problem.

Guy

Hi

No solution for now, I tried to add diversion header with PJSIP_HEADER but nothing worked.

Mitja

Hi

I made some progress, the division header is showing in sip trace, but I didn’t tested on provider trunk jet. For now I tested with 2 servers.

What I did:

in extension_custom.conf and add this lines:

[diversion]
exten => s,1,Set(DIVERSION_REASON=${IF($[${LEN(${DIVERSION_REASON})}=0]?no-answer:${DIVERSION_REASON})})
exten => s,n,GotoIf($[“${CHANNEL(channeltype)}”=“PJSIP”]?pjsip)
exten => s,n,Return()
exten => s,n(pjsip),Set(PJSIP_HEADER(add,Diversion)= >tel:${FROM_DID}>;reason=${DIVERSION_REASON};screen=no;privacy=off)
exten => s,n,Return()

Login to GUI, in your trunk go to “General” - “Asterisk Trunk Dial Options” and enable Override button and add this line “Ttb(diversion,s,1)”

BR
Mitja

Doing this will break other functionality in FreePBX where it tries to set the b leg on a call and will now fail.

I have suspected that will be a problem.
Any ideas how implement diversion header in a different way?