Hello,


if you use default kamailio.cfg auth part, then besides checking the auth response, the functions checks that From/To username are the same as authentiaction username (to prevent caller id spoofing) -- see the parameters of auth_check() to adjust this behaviour in case you need that those usernames are different.

Cheers,
Daniel

On 14/09/15 15:58, Austin Einter wrote:
I am trying to register with Kamailio server from my custom endpoint.
I have below call flows

Register -> 401
Register -> 401

When I saw Kamailio log, I do not see any error.
Looks auth response is fine. Then why 401 repeatedly.

Log is given blow.
Please guide to fix this issue.


Sep 14 18:41:08 necs107 kamailio[2650]: DEBUG: auth_db [authorize.c:208]: get_ha1(): HA1 string calculated: 8749f9da135d71526725a337008df1d5
Sep 14 18:41:08 necs107 kamailio[2650]: DEBUG: auth [api.c:211]: auth_check_response(): check_response: Our result = '4aa70d676021329550b3d17e17238fac'
Sep 14 18:41:08 necs107 kamailio[2650]: DEBUG: auth [api.c:218]: auth_check_response(): check_response: Authorization is OK
Sep 14 18:41:08 necs107 kamailio[2650]: DEBUG: <core> [db_res.c:81]: db_free_columns(): freeing 1 columns
Sep 14 18:41:08 necs107 kamailio[2650]: DEBUG: <core> [db_res.c:85]: db_free_columns(): freeing RES_NAMES[0] at 0x7f8a24d5e1d0
Sep 14 18:41:08 necs107 kamailio[2650]: DEBUG: <core> [db_res.c:94]: db_free_columns(): freeing result names at 0x7f8a24d7ceb0
Sep 14 18:41:08 necs107 kamailio[2650]: DEBUG: <core> [db_res.c:99]: db_free_columns(): freeing result types at 0x7f8a24d7cef0
Sep 14 18:41:08 necs107 kamailio[2650]: DEBUG: <core> [db_res.c:54]: db_free_rows(): freeing 1 rows
Sep 14 18:41:08 necs107 kamailio[2650]: DEBUG: <core> [db_row.c:97]: db_free_row(): freeing row values at 0x7f8a24d5e260
Sep 14 18:41:08 necs107 kamailio[2650]: DEBUG: <core> [db_res.c:62]: db_free_rows(): freeing rows at 0x7f8a24d5e218
Sep 14 18:41:08 necs107 kamailio[2650]: DEBUG: <core> [db_res.c:136]: db_free_result(): freeing result set at 0x7f8a24d7ce18
Sep 14 18:41:08 necs107 kamailio[2650]: DEBUG: auth [challenge.c:127]: get_challenge_hf(): build_challenge_hf: realm='10.10.64.125'
Sep 14 18:41:08 necs107 kamailio[2650]: DEBUG: auth [challenge.c:269]: get_challenge_hf(): auth: 'WWW-Authenticate: Digest realm="10.10.64.125", nonce="VfbImFX2x2yEeE8kEuL2IXqW2TgKu+eC"#015#012'
Sep 14 18:41:08 necs107 kamailio[2650]: DEBUG: sl [sl.c:296]: send_reply(): reply in stateless mode (sl)
Sep 14 18:41:08 necs107 kamailio[2650]: DEBUG: <core> [msg_translator.c:206]: check_via_address(): check_via_address(10.3.2.18, 10.3.2.18, 0)
Sep 14 18:41:08 necs107 kamailio[2650]: DEBUG: <core> [tcp_main.c:2283]: tcpconn_send_put(): tcp_send: send from reader (2650 (9)), reusing fd
Sep 14 18:41:08 necs107 kamailio[2650]: DEBUG: <core> [tcp_main.c:2518]: tcpconn_do_send(): tcp_send: sending...
Sep 14 18:41:08 necs107 kamailio[2650]: DEBUG: <core> [tcp_main.c:2552]: tcpconn_do_send(): tcp_send: after real write: c= 0x7f8a1c5dbe78 n=445 fd=9
Sep 14 18:41:08 necs107 kamailio[2650]: DEBUG: <core> [tcp_main.c:2553]: tcpconn_do_send(): tcp_send: buf=#012SIP/2.0 401 Unauthorized#015#012Via: SIP/2.0/TCP 10.3.2.18:6970;branch=z9hG4bK1875333638#015#012From: <sip:262099922700000@10.10.64.125;user=phone>;tag=209355482#015#012To: <sip:+499922700000@10.10.64.125;user=phone>;tag=8345fd11d20ec1ca026994bf51313cb0.a2c6#015#012Call-ID: 1340939517@10.10.64.125#015#012CSeq: 3 REGISTER#015#012WWW-Authenticate: Digest realm="10.10.64.125", nonce="VfbImFX2x2yEeE8kEuL2IXqW2TgKu+eC"#015#012Server: kamailio (4.2.5 (x86_64/linux))#015#012Content-Length: 0#015#012#015#012
Sep 14 18:41:08 necs107 kamailio[2650]: DEBUG: <core> [usr_avp.c:643]: destroy_avp_list(): DEBUG:destroy_avp_list: destroying list (nil)
Sep 14 18:41:08 necs107 kamailio[2650]: message repeated 5 times: [ DEBUG: <core> [usr_avp.c:643]: destroy_avp_list(): DEBUG:destroy_avp_list: destroying list (nil)]




_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio - http://www.asipto.com
Kamailio Advanced Training, Sep 28-30, 2015, in Berlin - http://asipto.com/u/kat