How to attach SIP headers to a Page call on outgoing leg?

Preface: I’m using the PJSIP channel driver instead of chan_sip. In the old chan_sip, the SIP headers would be automatically attached to the outbound calling channel when a ‘Dial’ or ‘Page’ dialplan application was executed. PJSIP’s diaplan function attaches it to the incoming channel only. I have SIP headers attached to outgoing call legs following the guide in the PJSIP_HEADER function currently. However…

According to the ‘Page’ dialplan application, there doesn’t seem to be a place to execute a pre dial handler like the ‘Dial’ application does. Since the SIP stack is now using PJSIP, I have to attach all SIP headers in my pre dial handler but can’t seem to figure out how to do the same thing with the ‘Page’.

I just need a way to attach a SIP header using the PJSIP channel driver. The SIP header is needed to inform the endpoint to auto answer.

UPDATE! After hitting up the IRC #asterisk channel it seems like ‘Page’ has a pre dial option in trunk so it’s at least in the pipe.

Hrm. I’m out of ideas beyond diving into the asterisk code itself. Anyone have a pointer?

#asterisk on Freenode to the rescue!

short story - app_page in trunk (13) has pre-dial handlers.

Long story - page Local channels that call Dial of PJSIP endpoints using pre-dial handlers