I am trying to figure out the PJSIP way how to forward calls from extern A via B to to extern C. I am following Manipulating Party ID Information and created
[cfu-test]
exten=>s,1,Noop()
same =>n,SET(A=${CALLERID(num)})
same =>n,SET(B=+4961...........)
same =>n,SET(C=+4915.........)
same => n,Set(REDIRECTING(orig-num,i)=${A})
same => n,Set(REDIRECTING(from-num,i)=${B})
same => n,Set(REDIRECTING(from-num-pres,i)=allowed)
same => n,Set(REDIRECTING(to-num,i)=${C})
same => n,Set(REDIRECTING(to-num-pres,i)=allowed)
same => n,Set(REDIRECTING(count,i)=$[${REDIRECTING(count)} + 1])
same => n,Set(REDIRECTING(reason,i)=cfu)
same => n,Dial(PJSIP/${C}@my-sbc)
same => n,Hangup()
[default]
exten => +4961... ,1,Gosub(cfu-test,s,1( ))
Incoming calls are diverted to C and everything is fine except the outgoing TO: header, which is C, not B. In my understanding, FROM: and TO: should be fixed along the call chain. And my provider wants the diverted INVITE look like this:
A= From, B = To und B = Diversion , C only in request URI
With chan_sip, i could achieve [Edit: To=C was wrong] To=B by replacing Dial with
same => n,DIAL(SIP/${C}@my-sbc!${B}@my-sbc)
but with PJSIP I found no such syntax. I read about header manipulation using a predial handler, but I wonder if there is a simpler solution using my REDIRECTING parameters.
Best regards