<!-- Kamailio Project uses GitHub Issues only for bugs in the code or feature requests. Please use this template only for feature requests.
If you have questions about using Kamailio or related to its configuration file, ask on sr-users mailing list:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Please try to fill this template as much as possible for any issue. It helps the developers to troubleshoot the issue.
If you submit a feature request (or enhancement) add the description of what you would like to be added.
If there is no content to be filled in a section, the entire section can be removed.
You can delete the comments from the template sections when filling.
You can delete next line and everything above before submitting (it is a comment). -->
### Description
I'm unable to add the generated `Identity` value to reply message when `kamailio` acts as a redirect server and replies with `302 Moved Temporarily` instead of relaying `INVITE`. This code doesn't work, i.e. no `Identity` header in `302 Moved Temporarily` message: ``` if (stirshaken_add_identity($var(x5u), $var(attest), $var(origtn_val), $var(desttn_val), $var(origid)) == 1) { append_branch("sip:$rU@127.0.0.1:6060"); sl_send_reply("302", "Moved Temporarily"); exit; } ```
### Expected behavior
It would be nice if the `stirshaken_add_identity_*` functions would add the generated `Identity` header to the reply messages too, or store the generated `Identity` header in a separate variable, like `$identity`, for the future processing.
Making it available on a variable seems to offer more flexibility, then append_to_reply() can be used for your specific case.
With the current version, if the sip transaction is not created yet (which I assume is not, because of stateless reply with sl_send_reply()), you can try:
``` if (stirshaken_add_identity($var(x5u), $var(attest), $var(origtn_val), $var(desttn_val), $var(origid))) { msg_apply_changes(); append_to_reply("Identity: $hdr(Identity)\r\n"); append_branch("sip:$rU@127.0.0.1:6060"); sl_send_reply("302", "Moved Temporarily"); exit; } ```
Hello Daniel! Thanks for your prompt reply, greatly appreciated! I can confirm that your solution works, but with a slight modification to the `record_route()` function to get rid of the error: ``` ERROR: <core> [core/msg_translator.c:3355]: sip_msg_apply_changes(): cannot apply msg changes after adding record-route header - it breaks conditional 2nd header ``` The solution of storing the `Identity` header in a separate variable and using it with the `append_to_reply()` function is the perfect solution for me, so I'll be looking forward to the implementation.
I added `stirshaken_build_identity(...)`, which sets the result in `$secsipid(val)`. Closing this one, if you find bugs in the new implementation, open a new issue.
Closed #2770.
Ohh, I just noticed now you referred to stirshaken function, I added to secsipid module, which I maintain.
I reopen this one, maybe someone wants to do it for stirshaken, if not, it will be closed after a while.
Reopened #2770.
Closing it, more than 6 months without a devel taking over this request to add to stirshaken module.
The feature is in secsipid module already.
Closed #2770.
Hi @miconda Thanks for your help
Its work for me whan using append_to_reply("Identity: $hdr(Identity)\r\n");
for any one face the same issue this my routing script
``` if (is_method("INVITE")) { $var(rc) = secsipid_add_identity("$fU", "$rU", "A", "", "http://localhost/ec256-public.pem", "/root/ec256-private.pem"); if ( $var(rc) ) { xlog("L_ERR", "[STIR/SHAKEN][$ci] Shaken authentication added (SIP Identity Header created)\n"); msg_apply_changes(); append_to_reply("Identity: $hdr(Identity)\r\n"); } else { xlog("L_ERR", "[STIR/SHAKEN][$ci] Failed\n"); }
sl_send_reply("302","Moved Temporarily"); exit; } ``` My question is What necessary headers should be returned with 302 response to make the calls working normally ? Like Contact header? Should I append new branch ?
@marayshi Please use our sr-users discussion list for this kind of generic questions.