[OpenSIPS-Users] Intercepting PRACK requests

Mickael Marrache mickaelmarrache at gmail.com
Thu Sep 11 13:53:15 CEST 2014


Hi,

I'm looking for a way to intercept PRACK requests per branch.

When my proxy receives a SIP INVITE, a module I wrote may modify some data
in the message. Then, the INVITE is forked in parallel to multiple
destinations. The call to the exported command of my module is made in
branch route so that changes for one destination are made only for messages
related to its branch. The old values are the same across all branches so I
store them from the beginning in the dialog. However, the new values are
branch specific and therefore I store them in branch AVPs. As the UAC
module does, I register a TM callback for the event TMCB_RESPONSE_OUT to
move the "winning" branch AVPs in the dialog when the initial INVITE
transaction completes. Still as the UAC module does, I register a TM
callback for the event TMCB_RESPONSE_IN to restore replies before
forwarding them. Finally, the sequential requests are automatically
modified by a dialog callback registered by the TM callback when the dialog
is established.

However, I may also receive PRACK requests from the different UACs but
these PRACKs are sent before the dialog is established, therefore the
dialog callback for modifying sequential requests is not registered.
Moreover, PRACKs requests sent by different UACs should be modified
differently depending on the sending UAC.

What is the right way to do it?

I thought about registering the dialog callback from the beginning and for
each received sequential request:

1. Determine if the dialog is established.
2. If dialog is established, modify the request using values stored in
dialog.
3. Otherwise, modify the request using values stored in the branch AVPs for
the branch associated to the request.

Thanks,
Mickael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20140911/33e27c2b/attachment.htm>


More information about the Users mailing list