[SR-Users] Re: http_async_client and sl_send_reply()

2024-05-01 Thread Federico Cabiddu via sr-users
Hi,
the presentation is from before http_async_client module was written so
the example configuration does not apply straight once you add the http
async request.


> if (is_method("INVITE")) {
> #Push notification
> route(SUSPEND);
> }
>
You don't have to suspend the transaction here, http_async_query will do it
for you if you have to send the push.
I would rather do
if (is_method("INVITE")) {
#Push notification
route(SENDPUSH);
}

In the SENDPUSH route suspend the transaction
$http_req(suspend) = 1;
Then in the HTTP_REPLY route process the return code and either suspend
again the transaction or reply an error message:

route[HTTP_REPLY] {
   if ($http_ok && $http_rs == 200) {
route(SUSPEND);
   } else if($http_rs == 415) {
send_reply("415", "The other party does not support video
calling!");
   } else {
xlog("L_ALERT", "route[HTTP_REPLY]: error $http_err)\n");
send_reply("500", "Server Error");
   }
}

Hope this helps.

Cheers,

Federico


On Sat, Apr 27, 2024 at 6:38 PM Masud Muborakshohi via sr-users <
sr-users@lists.kamailio.org> wrote:

> Thank you for quick response!
> But when I leave suspending enabled ($http_req(suspend) = 1, default) the
> call logic does not work, when after receiving a register (with id_index
> and id_label) from party B, the call should continue. I built this
> functionality based on your presentation
> https://www.voztovoice.org/sites/default/files/KamilioWorld2015%20-Federico.Cabiddu-TSILO.pdf
> .
> I’ll give you my routes so that the picture is complete:
> request_route {
> ...
> if (is_method("INVITE")) {
> #Push notification
> route(SUSPEND);
> }
> ...
> }
>
> # Handle SIP registrations
> route[REGISTRAR] {
> if (!is_method("REGISTER")) return;
> ...
> if (!save("location")) {
> sl_reply_error();
> }
> ...
> #Push notification
> if ( (is_method("REGISTER")) && (($hdr(Expires) != "0") ||
> !(($hdr(Contact) =~ "expires=0"))) && ($hdr(id_index) != "" &&
> $hdr(id_label) != "") ) {
> xlog("L_INFO", "New $rm ru=$ru tu=$tu \n");
> route(JOIN);
> }
>
> exit;
> }
>
> #Push notification
> route[SUSPEND] {
> if(!t_is_set("failure_route")) t_on_failure("MANAGE_FAILURE");
> send_reply("100", "Suspending");
> if ( !t_suspend() )
> {
> xlog("L_ERROR","[SUSPEND]  failed suspending trasaction
> [$T(id_index):$T(id_label)]\n");
> send_reply("501", "Suspending error");
> exit;
> }
> xlog("L_INFO","[SUSPEND]  suspended transaction
> [$T(id_index):$T(id_label)] $fU=> $rU\n");
> $sht(vtp=>join::$rU) = "" + $T(id_index) + ":" + $T(id_label);
> route(SENDPUSH);
> exit;
>
> }
>
> route[SENDPUSH] {
> sl_send_reply("100", "Pushing");
> $http_req(suspend) = 0;
> $http_req(body) = '{ "caller": "' + $fU + '", "phone": "' + $rU +
> '", "id_index": "' + $T(id_index) + '", "id_label": "' + $T(id_label)+ '",
> "call_type": "'+ $var(calltype) +'" }';
> #for apple sandbox test.
> if (is_user_in("Request-URI", "test")) {
> http_async_query("http://127.0.0.1:9996/notification/;,
> "HTTP_REPLY");
> }
> http_async_query("http://127.0.0.1:/notification/;,
> "HTTP_REPLY");
> }
>
> #Resuming transaction.
> route[JOIN] {
> xlog("L_INFO","[JOIN] from REGISTER key value [$hdr(id_index)
>  --   $hdr(id_label)]\n");
> $var(hjoin) = 0;
> lock("$tU");
> $var(hjoin) = $sht(vtp=>join::$tU);
> $var(hstored) = $sht(vtp=>stored::$tU);
> $sht(vtp=>join::$tU) = $null;
> $var(id_index) = $(var(hjoin){s.select,0,:}{s.int});
> $var(id_label) = $(var(hjoin){s.select,1,:}{s.int});
> unlock("$tU");
> if($var(id_index)!=$null){
> if ($var(hjoin)==0)
> {
> xlog("L_INFO","do ts_append_to() for $tu and
> hstored = $var(hstored)\n");
> if ($var(hstored))
> {
> ts_append_to("$(hdr(id_index){s.int})",
> "$(hdr(id_label){s.int})", "location");
> xlog("L_INFO","do ts_append_to() for $tu
> end \n");
> }
> return;
> }
> xlog("L_INFO","resuming trasaction [$(hdr(id_index){s.int
> }):$(hdr(id_label){s.int})] $tU ($var(hjoin))\n");
> if ( !t_continue("$(hdr(id_index){s.int})",
> "$(hdr(id_label){s.int})", "LOCATION") ){
> send_reply("404", "CALL NOT FOUND");
> }
> }
> }
>
> #processing HTTP responses
> route[HTTP_REPLY] {
> if ($http_ok && $http_rs == 200) {
> xlog("L_INFO", "route[HTTP_REPLY]: status $http_rs\n");
> xlog("L_INFO", 

[SR-Users] Question: if SIP Timer L and Timer M from RFC6026 has been defined at Kamailio

2024-05-01 Thread jennifer yang via sr-users
Hello

Can anyone help answer these questions:

-   if SIP Timer L and Timer M from RFC6026 has been defined at Kamailio 
(version v5.5.x)?
Timer L: Wait time for accepted INVITE  request retransmits
Timer M: Wait time for retransmission of  2xx to INVITE or  additional 2xx from 
 other branches of a forked INVITE
-   if no specific Timer defined, which timer will be used instead?


thanks
br
jenni
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: How to use environment variable

2024-05-01 Thread Pavan Kumar via sr-users
Thanks, I'll look into it. :)

On Mon, Apr 29, 2024 at 12:03 PM Olle E. Johansson  wrote:

>
>
> On 28 Apr 2024, at 10:57, Pavan Kumar via sr-users <
> sr-users@lists.kamailio.org> wrote:
>
> Hi everyone,
>
> I am trying to assign environment variable as follows
>
> listen=udp:0.0.0.0:5060 advertise $env(MY_IP):5060
>
> Looks like using the environment variable as above is an invalid
> configuration.
>
> Is there a way to use IP from env var to advertise. Even better, is there
> a way to use result in a stun query as an advertised address?
>
>
> The config variables (called pseudo-variables in documentation) can only
> be used in the routing scripts, not in the core parameters section.
>
> There is a way to add defines for substitution on the command line and use
> them though. Check the documentation in the core cookbook on how to use
> defines and the command line help for more information.
>
> /O
>
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: Kamailio works but voice is not present during the calls!

2024-05-01 Thread christian.marinelli--- via sr-users
Sergio Charrua wrote:
> Please share your kamailio.cfg file, if possible. Do not forget to hide any
> username & password that may be specified in it (i.e. db connection)
> 
> 
> *Sérgio Charrua*
> 
> *www.voip.pt *
> Tel.: +351  91 631 11 44
> 
> Email : *sergio.charrua(a)voip.pt sergio.charrua(a)voip.pt*
> 
> This message and any files or documents attached are strictly confidential
> or otherwise legally protected.
> 
> It is intended only for the individual or entity named. If you are not the
> named addressee or have received this email in error, please inform the
> sender immediately, delete it from your system and do not copy or disclose
> it or its contents or use it for any purpose. Please also note that
> transmission cannot be guaranteed to be secure or error-free.
> 
> 
> 
> 
> 
> 
> 
> 
> On Tue, Apr 30, 2024 at 8:47 PM christian.marinelli--- via sr-users <
> sr-users(a)lists.kamailio.org wrote:
> 
> >   Benoit Panizzon wrote:
> >   Hi Christian
> > 
> > this is interesting but when i install the
> > package all
> >  start automatically.
> >   How can i disable this function (compilation for kernel module)?
> >   Maybe i need to install a different packege?  To disalbe kernel module 
> > usage:
> > 
> >  rtpengine.conf
> > 
> >  ### for userspace forwarding only:
> >  table = -1
> > 
> > 
> >  Mit freundlichen Grüssen
> > 
> >  -Benoît Panizzon- 
> >  Hi @Benoit Panizzon and @Sergio Charrua,
> >  i set up rtpengine on my SIP server and i configured it with the guide you
> >  suggested to me:
> > 
> >  
> > https://nickvsnetworking.com/kamailio-bytes-rtp-media-proxying-with-rtpengi…
> > 
> >  Unfortunatly, there is no voice during the calls :)
> >  This is the pcap file during the call with rtpengine configured, if it can
> >  help you:
> > 
> >  
> > https://drive.google.com/file/d/1VQVrd8w5UicAsjl095MkwN5gNUcdjfI6/view?usp=…
> > 
> >  To make the test, i use two devices (two smartphone) connected to internet
> >  via mobile network (not in the same LAN) and as i can saw from the pcap
> >  file, it seems they want to comunicate with different ports from the
> >  standard 5060 (i opened the 5060 on my router).
> >  This could be the problem?
> >  Thanks a lot in advance
> >  Christian
> >  __
> >  Kamailio - Users Mailing List - Non Commercial Discussions
> >  To unsubscribe send an email to sr-users-leave(a)lists.kamailio.org
> >  Important: keep the mailing list in the recipients, do not reply only to
> >  the sender!
> >  Edit mailing list options or unsubscribe:
> >

Hi @Sergio Charrua,
this is my kamailio.cfg configuration file:
https://docs.google.com/document/d/1HH9Gn8f_31nDhvbpprwKFs535z65C995nVqels7I3wQ/edit?usp=sharing
If you will need other informations, ask me without problems...
Thank you so much
Christian
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe: