Hi, I am integrating Kamailio into my application. I want to hook to the successful REGISTER and unregister event into Kamailio into my application. For now, I am able to hook into INVITE event and can hit my server to send a email to the callee user that user X is calling you. The way I am doing is by this if (is_method("INVITE")) { xlog("LOG_LOCAL3","L_INFO","invite came ($fU) ($tU)"); $var(res) = http_connect("sipnodejsserver", "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); xlog("LOG_LOCAL3","L_INFO","request sent $avp(route) $var(res)"); setflag(FLT_ACC); # do accounting }
I need to show into my application that their SIP phone is online or not. How can I hook into this?
I would recommend using `evapi` for something like this You could build a small go app that connects via evapi and send/receive events to/from kamailio.
On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman anuranbarman@gmail.com wrote:
Hi, I am integrating Kamailio into my application. I want to hook to the successful REGISTER and unregister event into Kamailio into my application. For now, I am able to hook into INVITE event and can hit my server to send a email to the callee user that user X is calling you. The way I am doing is by this if (is_method("INVITE")) { xlog("LOG_LOCAL3","L_INFO","invite came ($fU) ($tU)"); $var(res) = http_connect("sipnodejsserver", "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); xlog("LOG_LOCAL3","L_INFO","request sent $avp(route) $var(res)"); setflag(FLT_ACC); # do accounting }
I need to show into my application that their SIP phone is online or not. How can I hook into this? _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Though I have already a NodeJS server running, I will try the evapi module. If there are some tutorial/Wiki on how to do this please share that with me. That will be great help.
On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer eschmidbauer@gmail.com wrote:
I would recommend using `evapi` for something like this You could build a small go app that connects via evapi and send/receive events to/from kamailio.
On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman anuranbarman@gmail.com wrote:
Hi, I am integrating Kamailio into my application. I want to hook to the successful REGISTER and unregister event into Kamailio into my application. For now, I am able to hook into INVITE event and can hit my server to send a email to the callee user that user X is calling you. The way I am doing is by this if (is_method("INVITE")) { xlog("LOG_LOCAL3","L_INFO","invite came ($fU) ($tU)"); $var(res) = http_connect("sipnodejsserver", "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); xlog("LOG_LOCAL3","L_INFO","request sent $avp(route) $var(res)"); setflag(FLT_ACC); # do accounting }
I need to show into my application that their SIP phone is online or not. How can I hook into this? _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
It seems like this module is useful for making the connection/message flow. But that I need when I have the events of Register and unregister. How to get the events from this module?
On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman anuranbarman@gmail.com wrote:
Though I have already a NodeJS server running, I will try the evapi module. If there are some tutorial/Wiki on how to do this please share that with me. That will be great help.
On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer eschmidbauer@gmail.com wrote:
I would recommend using `evapi` for something like this You could build a small go app that connects via evapi and send/receive events to/from kamailio.
On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman anuranbarman@gmail.com wrote:
Hi, I am integrating Kamailio into my application. I want to hook to the successful REGISTER and unregister event into Kamailio into my application. For now, I am able to hook into INVITE event and can hit my server to send a email to the callee user that user X is calling you. The way I am doing is by this if (is_method("INVITE")) { xlog("LOG_LOCAL3","L_INFO","invite came ($fU) ($tU)"); $var(res) = http_connect("sipnodejsserver", "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); xlog("LOG_LOCAL3","L_INFO","request sent $avp(route) $var(res)"); setflag(FLT_ACC); # do accounting }
I need to show into my application that their SIP phone is online or not. How can I hook into this? _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
here is a good example of how you can use evapi in kamailio: http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing
here is a good example of how you can implement it with a go app: https://github.com/cgrates/kamevapi
On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman anuranbarman@gmail.com wrote:
It seems like this module is useful for making the connection/message flow. But that I need when I have the events of Register and unregister. How to get the events from this module?
On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman anuranbarman@gmail.com wrote:
Though I have already a NodeJS server running, I will try the evapi module. If there are some tutorial/Wiki on how to do this please share that with me. That will be great help.
On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer eschmidbauer@gmail.com wrote:
I would recommend using `evapi` for something like this You could build a small go app that connects via evapi and send/receive events to/from kamailio.
On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman anuranbarman@gmail.com wrote:
Hi, I am integrating Kamailio into my application. I want to hook to the successful REGISTER and unregister event into Kamailio into my application. For now, I am able to hook into INVITE event and can hit my server to send a email to the callee user that user X is calling you. The way I am doing is by this if (is_method("INVITE")) { xlog("LOG_LOCAL3","L_INFO","invite came ($fU) ($tU)"); $var(res) = http_connect("sipnodejsserver", "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); xlog("LOG_LOCAL3","L_INFO","request sent $avp(route) $var(res)"); setflag(FLT_ACC); # do accounting }
I need to show into my application that their SIP phone is online or not. How can I hook into this? _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Just as you do is_method(“INVITE”) you can do is_method(“REGISTER”) after that you can check the EXPIRE, if it is zero then it is an UN-REGISTER.
On Mon, 22 Jul 2019 at 12:35, E. Schmidbauer eschmidbauer@gmail.com wrote:
here is a good example of how you can use evapi in kamailio: http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing
here is a good example of how you can implement it with a go app: https://github.com/cgrates/kamevapi
On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman anuranbarman@gmail.com wrote:
It seems like this module is useful for making the connection/message flow. But that I need when I have the events of Register and unregister. How to get the events from this module?
On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman anuranbarman@gmail.com wrote:
Though I have already a NodeJS server running, I will try the evapi module. If there are some tutorial/Wiki on how to do this please share that with me. That will be great help.
On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer eschmidbauer@gmail.com wrote:
I would recommend using `evapi` for something like this You could build a small go app that connects via evapi and send/receive events to/from kamailio.
On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman anuranbarman@gmail.com wrote:
Hi, I am integrating Kamailio into my application. I want to hook to the successful REGISTER and unregister event into Kamailio into my application. For now, I am able to hook into INVITE event and can hit my server to send a email to the callee user that user X is calling you. The way I am doing is by this if (is_method("INVITE")) { xlog("LOG_LOCAL3","L_INFO","invite came ($fU) ($tU)"); $var(res) = http_connect("sipnodejsserver", "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); xlog("LOG_LOCAL3","L_INFO","request sent $avp(route) $var(res)"); setflag(FLT_ACC); # do accounting }
I need to show into my application that their SIP phone is online or not. How can I hook into this? _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
But it does not tell me if thats a successful register. I can make the user online but may be the request fails as credentials are wrong. So the REGISTER is not successful. How can I handle that?
On Mon, 22 Jul 2019 at 5:14 PM, David Villasmil < david.villasmil.work@gmail.com> wrote:
Just as you do is_method(“INVITE”) you can do is_method(“REGISTER”) after that you can check the EXPIRE, if it is zero then it is an UN-REGISTER.
On Mon, 22 Jul 2019 at 12:35, E. Schmidbauer eschmidbauer@gmail.com wrote:
here is a good example of how you can use evapi in kamailio:
http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing
here is a good example of how you can implement it with a go app: https://github.com/cgrates/kamevapi
On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman anuranbarman@gmail.com wrote:
It seems like this module is useful for making the connection/message flow. But that I need when I have the events of Register and unregister. How to get the events from this module?
On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman anuranbarman@gmail.com wrote:
Though I have already a NodeJS server running, I will try the evapi module. If there are some tutorial/Wiki on how to do this please share that with me. That will be great help.
On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer eschmidbauer@gmail.com wrote:
I would recommend using `evapi` for something like this You could build a small go app that connects via evapi and send/receive events to/from kamailio.
On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman anuranbarman@gmail.com wrote:
Hi, I am integrating Kamailio into my application. I want to hook to the successful REGISTER and unregister event into Kamailio into my application. For now, I am able to hook into INVITE event and can hit my server to send a email to the callee user that user X is calling you. The way I am doing is by this if (is_method("INVITE")) { xlog("LOG_LOCAL3","L_INFO","invite came ($fU) ($tU)"); $var(res) = http_connect("sipnodejsserver", "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); xlog("LOG_LOCAL3","L_INFO","request sent $avp(route) $var(res)"); setflag(FLT_ACC); # do accounting }
I need to show into my application that their SIP phone is online or not. How can I hook into this? _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337 _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
you should be doing some sort of authentication and then saving the user's registration data. add a route to fire an event when the registration data is saved. or even better IMO would be to use an event queue like mqueue and rtimer to push events into a queue and process them with rtimer and evapi
On Mon, Jul 22, 2019 at 7:46 AM Anuran Barman anuranbarman@gmail.com wrote:
But it does not tell me if thats a successful register. I can make the user online but may be the request fails as credentials are wrong. So the REGISTER is not successful. How can I handle that?
On Mon, 22 Jul 2019 at 5:14 PM, David Villasmil < david.villasmil.work@gmail.com> wrote:
Just as you do is_method(“INVITE”) you can do is_method(“REGISTER”) after that you can check the EXPIRE, if it is zero then it is an UN-REGISTER.
On Mon, 22 Jul 2019 at 12:35, E. Schmidbauer eschmidbauer@gmail.com wrote:
here is a good example of how you can use evapi in kamailio:
http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing
here is a good example of how you can implement it with a go app: https://github.com/cgrates/kamevapi
On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman anuranbarman@gmail.com wrote:
It seems like this module is useful for making the connection/message flow. But that I need when I have the events of Register and unregister. How to get the events from this module?
On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman anuranbarman@gmail.com wrote:
Though I have already a NodeJS server running, I will try the evapi module. If there are some tutorial/Wiki on how to do this please share that with me. That will be great help.
On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer eschmidbauer@gmail.com wrote:
I would recommend using `evapi` for something like this You could build a small go app that connects via evapi and send/receive events to/from kamailio.
On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman anuranbarman@gmail.com wrote:
> Hi, > I am integrating Kamailio into my application. I want to hook to > the successful REGISTER and unregister event into Kamailio into my > application. For now, I am able to hook into INVITE event and can hit my > server to send a email to the callee user that user X is calling you. The > way I am doing is by this > if (is_method("INVITE")) { > xlog("LOG_LOCAL3","L_INFO","invite came ($fU) > ($tU)"); > $var(res) = http_connect("sipnodejsserver", > "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); > xlog("LOG_LOCAL3","L_INFO","request sent $avp(route) > $var(res)"); > setflag(FLT_ACC); # do accounting > } > > I need to show into my application that their SIP phone is online or > not. How can I hook into this? > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users > _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337 _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
# IP authorization and user authentication route[AUTH] { #!ifdef WITH_AUTH
#!ifdef WITH_IPAUTH if((!is_method("REGISTER")) && allow_source_address()) { # source IP allowed return; } #!endif
if (is_method("REGISTER") || from_uri==myself) { xlog("LOG_LOCAL3","L_INFO","authentication request from domain=$ad realm=$ar username=$Au sourceIP=$si agentHeader=$ua"); # authenticate requests if (!auth_check("$fd", "subscriber", "1")) { auth_challenge("$fd", "0"); exit; } # user authenticated - remove auth header if(!is_method("REGISTER|PUBLISH")) consume_credentials(); xlog("LOG_LOCAL3","L_INFO","authentication successful"); *<============== At this point can I assume authentication is successful ??* } # if caller is not local subscriber, then check if it calls # a local destination, otherwise deny, not an open relay here if (from_uri!=myself && uri!=myself) { sl_send_reply("403","Not relaying"); exit; }
#!endif return; }
Kindly look into the snippet above. The bold lettered one. At that point can I assume authentication is successful ??
On Mon, Jul 22, 2019 at 5:58 PM E. Schmidbauer eschmidbauer@gmail.com wrote:
you should be doing some sort of authentication and then saving the user's registration data. add a route to fire an event when the registration data is saved. or even better IMO would be to use an event queue like mqueue and rtimer to push events into a queue and process them with rtimer and evapi
On Mon, Jul 22, 2019 at 7:46 AM Anuran Barman anuranbarman@gmail.com wrote:
But it does not tell me if thats a successful register. I can make the user online but may be the request fails as credentials are wrong. So the REGISTER is not successful. How can I handle that?
On Mon, 22 Jul 2019 at 5:14 PM, David Villasmil < david.villasmil.work@gmail.com> wrote:
Just as you do is_method(“INVITE”) you can do is_method(“REGISTER”) after that you can check the EXPIRE, if it is zero then it is an UN-REGISTER.
On Mon, 22 Jul 2019 at 12:35, E. Schmidbauer eschmidbauer@gmail.com wrote:
here is a good example of how you can use evapi in kamailio:
http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing
here is a good example of how you can implement it with a go app: https://github.com/cgrates/kamevapi
On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman anuranbarman@gmail.com wrote:
It seems like this module is useful for making the connection/message flow. But that I need when I have the events of Register and unregister. How to get the events from this module?
On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman anuranbarman@gmail.com wrote:
Though I have already a NodeJS server running, I will try the evapi module. If there are some tutorial/Wiki on how to do this please share that with me. That will be great help.
On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer < eschmidbauer@gmail.com> wrote:
> I would recommend using `evapi` for something like this > You could build a small go app that connects via evapi and > send/receive events to/from kamailio. > > > On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman < > anuranbarman@gmail.com> wrote: > >> Hi, >> I am integrating Kamailio into my application. I want to hook to >> the successful REGISTER and unregister event into Kamailio into my >> application. For now, I am able to hook into INVITE event and can hit my >> server to send a email to the callee user that user X is calling you. The >> way I am doing is by this >> if (is_method("INVITE")) { >> xlog("LOG_LOCAL3","L_INFO","invite came ($fU) >> ($tU)"); >> $var(res) = http_connect("sipnodejsserver", >> "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); >> xlog("LOG_LOCAL3","L_INFO","request sent >> $avp(route) $var(res)"); >> setflag(FLT_ACC); # do accounting >> } >> >> I need to show into my application that their SIP phone is online >> or not. How can I hook into this? >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users > _______________________________________________
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337 _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
evapi seems to be complicated and more than necessary for I want to do. Can't I get the successful register and unregister event from config file just like got INVITE event without using it?
On Mon, Jul 22, 2019 at 6:02 PM Anuran Barman anuranbarman@gmail.com wrote:
# IP authorization and user authentication route[AUTH] { #!ifdef WITH_AUTH
#!ifdef WITH_IPAUTH if((!is_method("REGISTER")) && allow_source_address()) { # source IP allowed return; } #!endif
if (is_method("REGISTER") || from_uri==myself) { xlog("LOG_LOCAL3","L_INFO","authentication request from domain=$ad realm=$ar username=$Au sourceIP=$si agentHeader=$ua"); # authenticate requests if (!auth_check("$fd", "subscriber", "1")) { auth_challenge("$fd", "0"); exit; } # user authenticated - remove auth header if(!is_method("REGISTER|PUBLISH")) consume_credentials(); xlog("LOG_LOCAL3","L_INFO","authentication successful"); *<============== At this point can I assume authentication is successful ??* } # if caller is not local subscriber, then check if it calls # a local destination, otherwise deny, not an open relay here if (from_uri!=myself && uri!=myself) { sl_send_reply("403","Not relaying"); exit; }
#!endif return; }
Kindly look into the snippet above. The bold lettered one. At that point can I assume authentication is successful ??
On Mon, Jul 22, 2019 at 5:58 PM E. Schmidbauer eschmidbauer@gmail.com wrote:
you should be doing some sort of authentication and then saving the user's registration data. add a route to fire an event when the registration data is saved. or even better IMO would be to use an event queue like mqueue and rtimer to push events into a queue and process them with rtimer and evapi
On Mon, Jul 22, 2019 at 7:46 AM Anuran Barman anuranbarman@gmail.com wrote:
But it does not tell me if thats a successful register. I can make the user online but may be the request fails as credentials are wrong. So the REGISTER is not successful. How can I handle that?
On Mon, 22 Jul 2019 at 5:14 PM, David Villasmil < david.villasmil.work@gmail.com> wrote:
Just as you do is_method(“INVITE”) you can do is_method(“REGISTER”) after that you can check the EXPIRE, if it is zero then it is an UN-REGISTER.
On Mon, 22 Jul 2019 at 12:35, E. Schmidbauer eschmidbauer@gmail.com wrote:
here is a good example of how you can use evapi in kamailio:
http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing
here is a good example of how you can implement it with a go app: https://github.com/cgrates/kamevapi
On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman anuranbarman@gmail.com wrote:
It seems like this module is useful for making the connection/message flow. But that I need when I have the events of Register and unregister. How to get the events from this module?
On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman anuranbarman@gmail.com wrote:
> Though I have already a NodeJS server running, I will try the evapi > module. If there are some tutorial/Wiki on how to do this please share that > with me. That will be great help. > > On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer < > eschmidbauer@gmail.com> wrote: > >> I would recommend using `evapi` for something like this >> You could build a small go app that connects via evapi and >> send/receive events to/from kamailio. >> >> >> On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman < >> anuranbarman@gmail.com> wrote: >> >>> Hi, >>> I am integrating Kamailio into my application. I want to hook to >>> the successful REGISTER and unregister event into Kamailio into my >>> application. For now, I am able to hook into INVITE event and can hit my >>> server to send a email to the callee user that user X is calling you. The >>> way I am doing is by this >>> if (is_method("INVITE")) { >>> xlog("LOG_LOCAL3","L_INFO","invite came ($fU) >>> ($tU)"); >>> $var(res) = http_connect("sipnodejsserver", >>> "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); >>> xlog("LOG_LOCAL3","L_INFO","request sent >>> $avp(route) $var(res)"); >>> setflag(FLT_ACC); # do accounting >>> } >>> >>> I need to show into my application that their SIP phone is online >>> or not. How can I hook into this? >>> _______________________________________________ >>> Kamailio (SER) - Users Mailing List >>> sr-users@lists.kamailio.org >>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>> >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> > _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337 _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
You do right after the authentication challenge. I will send a snipped (on my phone)
On Mon, 22 Jul 2019 at 13:38, Anuran Barman anuranbarman@gmail.com wrote:
evapi seems to be complicated and more than necessary for I want to do. Can't I get the successful register and unregister event from config file just like got INVITE event without using it?
On Mon, Jul 22, 2019 at 6:02 PM Anuran Barman anuranbarman@gmail.com wrote:
# IP authorization and user authentication route[AUTH] { #!ifdef WITH_AUTH
#!ifdef WITH_IPAUTH if((!is_method("REGISTER")) && allow_source_address()) { # source IP allowed return; } #!endif
if (is_method("REGISTER") || from_uri==myself) { xlog("LOG_LOCAL3","L_INFO","authentication request from domain=$ad realm=$ar username=$Au sourceIP=$si agentHeader=$ua"); # authenticate requests if (!auth_check("$fd", "subscriber", "1")) { auth_challenge("$fd", "0"); exit; } # user authenticated - remove auth header if(!is_method("REGISTER|PUBLISH")) consume_credentials(); xlog("LOG_LOCAL3","L_INFO","authentication successful"); *<============== At this point can I assume authentication is successful ??* } # if caller is not local subscriber, then check if it calls # a local destination, otherwise deny, not an open relay here if (from_uri!=myself && uri!=myself) { sl_send_reply("403","Not relaying"); exit; }
#!endif return; }
Kindly look into the snippet above. The bold lettered one. At that point can I assume authentication is successful ??
On Mon, Jul 22, 2019 at 5:58 PM E. Schmidbauer eschmidbauer@gmail.com wrote:
you should be doing some sort of authentication and then saving the user's registration data. add a route to fire an event when the registration data is saved. or even better IMO would be to use an event queue like mqueue and rtimer to push events into a queue and process them with rtimer and evapi
On Mon, Jul 22, 2019 at 7:46 AM Anuran Barman anuranbarman@gmail.com wrote:
But it does not tell me if thats a successful register. I can make the user online but may be the request fails as credentials are wrong. So the REGISTER is not successful. How can I handle that?
On Mon, 22 Jul 2019 at 5:14 PM, David Villasmil < david.villasmil.work@gmail.com> wrote:
Just as you do is_method(“INVITE”) you can do is_method(“REGISTER”) after that you can check the EXPIRE, if it is zero then it is an UN-REGISTER.
On Mon, 22 Jul 2019 at 12:35, E. Schmidbauer eschmidbauer@gmail.com wrote:
here is a good example of how you can use evapi in kamailio:
http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing
here is a good example of how you can implement it with a go app: https://github.com/cgrates/kamevapi
On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman anuranbarman@gmail.com wrote:
> It seems like this module is useful for making the > connection/message flow. But that I need when I have the events of Register > and unregister. How to get the events from this module? > > On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman < > anuranbarman@gmail.com> wrote: > >> Though I have already a NodeJS server running, I will try the evapi >> module. If there are some tutorial/Wiki on how to do this please share that >> with me. That will be great help. >> >> On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer < >> eschmidbauer@gmail.com> wrote: >> >>> I would recommend using `evapi` for something like this >>> You could build a small go app that connects via evapi and >>> send/receive events to/from kamailio. >>> >>> >>> On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman < >>> anuranbarman@gmail.com> wrote: >>> >>>> Hi, >>>> I am integrating Kamailio into my application. I want to hook to >>>> the successful REGISTER and unregister event into Kamailio into my >>>> application. For now, I am able to hook into INVITE event and can hit my >>>> server to send a email to the callee user that user X is calling you. The >>>> way I am doing is by this >>>> if (is_method("INVITE")) { >>>> xlog("LOG_LOCAL3","L_INFO","invite came ($fU) >>>> ($tU)"); >>>> $var(res) = http_connect("sipnodejsserver", >>>> "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); >>>> xlog("LOG_LOCAL3","L_INFO","request sent >>>> $avp(route) $var(res)"); >>>> setflag(FLT_ACC); # do accounting >>>> } >>>> >>>> I need to show into my application that their SIP phone is online >>>> or not. How can I hook into this? >>>> _______________________________________________ >>>> Kamailio (SER) - Users Mailing List >>>> sr-users@lists.kamailio.org >>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>> >>> _______________________________________________ >>> Kamailio (SER) - Users Mailing List >>> sr-users@lists.kamailio.org >>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>> >> _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users > _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337 _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
that will be helpful. Thanks
On Mon, 22 Jul 2019 at 11:06 PM, David Villasmil < david.villasmil.work@gmail.com> wrote:
You do right after the authentication challenge. I will send a snipped (on my phone)
On Mon, 22 Jul 2019 at 13:38, Anuran Barman anuranbarman@gmail.com wrote:
evapi seems to be complicated and more than necessary for I want to do. Can't I get the successful register and unregister event from config file just like got INVITE event without using it?
On Mon, Jul 22, 2019 at 6:02 PM Anuran Barman anuranbarman@gmail.com wrote:
# IP authorization and user authentication route[AUTH] { #!ifdef WITH_AUTH
#!ifdef WITH_IPAUTH if((!is_method("REGISTER")) && allow_source_address()) { # source IP allowed return; } #!endif
if (is_method("REGISTER") || from_uri==myself) { xlog("LOG_LOCAL3","L_INFO","authentication request from domain=$ad realm=$ar username=$Au sourceIP=$si agentHeader=$ua"); # authenticate requests if (!auth_check("$fd", "subscriber", "1")) { auth_challenge("$fd", "0"); exit; } # user authenticated - remove auth header if(!is_method("REGISTER|PUBLISH")) consume_credentials(); xlog("LOG_LOCAL3","L_INFO","authentication successful"); *<============== At this point can I assume authentication is successful ??* } # if caller is not local subscriber, then check if it calls # a local destination, otherwise deny, not an open relay here if (from_uri!=myself && uri!=myself) { sl_send_reply("403","Not relaying"); exit; }
#!endif return; }
Kindly look into the snippet above. The bold lettered one. At that point can I assume authentication is successful ??
On Mon, Jul 22, 2019 at 5:58 PM E. Schmidbauer eschmidbauer@gmail.com wrote:
you should be doing some sort of authentication and then saving the user's registration data. add a route to fire an event when the registration data is saved. or even better IMO would be to use an event queue like mqueue and rtimer to push events into a queue and process them with rtimer and evapi
On Mon, Jul 22, 2019 at 7:46 AM Anuran Barman anuranbarman@gmail.com wrote:
But it does not tell me if thats a successful register. I can make the user online but may be the request fails as credentials are wrong. So the REGISTER is not successful. How can I handle that?
On Mon, 22 Jul 2019 at 5:14 PM, David Villasmil < david.villasmil.work@gmail.com> wrote:
Just as you do is_method(“INVITE”) you can do is_method(“REGISTER”) after that you can check the EXPIRE, if it is zero then it is an UN-REGISTER.
On Mon, 22 Jul 2019 at 12:35, E. Schmidbauer eschmidbauer@gmail.com wrote:
> here is a good example of how you can use evapi in kamailio: > > http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing > > here is a good example of how you can implement it with a go app: > https://github.com/cgrates/kamevapi > > > > > On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman < > anuranbarman@gmail.com> wrote: > >> It seems like this module is useful for making the >> connection/message flow. But that I need when I have the events of Register >> and unregister. How to get the events from this module? >> >> On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman < >> anuranbarman@gmail.com> wrote: >> >>> Though I have already a NodeJS server running, I will try the >>> evapi module. If there are some tutorial/Wiki on how to do this please >>> share that with me. That will be great help. >>> >>> On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer < >>> eschmidbauer@gmail.com> wrote: >>> >>>> I would recommend using `evapi` for something like this >>>> You could build a small go app that connects via evapi and >>>> send/receive events to/from kamailio. >>>> >>>> >>>> On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman < >>>> anuranbarman@gmail.com> wrote: >>>> >>>>> Hi, >>>>> I am integrating Kamailio into my application. I want to hook >>>>> to the successful REGISTER and unregister event into Kamailio into my >>>>> application. For now, I am able to hook into INVITE event and can hit my >>>>> server to send a email to the callee user that user X is calling you. The >>>>> way I am doing is by this >>>>> if (is_method("INVITE")) { >>>>> xlog("LOG_LOCAL3","L_INFO","invite came ($fU) >>>>> ($tU)"); >>>>> $var(res) = http_connect("sipnodejsserver", >>>>> "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); >>>>> xlog("LOG_LOCAL3","L_INFO","request sent >>>>> $avp(route) $var(res)"); >>>>> setflag(FLT_ACC); # do accounting >>>>> } >>>>> >>>>> I need to show into my application that their SIP phone is >>>>> online or not. How can I hook into this? >>>>> _______________________________________________ >>>>> Kamailio (SER) - Users Mailing List >>>>> sr-users@lists.kamailio.org >>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>> >>>> _______________________________________________ >>>> Kamailio (SER) - Users Mailing List >>>> sr-users@lists.kamailio.org >>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>> >>> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337 _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337 _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
For REGISTERs On this line https://github.com/kamailio/kamailio/blob/master/etc/kamailio.cfg#L762 The register has already been authenticated sucessfully, so you can put it there.
For UN-REGISTERs just check (at the same point, since a user _must_ authenticate to un-register) the expire header, something like:
if (is_present_hf("Expires") && $(hdr(Expires){s.int})==0) { # do your thing }
Hope that helps
David Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Mon, Jul 22, 2019 at 6:40 PM Anuran Barman anuranbarman@gmail.com wrote:
that will be helpful. Thanks
On Mon, 22 Jul 2019 at 11:06 PM, David Villasmil < david.villasmil.work@gmail.com> wrote:
You do right after the authentication challenge. I will send a snipped (on my phone)
On Mon, 22 Jul 2019 at 13:38, Anuran Barman anuranbarman@gmail.com wrote:
evapi seems to be complicated and more than necessary for I want to do. Can't I get the successful register and unregister event from config file just like got INVITE event without using it?
On Mon, Jul 22, 2019 at 6:02 PM Anuran Barman anuranbarman@gmail.com wrote:
# IP authorization and user authentication route[AUTH] { #!ifdef WITH_AUTH
#!ifdef WITH_IPAUTH if((!is_method("REGISTER")) && allow_source_address()) { # source IP allowed return; } #!endif
if (is_method("REGISTER") || from_uri==myself) { xlog("LOG_LOCAL3","L_INFO","authentication request from domain=$ad realm=$ar username=$Au sourceIP=$si agentHeader=$ua"); # authenticate requests if (!auth_check("$fd", "subscriber", "1")) { auth_challenge("$fd", "0"); exit; } # user authenticated - remove auth header if(!is_method("REGISTER|PUBLISH")) consume_credentials(); xlog("LOG_LOCAL3","L_INFO","authentication successful"); *<============== At this point can I assume authentication is successful ??* } # if caller is not local subscriber, then check if it calls # a local destination, otherwise deny, not an open relay here if (from_uri!=myself && uri!=myself) { sl_send_reply("403","Not relaying"); exit; }
#!endif return; }
Kindly look into the snippet above. The bold lettered one. At that point can I assume authentication is successful ??
On Mon, Jul 22, 2019 at 5:58 PM E. Schmidbauer eschmidbauer@gmail.com wrote:
you should be doing some sort of authentication and then saving the user's registration data. add a route to fire an event when the registration data is saved. or even better IMO would be to use an event queue like mqueue and rtimer to push events into a queue and process them with rtimer and evapi
On Mon, Jul 22, 2019 at 7:46 AM Anuran Barman anuranbarman@gmail.com wrote:
But it does not tell me if thats a successful register. I can make the user online but may be the request fails as credentials are wrong. So the REGISTER is not successful. How can I handle that?
On Mon, 22 Jul 2019 at 5:14 PM, David Villasmil < david.villasmil.work@gmail.com> wrote:
> Just as you do is_method(“INVITE”) you can do is_method(“REGISTER”) > after that you can check the EXPIRE, if it is zero then it is an > UN-REGISTER. > > > On Mon, 22 Jul 2019 at 12:35, E. Schmidbauer eschmidbauer@gmail.com > wrote: > >> here is a good example of how you can use evapi in kamailio: >> >> http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing >> >> here is a good example of how you can implement it with a go app: >> https://github.com/cgrates/kamevapi >> >> >> >> >> On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman < >> anuranbarman@gmail.com> wrote: >> >>> It seems like this module is useful for making the >>> connection/message flow. But that I need when I have the events of Register >>> and unregister. How to get the events from this module? >>> >>> On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman < >>> anuranbarman@gmail.com> wrote: >>> >>>> Though I have already a NodeJS server running, I will try the >>>> evapi module. If there are some tutorial/Wiki on how to do this please >>>> share that with me. That will be great help. >>>> >>>> On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer < >>>> eschmidbauer@gmail.com> wrote: >>>> >>>>> I would recommend using `evapi` for something like this >>>>> You could build a small go app that connects via evapi and >>>>> send/receive events to/from kamailio. >>>>> >>>>> >>>>> On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman < >>>>> anuranbarman@gmail.com> wrote: >>>>> >>>>>> Hi, >>>>>> I am integrating Kamailio into my application. I want to hook >>>>>> to the successful REGISTER and unregister event into Kamailio into my >>>>>> application. For now, I am able to hook into INVITE event and can hit my >>>>>> server to send a email to the callee user that user X is calling you. The >>>>>> way I am doing is by this >>>>>> if (is_method("INVITE")) { >>>>>> xlog("LOG_LOCAL3","L_INFO","invite came ($fU) >>>>>> ($tU)"); >>>>>> $var(res) = http_connect("sipnodejsserver", >>>>>> "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); >>>>>> xlog("LOG_LOCAL3","L_INFO","request sent >>>>>> $avp(route) $var(res)"); >>>>>> setflag(FLT_ACC); # do accounting >>>>>> } >>>>>> >>>>>> I need to show into my application that their SIP phone is >>>>>> online or not. How can I hook into this? >>>>>> _______________________________________________ >>>>>> Kamailio (SER) - Users Mailing List >>>>>> sr-users@lists.kamailio.org >>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>> >>>>> _______________________________________________ >>>>> Kamailio (SER) - Users Mailing List >>>>> sr-users@lists.kamailio.org >>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>> >>>> _______________________________________________ >>> Kamailio (SER) - Users Mailing List >>> sr-users@lists.kamailio.org >>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>> >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> > -- > Regards, > > David Villasmil > email: david.villasmil.work@gmail.com > phone: +34669448337 > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users > _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337 _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hello,
you can get the result of the register module "save()" function call from its return value:
https://www.kamailio.org/docs/modules/5.2.x/modules/registrar.html#registrar... and then use a similar logic like you quoted in the initial question.
You can of course also just query the usrloc module with the provide remote function API:
https://www.kamailio.org/docs/modules/5.2.x/modules/usrloc.html#usrloc.r.loo...
This can be called over HTTP, JSON HTTP and others.
Cheers,
Henning
Am 22.07.19 um 14:34 schrieb Anuran Barman: evapi seems to be complicated and more than necessary for I want to do. Can't I get the successful register and unregister event from config file just like got INVITE event without using it?
On Mon, Jul 22, 2019 at 6:02 PM Anuran Barman <anuranbarman@gmail.commailto:anuranbarman@gmail.com> wrote: # IP authorization and user authentication route[AUTH] { #!ifdef WITH_AUTH
#!ifdef WITH_IPAUTH if((!is_method("REGISTER")) && allow_source_address()) { # source IP allowed return; } #!endif
if (is_method("REGISTER") || from_uri==myself) { xlog("LOG_LOCAL3","L_INFO","authentication request from domain=$ad realm=$ar username=$Au sourceIP=$si agentHeader=$ua"); # authenticate requests if (!auth_check("$fd", "subscriber", "1")) { auth_challenge("$fd", "0"); exit; } # user authenticated - remove auth header if(!is_method("REGISTER|PUBLISH")) consume_credentials(); xlog("LOG_LOCAL3","L_INFO","authentication successful"); <============== At this point can I assume authentication is successful ?? } # if caller is not local subscriber, then check if it calls # a local destination, otherwise deny, not an open relay here if (from_uri!=myself && uri!=myself) { sl_send_reply("403","Not relaying"); exit; }
#!endif return; }
Kindly look into the snippet above. The bold lettered one. At that point can I assume authentication is successful ??
On Mon, Jul 22, 2019 at 5:58 PM E. Schmidbauer <eschmidbauer@gmail.commailto:eschmidbauer@gmail.com> wrote: you should be doing some sort of authentication and then saving the user's registration data. add a route to fire an event when the registration data is saved. or even better IMO would be to use an event queue like mqueue and rtimer to push events into a queue and process them with rtimer and evapi
On Mon, Jul 22, 2019 at 7:46 AM Anuran Barman <anuranbarman@gmail.commailto:anuranbarman@gmail.com> wrote: But it does not tell me if thats a successful register. I can make the user online but may be the request fails as credentials are wrong. So the REGISTER is not successful. How can I handle that?
On Mon, 22 Jul 2019 at 5:14 PM, David Villasmil <david.villasmil.work@gmail.commailto:david.villasmil.work@gmail.com> wrote: Just as you do is_method(“INVITE”) you can do is_method(“REGISTER”) after that you can check the EXPIRE, if it is zero then it is an UN-REGISTER.
On Mon, 22 Jul 2019 at 12:35, E. Schmidbauer <eschmidbauer@gmail.commailto:eschmidbauer@gmail.com> wrote: here is a good example of how you can use evapi in kamailio: http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing
here is a good example of how you can implement it with a go app: https://github.com/cgrates/kamevapi
On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman <anuranbarman@gmail.commailto:anuranbarman@gmail.com> wrote: It seems like this module is useful for making the connection/message flow. But that I need when I have the events of Register and unregister. How to get the events from this module?
On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman <anuranbarman@gmail.commailto:anuranbarman@gmail.com> wrote: Though I have already a NodeJS server running, I will try the evapi module. If there are some tutorial/Wiki on how to do this please share that with me. That will be great help.
On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer <eschmidbauer@gmail.commailto:eschmidbauer@gmail.com> wrote: I would recommend using `evapi` for something like this You could build a small go app that connects via evapi and send/receive events to/from kamailio.
On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman <anuranbarman@gmail.commailto:anuranbarman@gmail.com> wrote: Hi, I am integrating Kamailio into my application. I want to hook to the successful REGISTER and unregister event into Kamailio into my application. For now, I am able to hook into INVITE event and can hit my server to send a email to the callee user that user X is calling you. The way I am doing is by this if (is_method("INVITE")) { xlog("LOG_LOCAL3","L_INFO","invite came ($fU) ($tU)"); $var(res) = http_connect("sipnodejsserver", "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); xlog("LOG_LOCAL3","L_INFO","request sent $avp(route) $var(res)"); setflag(FLT_ACC); # do accounting }
I need to show into my application that their SIP phone is online or not. How can I hook into this? _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users -- Regards,
David Villasmil email: david.villasmil.work@gmail.commailto:david.villasmil.work@gmail.com phone: +34669448337 _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
Thanks, I will try these out and get back to you.
On Mon, Jul 22, 2019 at 11:18 PM Henning Westerholt hw@skalatan.de wrote:
Hello,
you can get the result of the register module "save()" function call from its return value:
https://www.kamailio.org/docs/modules/5.2.x/modules/registrar.html#registrar... and then use a similar logic like you quoted in the initial question.
You can of course also just query the usrloc module with the provide remote function API:
https://www.kamailio.org/docs/modules/5.2.x/modules/usrloc.html#usrloc.r.loo...
This can be called over HTTP, JSON HTTP and others.
Cheers,
Henning Am 22.07.19 um 14:34 schrieb Anuran Barman:
evapi seems to be complicated and more than necessary for I want to do. Can't I get the successful register and unregister event from config file just like got INVITE event without using it?
On Mon, Jul 22, 2019 at 6:02 PM Anuran Barman anuranbarman@gmail.com wrote:
# IP authorization and user authentication route[AUTH] { #!ifdef WITH_AUTH
#!ifdef WITH_IPAUTH if((!is_method("REGISTER")) && allow_source_address()) { # source IP allowed return; } #!endif
if (is_method("REGISTER") || from_uri==myself) { xlog("LOG_LOCAL3","L_INFO","authentication request from domain=$ad realm=$ar username=$Au sourceIP=$si agentHeader=$ua"); # authenticate requests if (!auth_check("$fd", "subscriber", "1")) { auth_challenge("$fd", "0"); exit; } # user authenticated - remove auth header if(!is_method("REGISTER|PUBLISH")) consume_credentials(); xlog("LOG_LOCAL3","L_INFO","authentication successful"); *<============== At this point can I assume authentication is successful ??* } # if caller is not local subscriber, then check if it calls # a local destination, otherwise deny, not an open relay here if (from_uri!=myself && uri!=myself) { sl_send_reply("403","Not relaying"); exit; }
#!endif return; }
Kindly look into the snippet above. The bold lettered one. At that point can I assume authentication is successful ??
On Mon, Jul 22, 2019 at 5:58 PM E. Schmidbauer eschmidbauer@gmail.com wrote:
you should be doing some sort of authentication and then saving the user's registration data. add a route to fire an event when the registration data is saved. or even better IMO would be to use an event queue like mqueue and rtimer to push events into a queue and process them with rtimer and evapi
On Mon, Jul 22, 2019 at 7:46 AM Anuran Barman anuranbarman@gmail.com wrote:
But it does not tell me if thats a successful register. I can make the user online but may be the request fails as credentials are wrong. So the REGISTER is not successful. How can I handle that?
On Mon, 22 Jul 2019 at 5:14 PM, David Villasmil < david.villasmil.work@gmail.com> wrote:
Just as you do is_method(“INVITE”) you can do is_method(“REGISTER”) after that you can check the EXPIRE, if it is zero then it is an UN-REGISTER.
On Mon, 22 Jul 2019 at 12:35, E. Schmidbauer eschmidbauer@gmail.com wrote:
here is a good example of how you can use evapi in kamailio:
http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing
here is a good example of how you can implement it with a go app: https://github.com/cgrates/kamevapi
On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman anuranbarman@gmail.com wrote:
> It seems like this module is useful for making the > connection/message flow. But that I need when I have the events of Register > and unregister. How to get the events from this module? > > On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman < > anuranbarman@gmail.com> wrote: > >> Though I have already a NodeJS server running, I will try the evapi >> module. If there are some tutorial/Wiki on how to do this please share that >> with me. That will be great help. >> >> On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer < >> eschmidbauer@gmail.com> wrote: >> >>> I would recommend using `evapi` for something like this >>> You could build a small go app that connects via evapi and >>> send/receive events to/from kamailio. >>> >>> >>> On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman < >>> anuranbarman@gmail.com> wrote: >>> >>>> Hi, >>>> I am integrating Kamailio into my application. I want to hook to >>>> the successful REGISTER and unregister event into Kamailio into my >>>> application. For now, I am able to hook into INVITE event and can hit my >>>> server to send a email to the callee user that user X is calling you. The >>>> way I am doing is by this >>>> if (is_method("INVITE")) { >>>> xlog("LOG_LOCAL3","L_INFO","invite came ($fU) >>>> ($tU)"); >>>> $var(res) = http_connect("sipnodejsserver", >>>> "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); >>>> xlog("LOG_LOCAL3","L_INFO","request sent >>>> $avp(route) $var(res)"); >>>> setflag(FLT_ACC); # do accounting >>>> } >>>> >>>> I need to show into my application that their SIP phone is online >>>> or not. How can I hook into this? >>>> _______________________________________________ >>>> Kamailio (SER) - Users Mailing List >>>> sr-users@lists.kamailio.org >>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>> >>> _______________________________________________ >>> Kamailio (SER) - Users Mailing List >>> sr-users@lists.kamailio.org >>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>> >> _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users > _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337 _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
So I tried the the Expires header for UNREGISTER and it is working fine. Thanks for that. But the problem is that SIP Phone does not send UNREGISTER event. It only sends REGISTER method periodically. So in my Server it will be always online. So to overcome that I will be running e cron job which will pool the online users from 'location' table of kamailio mysql db. But the problem is, 'location' table does not get updated as soon as possible, rather if I disconnect the SIP Phone and do 'kamctl ul show' it will be still there for like 5 mins, after that it goes away. How can I change the timeout of this,say to 2mins, meaning that after 2mins if there is no response from the client ,Kamailio will mark it as offline. Where to change that parameter?
On Mon, Jul 22, 2019 at 11:20 PM Anuran Barman anuranbarman@gmail.com wrote:
Thanks, I will try these out and get back to you.
On Mon, Jul 22, 2019 at 11:18 PM Henning Westerholt hw@skalatan.de wrote:
Hello,
you can get the result of the register module "save()" function call from its return value:
https://www.kamailio.org/docs/modules/5.2.x/modules/registrar.html#registrar... and then use a similar logic like you quoted in the initial question.
You can of course also just query the usrloc module with the provide remote function API:
https://www.kamailio.org/docs/modules/5.2.x/modules/usrloc.html#usrloc.r.loo...
This can be called over HTTP, JSON HTTP and others.
Cheers,
Henning Am 22.07.19 um 14:34 schrieb Anuran Barman:
evapi seems to be complicated and more than necessary for I want to do. Can't I get the successful register and unregister event from config file just like got INVITE event without using it?
On Mon, Jul 22, 2019 at 6:02 PM Anuran Barman anuranbarman@gmail.com wrote:
# IP authorization and user authentication route[AUTH] { #!ifdef WITH_AUTH
#!ifdef WITH_IPAUTH if((!is_method("REGISTER")) && allow_source_address()) { # source IP allowed return; } #!endif
if (is_method("REGISTER") || from_uri==myself) { xlog("LOG_LOCAL3","L_INFO","authentication request from domain=$ad realm=$ar username=$Au sourceIP=$si agentHeader=$ua"); # authenticate requests if (!auth_check("$fd", "subscriber", "1")) { auth_challenge("$fd", "0"); exit; } # user authenticated - remove auth header if(!is_method("REGISTER|PUBLISH")) consume_credentials(); xlog("LOG_LOCAL3","L_INFO","authentication successful"); *<============== At this point can I assume authentication is successful ??* } # if caller is not local subscriber, then check if it calls # a local destination, otherwise deny, not an open relay here if (from_uri!=myself && uri!=myself) { sl_send_reply("403","Not relaying"); exit; }
#!endif return; }
Kindly look into the snippet above. The bold lettered one. At that point can I assume authentication is successful ??
On Mon, Jul 22, 2019 at 5:58 PM E. Schmidbauer eschmidbauer@gmail.com wrote:
you should be doing some sort of authentication and then saving the user's registration data. add a route to fire an event when the registration data is saved. or even better IMO would be to use an event queue like mqueue and rtimer to push events into a queue and process them with rtimer and evapi
On Mon, Jul 22, 2019 at 7:46 AM Anuran Barman anuranbarman@gmail.com wrote:
But it does not tell me if thats a successful register. I can make the user online but may be the request fails as credentials are wrong. So the REGISTER is not successful. How can I handle that?
On Mon, 22 Jul 2019 at 5:14 PM, David Villasmil < david.villasmil.work@gmail.com> wrote:
Just as you do is_method(“INVITE”) you can do is_method(“REGISTER”) after that you can check the EXPIRE, if it is zero then it is an UN-REGISTER.
On Mon, 22 Jul 2019 at 12:35, E. Schmidbauer eschmidbauer@gmail.com wrote:
> here is a good example of how you can use evapi in kamailio: > > http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing > > here is a good example of how you can implement it with a go app: > https://github.com/cgrates/kamevapi > > > > > On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman < > anuranbarman@gmail.com> wrote: > >> It seems like this module is useful for making the >> connection/message flow. But that I need when I have the events of Register >> and unregister. How to get the events from this module? >> >> On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman < >> anuranbarman@gmail.com> wrote: >> >>> Though I have already a NodeJS server running, I will try the >>> evapi module. If there are some tutorial/Wiki on how to do this please >>> share that with me. That will be great help. >>> >>> On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer < >>> eschmidbauer@gmail.com> wrote: >>> >>>> I would recommend using `evapi` for something like this >>>> You could build a small go app that connects via evapi and >>>> send/receive events to/from kamailio. >>>> >>>> >>>> On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman < >>>> anuranbarman@gmail.com> wrote: >>>> >>>>> Hi, >>>>> I am integrating Kamailio into my application. I want to hook >>>>> to the successful REGISTER and unregister event into Kamailio into my >>>>> application. For now, I am able to hook into INVITE event and can hit my >>>>> server to send a email to the callee user that user X is calling you. The >>>>> way I am doing is by this >>>>> if (is_method("INVITE")) { >>>>> xlog("LOG_LOCAL3","L_INFO","invite came ($fU) >>>>> ($tU)"); >>>>> $var(res) = http_connect("sipnodejsserver", >>>>> "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); >>>>> xlog("LOG_LOCAL3","L_INFO","request sent >>>>> $avp(route) $var(res)"); >>>>> setflag(FLT_ACC); # do accounting >>>>> } >>>>> >>>>> I need to show into my application that their SIP phone is >>>>> online or not. How can I hook into this? >>>>> _______________________________________________ >>>>> Kamailio (SER) - Users Mailing List >>>>> sr-users@lists.kamailio.org >>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>> >>>> _______________________________________________ >>>> Kamailio (SER) - Users Mailing List >>>> sr-users@lists.kamailio.org >>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>> >>> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337 _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
Hello,
have a look to the db_mode parameter in the usrloc module. You can operate the module in different database modes.
Cheers,
Henning
Am 23.07.19 um 09:48 schrieb Anuran Barman: So I tried the the Expires header for UNREGISTER and it is working fine. Thanks for that. But the problem is that SIP Phone does not send UNREGISTER event. It only sends REGISTER method periodically. So in my Server it will be always online. So to overcome that I will be running e cron job which will pool the online users from 'location' table of kamailio mysql db. But the problem is, 'location' table does not get updated as soon as possible, rather if I disconnect the SIP Phone and do 'kamctl ul show' it will be still there for like 5 mins, after that it goes away. How can I change the timeout of this,say to 2mins, meaning that after 2mins if there is no response from the client ,Kamailio will mark it as offline. Where to change that parameter?
On Mon, Jul 22, 2019 at 11:20 PM Anuran Barman <anuranbarman@gmail.commailto:anuranbarman@gmail.com> wrote: Thanks, I will try these out and get back to you.
On Mon, Jul 22, 2019 at 11:18 PM Henning Westerholt <hw@skalatan.demailto:hw@skalatan.de> wrote:
Hello,
you can get the result of the register module "save()" function call from its return value:
https://www.kamailio.org/docs/modules/5.2.x/modules/registrar.html#registrar... and then use a similar logic like you quoted in the initial question.
You can of course also just query the usrloc module with the provide remote function API:
https://www.kamailio.org/docs/modules/5.2.x/modules/usrloc.html#usrloc.r.loo...
This can be called over HTTP, JSON HTTP and others.
Cheers,
Henning
Am 22.07.19 um 14:34 schrieb Anuran Barman: evapi seems to be complicated and more than necessary for I want to do. Can't I get the successful register and unregister event from config file just like got INVITE event without using it?
On Mon, Jul 22, 2019 at 6:02 PM Anuran Barman <anuranbarman@gmail.commailto:anuranbarman@gmail.com> wrote: # IP authorization and user authentication route[AUTH] { #!ifdef WITH_AUTH
#!ifdef WITH_IPAUTH if((!is_method("REGISTER")) && allow_source_address()) { # source IP allowed return; } #!endif
if (is_method("REGISTER") || from_uri==myself) { xlog("LOG_LOCAL3","L_INFO","authentication request from domain=$ad realm=$ar username=$Au sourceIP=$si agentHeader=$ua"); # authenticate requests if (!auth_check("$fd", "subscriber", "1")) { auth_challenge("$fd", "0"); exit; } # user authenticated - remove auth header if(!is_method("REGISTER|PUBLISH")) consume_credentials(); xlog("LOG_LOCAL3","L_INFO","authentication successful"); <============== At this point can I assume authentication is successful ?? } # if caller is not local subscriber, then check if it calls # a local destination, otherwise deny, not an open relay here if (from_uri!=myself && uri!=myself) { sl_send_reply("403","Not relaying"); exit; }
#!endif return; }
Kindly look into the snippet above. The bold lettered one. At that point can I assume authentication is successful ??
On Mon, Jul 22, 2019 at 5:58 PM E. Schmidbauer <eschmidbauer@gmail.commailto:eschmidbauer@gmail.com> wrote: you should be doing some sort of authentication and then saving the user's registration data. add a route to fire an event when the registration data is saved. or even better IMO would be to use an event queue like mqueue and rtimer to push events into a queue and process them with rtimer and evapi
On Mon, Jul 22, 2019 at 7:46 AM Anuran Barman <anuranbarman@gmail.commailto:anuranbarman@gmail.com> wrote: But it does not tell me if thats a successful register. I can make the user online but may be the request fails as credentials are wrong. So the REGISTER is not successful. How can I handle that?
On Mon, 22 Jul 2019 at 5:14 PM, David Villasmil <david.villasmil.work@gmail.commailto:david.villasmil.work@gmail.com> wrote: Just as you do is_method(“INVITE”) you can do is_method(“REGISTER”) after that you can check the EXPIRE, if it is zero then it is an UN-REGISTER.
On Mon, 22 Jul 2019 at 12:35, E. Schmidbauer <eschmidbauer@gmail.commailto:eschmidbauer@gmail.com> wrote: here is a good example of how you can use evapi in kamailio: http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing
here is a good example of how you can implement it with a go app: https://github.com/cgrates/kamevapi
On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman <anuranbarman@gmail.commailto:anuranbarman@gmail.com> wrote: It seems like this module is useful for making the connection/message flow. But that I need when I have the events of Register and unregister. How to get the events from this module?
On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman <anuranbarman@gmail.commailto:anuranbarman@gmail.com> wrote: Though I have already a NodeJS server running, I will try the evapi module. If there are some tutorial/Wiki on how to do this please share that with me. That will be great help.
On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer <eschmidbauer@gmail.commailto:eschmidbauer@gmail.com> wrote: I would recommend using `evapi` for something like this You could build a small go app that connects via evapi and send/receive events to/from kamailio.
On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman <anuranbarman@gmail.commailto:anuranbarman@gmail.com> wrote: Hi, I am integrating Kamailio into my application. I want to hook to the successful REGISTER and unregister event into Kamailio into my application. For now, I am able to hook into INVITE event and can hit my server to send a email to the callee user that user X is calling you. The way I am doing is by this if (is_method("INVITE")) { xlog("LOG_LOCAL3","L_INFO","invite came ($fU) ($tU)"); $var(res) = http_connect("sipnodejsserver", "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); xlog("LOG_LOCAL3","L_INFO","request sent $avp(route) $var(res)"); setflag(FLT_ACC); # do accounting }
I need to show into my application that their SIP phone is online or not. How can I hook into this? _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users -- Regards,
David Villasmil email: david.villasmil.work@gmail.commailto:david.villasmil.work@gmail.com phone: +34669448337 _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
db_mode is already set to 2. There is one parameter I saw which is saying about cleaning expired db records so I set it to Enabled. But it did not change anything.
modparam("usrloc", "db_timer_clean", 1)
On Tue, Jul 23, 2019 at 1:34 PM Henning Westerholt hw@skalatan.de wrote:
Hello,
have a look to the db_mode parameter in the usrloc module. You can operate the module in different database modes.
Cheers,
Henning Am 23.07.19 um 09:48 schrieb Anuran Barman:
So I tried the the Expires header for UNREGISTER and it is working fine. Thanks for that. But the problem is that SIP Phone does not send UNREGISTER event. It only sends REGISTER method periodically. So in my Server it will be always online. So to overcome that I will be running e cron job which will pool the online users from 'location' table of kamailio mysql db. But the problem is, 'location' table does not get updated as soon as possible, rather if I disconnect the SIP Phone and do 'kamctl ul show' it will be still there for like 5 mins, after that it goes away. How can I change the timeout of this,say to 2mins, meaning that after 2mins if there is no response from the client ,Kamailio will mark it as offline. Where to change that parameter?
On Mon, Jul 22, 2019 at 11:20 PM Anuran Barman anuranbarman@gmail.com wrote:
Thanks, I will try these out and get back to you.
On Mon, Jul 22, 2019 at 11:18 PM Henning Westerholt hw@skalatan.de wrote:
Hello,
you can get the result of the register module "save()" function call from its return value:
https://www.kamailio.org/docs/modules/5.2.x/modules/registrar.html#registrar... and then use a similar logic like you quoted in the initial question.
You can of course also just query the usrloc module with the provide remote function API:
https://www.kamailio.org/docs/modules/5.2.x/modules/usrloc.html#usrloc.r.loo...
This can be called over HTTP, JSON HTTP and others.
Cheers,
Henning Am 22.07.19 um 14:34 schrieb Anuran Barman:
evapi seems to be complicated and more than necessary for I want to do. Can't I get the successful register and unregister event from config file just like got INVITE event without using it?
On Mon, Jul 22, 2019 at 6:02 PM Anuran Barman anuranbarman@gmail.com wrote:
# IP authorization and user authentication route[AUTH] { #!ifdef WITH_AUTH
#!ifdef WITH_IPAUTH if((!is_method("REGISTER")) && allow_source_address()) { # source IP allowed return; } #!endif
if (is_method("REGISTER") || from_uri==myself) { xlog("LOG_LOCAL3","L_INFO","authentication request from domain=$ad realm=$ar username=$Au sourceIP=$si agentHeader=$ua"); # authenticate requests if (!auth_check("$fd", "subscriber", "1")) { auth_challenge("$fd", "0"); exit; } # user authenticated - remove auth header if(!is_method("REGISTER|PUBLISH")) consume_credentials(); xlog("LOG_LOCAL3","L_INFO","authentication successful"); *<============== At this point can I assume authentication is successful ??* } # if caller is not local subscriber, then check if it calls # a local destination, otherwise deny, not an open relay here if (from_uri!=myself && uri!=myself) { sl_send_reply("403","Not relaying"); exit; }
#!endif return; }
Kindly look into the snippet above. The bold lettered one. At that point can I assume authentication is successful ??
On Mon, Jul 22, 2019 at 5:58 PM E. Schmidbauer eschmidbauer@gmail.com wrote:
you should be doing some sort of authentication and then saving the user's registration data. add a route to fire an event when the registration data is saved. or even better IMO would be to use an event queue like mqueue and rtimer to push events into a queue and process them with rtimer and evapi
On Mon, Jul 22, 2019 at 7:46 AM Anuran Barman anuranbarman@gmail.com wrote:
But it does not tell me if thats a successful register. I can make the user online but may be the request fails as credentials are wrong. So the REGISTER is not successful. How can I handle that?
On Mon, 22 Jul 2019 at 5:14 PM, David Villasmil < david.villasmil.work@gmail.com> wrote:
> Just as you do is_method(“INVITE”) you can do is_method(“REGISTER”) > after that you can check the EXPIRE, if it is zero then it is an > UN-REGISTER. > > > On Mon, 22 Jul 2019 at 12:35, E. Schmidbauer eschmidbauer@gmail.com > wrote: > >> here is a good example of how you can use evapi in kamailio: >> >> http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing >> >> here is a good example of how you can implement it with a go app: >> https://github.com/cgrates/kamevapi >> >> >> >> >> On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman < >> anuranbarman@gmail.com> wrote: >> >>> It seems like this module is useful for making the >>> connection/message flow. But that I need when I have the events of Register >>> and unregister. How to get the events from this module? >>> >>> On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman < >>> anuranbarman@gmail.com> wrote: >>> >>>> Though I have already a NodeJS server running, I will try the >>>> evapi module. If there are some tutorial/Wiki on how to do this please >>>> share that with me. That will be great help. >>>> >>>> On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer < >>>> eschmidbauer@gmail.com> wrote: >>>> >>>>> I would recommend using `evapi` for something like this >>>>> You could build a small go app that connects via evapi and >>>>> send/receive events to/from kamailio. >>>>> >>>>> >>>>> On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman < >>>>> anuranbarman@gmail.com> wrote: >>>>> >>>>>> Hi, >>>>>> I am integrating Kamailio into my application. I want to hook >>>>>> to the successful REGISTER and unregister event into Kamailio into my >>>>>> application. For now, I am able to hook into INVITE event and can hit my >>>>>> server to send a email to the callee user that user X is calling you. The >>>>>> way I am doing is by this >>>>>> if (is_method("INVITE")) { >>>>>> xlog("LOG_LOCAL3","L_INFO","invite came ($fU) >>>>>> ($tU)"); >>>>>> $var(res) = http_connect("sipnodejsserver", >>>>>> "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); >>>>>> xlog("LOG_LOCAL3","L_INFO","request sent >>>>>> $avp(route) $var(res)"); >>>>>> setflag(FLT_ACC); # do accounting >>>>>> } >>>>>> >>>>>> I need to show into my application that their SIP phone is >>>>>> online or not. How can I hook into this? >>>>>> _______________________________________________ >>>>>> Kamailio (SER) - Users Mailing List >>>>>> sr-users@lists.kamailio.org >>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>> >>>>> _______________________________________________ >>>>> Kamailio (SER) - Users Mailing List >>>>> sr-users@lists.kamailio.org >>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>> >>>> _______________________________________________ >>> Kamailio (SER) - Users Mailing List >>> sr-users@lists.kamailio.org >>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>> >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> > -- > Regards, > > David Villasmil > email: david.villasmil.work@gmail.com > phone: +34669448337 > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users > _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
--
Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
The module should remove the user's contact when the register expires.
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Tue, Jul 23, 2019 at 10:07 AM Anuran Barman anuranbarman@gmail.com wrote:
db_mode is already set to 2. There is one parameter I saw which is saying about cleaning expired db records so I set it to Enabled. But it did not change anything.
modparam("usrloc", "db_timer_clean", 1)
On Tue, Jul 23, 2019 at 1:34 PM Henning Westerholt hw@skalatan.de wrote:
Hello,
have a look to the db_mode parameter in the usrloc module. You can operate the module in different database modes.
Cheers,
Henning Am 23.07.19 um 09:48 schrieb Anuran Barman:
So I tried the the Expires header for UNREGISTER and it is working fine. Thanks for that. But the problem is that SIP Phone does not send UNREGISTER event. It only sends REGISTER method periodically. So in my Server it will be always online. So to overcome that I will be running e cron job which will pool the online users from 'location' table of kamailio mysql db. But the problem is, 'location' table does not get updated as soon as possible, rather if I disconnect the SIP Phone and do 'kamctl ul show' it will be still there for like 5 mins, after that it goes away. How can I change the timeout of this,say to 2mins, meaning that after 2mins if there is no response from the client ,Kamailio will mark it as offline. Where to change that parameter?
On Mon, Jul 22, 2019 at 11:20 PM Anuran Barman anuranbarman@gmail.com wrote:
Thanks, I will try these out and get back to you.
On Mon, Jul 22, 2019 at 11:18 PM Henning Westerholt hw@skalatan.de wrote:
Hello,
you can get the result of the register module "save()" function call from its return value:
https://www.kamailio.org/docs/modules/5.2.x/modules/registrar.html#registrar... and then use a similar logic like you quoted in the initial question.
You can of course also just query the usrloc module with the provide remote function API:
https://www.kamailio.org/docs/modules/5.2.x/modules/usrloc.html#usrloc.r.loo...
This can be called over HTTP, JSON HTTP and others.
Cheers,
Henning Am 22.07.19 um 14:34 schrieb Anuran Barman:
evapi seems to be complicated and more than necessary for I want to do. Can't I get the successful register and unregister event from config file just like got INVITE event without using it?
On Mon, Jul 22, 2019 at 6:02 PM Anuran Barman anuranbarman@gmail.com wrote:
# IP authorization and user authentication route[AUTH] { #!ifdef WITH_AUTH
#!ifdef WITH_IPAUTH if((!is_method("REGISTER")) && allow_source_address()) { # source IP allowed return; } #!endif
if (is_method("REGISTER") || from_uri==myself) { xlog("LOG_LOCAL3","L_INFO","authentication request from domain=$ad realm=$ar username=$Au sourceIP=$si agentHeader=$ua"); # authenticate requests if (!auth_check("$fd", "subscriber", "1")) { auth_challenge("$fd", "0"); exit; } # user authenticated - remove auth header if(!is_method("REGISTER|PUBLISH")) consume_credentials(); xlog("LOG_LOCAL3","L_INFO","authentication successful"); *<============== At this point can I assume authentication is successful ??* } # if caller is not local subscriber, then check if it calls # a local destination, otherwise deny, not an open relay here if (from_uri!=myself && uri!=myself) { sl_send_reply("403","Not relaying"); exit; }
#!endif return; }
Kindly look into the snippet above. The bold lettered one. At that point can I assume authentication is successful ??
On Mon, Jul 22, 2019 at 5:58 PM E. Schmidbauer eschmidbauer@gmail.com wrote:
you should be doing some sort of authentication and then saving the user's registration data. add a route to fire an event when the registration data is saved. or even better IMO would be to use an event queue like mqueue and rtimer to push events into a queue and process them with rtimer and evapi
On Mon, Jul 22, 2019 at 7:46 AM Anuran Barman anuranbarman@gmail.com wrote:
> But it does not tell me if thats a successful register. I can make > the user online but may be the request fails as credentials are wrong. So > the REGISTER is not successful. How can I handle that? > > On Mon, 22 Jul 2019 at 5:14 PM, David Villasmil < > david.villasmil.work@gmail.com> wrote: > >> Just as you do is_method(“INVITE”) you can do is_method(“REGISTER”) >> after that you can check the EXPIRE, if it is zero then it is an >> UN-REGISTER. >> >> >> On Mon, 22 Jul 2019 at 12:35, E. Schmidbauer < >> eschmidbauer@gmail.com> wrote: >> >>> here is a good example of how you can use evapi in kamailio: >>> >>> http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing >>> >>> here is a good example of how you can implement it with a go app: >>> https://github.com/cgrates/kamevapi >>> >>> >>> >>> >>> On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman < >>> anuranbarman@gmail.com> wrote: >>> >>>> It seems like this module is useful for making the >>>> connection/message flow. But that I need when I have the events of Register >>>> and unregister. How to get the events from this module? >>>> >>>> On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman < >>>> anuranbarman@gmail.com> wrote: >>>> >>>>> Though I have already a NodeJS server running, I will try the >>>>> evapi module. If there are some tutorial/Wiki on how to do this please >>>>> share that with me. That will be great help. >>>>> >>>>> On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer < >>>>> eschmidbauer@gmail.com> wrote: >>>>> >>>>>> I would recommend using `evapi` for something like this >>>>>> You could build a small go app that connects via evapi and >>>>>> send/receive events to/from kamailio. >>>>>> >>>>>> >>>>>> On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman < >>>>>> anuranbarman@gmail.com> wrote: >>>>>> >>>>>>> Hi, >>>>>>> I am integrating Kamailio into my application. I want to hook >>>>>>> to the successful REGISTER and unregister event into Kamailio into my >>>>>>> application. For now, I am able to hook into INVITE event and can hit my >>>>>>> server to send a email to the callee user that user X is calling you. The >>>>>>> way I am doing is by this >>>>>>> if (is_method("INVITE")) { >>>>>>> xlog("LOG_LOCAL3","L_INFO","invite came ($fU) >>>>>>> ($tU)"); >>>>>>> $var(res) = http_connect("sipnodejsserver", >>>>>>> "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); >>>>>>> xlog("LOG_LOCAL3","L_INFO","request sent >>>>>>> $avp(route) $var(res)"); >>>>>>> setflag(FLT_ACC); # do accounting >>>>>>> } >>>>>>> >>>>>>> I need to show into my application that their SIP phone is >>>>>>> online or not. How can I hook into this? >>>>>>> _______________________________________________ >>>>>>> Kamailio (SER) - Users Mailing List >>>>>>> sr-users@lists.kamailio.org >>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>> >>>>>> _______________________________________________ >>>>>> Kamailio (SER) - Users Mailing List >>>>>> sr-users@lists.kamailio.org >>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>> >>>>> _______________________________________________ >>>> Kamailio (SER) - Users Mailing List >>>> sr-users@lists.kamailio.org >>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>> >>> _______________________________________________ >>> Kamailio (SER) - Users Mailing List >>> sr-users@lists.kamailio.org >>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>> >> -- >> Regards, >> >> David Villasmil >> email: david.villasmil.work@gmail.com >> phone: +34669448337 >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users > _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
--
Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
yeah it is removing. that sip phone had expiration time more so it was not getting deleted. later I found out. Thanks
On Tue, 23 Jul 2019 at 7:46 PM, David Villasmil < david.villasmil.work@gmail.com> wrote:
The module should remove the user's contact when the register expires.
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Tue, Jul 23, 2019 at 10:07 AM Anuran Barman anuranbarman@gmail.com wrote:
db_mode is already set to 2. There is one parameter I saw which is saying about cleaning expired db records so I set it to Enabled. But it did not change anything.
modparam("usrloc", "db_timer_clean", 1)
On Tue, Jul 23, 2019 at 1:34 PM Henning Westerholt hw@skalatan.de wrote:
Hello,
have a look to the db_mode parameter in the usrloc module. You can operate the module in different database modes.
Cheers,
Henning Am 23.07.19 um 09:48 schrieb Anuran Barman:
So I tried the the Expires header for UNREGISTER and it is working fine. Thanks for that. But the problem is that SIP Phone does not send UNREGISTER event. It only sends REGISTER method periodically. So in my Server it will be always online. So to overcome that I will be running e cron job which will pool the online users from 'location' table of kamailio mysql db. But the problem is, 'location' table does not get updated as soon as possible, rather if I disconnect the SIP Phone and do 'kamctl ul show' it will be still there for like 5 mins, after that it goes away. How can I change the timeout of this,say to 2mins, meaning that after 2mins if there is no response from the client ,Kamailio will mark it as offline. Where to change that parameter?
On Mon, Jul 22, 2019 at 11:20 PM Anuran Barman anuranbarman@gmail.com wrote:
Thanks, I will try these out and get back to you.
On Mon, Jul 22, 2019 at 11:18 PM Henning Westerholt hw@skalatan.de wrote:
Hello,
you can get the result of the register module "save()" function call from its return value:
https://www.kamailio.org/docs/modules/5.2.x/modules/registrar.html#registrar... and then use a similar logic like you quoted in the initial question.
You can of course also just query the usrloc module with the provide remote function API:
https://www.kamailio.org/docs/modules/5.2.x/modules/usrloc.html#usrloc.r.loo...
This can be called over HTTP, JSON HTTP and others.
Cheers,
Henning Am 22.07.19 um 14:34 schrieb Anuran Barman:
evapi seems to be complicated and more than necessary for I want to do. Can't I get the successful register and unregister event from config file just like got INVITE event without using it?
On Mon, Jul 22, 2019 at 6:02 PM Anuran Barman anuranbarman@gmail.com wrote:
# IP authorization and user authentication route[AUTH] { #!ifdef WITH_AUTH
#!ifdef WITH_IPAUTH if((!is_method("REGISTER")) && allow_source_address()) { # source IP allowed return; } #!endif
if (is_method("REGISTER") || from_uri==myself) { xlog("LOG_LOCAL3","L_INFO","authentication request from domain=$ad realm=$ar username=$Au sourceIP=$si agentHeader=$ua"); # authenticate requests if (!auth_check("$fd", "subscriber", "1")) { auth_challenge("$fd", "0"); exit; } # user authenticated - remove auth header if(!is_method("REGISTER|PUBLISH")) consume_credentials(); xlog("LOG_LOCAL3","L_INFO","authentication successful"); *<============== At this point can I assume authentication is successful ??* } # if caller is not local subscriber, then check if it calls # a local destination, otherwise deny, not an open relay here if (from_uri!=myself && uri!=myself) { sl_send_reply("403","Not relaying"); exit; }
#!endif return; }
Kindly look into the snippet above. The bold lettered one. At that point can I assume authentication is successful ??
On Mon, Jul 22, 2019 at 5:58 PM E. Schmidbauer < eschmidbauer@gmail.com> wrote:
> you should be doing some sort of authentication and then saving the > user's registration data. > add a route to fire an event when the registration data is saved. > or even better IMO would be to use an event queue like mqueue and > rtimer to push events into a queue and process them with rtimer and evapi > > On Mon, Jul 22, 2019 at 7:46 AM Anuran Barman < > anuranbarman@gmail.com> wrote: > >> But it does not tell me if thats a successful register. I can make >> the user online but may be the request fails as credentials are wrong. So >> the REGISTER is not successful. How can I handle that? >> >> On Mon, 22 Jul 2019 at 5:14 PM, David Villasmil < >> david.villasmil.work@gmail.com> wrote: >> >>> Just as you do is_method(“INVITE”) you can do >>> is_method(“REGISTER”) after that you can check the EXPIRE, if it is zero >>> then it is an UN-REGISTER. >>> >>> >>> On Mon, 22 Jul 2019 at 12:35, E. Schmidbauer < >>> eschmidbauer@gmail.com> wrote: >>> >>>> here is a good example of how you can use evapi in kamailio: >>>> >>>> http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing >>>> >>>> here is a good example of how you can implement it with a go app: >>>> https://github.com/cgrates/kamevapi >>>> >>>> >>>> >>>> >>>> On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman < >>>> anuranbarman@gmail.com> wrote: >>>> >>>>> It seems like this module is useful for making the >>>>> connection/message flow. But that I need when I have the events of Register >>>>> and unregister. How to get the events from this module? >>>>> >>>>> On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman < >>>>> anuranbarman@gmail.com> wrote: >>>>> >>>>>> Though I have already a NodeJS server running, I will try the >>>>>> evapi module. If there are some tutorial/Wiki on how to do this please >>>>>> share that with me. That will be great help. >>>>>> >>>>>> On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer < >>>>>> eschmidbauer@gmail.com> wrote: >>>>>> >>>>>>> I would recommend using `evapi` for something like this >>>>>>> You could build a small go app that connects via evapi and >>>>>>> send/receive events to/from kamailio. >>>>>>> >>>>>>> >>>>>>> On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman < >>>>>>> anuranbarman@gmail.com> wrote: >>>>>>> >>>>>>>> Hi, >>>>>>>> I am integrating Kamailio into my application. I want to >>>>>>>> hook to the successful REGISTER and unregister event into Kamailio into my >>>>>>>> application. For now, I am able to hook into INVITE event and can hit my >>>>>>>> server to send a email to the callee user that user X is calling you. The >>>>>>>> way I am doing is by this >>>>>>>> if (is_method("INVITE")) { >>>>>>>> xlog("LOG_LOCAL3","L_INFO","invite came ($fU) >>>>>>>> ($tU)"); >>>>>>>> $var(res) = http_connect("sipnodejsserver", >>>>>>>> "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); >>>>>>>> xlog("LOG_LOCAL3","L_INFO","request sent >>>>>>>> $avp(route) $var(res)"); >>>>>>>> setflag(FLT_ACC); # do accounting >>>>>>>> } >>>>>>>> >>>>>>>> I need to show into my application that their SIP phone is >>>>>>>> online or not. How can I hook into this? >>>>>>>> _______________________________________________ >>>>>>>> Kamailio (SER) - Users Mailing List >>>>>>>> sr-users@lists.kamailio.org >>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>>> >>>>>>> _______________________________________________ >>>>>>> Kamailio (SER) - Users Mailing List >>>>>>> sr-users@lists.kamailio.org >>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>> >>>>>> _______________________________________________ >>>>> Kamailio (SER) - Users Mailing List >>>>> sr-users@lists.kamailio.org >>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>> >>>> _______________________________________________ >>>> Kamailio (SER) - Users Mailing List >>>> sr-users@lists.kamailio.org >>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>> >>> -- >>> Regards, >>> >>> David Villasmil >>> email: david.villasmil.work@gmail.com >>> phone: +34669448337 >>> _______________________________________________ >>> Kamailio (SER) - Users Mailing List >>> sr-users@lists.kamailio.org >>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>> >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >
Kamailio (SER) - Users Mailing Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
--
Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
you should be able to use usrloc's function:
1.15. ul_register_ulcb(type ,callback, param)
The function register with USRLOC a callback function to be called when some event occures inside USRLOC.
Meaning of the parameters is as follows:
-
*int types* - type of event for which the callback should be called (see usrloc/ul_callback.h). -
*ul_cb f* - callback function; see usrloc/ul_callback.h for prototype. -
*void *param* - some parameter to be passed to the callback each time when it is called.
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Tue, Jul 23, 2019 at 3:23 PM Anuran Barman anuranbarman@gmail.com wrote:
yeah it is removing. that sip phone had expiration time more so it was not getting deleted. later I found out. Thanks
On Tue, 23 Jul 2019 at 7:46 PM, David Villasmil < david.villasmil.work@gmail.com> wrote:
The module should remove the user's contact when the register expires.
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Tue, Jul 23, 2019 at 10:07 AM Anuran Barman anuranbarman@gmail.com wrote:
db_mode is already set to 2. There is one parameter I saw which is saying about cleaning expired db records so I set it to Enabled. But it did not change anything.
modparam("usrloc", "db_timer_clean", 1)
On Tue, Jul 23, 2019 at 1:34 PM Henning Westerholt hw@skalatan.de wrote:
Hello,
have a look to the db_mode parameter in the usrloc module. You can operate the module in different database modes.
Cheers,
Henning Am 23.07.19 um 09:48 schrieb Anuran Barman:
So I tried the the Expires header for UNREGISTER and it is working fine. Thanks for that. But the problem is that SIP Phone does not send UNREGISTER event. It only sends REGISTER method periodically. So in my Server it will be always online. So to overcome that I will be running e cron job which will pool the online users from 'location' table of kamailio mysql db. But the problem is, 'location' table does not get updated as soon as possible, rather if I disconnect the SIP Phone and do 'kamctl ul show' it will be still there for like 5 mins, after that it goes away. How can I change the timeout of this,say to 2mins, meaning that after 2mins if there is no response from the client ,Kamailio will mark it as offline. Where to change that parameter?
On Mon, Jul 22, 2019 at 11:20 PM Anuran Barman anuranbarman@gmail.com wrote:
Thanks, I will try these out and get back to you.
On Mon, Jul 22, 2019 at 11:18 PM Henning Westerholt hw@skalatan.de wrote:
Hello,
you can get the result of the register module "save()" function call from its return value:
https://www.kamailio.org/docs/modules/5.2.x/modules/registrar.html#registrar... and then use a similar logic like you quoted in the initial question.
You can of course also just query the usrloc module with the provide remote function API:
https://www.kamailio.org/docs/modules/5.2.x/modules/usrloc.html#usrloc.r.loo...
This can be called over HTTP, JSON HTTP and others.
Cheers,
Henning Am 22.07.19 um 14:34 schrieb Anuran Barman:
evapi seems to be complicated and more than necessary for I want to do. Can't I get the successful register and unregister event from config file just like got INVITE event without using it?
On Mon, Jul 22, 2019 at 6:02 PM Anuran Barman anuranbarman@gmail.com wrote:
> # IP authorization and user authentication > route[AUTH] { > #!ifdef WITH_AUTH > > #!ifdef WITH_IPAUTH > if((!is_method("REGISTER")) && allow_source_address()) { > # source IP allowed > return; > } > #!endif > > if (is_method("REGISTER") || from_uri==myself) { > xlog("LOG_LOCAL3","L_INFO","authentication request from domain=$ad > realm=$ar username=$Au sourceIP=$si agentHeader=$ua"); > # authenticate requests > if (!auth_check("$fd", "subscriber", "1")) { > auth_challenge("$fd", "0"); > exit; > } > # user authenticated - remove auth header > if(!is_method("REGISTER|PUBLISH")) > consume_credentials(); > xlog("LOG_LOCAL3","L_INFO","authentication successful"); *<============== > At this point can I assume authentication is successful ??* > } > # if caller is not local subscriber, then check if it calls > # a local destination, otherwise deny, not an open relay here > if (from_uri!=myself && uri!=myself) { > sl_send_reply("403","Not relaying"); > exit; > } > > #!endif > return; > } > > Kindly look into the snippet above. The bold lettered one. At that > point can I assume authentication is successful ?? > > On Mon, Jul 22, 2019 at 5:58 PM E. Schmidbauer < > eschmidbauer@gmail.com> wrote: > >> you should be doing some sort of authentication and then saving the >> user's registration data. >> add a route to fire an event when the registration data is saved. >> or even better IMO would be to use an event queue like mqueue and >> rtimer to push events into a queue and process them with rtimer and evapi >> >> On Mon, Jul 22, 2019 at 7:46 AM Anuran Barman < >> anuranbarman@gmail.com> wrote: >> >>> But it does not tell me if thats a successful register. I can make >>> the user online but may be the request fails as credentials are wrong. So >>> the REGISTER is not successful. How can I handle that? >>> >>> On Mon, 22 Jul 2019 at 5:14 PM, David Villasmil < >>> david.villasmil.work@gmail.com> wrote: >>> >>>> Just as you do is_method(“INVITE”) you can do >>>> is_method(“REGISTER”) after that you can check the EXPIRE, if it is zero >>>> then it is an UN-REGISTER. >>>> >>>> >>>> On Mon, 22 Jul 2019 at 12:35, E. Schmidbauer < >>>> eschmidbauer@gmail.com> wrote: >>>> >>>>> here is a good example of how you can use evapi in kamailio: >>>>> >>>>> http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing >>>>> >>>>> here is a good example of how you can implement it with a go >>>>> app: >>>>> https://github.com/cgrates/kamevapi >>>>> >>>>> >>>>> >>>>> >>>>> On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman < >>>>> anuranbarman@gmail.com> wrote: >>>>> >>>>>> It seems like this module is useful for making the >>>>>> connection/message flow. But that I need when I have the events of Register >>>>>> and unregister. How to get the events from this module? >>>>>> >>>>>> On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman < >>>>>> anuranbarman@gmail.com> wrote: >>>>>> >>>>>>> Though I have already a NodeJS server running, I will try the >>>>>>> evapi module. If there are some tutorial/Wiki on how to do this please >>>>>>> share that with me. That will be great help. >>>>>>> >>>>>>> On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer < >>>>>>> eschmidbauer@gmail.com> wrote: >>>>>>> >>>>>>>> I would recommend using `evapi` for something like this >>>>>>>> You could build a small go app that connects via evapi and >>>>>>>> send/receive events to/from kamailio. >>>>>>>> >>>>>>>> >>>>>>>> On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman < >>>>>>>> anuranbarman@gmail.com> wrote: >>>>>>>> >>>>>>>>> Hi, >>>>>>>>> I am integrating Kamailio into my application. I want to >>>>>>>>> hook to the successful REGISTER and unregister event into Kamailio into my >>>>>>>>> application. For now, I am able to hook into INVITE event and can hit my >>>>>>>>> server to send a email to the callee user that user X is calling you. The >>>>>>>>> way I am doing is by this >>>>>>>>> if (is_method("INVITE")) { >>>>>>>>> xlog("LOG_LOCAL3","L_INFO","invite came >>>>>>>>> ($fU) ($tU)"); >>>>>>>>> $var(res) = http_connect("sipnodejsserver", >>>>>>>>> "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); >>>>>>>>> xlog("LOG_LOCAL3","L_INFO","request sent >>>>>>>>> $avp(route) $var(res)"); >>>>>>>>> setflag(FLT_ACC); # do accounting >>>>>>>>> } >>>>>>>>> >>>>>>>>> I need to show into my application that their SIP phone is >>>>>>>>> online or not. How can I hook into this? >>>>>>>>> _______________________________________________ >>>>>>>>> Kamailio (SER) - Users Mailing List >>>>>>>>> sr-users@lists.kamailio.org >>>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> Kamailio (SER) - Users Mailing List >>>>>>>> sr-users@lists.kamailio.org >>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>>> >>>>>>> _______________________________________________ >>>>>> Kamailio (SER) - Users Mailing List >>>>>> sr-users@lists.kamailio.org >>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>> >>>>> _______________________________________________ >>>>> Kamailio (SER) - Users Mailing List >>>>> sr-users@lists.kamailio.org >>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>> >>>> -- >>>> Regards, >>>> >>>> David Villasmil >>>> email: david.villasmil.work@gmail.com >>>> phone: +34669448337 >>>> _______________________________________________ >>>> Kamailio (SER) - Users Mailing List >>>> sr-users@lists.kamailio.org >>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>> >>> _______________________________________________ >>> Kamailio (SER) - Users Mailing List >>> sr-users@lists.kamailio.org >>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>> >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> > _______________________________________________ Kamailio (SER) - Users Mailing Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
--
Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
You can register a callback for any events on the usrloc module, i.e.:
ul_register_ulcb("3", "usrloc:contact-expired");
then create a route like:
event_route[usrloc:contact-expired] { ... do your thing here ... }
I've never had the need to use it, but should work for you
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Tue, Jul 23, 2019 at 5:26 PM David Villasmil < david.villasmil.work@gmail.com> wrote:
you should be able to use usrloc's function:
1.15. ul_register_ulcb(type ,callback, param)
The function register with USRLOC a callback function to be called when some event occures inside USRLOC.
Meaning of the parameters is as follows:
*int types* - type of event for which the callback should be called (see usrloc/ul_callback.h).
*ul_cb f* - callback function; see usrloc/ul_callback.h for prototype.
*void *param* - some parameter to be passed to the callback each time when it is called.
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Tue, Jul 23, 2019 at 3:23 PM Anuran Barman anuranbarman@gmail.com wrote:
yeah it is removing. that sip phone had expiration time more so it was not getting deleted. later I found out. Thanks
On Tue, 23 Jul 2019 at 7:46 PM, David Villasmil < david.villasmil.work@gmail.com> wrote:
The module should remove the user's contact when the register expires.
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Tue, Jul 23, 2019 at 10:07 AM Anuran Barman anuranbarman@gmail.com wrote:
db_mode is already set to 2. There is one parameter I saw which is saying about cleaning expired db records so I set it to Enabled. But it did not change anything.
modparam("usrloc", "db_timer_clean", 1)
On Tue, Jul 23, 2019 at 1:34 PM Henning Westerholt hw@skalatan.de wrote:
Hello,
have a look to the db_mode parameter in the usrloc module. You can operate the module in different database modes.
Cheers,
Henning Am 23.07.19 um 09:48 schrieb Anuran Barman:
So I tried the the Expires header for UNREGISTER and it is working fine. Thanks for that. But the problem is that SIP Phone does not send UNREGISTER event. It only sends REGISTER method periodically. So in my Server it will be always online. So to overcome that I will be running e cron job which will pool the online users from 'location' table of kamailio mysql db. But the problem is, 'location' table does not get updated as soon as possible, rather if I disconnect the SIP Phone and do 'kamctl ul show' it will be still there for like 5 mins, after that it goes away. How can I change the timeout of this,say to 2mins, meaning that after 2mins if there is no response from the client ,Kamailio will mark it as offline. Where to change that parameter?
On Mon, Jul 22, 2019 at 11:20 PM Anuran Barman anuranbarman@gmail.com wrote:
Thanks, I will try these out and get back to you.
On Mon, Jul 22, 2019 at 11:18 PM Henning Westerholt hw@skalatan.de wrote:
> Hello, > > you can get the result of the register module "save()" function call > from its return value: > > > https://www.kamailio.org/docs/modules/5.2.x/modules/registrar.html#registrar... > and then use a similar logic like you quoted in the initial question. > > You can of course also just query the usrloc module with the provide > remote function API: > > > https://www.kamailio.org/docs/modules/5.2.x/modules/usrloc.html#usrloc.r.loo... > > This can be called over HTTP, JSON HTTP and others. > > Cheers, > > Henning > Am 22.07.19 um 14:34 schrieb Anuran Barman: > > evapi seems to be complicated and more than necessary for I want to > do. Can't I get the successful register and unregister event from config > file just like got INVITE event without using it? > > On Mon, Jul 22, 2019 at 6:02 PM Anuran Barman < > anuranbarman@gmail.com> wrote: > >> # IP authorization and user authentication >> route[AUTH] { >> #!ifdef WITH_AUTH >> >> #!ifdef WITH_IPAUTH >> if((!is_method("REGISTER")) && allow_source_address()) { >> # source IP allowed >> return; >> } >> #!endif >> >> if (is_method("REGISTER") || from_uri==myself) { >> xlog("LOG_LOCAL3","L_INFO","authentication request from domain=$ad >> realm=$ar username=$Au sourceIP=$si agentHeader=$ua"); >> # authenticate requests >> if (!auth_check("$fd", "subscriber", "1")) { >> auth_challenge("$fd", "0"); >> exit; >> } >> # user authenticated - remove auth header >> if(!is_method("REGISTER|PUBLISH")) >> consume_credentials(); >> xlog("LOG_LOCAL3","L_INFO","authentication successful"); *<============== >> At this point can I assume authentication is successful ??* >> } >> # if caller is not local subscriber, then check if it calls >> # a local destination, otherwise deny, not an open relay here >> if (from_uri!=myself && uri!=myself) { >> sl_send_reply("403","Not relaying"); >> exit; >> } >> >> #!endif >> return; >> } >> >> Kindly look into the snippet above. The bold lettered one. At that >> point can I assume authentication is successful ?? >> >> On Mon, Jul 22, 2019 at 5:58 PM E. Schmidbauer < >> eschmidbauer@gmail.com> wrote: >> >>> you should be doing some sort of authentication and then saving >>> the user's registration data. >>> add a route to fire an event when the registration data is saved. >>> or even better IMO would be to use an event queue like mqueue and >>> rtimer to push events into a queue and process them with rtimer and evapi >>> >>> On Mon, Jul 22, 2019 at 7:46 AM Anuran Barman < >>> anuranbarman@gmail.com> wrote: >>> >>>> But it does not tell me if thats a successful register. I can >>>> make the user online but may be the request fails as credentials are wrong. >>>> So the REGISTER is not successful. How can I handle that? >>>> >>>> On Mon, 22 Jul 2019 at 5:14 PM, David Villasmil < >>>> david.villasmil.work@gmail.com> wrote: >>>> >>>>> Just as you do is_method(“INVITE”) you can do >>>>> is_method(“REGISTER”) after that you can check the EXPIRE, if it is zero >>>>> then it is an UN-REGISTER. >>>>> >>>>> >>>>> On Mon, 22 Jul 2019 at 12:35, E. Schmidbauer < >>>>> eschmidbauer@gmail.com> wrote: >>>>> >>>>>> here is a good example of how you can use evapi in kamailio: >>>>>> >>>>>> http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing >>>>>> >>>>>> here is a good example of how you can implement it with a go >>>>>> app: >>>>>> https://github.com/cgrates/kamevapi >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman < >>>>>> anuranbarman@gmail.com> wrote: >>>>>> >>>>>>> It seems like this module is useful for making the >>>>>>> connection/message flow. But that I need when I have the events of Register >>>>>>> and unregister. How to get the events from this module? >>>>>>> >>>>>>> On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman < >>>>>>> anuranbarman@gmail.com> wrote: >>>>>>> >>>>>>>> Though I have already a NodeJS server running, I will try the >>>>>>>> evapi module. If there are some tutorial/Wiki on how to do this please >>>>>>>> share that with me. That will be great help. >>>>>>>> >>>>>>>> On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer < >>>>>>>> eschmidbauer@gmail.com> wrote: >>>>>>>> >>>>>>>>> I would recommend using `evapi` for something like this >>>>>>>>> You could build a small go app that connects via evapi and >>>>>>>>> send/receive events to/from kamailio. >>>>>>>>> >>>>>>>>> >>>>>>>>> On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman < >>>>>>>>> anuranbarman@gmail.com> wrote: >>>>>>>>> >>>>>>>>>> Hi, >>>>>>>>>> I am integrating Kamailio into my application. I want to >>>>>>>>>> hook to the successful REGISTER and unregister event into Kamailio into my >>>>>>>>>> application. For now, I am able to hook into INVITE event and can hit my >>>>>>>>>> server to send a email to the callee user that user X is calling you. The >>>>>>>>>> way I am doing is by this >>>>>>>>>> if (is_method("INVITE")) { >>>>>>>>>> xlog("LOG_LOCAL3","L_INFO","invite came >>>>>>>>>> ($fU) ($tU)"); >>>>>>>>>> $var(res) = http_connect("sipnodejsserver", >>>>>>>>>> "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); >>>>>>>>>> xlog("LOG_LOCAL3","L_INFO","request sent >>>>>>>>>> $avp(route) $var(res)"); >>>>>>>>>> setflag(FLT_ACC); # do accounting >>>>>>>>>> } >>>>>>>>>> >>>>>>>>>> I need to show into my application that their SIP phone is >>>>>>>>>> online or not. How can I hook into this? >>>>>>>>>> _______________________________________________ >>>>>>>>>> Kamailio (SER) - Users Mailing List >>>>>>>>>> sr-users@lists.kamailio.org >>>>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> Kamailio (SER) - Users Mailing List >>>>>>>>> sr-users@lists.kamailio.org >>>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>>>> >>>>>>>> _______________________________________________ >>>>>>> Kamailio (SER) - Users Mailing List >>>>>>> sr-users@lists.kamailio.org >>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>> >>>>>> _______________________________________________ >>>>>> Kamailio (SER) - Users Mailing List >>>>>> sr-users@lists.kamailio.org >>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>> >>>>> -- >>>>> Regards, >>>>> >>>>> David Villasmil >>>>> email: david.villasmil.work@gmail.com >>>>> phone: +34669448337 >>>>> _______________________________________________ >>>>> Kamailio (SER) - Users Mailing List >>>>> sr-users@lists.kamailio.org >>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>> >>>> _______________________________________________ >>>> Kamailio (SER) - Users Mailing List >>>> sr-users@lists.kamailio.org >>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>> >>> _______________________________________________ >>> Kamailio (SER) - Users Mailing List >>> sr-users@lists.kamailio.org >>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>> >> > _______________________________________________ > Kamailio (SER) - Users Mailing Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users > > -- > Henning Westerholt - https://skalatan.de/blog/ > Kamailio services - https://skalatan.de/services > > --
Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
This method looks promising. In the doc its saying last one parameter is the some params which you wanna pass to the callback, how can I pass the expired username to the callback?
On Tue, Jul 23, 2019 at 10:04 PM David Villasmil < david.villasmil.work@gmail.com> wrote:
You can register a callback for any events on the usrloc module, i.e.:
ul_register_ulcb("3", "usrloc:contact-expired");
then create a route like:
event_route[usrloc:contact-expired] { ... do your thing here ... }
I've never had the need to use it, but should work for you
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Tue, Jul 23, 2019 at 5:26 PM David Villasmil < david.villasmil.work@gmail.com> wrote:
you should be able to use usrloc's function:
1.15. ul_register_ulcb(type ,callback, param)
The function register with USRLOC a callback function to be called when some event occures inside USRLOC.
Meaning of the parameters is as follows:
*int types* - type of event for which the callback should be called (see usrloc/ul_callback.h).
*ul_cb f* - callback function; see usrloc/ul_callback.h for prototype.
*void *param* - some parameter to be passed to the callback each time when it is called.
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Tue, Jul 23, 2019 at 3:23 PM Anuran Barman anuranbarman@gmail.com wrote:
yeah it is removing. that sip phone had expiration time more so it was not getting deleted. later I found out. Thanks
On Tue, 23 Jul 2019 at 7:46 PM, David Villasmil < david.villasmil.work@gmail.com> wrote:
The module should remove the user's contact when the register expires.
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Tue, Jul 23, 2019 at 10:07 AM Anuran Barman anuranbarman@gmail.com wrote:
db_mode is already set to 2. There is one parameter I saw which is saying about cleaning expired db records so I set it to Enabled. But it did not change anything.
modparam("usrloc", "db_timer_clean", 1)
On Tue, Jul 23, 2019 at 1:34 PM Henning Westerholt hw@skalatan.de wrote:
Hello,
have a look to the db_mode parameter in the usrloc module. You can operate the module in different database modes.
Cheers,
Henning Am 23.07.19 um 09:48 schrieb Anuran Barman:
So I tried the the Expires header for UNREGISTER and it is working fine. Thanks for that. But the problem is that SIP Phone does not send UNREGISTER event. It only sends REGISTER method periodically. So in my Server it will be always online. So to overcome that I will be running e cron job which will pool the online users from 'location' table of kamailio mysql db. But the problem is, 'location' table does not get updated as soon as possible, rather if I disconnect the SIP Phone and do 'kamctl ul show' it will be still there for like 5 mins, after that it goes away. How can I change the timeout of this,say to 2mins, meaning that after 2mins if there is no response from the client ,Kamailio will mark it as offline. Where to change that parameter?
On Mon, Jul 22, 2019 at 11:20 PM Anuran Barman < anuranbarman@gmail.com> wrote:
> Thanks, I will try these out and get back to you. > > On Mon, Jul 22, 2019 at 11:18 PM Henning Westerholt hw@skalatan.de > wrote: > >> Hello, >> >> you can get the result of the register module "save()" function >> call from its return value: >> >> >> https://www.kamailio.org/docs/modules/5.2.x/modules/registrar.html#registrar... >> and then use a similar logic like you quoted in the initial question. >> >> You can of course also just query the usrloc module with the >> provide remote function API: >> >> >> https://www.kamailio.org/docs/modules/5.2.x/modules/usrloc.html#usrloc.r.loo... >> >> This can be called over HTTP, JSON HTTP and others. >> >> Cheers, >> >> Henning >> Am 22.07.19 um 14:34 schrieb Anuran Barman: >> >> evapi seems to be complicated and more than necessary for I want to >> do. Can't I get the successful register and unregister event from config >> file just like got INVITE event without using it? >> >> On Mon, Jul 22, 2019 at 6:02 PM Anuran Barman < >> anuranbarman@gmail.com> wrote: >> >>> # IP authorization and user authentication >>> route[AUTH] { >>> #!ifdef WITH_AUTH >>> >>> #!ifdef WITH_IPAUTH >>> if((!is_method("REGISTER")) && allow_source_address()) { >>> # source IP allowed >>> return; >>> } >>> #!endif >>> >>> if (is_method("REGISTER") || from_uri==myself) { >>> xlog("LOG_LOCAL3","L_INFO","authentication request from domain=$ad >>> realm=$ar username=$Au sourceIP=$si agentHeader=$ua"); >>> # authenticate requests >>> if (!auth_check("$fd", "subscriber", "1")) { >>> auth_challenge("$fd", "0"); >>> exit; >>> } >>> # user authenticated - remove auth header >>> if(!is_method("REGISTER|PUBLISH")) >>> consume_credentials(); >>> xlog("LOG_LOCAL3","L_INFO","authentication successful"); *<============== >>> At this point can I assume authentication is successful ??* >>> } >>> # if caller is not local subscriber, then check if it calls >>> # a local destination, otherwise deny, not an open relay here >>> if (from_uri!=myself && uri!=myself) { >>> sl_send_reply("403","Not relaying"); >>> exit; >>> } >>> >>> #!endif >>> return; >>> } >>> >>> Kindly look into the snippet above. The bold lettered one. At that >>> point can I assume authentication is successful ?? >>> >>> On Mon, Jul 22, 2019 at 5:58 PM E. Schmidbauer < >>> eschmidbauer@gmail.com> wrote: >>> >>>> you should be doing some sort of authentication and then saving >>>> the user's registration data. >>>> add a route to fire an event when the registration data is saved. >>>> or even better IMO would be to use an event queue like mqueue and >>>> rtimer to push events into a queue and process them with rtimer and evapi >>>> >>>> On Mon, Jul 22, 2019 at 7:46 AM Anuran Barman < >>>> anuranbarman@gmail.com> wrote: >>>> >>>>> But it does not tell me if thats a successful register. I can >>>>> make the user online but may be the request fails as credentials are wrong. >>>>> So the REGISTER is not successful. How can I handle that? >>>>> >>>>> On Mon, 22 Jul 2019 at 5:14 PM, David Villasmil < >>>>> david.villasmil.work@gmail.com> wrote: >>>>> >>>>>> Just as you do is_method(“INVITE”) you can do >>>>>> is_method(“REGISTER”) after that you can check the EXPIRE, if it is zero >>>>>> then it is an UN-REGISTER. >>>>>> >>>>>> >>>>>> On Mon, 22 Jul 2019 at 12:35, E. Schmidbauer < >>>>>> eschmidbauer@gmail.com> wrote: >>>>>> >>>>>>> here is a good example of how you can use evapi in kamailio: >>>>>>> >>>>>>> http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing >>>>>>> >>>>>>> here is a good example of how you can implement it with a go >>>>>>> app: >>>>>>> https://github.com/cgrates/kamevapi >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman < >>>>>>> anuranbarman@gmail.com> wrote: >>>>>>> >>>>>>>> It seems like this module is useful for making the >>>>>>>> connection/message flow. But that I need when I have the events of Register >>>>>>>> and unregister. How to get the events from this module? >>>>>>>> >>>>>>>> On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman < >>>>>>>> anuranbarman@gmail.com> wrote: >>>>>>>> >>>>>>>>> Though I have already a NodeJS server running, I will try >>>>>>>>> the evapi module. If there are some tutorial/Wiki on how to do this please >>>>>>>>> share that with me. That will be great help. >>>>>>>>> >>>>>>>>> On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer < >>>>>>>>> eschmidbauer@gmail.com> wrote: >>>>>>>>> >>>>>>>>>> I would recommend using `evapi` for something like this >>>>>>>>>> You could build a small go app that connects via evapi and >>>>>>>>>> send/receive events to/from kamailio. >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman < >>>>>>>>>> anuranbarman@gmail.com> wrote: >>>>>>>>>> >>>>>>>>>>> Hi, >>>>>>>>>>> I am integrating Kamailio into my application. I want to >>>>>>>>>>> hook to the successful REGISTER and unregister event into Kamailio into my >>>>>>>>>>> application. For now, I am able to hook into INVITE event and can hit my >>>>>>>>>>> server to send a email to the callee user that user X is calling you. The >>>>>>>>>>> way I am doing is by this >>>>>>>>>>> if (is_method("INVITE")) { >>>>>>>>>>> xlog("LOG_LOCAL3","L_INFO","invite came >>>>>>>>>>> ($fU) ($tU)"); >>>>>>>>>>> $var(res) = >>>>>>>>>>> http_connect("sipnodejsserver", >>>>>>>>>>> "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); >>>>>>>>>>> xlog("LOG_LOCAL3","L_INFO","request sent >>>>>>>>>>> $avp(route) $var(res)"); >>>>>>>>>>> setflag(FLT_ACC); # do accounting >>>>>>>>>>> } >>>>>>>>>>> >>>>>>>>>>> I need to show into my application that their SIP phone is >>>>>>>>>>> online or not. How can I hook into this? >>>>>>>>>>> _______________________________________________ >>>>>>>>>>> Kamailio (SER) - Users Mailing List >>>>>>>>>>> sr-users@lists.kamailio.org >>>>>>>>>>> >>>>>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>>> Kamailio (SER) - Users Mailing List >>>>>>>>>> sr-users@lists.kamailio.org >>>>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>> Kamailio (SER) - Users Mailing List >>>>>>>> sr-users@lists.kamailio.org >>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>>> >>>>>>> _______________________________________________ >>>>>>> Kamailio (SER) - Users Mailing List >>>>>>> sr-users@lists.kamailio.org >>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>> >>>>>> -- >>>>>> Regards, >>>>>> >>>>>> David Villasmil >>>>>> email: david.villasmil.work@gmail.com >>>>>> phone: +34669448337 >>>>>> _______________________________________________ >>>>>> Kamailio (SER) - Users Mailing List >>>>>> sr-users@lists.kamailio.org >>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>> >>>>> _______________________________________________ >>>>> Kamailio (SER) - Users Mailing List >>>>> sr-users@lists.kamailio.org >>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>> >>>> _______________________________________________ >>>> Kamailio (SER) - Users Mailing List >>>> sr-users@lists.kamailio.org >>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>> >>> >> _______________________________________________ >> Kamailio (SER) - Users Mailing Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> >> -- >> Henning Westerholt - https://skalatan.de/blog/ >> Kamailio services - https://skalatan.de/services >> >> -- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Where should I put this line? ul_register_ulcb("3", "usrloc:contact-expired");
Am I supposed to to put it in request_route{} block ?? If i put it there kamailio fails to start up giving error ERROR: <core> [cfg.y:3235]: yyparse(): cfg. parser: failed to find command ul_register_ulcb (params 2)
On Wed, Jul 24, 2019 at 10:47 AM Anuran Barman anuranbarman@gmail.com wrote:
This method looks promising. In the doc its saying last one parameter is the some params which you wanna pass to the callback, how can I pass the expired username to the callback?
On Tue, Jul 23, 2019 at 10:04 PM David Villasmil < david.villasmil.work@gmail.com> wrote:
You can register a callback for any events on the usrloc module, i.e.:
ul_register_ulcb("3", "usrloc:contact-expired");
then create a route like:
event_route[usrloc:contact-expired] { ... do your thing here ... }
I've never had the need to use it, but should work for you
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Tue, Jul 23, 2019 at 5:26 PM David Villasmil < david.villasmil.work@gmail.com> wrote:
you should be able to use usrloc's function:
1.15. ul_register_ulcb(type ,callback, param)
The function register with USRLOC a callback function to be called when some event occures inside USRLOC.
Meaning of the parameters is as follows:
*int types* - type of event for which the callback should be called (see usrloc/ul_callback.h).
*ul_cb f* - callback function; see usrloc/ul_callback.h for prototype.
*void *param* - some parameter to be passed to the callback each time when it is called.
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Tue, Jul 23, 2019 at 3:23 PM Anuran Barman anuranbarman@gmail.com wrote:
yeah it is removing. that sip phone had expiration time more so it was not getting deleted. later I found out. Thanks
On Tue, 23 Jul 2019 at 7:46 PM, David Villasmil < david.villasmil.work@gmail.com> wrote:
The module should remove the user's contact when the register expires.
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Tue, Jul 23, 2019 at 10:07 AM Anuran Barman anuranbarman@gmail.com wrote:
db_mode is already set to 2. There is one parameter I saw which is saying about cleaning expired db records so I set it to Enabled. But it did not change anything.
modparam("usrloc", "db_timer_clean", 1)
On Tue, Jul 23, 2019 at 1:34 PM Henning Westerholt hw@skalatan.de wrote:
> Hello, > > have a look to the db_mode parameter in the usrloc module. You can > operate the module in different database modes. > > Cheers, > > Henning > Am 23.07.19 um 09:48 schrieb Anuran Barman: > > So I tried the the Expires header for UNREGISTER and it is > working fine. Thanks for that. But the problem is that SIP Phone does not > send UNREGISTER event. It only sends REGISTER method periodically. So in my > Server it will be always online. So to overcome that I will be running e > cron job which will pool the online users from 'location' table of kamailio > mysql db. But the problem is, 'location' table does not get updated as > soon as possible, rather if I disconnect the SIP Phone and do 'kamctl ul > show' it will be still there for like 5 mins, after that it goes away. How > can I change the timeout of this,say to 2mins, meaning that after 2mins if > there is no response from the client ,Kamailio will mark it as offline. > Where to change that parameter? > > On Mon, Jul 22, 2019 at 11:20 PM Anuran Barman < > anuranbarman@gmail.com> wrote: > >> Thanks, I will try these out and get back to you. >> >> On Mon, Jul 22, 2019 at 11:18 PM Henning Westerholt hw@skalatan.de >> wrote: >> >>> Hello, >>> >>> you can get the result of the register module "save()" function >>> call from its return value: >>> >>> >>> https://www.kamailio.org/docs/modules/5.2.x/modules/registrar.html#registrar... >>> and then use a similar logic like you quoted in the initial question. >>> >>> You can of course also just query the usrloc module with the >>> provide remote function API: >>> >>> >>> https://www.kamailio.org/docs/modules/5.2.x/modules/usrloc.html#usrloc.r.loo... >>> >>> This can be called over HTTP, JSON HTTP and others. >>> >>> Cheers, >>> >>> Henning >>> Am 22.07.19 um 14:34 schrieb Anuran Barman: >>> >>> evapi seems to be complicated and more than necessary for I want >>> to do. Can't I get the successful register and unregister event from config >>> file just like got INVITE event without using it? >>> >>> On Mon, Jul 22, 2019 at 6:02 PM Anuran Barman < >>> anuranbarman@gmail.com> wrote: >>> >>>> # IP authorization and user authentication >>>> route[AUTH] { >>>> #!ifdef WITH_AUTH >>>> >>>> #!ifdef WITH_IPAUTH >>>> if((!is_method("REGISTER")) && allow_source_address()) { >>>> # source IP allowed >>>> return; >>>> } >>>> #!endif >>>> >>>> if (is_method("REGISTER") || from_uri==myself) { >>>> xlog("LOG_LOCAL3","L_INFO","authentication request from >>>> domain=$ad realm=$ar username=$Au sourceIP=$si agentHeader=$ua"); >>>> # authenticate requests >>>> if (!auth_check("$fd", "subscriber", "1")) { >>>> auth_challenge("$fd", "0"); >>>> exit; >>>> } >>>> # user authenticated - remove auth header >>>> if(!is_method("REGISTER|PUBLISH")) >>>> consume_credentials(); >>>> xlog("LOG_LOCAL3","L_INFO","authentication successful"); *<============== >>>> At this point can I assume authentication is successful ??* >>>> } >>>> # if caller is not local subscriber, then check if it calls >>>> # a local destination, otherwise deny, not an open relay here >>>> if (from_uri!=myself && uri!=myself) { >>>> sl_send_reply("403","Not relaying"); >>>> exit; >>>> } >>>> >>>> #!endif >>>> return; >>>> } >>>> >>>> Kindly look into the snippet above. The bold lettered one. At >>>> that point can I assume authentication is successful ?? >>>> >>>> On Mon, Jul 22, 2019 at 5:58 PM E. Schmidbauer < >>>> eschmidbauer@gmail.com> wrote: >>>> >>>>> you should be doing some sort of authentication and then saving >>>>> the user's registration data. >>>>> add a route to fire an event when the registration data is saved. >>>>> or even better IMO would be to use an event queue like mqueue >>>>> and rtimer to push events into a queue and process them with rtimer and >>>>> evapi >>>>> >>>>> On Mon, Jul 22, 2019 at 7:46 AM Anuran Barman < >>>>> anuranbarman@gmail.com> wrote: >>>>> >>>>>> But it does not tell me if thats a successful register. I can >>>>>> make the user online but may be the request fails as credentials are wrong. >>>>>> So the REGISTER is not successful. How can I handle that? >>>>>> >>>>>> On Mon, 22 Jul 2019 at 5:14 PM, David Villasmil < >>>>>> david.villasmil.work@gmail.com> wrote: >>>>>> >>>>>>> Just as you do is_method(“INVITE”) you can do >>>>>>> is_method(“REGISTER”) after that you can check the EXPIRE, if it is zero >>>>>>> then it is an UN-REGISTER. >>>>>>> >>>>>>> >>>>>>> On Mon, 22 Jul 2019 at 12:35, E. Schmidbauer < >>>>>>> eschmidbauer@gmail.com> wrote: >>>>>>> >>>>>>>> here is a good example of how you can use evapi in kamailio: >>>>>>>> >>>>>>>> http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing >>>>>>>> >>>>>>>> here is a good example of how you can implement it with a go >>>>>>>> app: >>>>>>>> https://github.com/cgrates/kamevapi >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman < >>>>>>>> anuranbarman@gmail.com> wrote: >>>>>>>> >>>>>>>>> It seems like this module is useful for making the >>>>>>>>> connection/message flow. But that I need when I have the events of Register >>>>>>>>> and unregister. How to get the events from this module? >>>>>>>>> >>>>>>>>> On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman < >>>>>>>>> anuranbarman@gmail.com> wrote: >>>>>>>>> >>>>>>>>>> Though I have already a NodeJS server running, I will try >>>>>>>>>> the evapi module. If there are some tutorial/Wiki on how to do this please >>>>>>>>>> share that with me. That will be great help. >>>>>>>>>> >>>>>>>>>> On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer < >>>>>>>>>> eschmidbauer@gmail.com> wrote: >>>>>>>>>> >>>>>>>>>>> I would recommend using `evapi` for something like this >>>>>>>>>>> You could build a small go app that connects via evapi and >>>>>>>>>>> send/receive events to/from kamailio. >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman < >>>>>>>>>>> anuranbarman@gmail.com> wrote: >>>>>>>>>>> >>>>>>>>>>>> Hi, >>>>>>>>>>>> I am integrating Kamailio into my application. I want to >>>>>>>>>>>> hook to the successful REGISTER and unregister event into Kamailio into my >>>>>>>>>>>> application. For now, I am able to hook into INVITE event and can hit my >>>>>>>>>>>> server to send a email to the callee user that user X is calling you. The >>>>>>>>>>>> way I am doing is by this >>>>>>>>>>>> if (is_method("INVITE")) { >>>>>>>>>>>> xlog("LOG_LOCAL3","L_INFO","invite came >>>>>>>>>>>> ($fU) ($tU)"); >>>>>>>>>>>> $var(res) = >>>>>>>>>>>> http_connect("sipnodejsserver", >>>>>>>>>>>> "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); >>>>>>>>>>>> xlog("LOG_LOCAL3","L_INFO","request sent >>>>>>>>>>>> $avp(route) $var(res)"); >>>>>>>>>>>> setflag(FLT_ACC); # do accounting >>>>>>>>>>>> } >>>>>>>>>>>> >>>>>>>>>>>> I need to show into my application that their SIP phone >>>>>>>>>>>> is online or not. How can I hook into this? >>>>>>>>>>>> _______________________________________________ >>>>>>>>>>>> Kamailio (SER) - Users Mailing List >>>>>>>>>>>> sr-users@lists.kamailio.org >>>>>>>>>>>> >>>>>>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>>>>>>> >>>>>>>>>>> _______________________________________________ >>>>>>>>>>> Kamailio (SER) - Users Mailing List >>>>>>>>>>> sr-users@lists.kamailio.org >>>>>>>>>>> >>>>>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>> Kamailio (SER) - Users Mailing List >>>>>>>>> sr-users@lists.kamailio.org >>>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> Kamailio (SER) - Users Mailing List >>>>>>>> sr-users@lists.kamailio.org >>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>>> >>>>>>> -- >>>>>>> Regards, >>>>>>> >>>>>>> David Villasmil >>>>>>> email: david.villasmil.work@gmail.com >>>>>>> phone: +34669448337 >>>>>>> _______________________________________________ >>>>>>> Kamailio (SER) - Users Mailing List >>>>>>> sr-users@lists.kamailio.org >>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>>> >>>>>> _______________________________________________ >>>>>> Kamailio (SER) - Users Mailing List >>>>>> sr-users@lists.kamailio.org >>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>>> >>>>> _______________________________________________ >>>>> Kamailio (SER) - Users Mailing List >>>>> sr-users@lists.kamailio.org >>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>>>> >>>> >>> _______________________________________________ >>> Kamailio (SER) - Users Mailing Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>> >>> -- >>> Henning Westerholt - https://skalatan.de/blog/ >>> Kamailio services - https://skalatan.de/services >>> >>> -- > Henning Westerholt - https://skalatan.de/blog/ > Kamailio services - https://skalatan.de/services > > _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hello Anuran,
things are a bit mixed up here. ;-)
The registrar module brings a pre-defined event-route that you can use to execute your custom cfg script code when the event triggers:
https://www.kamailio.org/docs/modules/5.2.x/modules/registrar.html#idm102850...
This is a own route, you place it on the same level as other routes like failure_route etc..
The ul_register_ulcb(..) is a C function API. If you like to use this, you need to do some C coding, which is probably not what you want to do. This will not work in the kamailio cfg.
Cheers,
Henning
Am 24.07.19 um 07:29 schrieb Anuran Barman: Where should I put this line? ul_register_ulcb("3", "usrloc:contact-expired");
Am I supposed to to put it in request_route{} block ?? If i put it there kamailio fails to start up giving error ERROR: <core> [cfg.y:3235]: yyparse(): cfg. parser: failed to find command ul_register_ulcb (params 2)
On Wed, Jul 24, 2019 at 10:47 AM Anuran Barman <anuranbarman@gmail.commailto:anuranbarman@gmail.com> wrote: This method looks promising. In the doc its saying last one parameter is the some params which you wanna pass to the callback, how can I pass the expired username to the callback?
On Tue, Jul 23, 2019 at 10:04 PM David Villasmil <david.villasmil.work@gmail.commailto:david.villasmil.work@gmail.com> wrote: You can register a callback for any events on the usrloc module, i.e.:
ul_register_ulcb("3", "usrloc:contact-expired");
then create a route like:
event_route[usrloc:contact-expired] { ... do your thing here ... }
I've never had the need to use it, but should work for you
Regards,
David Villasmil email: david.villasmil.work@gmail.commailto:david.villasmil.work@gmail.com phone: +34669448337
On Tue, Jul 23, 2019 at 5:26 PM David Villasmil <david.villasmil.work@gmail.commailto:david.villasmil.work@gmail.com> wrote: you should be able to use usrloc's function:
1.15. ul_register_ulcb(type ,callback, param)
The function register with USRLOC a callback function to be called when some event occures inside USRLOC.
Meaning of the parameters is as follows:
* int types - type of event for which the callback should be called (see usrloc/ul_callback.h).
* ul_cb f - callback function; see usrloc/ul_callback.h for prototype.
* void *param - some parameter to be passed to the callback each time when it is called.
Regards,
David Villasmil email: david.villasmil.work@gmail.commailto:david.villasmil.work@gmail.com phone: +34669448337
On Tue, Jul 23, 2019 at 3:23 PM Anuran Barman <anuranbarman@gmail.commailto:anuranbarman@gmail.com> wrote: yeah it is removing. that sip phone had expiration time more so it was not getting deleted. later I found out. Thanks
On Tue, 23 Jul 2019 at 7:46 PM, David Villasmil <david.villasmil.work@gmail.commailto:david.villasmil.work@gmail.com> wrote: The module should remove the user's contact when the register expires.
Regards,
David Villasmil email: david.villasmil.work@gmail.commailto:david.villasmil.work@gmail.com phone: +34669448337
On Tue, Jul 23, 2019 at 10:07 AM Anuran Barman <anuranbarman@gmail.commailto:anuranbarman@gmail.com> wrote: db_mode is already set to 2. There is one parameter I saw which is saying about cleaning expired db records so I set it to Enabled. But it did not change anything.
modparam("usrloc", "db_timer_clean", 1)
On Tue, Jul 23, 2019 at 1:34 PM Henning Westerholt <hw@skalatan.demailto:hw@skalatan.de> wrote:
Hello,
have a look to the db_mode parameter in the usrloc module. You can operate the module in different database modes.
Cheers,
Henning
Am 23.07.19 um 09:48 schrieb Anuran Barman: So I tried the the Expires header for UNREGISTER and it is working fine. Thanks for that. But the problem is that SIP Phone does not send UNREGISTER event. It only sends REGISTER method periodically. So in my Server it will be always online. So to overcome that I will be running e cron job which will pool the online users from 'location' table of kamailio mysql db. But the problem is, 'location' table does not get updated as soon as possible, rather if I disconnect the SIP Phone and do 'kamctl ul show' it will be still there for like 5 mins, after that it goes away. How can I change the timeout of this,say to 2mins, meaning that after 2mins if there is no response from the client ,Kamailio will mark it as offline. Where to change that parameter?
On Mon, Jul 22, 2019 at 11:20 PM Anuran Barman <anuranbarman@gmail.commailto:anuranbarman@gmail.com> wrote: Thanks, I will try these out and get back to you.
On Mon, Jul 22, 2019 at 11:18 PM Henning Westerholt <hw@skalatan.demailto:hw@skalatan.de> wrote:
Hello,
you can get the result of the register module "save()" function call from its return value:
https://www.kamailio.org/docs/modules/5.2.x/modules/registrar.html#registrar... and then use a similar logic like you quoted in the initial question.
You can of course also just query the usrloc module with the provide remote function API:
https://www.kamailio.org/docs/modules/5.2.x/modules/usrloc.html#usrloc.r.loo...
This can be called over HTTP, JSON HTTP and others.
Cheers,
Henning
Am 22.07.19 um 14:34 schrieb Anuran Barman: evapi seems to be complicated and more than necessary for I want to do. Can't I get the successful register and unregister event from config file just like got INVITE event without using it?
On Mon, Jul 22, 2019 at 6:02 PM Anuran Barman <anuranbarman@gmail.commailto:anuranbarman@gmail.com> wrote: # IP authorization and user authentication route[AUTH] { #!ifdef WITH_AUTH
#!ifdef WITH_IPAUTH if((!is_method("REGISTER")) && allow_source_address()) { # source IP allowed return; } #!endif
if (is_method("REGISTER") || from_uri==myself) { xlog("LOG_LOCAL3","L_INFO","authentication request from domain=$ad realm=$ar username=$Au sourceIP=$si agentHeader=$ua"); # authenticate requests if (!auth_check("$fd", "subscriber", "1")) { auth_challenge("$fd", "0"); exit; } # user authenticated - remove auth header if(!is_method("REGISTER|PUBLISH")) consume_credentials(); xlog("LOG_LOCAL3","L_INFO","authentication successful"); <============== At this point can I assume authentication is successful ?? } # if caller is not local subscriber, then check if it calls # a local destination, otherwise deny, not an open relay here if (from_uri!=myself && uri!=myself) { sl_send_reply("403","Not relaying"); exit; }
#!endif return; }
Kindly look into the snippet above. The bold lettered one. At that point can I assume authentication is successful ??
On Mon, Jul 22, 2019 at 5:58 PM E. Schmidbauer <eschmidbauer@gmail.commailto:eschmidbauer@gmail.com> wrote: you should be doing some sort of authentication and then saving the user's registration data. add a route to fire an event when the registration data is saved. or even better IMO would be to use an event queue like mqueue and rtimer to push events into a queue and process them with rtimer and evapi
On Mon, Jul 22, 2019 at 7:46 AM Anuran Barman <anuranbarman@gmail.commailto:anuranbarman@gmail.com> wrote: But it does not tell me if thats a successful register. I can make the user online but may be the request fails as credentials are wrong. So the REGISTER is not successful. How can I handle that?
On Mon, 22 Jul 2019 at 5:14 PM, David Villasmil <david.villasmil.work@gmail.commailto:david.villasmil.work@gmail.com> wrote: Just as you do is_method(“INVITE”) you can do is_method(“REGISTER”) after that you can check the EXPIRE, if it is zero then it is an UN-REGISTER.
On Mon, 22 Jul 2019 at 12:35, E. Schmidbauer <eschmidbauer@gmail.commailto:eschmidbauer@gmail.com> wrote: here is a good example of how you can use evapi in kamailio: http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs#evapi_processing
here is a good example of how you can implement it with a go app: https://github.com/cgrates/kamevapi
On Mon, Jul 22, 2019 at 7:18 AM Anuran Barman <anuranbarman@gmail.commailto:anuranbarman@gmail.com> wrote: It seems like this module is useful for making the connection/message flow. But that I need when I have the events of Register and unregister. How to get the events from this module?
On Mon, Jul 22, 2019 at 3:51 PM Anuran Barman <anuranbarman@gmail.commailto:anuranbarman@gmail.com> wrote: Though I have already a NodeJS server running, I will try the evapi module. If there are some tutorial/Wiki on how to do this please share that with me. That will be great help.
On Mon, Jul 22, 2019 at 3:39 PM E. Schmidbauer <eschmidbauer@gmail.commailto:eschmidbauer@gmail.com> wrote: I would recommend using `evapi` for something like this You could build a small go app that connects via evapi and send/receive events to/from kamailio.
On Mon, Jul 22, 2019 at 3:07 AM Anuran Barman <anuranbarman@gmail.commailto:anuranbarman@gmail.com> wrote: Hi, I am integrating Kamailio into my application. I want to hook to the successful REGISTER and unregister event into Kamailio into my application. For now, I am able to hook into INVITE event and can hit my server to send a email to the callee user that user X is calling you. The way I am doing is by this if (is_method("INVITE")) { xlog("LOG_LOCAL3","L_INFO","invite came ($fU) ($tU)"); $var(res) = http_connect("sipnodejsserver", "/","text/plain","src_user:$fU,dst_user:$tU" ,"$avp(route)"); xlog("LOG_LOCAL3","L_INFO","request sent $avp(route) $var(res)"); setflag(FLT_ACC); # do accounting }
I need to show into my application that their SIP phone is online or not. How can I hook into this? _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users -- Regards,
David Villasmil email: david.villasmil.work@gmail.commailto:david.villasmil.work@gmail.com phone: +34669448337 _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services