It can be merged, but the retrieval of current r-uri has to be changed. I don't think it is wise to use config variables names in the C code. I refer to the snippet:

 +  str src_uri = str_init("$ru");
...
 +  if (pv_eval_str(msg, &ruri, &src_uri) < 0) {
 +      LM_ERR("Failed to get $ru value fallback to parse msg\n");
 +      ruri.s = REQ_LINE(msg).uri.s;
 +      ruri.len = REQ_LINE(msg).uri.len;
 +  }

It should be as simple as:

if(parse_sip_msg_uri(msg)<0) { /* error handling */ }

if (msg->new_uri.s!=NULL) {
  ruri = msg->new_uri;
} else {
   ruri = REQ_LINE(msg).uri;
}

The name of r-uri variable ($ru) is set by pv module, I don't think sca (or other module) have to rely on that being forever. Also, it requires parsing the name and evaluation. In cases when there is a lot of duplicated code, better export the C function from pv module and make that a dependency, otherwise this approach can hide unpredictible behaviour in long term, without getting any errors at compilation or linking.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.