SV: [Serusers] Question about usrloc

Runar Lyngmo runar.lyngmo at opus-hadsel.no
Mon Aug 30 16:06:57 CEST 2004


Thanks for quick reply :)

I have a new question then.

Do I have to enable something in my ser config file to get this
functionality? Or is it supposed to be enabled by default? I'm using
ser-0.8.14.

My ser registers the username in the sip uri as the username in the location
db.

Under I have pasted some content of my mysql db, ngrep log, ser debug
(stdout) and config file. Maybe someone can see what's wrong. (most probably
all of it) :)


Best Regards,

Runar Lyngmo

mysql> select username,contact from location;
+----------+----------------------------------+
| username | contact                          |
+----------+----------------------------------+
| 12345    | sip:12345 at 10.101.242.255:5060    |
+----------+----------------------------------+
1 row in set (0.00 sec)


mysql> select username,password,email_address from subscriber where
username="msn1-0003f5" and domain="sip.test.local";
+-------------+-------------+----------------------------+
| username    | password    | email_address              |
+-------------+-------------+----------------------------+
| msn1-0003f5 | msn1-0003f5 | msn1-0003f5 at sip.test.local |
+-------------+-------------+----------------------------+
1 row in set (0.00 sec)


---------------------------- NGREP Start----------------------------

#
U 10.101.242.255:5060 -> 192.168.20.19:5060
REGISTER sip:sip.test.local;transport=UDP SIP/2.0.
User-Agent: ATI-RG613TX/2-0-2_11.
From: msn1-0003f5 <sip:12345 at sip.test.local>;tag=AADICAAN2gAD9Qxx.
To: msn1-0003f5 <sip:12345 at sip.test.local>.
Call-ID: AgBfCgxx at 10.101.242.255.
CSeq: 2 REGISTER.
Contact: <sip:12345 at 10.101.242.255:5060>.
Max-Forwards: 70.
Via: SIP/2.0/UDP 10.101.242.255:5060;branch=z9hG4bKAQBgCgxx.
Authorization: Digest username="msn1-0003f5", realm="sip.test.local",
nonce="41333187293d494707f1aec40c81785270a74c3d", uri="sip:sip.test.local",
response="df3cede49983d6ca9f328fb07f929cbe",
cnonce="0000000000000000000000000000a60", nc=00000001, qop=auth.

Content-Length: 0.
.

#
U 192.168.20.19:5060 -> 10.101.242.255:5060
SIP/2.0 200 OK.
From: msn1-0003f5 <sip:12345 at sip.test.local>;tag=AADICAAN2gAD9Qxx.
To: msn1-0003f5
<sip:12345 at sip.test.local>;tag=86a6834669ee9242fa3a0405be3ca1df.3ddd.
Call-ID: AgBfCgxx at 10.101.242.255.
CSeq: 2 REGISTER.
Via: SIP/2.0/UDP 10.101.242.255:5060;branch=z9hG4bKAQBgCgxx.
Contact: <sip:12345 at 10.101.242.255:5060>;q=0.00;expires=3600.
Server: Sip EXpress router (0.8.14 (i386/linux)).
Content-Length: 0.
Warning: 392 192.168.20.19:5060 "Noisy feedback tells:  pid=13530
req_src_ip=10.101.242.255 req_src_port=5060
in_uri=sip:sip.test.local;transport=UDP
out_uri=sip:sip.test.local;transport=UDP via_cnt==1".
.

---------------------------- NGREP Stop ----------------------------




---------------------------- SER Debug Start -----------------------------
0(13530) DEBUG: get_hdr_field: <To> [40]; uri=[sip:12345 at sip.test.local]
 0(13530) DEBUG: to body [msn1-0003f5 <sip:12345 at sip.test.local>
]
 0(13530) get_hdr_field: cseq <CSeq>: <3> <REGISTER>
 0(13530) Found param type 232, <branch> = <z9hG4bKAABfCgxx>; state=16
 0(13530) end of header reached, state=5
 0(13530) parse_headers: Via found, flags=1
 0(13530) parse_headers: this is the first via
 0(13530) After parse_msg...
 0(13530) preparing to run routing scripts...
 0(13530) DEBUG : is_maxfwd_present: max_forward header already found!
 0(13530) DEBUG: is_maxfwd_present: value = 70
 0(13530) DEBUG: add_param: tag=AADICAAN2gAD9Qxx
 0(13530) end of header reached, state=29
 0(13530) check_self - checking if host==us: 14==13 &&  [sip.test.local] ==
[192.168.20.19]
 0(13530) check_self - checking if port 5060 matches port 5060
 0(13530) REGISTER: Trying to register user... 0(13530) parse_headers:
flags=4096
 0(13530) check_nonce(): comparing
[41333161939eb5377d3dcb5d96a6ad086df68856] and
[41333161eeefffc125a3ad541f791ff6e20188b2]
 0(13530) pre_auth(): Invalid nonce value received
 0(13530) build_auth_hf(): 'WWW-Authenticate: Digest realm="sip.test.local",
nonce="41333186f507c5895e47b9df74a3cf984ab0471e", qop="auth"
'
 0(13530) parse_headers: flags=-1
 0(13530) DEBUG: get_hdr_body : content_length=0
 0(13530) found end of header
 0(13530) check_via_address(10.101.242.255, 10.101.242.255, 0)
 0(13530) DEBUG:destroy_avp_list: destroing list (nil)
 0(13530) receive_msg: cleaning up
 0(13530) SIP Request:
 0(13530)  method:  <REGISTER>
 0(13530)  uri:     <sip:sip.test.local;transport=UDP>
 0(13530)  version: <SIP/2.0>
 0(13530) parse_headers: flags=1
 0(13530) end of header reached, state=9
 0(13530) DEBUG: get_hdr_field: <To> [40]; uri=[sip:12345 at sip.test.local]
 0(13530) DEBUG: to body [msn1-0003f5 <sip:12345 at sip.test.local>
]
 0(13530) get_hdr_field: cseq <CSeq>: <3> <REGISTER>
 0(13530) Found param type 232, <branch> = <z9hG4bKAQBfCgxx>; state=16
 0(13530) end of header reached, state=5
 0(13530) parse_headers: Via found, flags=1
 0(13530) parse_headers: this is the first via
 0(13530) After parse_msg...
 0(13530) preparing to run routing scripts...
 0(13530) DEBUG : is_maxfwd_present: max_forward header already found!
 0(13530) DEBUG: is_maxfwd_present: value = 70
 0(13530) DEBUG: add_param: tag=AADICAAN2gAD9Qxx
 0(13530) end of header reached, state=29
 0(13530) check_self - checking if host==us: 14==13 &&  [sip.test.local] ==
[192.168.20.19]
 0(13530) check_self - checking if port 5060 matches port 5060
 0(13530) REGISTER: Trying to register user... 0(13530) parse_headers:
flags=4096
 0(13530) check_nonce(): comparing
[41333186f507c5895e47b9df74a3cf984ab0471e] and
[41333186f507c5895e47b9df74a3cf984ab0471e]
 0(13530) query="select password,rpid from subscriber where
username='msn1-0003f5' AND domain='sip.test.local'"
 0(13530) HA1 string calculated: 38c9cb54210106900a13b2c7144fca53
 0(13530) check_response(): Our result = '6995eb2dd11ca74a7204b4d2aeb31768'
 0(13530) check_response(): Authorization is OK
 0(13530) save_rpid(): rpid value is ''
 0(13530) parse_headers: flags=-1
 0(13530) DEBUG: get_hdr_body : content_length=0
 0(13530) found end of header
 0(13530) parse_headers: flags=33554432
 0(13530) parse_headers: flags=-1
 0(13530) check_via_address(10.101.242.255, 10.101.242.255, 0)
 0(13530) DEBUG:destroy_avp_list: destroing list (nil)
 0(13530) receive_msg: cleaning up
 0(13530) SIP Request:
 0(13530)  method:  <REGISTER>
 0(13530)  uri:     <sip:sip.test.local;transport=UDP>
 0(13530)  version: <SIP/2.0>
 0(13530) parse_headers: flags=1
 0(13530) end of header reached, state=9
 0(13530) DEBUG: get_hdr_field: <To> [40]; uri=[sip:12345 at sip.test.local]
 0(13530) DEBUG: to body [msn1-0003f5 <sip:12345 at sip.test.local>
]
 0(13530) get_hdr_field: cseq <CSeq>: <1> <REGISTER>
 0(13530) Found param type 232, <branch> = <z9hG4bKAABgCgxx>; state=16
 0(13530) end of header reached, state=5
 0(13530) parse_headers: Via found, flags=1
 0(13530) parse_headers: this is the first via
 0(13530) After parse_msg...
 0(13530) preparing to run routing scripts...
 0(13530) DEBUG : is_maxfwd_present: max_forward header already found!
 0(13530) DEBUG: is_maxfwd_present: value = 70
 0(13530) DEBUG: add_param: tag=AADICAAN2gAD9Qxx
 0(13530) end of header reached, state=29
 0(13530) check_self - checking if host==us: 14==13 &&  [sip.test.local] ==
[192.168.20.19]
 0(13530) check_self - checking if port 5060 matches port 5060
 0(13530) REGISTER: Trying to register user... 0(13530) parse_headers:
flags=4096
 0(13530) DEBUG: get_hdr_body : content_length=0
 0(13530) found end of header
 0(13530) pre_auth(): Credentials with given realm not found
 0(13530) build_auth_hf(): 'WWW-Authenticate: Digest realm="sip.test.local",
nonce="41333187293d494707f1aec40c81785270a74c3d", qop="auth"
'
 0(13530) parse_headers: flags=-1
 0(13530) check_via_address(10.101.242.255, 10.101.242.255, 0)
 0(13530) DEBUG:destroy_avp_list: destroing list (nil)
 0(13530) receive_msg: cleaning up
 0(13530) SIP Request:
 0(13530)  method:  <REGISTER>
 0(13530)  uri:     <sip:sip.test.local;transport=UDP>
 0(13530)  version: <SIP/2.0>
 0(13530) parse_headers: flags=1
 0(13530) end of header reached, state=9
 0(13530) DEBUG: get_hdr_field: <To> [40]; uri=[sip:12345 at sip.test.local]
 0(13530) DEBUG: to body [msn1-0003f5 <sip:12345 at sip.test.local>
]
 0(13530) get_hdr_field: cseq <CSeq>: <2> <REGISTER>
 0(13530) Found param type 232, <branch> = <z9hG4bKAQBgCgxx>; state=16
 0(13530) end of header reached, state=5
 0(13530) parse_headers: Via found, flags=1
 0(13530) parse_headers: this is the first via
 0(13530) After parse_msg...
 0(13530) preparing to run routing scripts...
 0(13530) DEBUG : is_maxfwd_present: max_forward header already found!
 0(13530) DEBUG: is_maxfwd_present: value = 70
 0(13530) DEBUG: add_param: tag=AADICAAN2gAD9Qxx
 0(13530) end of header reached, state=29
 0(13530) check_self - checking if host==us: 14==13 &&  [sip.test.local] ==
[192.168.20.19]
 0(13530) check_self - checking if port 5060 matches port 5060
 0(13530) REGISTER: Trying to register user... 0(13530) parse_headers:
flags=4096
 0(13530) check_nonce(): comparing
[41333187293d494707f1aec40c81785270a74c3d] and
[41333187293d494707f1aec40c81785270a74c3d]
 0(13530) query="select password,rpid from subscriber where
username='msn1-0003f5' AND domain='sip.test.local'"
 0(13530) HA1 string calculated: 38c9cb54210106900a13b2c7144fca53
 0(13530) check_response(): Our result = 'df3cede49983d6ca9f328fb07f929cbe'
 0(13530) check_response(): Authorization is OK
 0(13530) save_rpid(): rpid value is ''
 0(13530) parse_headers: flags=-1
 0(13530) DEBUG: get_hdr_body : content_length=0
 0(13530) found end of header
 0(13530) parse_headers: flags=33554432
 0(13530) parse_headers: flags=-1
 0(13530) check_via_address(10.101.242.255, 10.101.242.255, 0)
 0(13530) DEBUG:destroy_avp_list: destroing list (nil)
 0(13530) receive_msg: cleaning up
 1(13532) INFO: signal 2 received
 0(13530) INT received, program terminates
 2(13534) INFO: signal 15 received
 2(13534) Memory status (pkg):
 2(13534) fm_status (0x80c88c0):
 2(13534)  heap size= 1047440
 2(13534) dumping free list:
 2(13534) hash =   1 fragments no.:     3,

------------------------------- SER Debug STOP -----------------------------


----------------------------Part of my Config File Start -------------------

modparam("auth_db", "use_rpid", 1)

# Uncomment this if you want to use SQL database
# for persistent storage and comment the previous line
modparam("usrloc", "db_mode", 2)
# minimize write back window - default is 60 seconds
modparam("usrloc", "timer_interval", 10)
# database location
modparam("usrloc", "db_url", "mysql://ser:*@127.0.0.1/ser")

# -- auth params --
# Uncomment if you are using auth module
#
modparam("auth_db", "calculate_ha1", yes)
#
# If you set "calculate_ha1" parameter to yes (which true in this config),
# uncomment also the following parameter)
#
modparam("auth_db", "password_column", "password")
modparam("auth_db", "rpid_column", "rpid")
modparam("auth_db", "db_url","mysql://ser:*@127.0.0.1/ser")

# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)

modparam("group", "use_domain", 1)
modparam("group", "db_url", "mysql://ser:*@127.0.0.1/ser")

modparam("registrar", "append_branches", yes)

alias="sip.test.local"

route{
        # initial sanity checks -- messages with
        # max_forwards==0, or excessively long requests
        if (!mf_process_maxfwd_header("10")) {
                sl_send_reply("483","Too Many Hops");
                break;
        };
        if ( msg:len > max_len ) {
                sl_send_reply("513", "Message too big");
                break;
        };

        # we record-route all messages -- to make sure that
        # subsequent messages will go through our proxy; that's
        # particularly good if upstream and downstream entities
        # use different transport protocol

        record_route();

        if (uri==myself) {
                if ( method=="REGISTER" ) {
                        log("REGISTER: Trying to register user...");
                        # verify credentials
                        if (!www_authorize("", "subscriber")) {
                                www_challenge("", "1");
                                break;
                        }
                        save("location");
                        break;
                } else {
                        if ( src_ip==127.0.0.1 || src_ip==192.168.20.18 ) {
                                log("GATEWAY ORIGINATED CALL");
                                if (!lookup("location")) {
                                        sl_send_reply("404", "Not Found");
                                        break;
                                };

                                route(2);

                                break;
                        };

                        if (!proxy_authorize("", "subscriber")) {
                                proxy_challenge("", "1");
                                break;
                        } else {
                                consume_credentials();
                        }
                        if ( lookup("location") ) {
                                log("Here - TRY BREAKING");
                        } else {
                                # PSTN Destination.. Trying..
                                log("PSTN Destination.. Trying..");
                                route(1);
                                break;
                        };

                        route(2);
                        break;
                };
        };

        if (  method=="ACK" || method=="CANCEL" || method=="BYE" ) {
                route(2);
                break;
        };

        sl_send_reply("403", "Call cannot be served here");
        break;
}

#
# PSTN Routing
#

route[1] {
        rewritehostport("192.168.20.18:5090");
        if (!t_relay()) {
                sl_reply_error();
                break;
        };
        break;
}

#
# Just Relay
#

route[2] {
        append_branch();

        if (!t_relay()) {
                sl_reply_error();
                break;
        };
}



------------------------------- Config File Stop ---------------------------
-----Opprinnelig melding-----
Fra: Jan Janak [mailto:jan at iptel.org] 
Sendt: 30. august 2004 14:08
Til: Runar Lyngmo
Kopi: serusers at lists.iptel.org
Emne: Re: [Serusers] Question about usrloc

On 30-08 11:02, Runar Lyngmo wrote:
> Hello Ser users and developers!
> 
> I have a question about userloc. I'm authenticating my sip users (Allied
> Telesyn RG613-TX boxes) against mysql with a given username
(msn1-macaddress
> / msn2-macaddress) and auto generated password. Authentication works fine,
> but my question is related to how ser stores users location in the
location
> db. 
> 
> Example:
> Username: msn1-12345678 
> Phonenumber: 12345 
> Contact: sip:12345 at 192.168.1.1:5060
> 
> When this user is register the following I added to the location db:
> Username: 12345
> Domain: 
> Contact: sip:12345 at 192.168.1.1:5060
> +++
> 
> My question is regarding the username column, is it possible that it
> contains the username of the sip user, not the username in the contact
uri?

  Yes, it is the username of the user. It can be completely different
  from the username in Contact.

    Jan.




More information about the sr-users mailing list