Set Diversion Header on Outbound Call

Hi,
I use PJSIP with Asterisk 20. I would like to set diversion headers in the outgoing call.

I have read that the function PJSIP_HEADER is not the correct way and that the REDIRECTING function should be used instead.
Unfortunately, I have not yet been able to implement this successfully. What do I have to do to set diversion header for an outgoing call?
Any working example is welcome :wink:

Best regards
Karsten

What have you actually tried and what was the result? There is also documentation and an example on the docs site[1].

[1] Manipulating Party ID Information - Asterisk Documentation

Hi Joshua,
thanks for Your quick reply.

I have used the REDIRECTING function with only the from-num attribute. It was not clear from the documentation of the function itself (in the CLI) that, for example, the count should also be incremented.
Many thanks for the link to the page. There I could see that several function calls are required.
Now I am making progress.
Thank you and have a nice day.
Best regards
Karsten