[asterisk-dev] Manipulate re-INVITE response in user written Asterisk module

Andreas Wehrmann a.wehrmann at yandex.com
Tue Nov 6 05:01:01 CST 2018


On 05.11.18 12:07, Joshua C. Colp wrote:
>
>>>> Since I had no more ideas left, I then tried to hook into PJSIP directly
>>>> by providing a pjsip_module that implements the on_rx_response() callback.
>>>>
>>>> That doesn't really work either, because the callback never fired.
> This is because once a dialog is established only the modules attached to that dialog are executed, except for those executed before the transaction and dialog is found. You have to add your module to the dialog in some way to continue getting called.  Some of the modules already do this, such as res_pjsip_nat. It uses "pjsip_dlg_add_usage" to add itself to the dialog so it continues to get called in the future.
>
>>>> After I played around with module priority the callback eventually fired but I was unable to get the TSX and dialog references from PJ
>>>> (probably because the module got called too early?).
>>>> However I need those to get the corresponding ast_sip_session.
>>>>
>>>> At this point, I don't know how to proceed.
>>>> Is there a way to hook into reINVITE responses to achieve what I'm trying to do?
> The above dialog comment should allow you to continue to get callbacks and is the easiest way to make it work.
>

That was it!
Attaching the module to the dialog worked.
Thank you for the hint, I do appreciate it!

Best regards





More information about the asterisk-dev mailing list