Intercepting outgoing pjsip ACK request in a module

Hi there,

I’m writing an asterisk module where I’m desperately trying to intercept an outgoing ACK request but without any luck.
I’m using the usual ast_sip_session_register_supplement function, specifying .method = “ACK” and .outgoing_request, but it seems the callback is never called for outgoing ACK messages.

What I’m trying to get is a custom “user parameter” in the URIs of the messages (different from user=phone).

Any suggestion?

Thanks,
Daniele

We don’t generate ACKs, they are generated internally in the PJSIP stack so they won’t go through that layer. You’d likely need to use a sip module and ensure it is attached to the dialog itself. Intercepting the ACK isn’t something I’ve tried or needed to do, so I don’t know the best way outside of that.

With:

You’d likely need to use a sip module…

you mean I must give up the PJSIP channel and switch to the old SIP channel?

No, there are two things you can do in PJSIP for inserting logic. The first is session supplements as you’ve tried, which act on session messages created by the Asterisk side. The second implement SIP “services” which are the bare PJSIP module API. They allow much lower level access to things.

Great.
I registered a pjsip module using the ast_sip_register_service and actually I can intercept every message sent and received.
So far so good.
Unfortunately, in my module I should take the value of the parameter to insert in the URI from a channel variable, but of course I don’t have accesso to asterisk sessions in the pjsip module. Have you got some idea?
Thanks!

You’re kind of in uncharted territory that I haven’t thought about so I don’t really have anything to add. I don’t know if such information is really available in any mechanism at that level for an ACK…