[asterisk-users] PJSIP_HEADER - Diversion header manipulation

Joshua C. Colp jcolp at digium.com
Tue Dec 11 07:46:22 CST 2018

On Mon, Dec 10, 2018, at 6:02 AM, Davor Jovanovic wrote:
> Hi all,
> I’m trying to rewrite Diversion header when call forwarding is done on 
> the phone. The phone sends "302 Moved Temporarily" response and sets 
> Diversion header to a local number, but before Asterisk sends this call 
> towards TSP provider I need to change Diversion header to a full PSTN 
> number. I am using PJSIP_HEADER in a pre-dial handler (configuration is 
> below). On the same call I can add some other custom headers (logs are 
> below).
> Is there any chance I can rewrite Diversion header in this scenario with 
> PJSIP_HEADER function? Asterisk version is 16.0.1 built from source on 
> Debian 9.

The Diversion header is created and managed by the implementation in PJSIP itself. It can't be edited using the PJSIP_HEADER dialplan function, but can be manipulated using the normal core mechanisms[1].

[1] https://wiki.asterisk.org/wiki/display/AST/Manipulating+Party+ID+Information#ManipulatingPartyIDInformation-REDIRECTINGdialplanfunction

Joshua C. Colp
Digium - A Sangoma Company | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org

More information about the asterisk-users mailing list