<div dir="ltr"><div dir="ltr">On Tue, Nov 15, 2022 at 10:50 AM <<a href="mailto:asterisk@phreaknet.org">asterisk@phreaknet.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I am working on something where I need to be able to add a custom header <br>
to an outgoing NOTIFY response for a subscription.<br>
<br>
We have the concept of "body generators" for adding stuff to the body of <br>
an outgoing NOTIFY, but I'm not seeing anything akin to "header <br>
generators" that would easily allow doing this.<br>
<br>
I believe typically this is done by adding the header to the tdata pool, <br>
e.g. ast_sip_add_header(tdata, "Expires", buf) as one way of doing it.<br></blockquote><div><br></div><div>To be specific, it allocates a header FROM the tdata pool and sets it on tdata.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
However, res_pjsip_pubsub doesn't generate/initialize a pjsip_tx_data <br>
until after ast_sip_subscription_notify is already called, so it <br>
certainly can't be done before a pubsub module calls on the pubsub core <br>
to send the notify. Is there any way I've missed that allows us to <br>
access the tdata from a pubsub module, so we can add a header to the <br>
NOTIFY response?<br></blockquote><div><br></div><div>No.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
I do see there is an ast_sip_subscription_response_data struct defined <br>
in res_pjsip_pubsub.h. However, this is used literally nowhere in the <br>
code, only defined, so it's not clear to me how this is supposed to be <br>
used, since nothing currently uses it. Was this intended to be used for <br>
this purpose, or something else?<br></blockquote><div><br></div><div>What you see is the information there is.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
If res_pjsip_pubsub would need to be extended to support this, would it <br>
reasonable to add a callback to a pubsub module that allows it access to <br>
the pjsip_tx_data, so it can do whatever it needs to with it, before the <br>
response gets sent? Or another preferred method of allowing modules to <br>
add headers?<br></blockquote><div><br></div><div>At a surface it is probably fine.</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="font-family:tahoma,sans-serif"><font color="#073763">Joshua C. Colp</font></div><div style="font-family:tahoma,sans-serif"><font color="#073763">Asterisk Project Lead</font></div><div style="font-family:tahoma,sans-serif"><font color="#073763">Sangoma Technologies</font></div><div style="font-family:tahoma,sans-serif"><font color="#073763">Check us out at <a href="http://www.sangoma.com" target="_blank">www.sangoma.com</a> and <a href="http://www.asterisk.org" target="_blank">www.asterisk.org</a></font><br></div></div></div></div></div></div></div></div></div></div></div>