Discussion:
[Kamailio-Users] Registration Timeout Retransmission
Hemanshu Patel
2010-02-12 05:02:18 UTC
Permalink
Hello to all users,

I am very new to kamailio and just started using it. I have installed it
and my phones are getting register successfully.

But sometimes i am seeing a scenario, which makes my phones unusable for
sometime.
please see the condition as below

| phone |--------------| Kamailio |
| REGISTER----------------->
<----------------------401
| REGISTER----------------->
Tricky condition here

| timeout <--------------200 OK
phone shows itself as unregistered
| REGISTER---------------->
<--------------------401


After several retries phone stops to retry till say next 20 seconds,
during that time though there's an entry in location table in kamailio (i
am using mysql) my phone shows itself as unregistered phone.


Due to load or any other conditions Server takes a bit time to send 200OK
back to phone and During that time timer expires and phone sends REGISTER
once again.
now phone will keep sending REGISTER request with same nonse and other
value, and kamailio is configured to not to entertained same credentials
with nonce if it is authenticated once. So kamailio generates new 401
Message with new nonce value to which phone understands as the previous
reply thet he send for previous 401 was rejected, and the most probable
reason is wrong user credentials.....

Hope you guys have got my problem?
i can not allow kamailio to let use the same credentials+ response with
nonce if it has used it once for security reason. Then what could be the
solution for this.
I am very good in Programming, but just that i have just started to use
kamailio and not very much aware about its architecture.
--
Regards,

Hemanshu Patel

M: 09601295238
Klaus Darilion
2010-02-12 10:10:05 UTC
Permalink
You have detected a potential problem with nonce_reuse disabled. That's
why I always allow nonce_reuse. There might be other problems with
REGISTER retransmissions too, e.g. if the retransmission arives to late,
it will be rejected with "wrong CSeq" error.

A first workaround would be to send 100 trying back to the client, this
should prevent retransmissions. You could also handle the REGISTER
statefull (t_newtran()), but I think sending back "100 trying" should be
sufficient.

regards
klaus
Post by Hemanshu Patel
Hello to all users,
I am very new to kamailio and just started using it. I have installed it
and my phones are getting register successfully.
But sometimes i am seeing a scenario, which makes my phones unusable for
sometime.
please see the condition as below
| phone |--------------| Kamailio |
| REGISTER----------------->
<----------------------401
| REGISTER----------------->
Tricky condition here
| timeout<--------------200 OK
phone shows itself as unregistered
| REGISTER---------------->
<--------------------401
After several retries phone stops to retry till say next 20 seconds,
during that time though there's an entry in location table in kamailio (i
am using mysql) my phone shows itself as unregistered phone.
Due to load or any other conditions Server takes a bit time to send 200OK
back to phone and During that time timer expires and phone sends REGISTER
once again.
now phone will keep sending REGISTER request with same nonse and other
value, and kamailio is configured to not to entertained same credentials
with nonce if it is authenticated once. So kamailio generates new 401
Message with new nonce value to which phone understands as the previous
reply thet he send for previous 401 was rejected, and the most probable
reason is wrong user credentials.....
Hope you guys have got my problem?
i can not allow kamailio to let use the same credentials+ response with
nonce if it has used it once for security reason. Then what could be the
solution for this.
I am very good in Programming, but just that i have just started to use
kamailio and not very much aware about its architecture.
Hemanshu Patel
2010-02-12 10:23:02 UTC
Permalink
What kamailio is doing is what normally any rfc 3261 should do.
But in my case i dont want once used nonce and response to be reused.... i
think i left with only one solution, and which is that i am not suppose to
entertain retransmission of REGISTER request till say around 2 sec once i
send 200 OK.
This will give ample amount of time to client phone to receive 200OK and
once phone will receive 200OK it wont send another REGISTER request, and
from server end first REGISTER retransmission i am dropping.that servers
my purpose.

Can anyone suggest me the easiest way to implement the same.
Can i do it with already available flags or function or i need to hack a
code a bit.
--
Regards,

Hemanshu Patel

M: 09601295238
Post by Hemanshu Patel
Hello to all users,
I am very new to kamailio and just started using it. I have installed it
and my phones are getting register successfully.
But sometimes i am seeing a scenario, which makes my phones unusable for
sometime.
please see the condition as below
| phone |--------------| Kamailio |
| REGISTER----------------->
<----------------------401
| REGISTER----------------->
Tricky condition here
| timeout <--------------200 OK
phone shows itself as unregistered
| REGISTER---------------->
<--------------------401
After several retries phone stops to retry till say next 20 seconds,
during that time though there's an entry in location table in kamailio (i
am using mysql) my phone shows itself as unregistered phone.
Due to load or any other conditions Server takes a bit time to send 200OK
back to phone and During that time timer expires and phone sends REGISTER
once again.
now phone will keep sending REGISTER request with same nonse and other
value, and kamailio is configured to not to entertained same credentials
with nonce if it is authenticated once. So kamailio generates new 401
Message with new nonce value to which phone understands as the previous
reply thet he send for previous 401 was rejected, and the most probable
reason is wrong user credentials.....
Hope you guys have got my problem?
i can not allow kamailio to let use the same credentials+ response with
nonce if it has used it once for security reason. Then what could be the
solution for this.
I am very good in Programming, but just that i have just started to use
kamailio and not very much aware about its architecture.
--
Regards,
Hemanshu Patel
M: 09601295238
_______________________________________________
Kamailio (OpenSER) - Users mailing list
Users at lists.kamailio.org
http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
Klaus Darilion
2010-02-12 12:09:47 UTC
Permalink
Post by Hemanshu Patel
What kamailio is doing is what normally any rfc 3261 should do.
But in my case i dont want once used nonce and response to be reused.... i
think i left with only one solution, and which is that i am not suppose to
entertain retransmission of REGISTER request till say around 2 sec once i
send 200 OK.
In this case you have handle the REGISTER stateful.

Daniel, haven't you extended save() to send the reply stateful if a
transaction was created?

regards
klaus
Post by Hemanshu Patel
This will give ample amount of time to client phone to receive 200OK and
once phone will receive 200OK it wont send another REGISTER request, and
from server end first REGISTER retransmission i am dropping.that servers
my purpose.
Can anyone suggest me the easiest way to implement the same.
Can i do it with already available flags or function or i need to hack a
code a bit.
Daniel-Constantin Mierla
2010-02-12 12:23:05 UTC
Permalink
Hello,
Post by Klaus Darilion
Post by Hemanshu Patel
What kamailio is doing is what normally any rfc 3261 should do.
But in my case i dont want once used nonce and response to be
reused.... i
think i left with only one solution, and which is that i am not suppose to
entertain retransmission of REGISTER request till say around 2 sec once i
send 200 OK.
In this case you have handle the REGISTER stateful.
Daniel, haven't you extended save() to send the reply stateful if a
transaction was created?
yes, the registrar sends stateful reply if transaction exists. Make sure
sl module is loaded after tm so it can binds to tm api properly.


Cheers,
Daniel
Post by Klaus Darilion
regards
klaus
Post by Hemanshu Patel
This will give ample amount of time to client phone to receive 200OK and
once phone will receive 200OK it wont send another REGISTER request, and
from server end first REGISTER retransmission i am dropping.that servers
my purpose.
Can anyone suggest me the easiest way to implement the same.
Can i do it with already available flags or function or i need to hack a
code a bit.
--
Daniel-Constantin Mierla
SIP Server Professional Solutions
* http://www.asipto.com/
Hemanshu Patel
2010-02-13 05:32:12 UTC
Permalink
Thanks everyone for the reply,

But my problem is i dont want my REGISTER request to be handled
statefully....it increases CPU and memory utilization....and i am suppsoe
to handle lot of users on this server.

Then it seems theres no solution via configuration parameters..... i think
i need to add some codes somewhere to solve the problem.

the States are as below:

# registration is handled in stateless manner
# every REGISTER request...even if it is retransmission is been seen as
new transaction and as nonce_reuse is not allowed...it creates new
credentials and sends back 401 to phone.
# here i want something to stop.... i want to detect that this register
request is mere retransmission and not a new REGISTER request... and drop
it within some time frame...say cseq_delay time frame.....

Where should i starts roaming in code? can you guide me a bit about it.
--
Regards,

Hemanshu Patel

M: 09601295238
Post by Daniel-Constantin Mierla
Hello,
Post by Klaus Darilion
Post by Hemanshu Patel
What kamailio is doing is what normally any rfc 3261 should do.
But in my case i dont want once used nonce and response to be reused.... i
think i left with only one solution, and which is that i am not suppose to
entertain retransmission of REGISTER request till say around 2 sec once i
send 200 OK.
In this case you have handle the REGISTER stateful.
Daniel, haven't you extended save() to send the reply stateful if a
transaction was created?
yes, the registrar sends stateful reply if transaction exists. Make sure
sl module is loaded after tm so it can binds to tm api properly.
Cheers,
Daniel
Post by Klaus Darilion
regards
klaus
Post by Hemanshu Patel
This will give ample amount of time to client phone to receive 200OK and
once phone will receive 200OK it wont send another REGISTER request, and
from server end first REGISTER retransmission i am dropping.that servers
my purpose.
Can anyone suggest me the easiest way to implement the same.
Can i do it with already available flags or function or i need to hack a
code a bit.
--
Daniel-Constantin Mierla
SIP Server Professional Solutions
* http://www.asipto.com/
Loading...