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
Alex Mack wrote:
Hi!
Tanks for the answer. subst() did work but obviously didn't solve the
problem.
Below is the debug trace for the subst and a snippet from the used
ser.cfg. As you can see, subst works good, but ser still stores
xx(a)100.100.100.100 as aor. Maybe my regex isn't good enough? Maybe
the approach is wrong at all if ser extracts the vital header
information already before entering the routing script at all.
(IPs in the dumps are replaced, ser is 100.100.100.100, phone is
100.100.100.131, domain is
mydomain.org)
0(8293) method: <REGISTER>
0(8293) uri: <sip:100.100.100.100:5060>
0(8293) version: <SIP/2.0>
0(8293) parse_headers: flags=1
0(8293) end of header reached, state=5
0(8293) parse_headers: Via found, flags=1
0(8293) parse_headers: this is the first via
0(8293) After parse_msg...
0(8293) preparing to run routing scripts...
0(8293) parse_headers: flags=128
0(8293) end of header reached, state=9
0(8293) DEBUG: get_hdr_field: <To> [48];
uri=[sip:31@100.100.100.100:5060]
0(8293) DEBUG: to body ["optiPoint 1 (31)" <sip:31@100.100.100.100:5060>
]
0(8293) get_hdr_field: cseq <CSeq>: <2012717775> <REGISTER>
0(8293) DEBUG: get_hdr_body : content_length=0
0(8293) found end of header
0(8293) DEBUG: is_maxfwd_present: max_forwards header not found!
0(8293) parse_headers: flags=256
0(8293) find_first_route(): No Route headers found
0(8293) loose_route(): There is no Route HF
0(8293) grep_sock_info - checking if host==us: 13==13 &&
[100.100.100.100] == [100.100.100.100]
0(8293) grep_sock_info - checking if port 5060 matches port 5060
0(8293) grep_sock_info - checking if host==us: 13==13 &&
[100.100.100.100] == [100.100.100.100]
0(8293) grep_sock_info - checking if port 5060 matches port 5060
0(8293) #### Authenticate ###
0(8293) check_nonce(): comparing
[4187b4fa25e5e432b9e0bd204a429446c2a3ae9b] and
[4187b4fa0e8bde761be567ab9dd0f201ab31ab49]
0(8293) pre_auth(): Invalid nonce value received
0(8293) build_auth_hf(): 'WWW-Authenticate: Digest
realm="mydomain.org",
nonce="4187b536507484b10dcc87b97b7ee4866bf23601"
'
0(8293) parse_headers: flags=-1
0(8293) check_via_address(100.100.100.131, 100.100.100.131, 0)
0(8293) DEBUG:destroy_avp_list: destroying list (nil)
0(8293) receive_msg: cleaning up
0(8293) SIP Request:
0(8293) method: <REGISTER>
0(8293) uri: <sip:100.100.100.100:5060>
0(8293) version: <SIP/2.0>
0(8293) parse_headers: flags=1
0(8293) end of header reached, state=5
0(8293) parse_headers: Via found, flags=1
0(8293) parse_headers: this is the first via
0(8293) After parse_msg...
0(8293) preparing to run routing scripts...
0(8293) parse_headers: flags=128
0(8293) end of header reached, state=9
0(8293) DEBUG: get_hdr_field: <To> [48];
uri=[sip:31@100.100.100.100:5060]
0(8293) DEBUG: to body ["optiPoint 1 (31)" <sip:31@100.100.100.100:5060>
]
0(8293) get_hdr_field: cseq <CSeq>: <2012717776> <REGISTER>
0(8293) DEBUG: get_hdr_body : content_length=0
0(8293) found end of header
0(8293) DEBUG: is_maxfwd_present: max_forwards header not found!
0(8293) parse_headers: flags=256
0(8293) find_first_route(): No Route headers found
0(8293) loose_route(): There is no Route HF
0(8293) grep_sock_info - checking if host==us: 13==13 &&
[100.100.100.100] == [100.100.100.100]
0(8293) grep_sock_info - checking if port 5060 matches port 5060
0(8293) grep_sock_info - checking if host==us: 13==13 &&
[100.100.100.100] == [100.100.100.100]
0(8293) grep_sock_info - checking if port 5060 matches port 5060
0(8293) #### Authenticate ###
0(8293) check_nonce(): comparing
[4187b536507484b10dcc87b97b7ee4866bf23601] and
[4187b536507484b10dcc87b97b7ee4866bf23601]
0(8293) HA1 string calculated: 6a3f36c88615ea8517a2806d05102e83
0(8293) check_response(): Our result =
'c8fd067f0bb9cdb7a4688cde18a5d3cb'
0(8293) check_response(): Authorization is OK
0(8293) save_rpid(): rpid value is ''
0(8293) subst_run: running. r=0
0(8293) subst_run: matched (60, 20): [sip:31@100.100.100.100]
0(8293) subst_run: running. r=0
0(8293) subst_run: matched (114, 20): [sip:31@100.100.100.100]
0(8293) subst_run: running. r=1
0(8293) textops: subst_f: replacing at offset 101
[sip:31@100.100.100.100] with [sip:31@mydomain.org]
0(8293) textops: subst_f: replacing at offset 155
[sip:31@100.100.100.100] with [sip:31@mydomain.org]
0(8293) subst_f: lst was 0x80fd498
0(8293) #### IP replaced! ###
0(8293) #### saving location ###
0(8293) parse_headers: flags=-1
0(8293) parse_headers: flags=33554432
0(8293) build_contact(): Created Contact HF: Contact:
<sip:31@100.100.100.131:5060>;expires=90
0(8293) parse_headers: flags=-1
0(8293) check_via_address(100.100.100.131, 100.100.100.131, 0)
0(8293) #### break ###
0(8293) DEBUG:destroy_avp_list: destroying list (nil)
0(8293) receive_msg: cleaning up
snippet of ser.cfg:
if (uri==myself) {
if (method=="REGISTER") {
log (1, "#### Authenticate ###\n");
# Uncomment this if you want to use digest authentication
if (!www_authorize("mydomain.org",
"subscriber")) {
www_challenge("mydomain.org", "0");
break;
};
if (
subst('/sip:([^@]*)@100.100.100.100/sip:\1@mydomain.org/ig') ) {
log (1, "#### IP replaced! ###\n");
};
log (1, "#### saving location ###\n");
save("location");
log (1, "#### break ###\n");
break;
};
Hope someone can help me out of this one. Used version of ser is
0.8.99-dev12 (cvs checkout around 15:30 UTC on Nov 2 2004)
Thanks.
Alex Mack.
Claus Futtrup wrote:
Hi
You can use subst("") function in SER to handle rewriting of the To:
header
before you do save("") (requires little regular expression magic
which I
can help with if you are not familiar with REs :-).
Kind Regards
Claus Futtrup
Project Manager
GoIP, The IP telephone company
Mail: cf(a)goip.dk
Tlf: +45 46968000
Fax: +45 46968001
GoIP: +45 32716064
"The box said 'Requires Windows 95, NT, or better,' so I installed
Linux."
This message is for the designated recipient only and may contain
privileged
or confidential information. If you have received it in error, please
notify the sender immediately and delete the original. Any other
use of the
email by you is prohibited.
----- Original Message ----- From: "Alex Mack" <amack(a)fhm.edu>
To: <serusers(a)lists.iptel.org>
Sent: Tuesday, November 02, 2004 11:55 AM
Subject: Re: [Serusers] Problem with specific phones only able to
registerto ipnumber andnotdomain..
I have similar problems (Siemens Optipoint 400)
and I'm interested
in a solution, too. I've posted to this mailing list a week ago.
See below for the messages so far.
Claus Futtrup wrote:
> Hi Guys,
>
> I have this problem with a few phones, that they can only use IP
> number for
> proxy adress and domain. So when they register to the proxy, the
> location
> database will have user@ipnumber and not user@domain (use_domain, 0).
>
> The problem is then as follows: that when a caller that registeres
> with the
> domain name are unable to call users that register with the
> domains IP
> number and vice versa. lookup("location") simply replies not found.
>
> Now I know why it happens, but is there a solution for this
> problem. Like
> only look at user and not user@domain or user@ipnumber?
>
> Kind Regards
>
> Claus Futtrup
>
> _______________________________________________
> Serusers mailing list
> serusers(a)lists.iptel.org
>
http://lists.iptel.org/mailman/listinfo/serusers
> Hi Alex,
>
> Have you enabled "use_domain" parameter for usrloc module? If you
> set it to 0 (as default) usrloc will not use the domain part to
> perform usrloc lookup.
>
> Best regards,
> Marian Dumitru
>
> Alex Mack wrote:
>
>> Hi!
>>
>> I'm using ser with X-Ten Lite Soft-UA and Siemens optiPoint 400
>> IP phones. Problem is: the Siemens phones don't register
>> themselves correctly.
>>
>> For example:
>> (e.g., ser has IP 100.100.100.100)
>>
>> Soft-UA is "sip:30@mydomain.org"
>> Phone 1 is "sip:31@mydomain.org"
>> Phone 2 is "sip:32@mydomain.org"
>>
>> Soft-UA registers itself as "sip:30@mydomain.org"
>> Phone 1 registers itself as "sip:31@100.100.100.100" (seems to be
>> odd behaviour)
>> Phone 2 registers itself as "sip:32@100.100.100.100"
>>
>> But now the lookup fails if you start dialing from the phones. If
>> you dial "32" (e.g. from Phone 1), the phone generates an INVITE
>> to "sip:32@mydomain.org" which can't be found in usrloc (DEBUG
>> tells that) and the call fails. If you dial "30" from the same
>> phone, the call comes through, because "sip:30@mydomain.org" was
>> found in usrloc.
>> I tried to mangle the uri in the REGISTER message before
>> "save("location");", without effect. I've used
"replace(re,
>> str)", but it didn't seem to work.
>>
>> Any ideas to overcome that bug of the phones?
>>
>> Thanks!
>> Alex.
>>
>> _______________________________________________
>> Serusers mailing list
>> serusers(a)lists.iptel.org
>>
http://lists.iptel.org/mailman/listinfo/serusers
>>
_______________________________________________
Serusers mailing list
serusers(a)lists.iptel.org
http://lists.iptel.org/mailman/listinfo/serusers
_______________________________________________
Serusers mailing list
serusers(a)lists.iptel.org
http://lists.iptel.org/mailman/listinfo/serusers