Hello everyone,
I badly need some help on the following issue ...
I am trying to rewrite the To: and From: headers in order to change some prefixes found in REGISTER requests. In fact I want to save both the original request and the modified one. However, even though subst() reports a successfull replace in the logs (textops: subst_f: replacing at offset 41 [sip:33] with [sip:0] / textops: subst_f: replacing at offset 312 [sip:33] with [sip:0] ), the message does not seem to actually be modified. When I dump the request before and after in a file, I see no difference, and the save_noreply is processing the original REGISTER request.
I have read a thread from sep. 2003 where someone said the subst replacement is only effective just before the message is sent out ... so I even tried "faking" a t_relay before the save_noreply, but it does not work neither.
Here is the code I am using :
if (method=="REGISTER") {
save("location"); exec_msg("echo -e REGISTER `date` '\n' `printenv | grep SIP` '\n' >> /var/log/ser-register.log");
if (search("^From.*sip:33.*")) { subst('/sip:33/sip:0/g'); save_noreply("location"); exec_msg("echo -e REGISTER DUP `date` '\n' `printenv | grep SIP` '\n' >> /var/log/ser-register-dup.log"); exec_msg("cat - >> /var/log/ser-register-dup.log"); break; };
break;
};
Does anyone have an idea why it is not working at all ? FYI. I also tried textops replace_all function, with no luck.
Best Regards, Jerome Martin