Hi Alex,
As I said, that was a very ugly solution.
The problem you are facing can be approached from two direction:
1) mangle the REGISTER - SER takes the aor from TO header, so you have
to mangle it; but doing this will screw up badly the transaction
matching (see my previous email).
2) try to fix it on lookup - try to do lookup both as user@ip and
user@domain - but is the ugly solution.
Maybe doing code changing will help you. Something like having a
"use_domain" parameter for registrar module which will force to ignore
the domain part when building the aor.
Best regards,
Marian Dumitru
Alex Mack wrote:
Hi Marian!
You're right, that way IS very ugly.
You also could leave out the "if"-clause completely: transform *every*
request into "user@ip"-form rendering wrong requests only and transform
those back to the correct form. That's not an approach, that's a proof
of misconcept.
It can't be we're the only ones facing this problem. What does ser have
included to handle malformed/wrong REGISTER-requests? It has to be able
to mangle incoming REGISTER-requests beyond checking them. How can one
control what ser is puting into 'aor'? There have to be more parameters
for the save() function.
In the CVS one can see, that "use_domain" was removed for multi-domain
capability, but there has to be implemented a feature to "alias"
domains, e.g., all "100.100.100.100" are also "mydomain.org".
Best regards,
Alex Mack.
Marian Dumitru wrote:
> Hi Alex,
>
> The subst() cannot fix the problem. If you use it to alter the To
> header, you will have to forward the message to your self to allow the
> modifications to take place (for each message SER keeps the original
> message and a list of changes which are applied only when sending out
> he message). Even if you modify the To hdr and spiral the message back
> to you, you will have to catch the reply to undo the modification on
> To - otherwise, the UAC will no be able to match the reply with the
> request it sent. And to be able to catch the reply you need to use tm,
> but you cannot do so because the transaction will be broken because of
> the modified To hdr. I hope my words make some sens to you :-).
>
> there is a way, but very ugly and inefficient - try lookup using both
> forms user@ip and user@domain:
>
> if (!lookup("location)) {
> # try to replace domain with IP or IP with domain
> if ( subst_uri("/(sip:.*@)mydomain\.com(;.*)/\1xxx.xxx.xxx.xxx\2/") ||
> subst_uri("/(sip:.*@)xxx\.xxx\.xxx(;.*)\.xxx/\1mydomain.com\2/") ) {
> if (!lookup("location")) {
> # not found
> }
> }
> }
>
> I haven't test this, it's just an idea.
>
> Best regards,
> Marian Dumitru
>
--
Voice Sistem
http://www.voice-sistem.ro