Re: [OpenSIPS-Users] Orderly shutdown

2022-10-27 Thread Saint Michael
I want to thank everybody. I finished my project with the help of Vlad Paiu.
Saint Michael

On Thu, Oct 27, 2022 at 12:52 PM Saint Michael  wrote:
>
> Thanks Bogdan-Andrei
>
> however, if I try to set the whole flag to 0 (from an initial value of
> 15), I get
>
> /usr/local/bin/opensips-cli -x mi set_gflag 0
> ERROR: command 'set_gflag' returned: 400: Bad parameter value
>
> if we somehow get through that issue, then the code would be?
>
> if (is_gflag(0)) {
> xlog("$ci Shutting Down\r\n");
> sl_send_reply(503,"Temporary Failure");
> append_to_reply(503,"Temporary Failure\r\n");
> exit;
> else {
> xlog("$ci Gflag is not set\r\n");
> }
>
> Sorry for being so pushy. I am open to pay consultancy fees. It's just
> that I already lost a lot of money because I killed opensips with 700
> open calls and lost the billing.
>
>
> On Thu, Oct 27, 2022 at 12:21 PM Bogdan-Andrei Iancu
>  wrote:
> >
> > OK, let's do a "back to school" when comes to binary representation and ops
> >
> > Decimal 15 (what you set for initial) is , so all bits (index 0-3)
> > are set to 1, to true. So, when you set (to value 1) the gflag with idx
> > "1" , nothing will be actually changed as it is already 1 :P
> >
> > Regards,
> >
> > Bogdan-Andrei Iancu
> >
> > OpenSIPS Founder and Developer
> >https://www.opensips-solutions.com
> > OpenSIPS Bootcamp 5-16 Dec 2022, online
> >https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/
> >
> > On 10/27/22 7:05 PM, Saint Michael wrote:
> > > this code does not seem to work: I set the initial value to 15, inside
> > > opensips.cfg
> > > modparam("gflags", "initial", 15)
> > >
> > > Then:
> > > /usr/local/bin/opensips-cli -x mi set_gflag 1
> > > "OK"
> > > /usr/local/bin/opensips-cli -x mi get_gflags
> > > {
> > >  "hex": "0xF",
> > >  "dec": "15"
> > > }
> > >
> > > Maybe I am not following the whole thing. I apologize.
> > > I imagine that we have a 32 bit field, and we set a bit to 1 for bits 
> > > 0..31.
> > >
> > > On Thu, Oct 27, 2022 at 11:32 AM Bogdan-Andrei Iancu
> > >  wrote:
> > >> Ok, docs fixed, thanks Karsten for spotting the error [0]
> > >>
> > >> Michael, that;s right, if the gflag is set, just reject the code with
> > >> 503 Service Unavailable . You also may consider adding a Retry-After
> > >> header [1] using the append_to_reply() function.
> > >>
> > >> [0]
> > >> https://github.com/OpenSIPS/opensips/commit/5945746b09b480dd0b7f8ea4b3584e4521bdac3a
> > >> [1] https://www.ietf.org/rfc/rfc3261.html#section-20.33
> > >> [2]
> > >> https://opensips.org/html/docs/modules/3.2.x/sipmsgops.html#func_append_to_reply
> > >>
> > >> Regards,
> > >>
> > >> Bogdan-Andrei Iancu
> > >>
> > >> OpenSIPS Founder and Developer
> > >> https://www.opensips-solutions.com
> > >> OpenSIPS Bootcamp 5-16 Dec 2022, online
> > >> https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/
> > >>
> > >> On 10/27/22 4:15 PM, Saint Michael wrote:
> > >>> YES
> > >>> Maybe we should fix the documentation?
> > >>> now the real question is, what goes inside the bracket if the flag
> > >>> value matches, to reject the call:
> > >>> I propose
> > >>> {
> > >>> sl_send_reply(503,"Declined");
> > >>>   exit;
> > >>> }
> > >>>
> > >>>
> > >>> On Thu, Oct 27, 2022 at 9:04 AM Karsten Wemheuer  wrote:
> >  Hi,
> > 
> >  I am not familiar with the gflags module, but
> > 
> >  Am Donnerstag, dem 27.10.2022 um 08:39 -0400 schrieb Saint Michael:
> > > for testing I added
> > > route{
> > > if (is_gflag("1")) {
> > >   t_relay("udp:10.0.0.1:5060");
> > >   } else {
> > >   t_relay("udp:10.0.0.2:5060");
> > >   }
> >  I think, You should remove the quotes around the "1".
> > 
> >  I think, the example in the docs may be wrong (Your code was from the
> >  docs, I think). See section 1.4.3, where
> >    if(is_gflag(4))
> >  is written.
> > 
> >  HTH,
> > 
> >  Karsten
> > 
> > 
> > 
> >  ___
> >  Users mailing list
> >  Users@lists.opensips.org
> >  http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> >

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] SIP/2.0 500 Server error occurred (6/SL)

2022-10-27 Thread Kneeoh via Users
 I think we're running out of branches.. I believe the default is 12. Would 
this result in an internal 500 6/SL? What would I need to change and recompile 
to increase this?
ERROR:tm:add_uac: maximum number of branches exceeded
ERROR:tm:t_forward_nonack: failure to add branches
On Thursday, October 27, 2022, 12:29:26 PM EDT, Bogdan-Andrei Iancu 
 wrote:  
 
  Hi,
 
 Do you see any error logs ?
 
 Regards,
  Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  https://www.opensips-solutions.com
OpenSIPS Bootcamp 5-16 Dec 2022, online
  https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/ On 10/27/22 6:51 
PM, Kneeoh via Users wrote:
  
 
 Hi all, i'm trying to track down the root cause of a SIP/2.0 500 Server error 
occurred (6/SL) response from Opensips and can't find any definition for what 
type of issue would cause this. It seems to happen after receiving several 503s 
from downstream endpoints, then this internal error is generated and sent. Any 
guidance is appreciated, Thanks in advance.  
  ___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
 
 ___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
  ___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Orderly shutdown

2022-10-27 Thread Saint Michael
Thanks Bogdan-Andrei

however, if I try to set the whole flag to 0 (from an initial value of
15), I get

/usr/local/bin/opensips-cli -x mi set_gflag 0
ERROR: command 'set_gflag' returned: 400: Bad parameter value

if we somehow get through that issue, then the code would be?

if (is_gflag(0)) {
xlog("$ci Shutting Down\r\n");
sl_send_reply(503,"Temporary Failure");
append_to_reply(503,"Temporary Failure\r\n");
exit;
else {
xlog("$ci Gflag is not set\r\n");
}

Sorry for being so pushy. I am open to pay consultancy fees. It's just
that I already lost a lot of money because I killed opensips with 700
open calls and lost the billing.


On Thu, Oct 27, 2022 at 12:21 PM Bogdan-Andrei Iancu
 wrote:
>
> OK, let's do a "back to school" when comes to binary representation and ops
>
> Decimal 15 (what you set for initial) is , so all bits (index 0-3)
> are set to 1, to true. So, when you set (to value 1) the gflag with idx
> "1" , nothing will be actually changed as it is already 1 :P
>
> Regards,
>
> Bogdan-Andrei Iancu
>
> OpenSIPS Founder and Developer
>https://www.opensips-solutions.com
> OpenSIPS Bootcamp 5-16 Dec 2022, online
>https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/
>
> On 10/27/22 7:05 PM, Saint Michael wrote:
> > this code does not seem to work: I set the initial value to 15, inside
> > opensips.cfg
> > modparam("gflags", "initial", 15)
> >
> > Then:
> > /usr/local/bin/opensips-cli -x mi set_gflag 1
> > "OK"
> > /usr/local/bin/opensips-cli -x mi get_gflags
> > {
> >  "hex": "0xF",
> >  "dec": "15"
> > }
> >
> > Maybe I am not following the whole thing. I apologize.
> > I imagine that we have a 32 bit field, and we set a bit to 1 for bits 0..31.
> >
> > On Thu, Oct 27, 2022 at 11:32 AM Bogdan-Andrei Iancu
> >  wrote:
> >> Ok, docs fixed, thanks Karsten for spotting the error [0]
> >>
> >> Michael, that;s right, if the gflag is set, just reject the code with
> >> 503 Service Unavailable . You also may consider adding a Retry-After
> >> header [1] using the append_to_reply() function.
> >>
> >> [0]
> >> https://github.com/OpenSIPS/opensips/commit/5945746b09b480dd0b7f8ea4b3584e4521bdac3a
> >> [1] https://www.ietf.org/rfc/rfc3261.html#section-20.33
> >> [2]
> >> https://opensips.org/html/docs/modules/3.2.x/sipmsgops.html#func_append_to_reply
> >>
> >> Regards,
> >>
> >> Bogdan-Andrei Iancu
> >>
> >> OpenSIPS Founder and Developer
> >> https://www.opensips-solutions.com
> >> OpenSIPS Bootcamp 5-16 Dec 2022, online
> >> https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/
> >>
> >> On 10/27/22 4:15 PM, Saint Michael wrote:
> >>> YES
> >>> Maybe we should fix the documentation?
> >>> now the real question is, what goes inside the bracket if the flag
> >>> value matches, to reject the call:
> >>> I propose
> >>> {
> >>> sl_send_reply(503,"Declined");
> >>>   exit;
> >>> }
> >>>
> >>>
> >>> On Thu, Oct 27, 2022 at 9:04 AM Karsten Wemheuer  wrote:
>  Hi,
> 
>  I am not familiar with the gflags module, but
> 
>  Am Donnerstag, dem 27.10.2022 um 08:39 -0400 schrieb Saint Michael:
> > for testing I added
> > route{
> > if (is_gflag("1")) {
> >   t_relay("udp:10.0.0.1:5060");
> >   } else {
> >   t_relay("udp:10.0.0.2:5060");
> >   }
>  I think, You should remove the quotes around the "1".
> 
>  I think, the example in the docs may be wrong (Your code was from the
>  docs, I think). See section 1.4.3, where
>    if(is_gflag(4))
>  is written.
> 
>  HTH,
> 
>  Karsten
> 
> 
> 
>  ___
>  Users mailing list
>  Users@lists.opensips.org
>  http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] SIP/2.0 500 Server error occurred (6/SL)

2022-10-27 Thread Bogdan-Andrei Iancu

Hi,

Do you see any error logs ?

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  https://www.opensips-solutions.com
OpenSIPS Bootcamp 5-16 Dec 2022, online
  https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/

On 10/27/22 6:51 PM, Kneeoh via Users wrote:
Hi all, i'm trying to track down the root cause of a SIP/2.0 500 
Server error occurred (6/SL) response from Opensips and can't find any 
definition for what type of issue would cause this. It seems to happen 
after receiving several 503s from downstream endpoints, then this 
internal error is generated and sent. Any guidance is appreciated, 
Thanks in advance.


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Orderly shutdown

2022-10-27 Thread Bogdan-Andrei Iancu

OK, let's do a "back to school" when comes to binary representation and ops

Decimal 15 (what you set for initial) is , so all bits (index 0-3) 
are set to 1, to true. So, when you set (to value 1) the gflag with idx 
"1" , nothing will be actually changed as it is already 1 :P


Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  https://www.opensips-solutions.com
OpenSIPS Bootcamp 5-16 Dec 2022, online
  https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/

On 10/27/22 7:05 PM, Saint Michael wrote:

this code does not seem to work: I set the initial value to 15, inside
opensips.cfg
modparam("gflags", "initial", 15)

Then:
/usr/local/bin/opensips-cli -x mi set_gflag 1
"OK"
/usr/local/bin/opensips-cli -x mi get_gflags
{
 "hex": "0xF",
 "dec": "15"
}

Maybe I am not following the whole thing. I apologize.
I imagine that we have a 32 bit field, and we set a bit to 1 for bits 0..31.

On Thu, Oct 27, 2022 at 11:32 AM Bogdan-Andrei Iancu
 wrote:

Ok, docs fixed, thanks Karsten for spotting the error [0]

Michael, that;s right, if the gflag is set, just reject the code with
503 Service Unavailable . You also may consider adding a Retry-After
header [1] using the append_to_reply() function.

[0]
https://github.com/OpenSIPS/opensips/commit/5945746b09b480dd0b7f8ea4b3584e4521bdac3a
[1] https://www.ietf.org/rfc/rfc3261.html#section-20.33
[2]
https://opensips.org/html/docs/modules/3.2.x/sipmsgops.html#func_append_to_reply

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
https://www.opensips-solutions.com
OpenSIPS Bootcamp 5-16 Dec 2022, online
https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/

On 10/27/22 4:15 PM, Saint Michael wrote:

YES
Maybe we should fix the documentation?
now the real question is, what goes inside the bracket if the flag
value matches, to reject the call:
I propose
{
sl_send_reply(503,"Declined");
  exit;
}


On Thu, Oct 27, 2022 at 9:04 AM Karsten Wemheuer  wrote:

Hi,

I am not familiar with the gflags module, but

Am Donnerstag, dem 27.10.2022 um 08:39 -0400 schrieb Saint Michael:

for testing I added
route{
if (is_gflag("1")) {
  t_relay("udp:10.0.0.1:5060");
  } else {
  t_relay("udp:10.0.0.2:5060");
  }

I think, You should remove the quotes around the "1".

I think, the example in the docs may be wrong (Your code was from the
docs, I think). See section 1.4.3, where
  if(is_gflag(4))
is written.

HTH,

Karsten



___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Orderly shutdown

2022-10-27 Thread Saint Michael
this code does not seem to work: I set the initial value to 15, inside
opensips.cfg
modparam("gflags", "initial", 15)

Then:
/usr/local/bin/opensips-cli -x mi set_gflag 1
"OK"
/usr/local/bin/opensips-cli -x mi get_gflags
{
"hex": "0xF",
"dec": "15"
}

Maybe I am not following the whole thing. I apologize.
I imagine that we have a 32 bit field, and we set a bit to 1 for bits 0..31.

On Thu, Oct 27, 2022 at 11:32 AM Bogdan-Andrei Iancu
 wrote:
>
> Ok, docs fixed, thanks Karsten for spotting the error [0]
>
> Michael, that;s right, if the gflag is set, just reject the code with
> 503 Service Unavailable . You also may consider adding a Retry-After
> header [1] using the append_to_reply() function.
>
> [0]
> https://github.com/OpenSIPS/opensips/commit/5945746b09b480dd0b7f8ea4b3584e4521bdac3a
> [1] https://www.ietf.org/rfc/rfc3261.html#section-20.33
> [2]
> https://opensips.org/html/docs/modules/3.2.x/sipmsgops.html#func_append_to_reply
>
> Regards,
>
> Bogdan-Andrei Iancu
>
> OpenSIPS Founder and Developer
>https://www.opensips-solutions.com
> OpenSIPS Bootcamp 5-16 Dec 2022, online
>https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/
>
> On 10/27/22 4:15 PM, Saint Michael wrote:
> > YES
> > Maybe we should fix the documentation?
> > now the real question is, what goes inside the bracket if the flag
> > value matches, to reject the call:
> > I propose
> > {
> > sl_send_reply(503,"Declined");
> >  exit;
> > }
> >
> >
> > On Thu, Oct 27, 2022 at 9:04 AM Karsten Wemheuer  wrote:
> >> Hi,
> >>
> >> I am not familiar with the gflags module, but
> >>
> >> Am Donnerstag, dem 27.10.2022 um 08:39 -0400 schrieb Saint Michael:
> >>> for testing I added
> >>> route{
> >>> if (is_gflag("1")) {
> >>>  t_relay("udp:10.0.0.1:5060");
> >>>  } else {
> >>>  t_relay("udp:10.0.0.2:5060");
> >>>  }
> >> I think, You should remove the quotes around the "1".
> >>
> >> I think, the example in the docs may be wrong (Your code was from the
> >> docs, I think). See section 1.4.3, where
> >>  if(is_gflag(4))
> >> is written.
> >>
> >> HTH,
> >>
> >> Karsten
> >>
> >>
> >>
> >> ___
> >> Users mailing list
> >> Users@lists.opensips.org
> >> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] SIP/2.0 500 Server error occurred (6/SL)

2022-10-27 Thread Kneeoh via Users
Hi all, i'm trying to track down the root cause of a SIP/2.0 500 Server error 
occurred (6/SL) response from Opensips and can't find any definition for what 
type of issue would cause this. It seems to happen after receiving several 503s 
from downstream endpoints, then this internal error is generated and sent. Any 
guidance is appreciated, Thanks in advance.___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] - topology_hiding and no ACK

2022-10-27 Thread Bogdan-Andrei Iancu

Hi Nitesh,

Where you have the loose_route() in your script right now, use 
topology_hiding_match()

https://opensips.org/html/docs/modules/3.2.x/topology_hiding.html#func_topology_hiding_match

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  https://www.opensips-solutions.com
OpenSIPS Bootcamp 5-16 Dec 2022, online
  https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/

On 10/27/22 3:51 PM, Nitesh Divecha wrote:

Hey Bogdan-Andrei,

Thanks for your feedback.

To be honest - I don't know!

I followed some online tutorials and tried to implement 
"topology_hiding()" after is_method("INVITE") since the first message 
sent to Outbound Provider is INVITE.


I never tried topology_hiding_match().

What is the right way to implement topology_hiding module? My scenario 
is simple, I'm using the default cfg and making ATA register to 
OpenSIPS to make Outbound PSTN calls.


I guess Bootcamp is the answer :-)

Cheers,
Nitesh


On Thu, Oct 27, 2022 at 4:02 AM Bogdan-Andrei Iancu 
mailto:bog...@opensips.org>> wrote:


Hi Nitesh,

Do you do topology_hiding_match() for the sequential requests
(instead of the typical loose_route()) ?  As it seems you cfg
fails to properly handle the in-dialog / sequential requests.

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
   https://www.opensips-solutions.com  
OpenSIPS Bootcamp 5-16 Dec 2022, online
   https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/  


On 10/26/22 9:05 PM, Nitesh Divecha wrote:

Hello All,

I don't know if this is by design or me not implementing
correctly! I'm a newbie to OpenSIPS...

So I generated a new opensips_residential.cfg file and only
edited it with topology_hiding("UC"); under INVITE. Plus all the
extras to make ATA register successfully and SIP trunk.

Every time I make a call two INVITE dialogs are created. One from
ATA to OpenSIPS and second one from OpenSIPS to Outbound
Provider. When a PSTN call is answered, the Outbound Provider
sends 200 OK back to OpenSIPS, and OpenSIPS sends back 200 OK to
ATA. Then ATA acknowledges with ACK back to OpenSIPS BUT OpenSIPS
fails to send ACK to the Outbound Provider. So Outbound Provider
sends 200 OK again to OpenSIPS and OpenSIPS sends 200 OK to ATA
then ATA acknowledges with ACK back to OpenSIPS BUT OpenSIPS
fails to send back ACK... This dance goes on for 30 secs and
until Outbound Provider drops the call due to no ACK.

On the sngrep it shows that call from ATA to OpenSIPS "COMPLETED"
while OpenSIPS to Outbound Provider "CALL SETUP".

If I comment out topology_hiding("UC"); then everything works
perfectly and sngrep shows only one INVITE dialog from ATA to
OpenSIPS to Outbound Provider except the Outbound Provider can
see everything that is ATA's IP info, etc...

Here is my cfg:

route {
...
if (dp_translate(10 ,$rU ,$rU) ) {
              xlog("*** Dial plan translate from source $avp(src)
to $rU ***\n");

              $avp(furi) = "sip:xxx...@gothamcity.com
";
              uac_replace_from( , "$avp(furi)");
              #strip(1);
              if (!do_routing(0)) {
                      send_reply(500,"No PSTN Route found");
                      exit;
              }
              # t_on_branch("change_from");
              route(relay);
              exit;
      }
...
}

route[relay] {
      # for INVITEs enable some additional helper routes
      if (is_method("INVITE")) {
              # create_dialog();
              topology_hiding("UC");
              if(remove_hf("User-Agent")){
                      xlog("*** 4. User-Agent found and removed.
***\n");
              }

              if (isflagset("NAT") && has_body("application/sdp")) {
                      rtpproxy_offer("ro");
              }

              t_on_branch("per_branch_ops");
              t_on_reply("handle_nat");
              t_on_failure("missed_call");
      }

      if (isflagset("NAT")) {
              add_rr_param(";nat=yes");
      }

      if (!t_relay()) {
              send_reply(500,"Internal Error");
      }
      exit;
}

My eyes are sore and my head is spinning... Any help will be
highly appreciated... Thanks!

Cheers,
Nitesh


___
Users mailing list
Users@lists.opensips.org  
http://lists.opensips.org/cgi-bin/mailman/listinfo/users  





___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin

Re: [OpenSIPS-Users] Orderly shutdown

2022-10-27 Thread Bogdan-Andrei Iancu

Ok, docs fixed, thanks Karsten for spotting the error [0]

Michael, that;s right, if the gflag is set, just reject the code with 
503 Service Unavailable . You also may consider adding a Retry-After 
header [1] using the append_to_reply() function.


[0] 
https://github.com/OpenSIPS/opensips/commit/5945746b09b480dd0b7f8ea4b3584e4521bdac3a

[1] https://www.ietf.org/rfc/rfc3261.html#section-20.33
[2] 
https://opensips.org/html/docs/modules/3.2.x/sipmsgops.html#func_append_to_reply


Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  https://www.opensips-solutions.com
OpenSIPS Bootcamp 5-16 Dec 2022, online
  https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/

On 10/27/22 4:15 PM, Saint Michael wrote:

YES
Maybe we should fix the documentation?
now the real question is, what goes inside the bracket if the flag
value matches, to reject the call:
I propose
{
sl_send_reply(503,"Declined");
 exit;
}


On Thu, Oct 27, 2022 at 9:04 AM Karsten Wemheuer  wrote:

Hi,

I am not familiar with the gflags module, but

Am Donnerstag, dem 27.10.2022 um 08:39 -0400 schrieb Saint Michael:

for testing I added
route{
if (is_gflag("1")) {
 t_relay("udp:10.0.0.1:5060");
 } else {
 t_relay("udp:10.0.0.2:5060");
 }

I think, You should remove the quotes around the "1".

I think, the example in the docs may be wrong (Your code was from the
docs, I think). See section 1.4.3, where
 if(is_gflag(4))
is written.

HTH,

Karsten



___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Problem with gflags

2022-10-27 Thread Saint Michael
this code does not seem to work: the initial value is 15, inside opensips.cfg

/usr/local/bin/opensips-cli -x mi set_gflag 1
"OK"
/usr/local/bin/opensips-cli -x mi get_gflags
{
"hex": "0xF",
"dec": "15"
}

Maybe I am not following the whole thing. I apologize.


On Thu, Oct 27, 2022 at 11:14 AM Saint Michael  wrote:
>
> I am afraid I am not seeing it clearly:
> from the command line I set
> opensips-cli -x mi set_gflag 1
> "OK"
> what function will test if this is true inside the code?
> this does not work
> if (is_gflag(1)) {
> xlog("$ci Shutting Down\r\n");
> }
>  else {
> xlog("$ci Gflag is not 1\r\n");
> }
>
> it is counterintuitive that you set Bit 1 from the command line and
> then test it inside the code but it fails the test.
> How can I print the current gflag inside xlog();
>
>
>
> On Thu, Oct 27, 2022 at 11:00 AM Liviu Chircu  wrote:
> >
> > On 27.10.2022 17:55, Saint Michael wrote:
> > > I just need to know how to check for the gflag inside the code
> > > this:
> > >   if (is_gflag("1")) {..}
> > > does not work, even if the flag is (1), as I wrote this test from the
> > > command line works
> > >
> > > opensips-cli -x mi is_gflag 1
> > > true
> > >
> > > As you can see, unless you can test for the gflag value inside the
> > > code, it cannot be used. The module gflag is of a great importance
> > > when managing Opensips, because it allows for an orderly shutdown
> > > without losing CDR, that is: money.
> > >
> > > Many thanks.
> >
> > Script: is_gflag(0) (is bit "0" set?)
> > MI: is_gflag(1) (are all bits in bitmask "1" set?)
> >
> > --
> > Liviu Chircu
> > www.twitter.com/liviuchircu | www.opensips-solutions.com
> >

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Problem with gflags

2022-10-27 Thread Saint Michael
I am afraid I am not seeing it clearly:
from the command line I set
opensips-cli -x mi set_gflag 1
"OK"
what function will test if this is true inside the code?
this does not work
if (is_gflag(1)) {
xlog("$ci Shutting Down\r\n");
}
 else {
xlog("$ci Gflag is not 1\r\n");
}

it is counterintuitive that you set Bit 1 from the command line and
then test it inside the code but it fails the test.
How can I print the current gflag inside xlog();



On Thu, Oct 27, 2022 at 11:00 AM Liviu Chircu  wrote:
>
> On 27.10.2022 17:55, Saint Michael wrote:
> > I just need to know how to check for the gflag inside the code
> > this:
> >   if (is_gflag("1")) {..}
> > does not work, even if the flag is (1), as I wrote this test from the
> > command line works
> >
> > opensips-cli -x mi is_gflag 1
> > true
> >
> > As you can see, unless you can test for the gflag value inside the
> > code, it cannot be used. The module gflag is of a great importance
> > when managing Opensips, because it allows for an orderly shutdown
> > without losing CDR, that is: money.
> >
> > Many thanks.
>
> Script: is_gflag(0) (is bit "0" set?)
> MI: is_gflag(1) (are all bits in bitmask "1" set?)
>
> --
> Liviu Chircu
> www.twitter.com/liviuchircu | www.opensips-solutions.com
>

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Problem with gflags

2022-10-27 Thread Liviu Chircu

On 27.10.2022 17:55, Saint Michael wrote:

I just need to know how to check for the gflag inside the code
this:
  if (is_gflag("1")) {..}
does not work, even if the flag is (1), as I wrote this test from the
command line works

opensips-cli -x mi is_gflag 1
true

As you can see, unless you can test for the gflag value inside the
code, it cannot be used. The module gflag is of a great importance
when managing Opensips, because it allows for an orderly shutdown
without losing CDR, that is: money.

Many thanks.


Script: is_gflag(0) (is bit "0" set?)
MI: is_gflag(1) (are all bits in bitmask "1" set?)

--
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Problem with gflags

2022-10-27 Thread Saint Michael
I just need to know how to check for the gflag inside the code
this:
 if (is_gflag("1")) {..}
does not work, even if the flag is (1), as I wrote this test from the
command line works

opensips-cli -x mi is_gflag 1
true

As you can see, unless you can test for the gflag value inside the
code, it cannot be used. The module gflag is of a great importance
when managing Opensips, because it allows for an orderly shutdown
without losing CDR, that is: money.

Many thanks.





Thank you!

On Thu, Oct 27, 2022 at 10:48 AM Liviu Chircu  wrote:
>
> On 27.10.2022 17:20, Saint Michael wrote:
> > I only get the second xlog()
> >
> > The documentation may be wrong, it asks us to use
> > if (is_gflag("1")) {..}
> > But opensips fails to start.
> >
> > How do I test for gflag=1 inside my
> > route
>
> Hi SM,
>
> The set of functions in "gflags" module is a bit strange, however they
> are correct.  The script functions work with *bits* (e.g. bit 0, 1, 2,
> ...), while the MI functions work with *bitmasks* (e.g. 1, 2, 4, ...).
> Be careful not to mix the two, and you should get the correct results.
>
> I believe the docs are somewhat accurate about the above - if not, let
> me know and we can make improvements together.
>
> Best regards,
>
> --
> Liviu Chircu
> www.twitter.com/liviuchircu | www.opensips-solutions.com
>

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Problem with gflags

2022-10-27 Thread Liviu Chircu

On 27.10.2022 17:20, Saint Michael wrote:

I only get the second xlog()

The documentation may be wrong, it asks us to use
if (is_gflag("1")) {..}
But opensips fails to start.

How do I test for gflag=1 inside my
route


Hi SM,

The set of functions in "gflags" module is a bit strange, however they 
are correct.  The script functions work with *bits* (e.g. bit 0, 1, 2, 
...), while the MI functions work with *bitmasks* (e.g. 1, 2, 4, ...).  
Be careful not to mix the two, and you should get the correct results.


I believe the docs are somewhat accurate about the above - if not, let 
me know and we can make improvements together.


Best regards,

--
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] Problem with gflags

2022-10-27 Thread Saint Michael
Dear friends
I set flag to 1, using
opensips-cli -x mi set_gflag 1
and it works, in fact:

 opensips-cli -x mi get_gflags
{
"hex": "0x1",
"dec": "1"
}

but in the code, this test never works:

if (is_gflag(1)) {
xlog("$ci Shutting Down\r\n");
}
 else {
xlog("$ci Gflag is not 1\r\n");
}

I only get the second xlog()

The documentation may be wrong, it asks us to use
if (is_gflag("1")) {..}
But opensips fails to start.

How do I test for gflag=1 inside my
route
{

}

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Orderly shutdown

2022-10-27 Thread Saint Michael
YES
Maybe we should fix the documentation?
now the real question is, what goes inside the bracket if the flag
value matches, to reject the call:
I propose
{
sl_send_reply(503,"Declined");
exit;
}


On Thu, Oct 27, 2022 at 9:04 AM Karsten Wemheuer  wrote:
>
> Hi,
>
> I am not familiar with the gflags module, but
>
> Am Donnerstag, dem 27.10.2022 um 08:39 -0400 schrieb Saint Michael:
> > for testing I added
> > route{
> > if (is_gflag("1")) {
> > t_relay("udp:10.0.0.1:5060");
> > } else {
> > t_relay("udp:10.0.0.2:5060");
> > }
>
> I think, You should remove the quotes around the "1".
>
> I think, the example in the docs may be wrong (Your code was from the
> docs, I think). See section 1.4.3, where
> if(is_gflag(4))
> is written.
>
> HTH,
>
> Karsten
>
>
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Orderly shutdown

2022-10-27 Thread Karsten Wemheuer
Hi,

I am not familiar with the gflags module, but

Am Donnerstag, dem 27.10.2022 um 08:39 -0400 schrieb Saint Michael:
> for testing I added
> route{
> if (is_gflag("1")) {
> t_relay("udp:10.0.0.1:5060");
> } else {
> t_relay("udp:10.0.0.2:5060");
> }

I think, You should remove the quotes around the "1".

I think, the example in the docs may be wrong (Your code was from the
docs, I think). See section 1.4.3, where
if(is_gflag(4))
is written.

HTH,

Karsten



___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] - topology_hiding and no ACK

2022-10-27 Thread Nitesh Divecha
Hey Bogdan-Andrei,

Thanks for your feedback.

To be honest - I don't know!

I followed some online tutorials and tried to implement "topology_hiding()"
after is_method("INVITE") since the first message sent to Outbound Provider
is INVITE.

I never tried topology_hiding_match().

What is the right way to implement topology_hiding module? My scenario is
simple, I'm using the default cfg and making ATA register to OpenSIPS to
make Outbound PSTN calls.

I guess Bootcamp is the answer :-)

Cheers,
Nitesh


On Thu, Oct 27, 2022 at 4:02 AM Bogdan-Andrei Iancu 
wrote:

> Hi Nitesh,
>
> Do you do topology_hiding_match() for the sequential requests (instead of
> the typical loose_route()) ?  As it seems you cfg fails to properly handle
> the in-dialog / sequential requests.
>
> Regards,
>
> Bogdan-Andrei Iancu
>
> OpenSIPS Founder and Developer
>   https://www.opensips-solutions.com
> OpenSIPS Bootcamp 5-16 Dec 2022, online
>   https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/
>
> On 10/26/22 9:05 PM, Nitesh Divecha wrote:
>
> Hello All,
>
> I don't know if this is by design or me not implementing correctly! I'm a
> newbie to OpenSIPS...
>
> So I generated a new opensips_residential.cfg file and only edited it
> with topology_hiding("UC"); under INVITE. Plus all the extras to make ATA
> register successfully and SIP trunk.
>
> Every time I make a call two INVITE dialogs are created. One from ATA to
> OpenSIPS and second one from OpenSIPS to Outbound Provider. When a PSTN
> call is answered, the Outbound Provider sends 200 OK back to OpenSIPS, and
> OpenSIPS sends back 200 OK to ATA. Then ATA acknowledges with ACK back to
> OpenSIPS BUT OpenSIPS fails to send ACK to the Outbound Provider. So
> Outbound Provider sends 200 OK again to OpenSIPS and OpenSIPS sends 200 OK
> to ATA then ATA acknowledges with ACK back to OpenSIPS BUT OpenSIPS fails
> to send back ACK... This dance goes on for 30 secs and until Outbound
> Provider drops the call due to no ACK.
>
> On the sngrep it shows that call from ATA to OpenSIPS "COMPLETED" while
> OpenSIPS to Outbound Provider "CALL SETUP".
>
> If I comment out topology_hiding("UC"); then everything works perfectly
> and sngrep shows only one INVITE dialog from ATA to OpenSIPS to Outbound
> Provider except the Outbound Provider can see everything that is ATA's IP
> info, etc...
>
> Here is my cfg:
>
> route {
> ...
> if (dp_translate(10 ,$rU ,$rU) ) {
> xlog("*** Dial plan translate from source $avp(src) to $rU
> ***\n");
>
> $avp(furi) = "sip:xxx...@gothamcity.com";
> uac_replace_from( , "$avp(furi)");
> #strip(1);
> if (!do_routing(0)) {
> send_reply(500,"No PSTN Route found");
> exit;
> }
> # t_on_branch("change_from");
> route(relay);
> exit;
> }
> ...
> }
>
> route[relay] {
> # for INVITEs enable some additional helper routes
> if (is_method("INVITE")) {
> # create_dialog();
> topology_hiding("UC");
> if(remove_hf("User-Agent")){
> xlog("*** 4. User-Agent found and removed. ***\n");
> }
>
> if (isflagset("NAT") && has_body("application/sdp")) {
> rtpproxy_offer("ro");
> }
>
> t_on_branch("per_branch_ops");
> t_on_reply("handle_nat");
> t_on_failure("missed_call");
> }
>
> if (isflagset("NAT")) {
> add_rr_param(";nat=yes");
> }
>
> if (!t_relay()) {
> send_reply(500,"Internal Error");
> }
> exit;
> }
>
> My eyes are sore and my head is spinning... Any help will be highly
> appreciated... Thanks!
>
> Cheers,
> Nitesh
>
>
> ___
> Users mailing 
> listUsers@lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Orderly shutdown

2022-10-27 Thread Saint Michael
for testing I added
route{
if (is_gflag("1")) {
t_relay("udp:10.0.0.1:5060");
} else {
t_relay("udp:10.0.0.2:5060");
}
but I see these errors

Oct 27 12:34:33 proxy opensips[140294]: Aliases:
Oct 27 12:34:33 proxy opensips[140296]: Oct 27 12:34:33 [140296]
ERROR:core:fix_cmd: Param [1] expected to be an integer or variable
Oct 27 12:34:33 proxy opensips[140296]: Oct 27 12:34:33 [140296]
ERROR:core:fix_actions: Failed to fix command 
Oct 27 12:34:33 proxy opensips[140296]: Oct 27 12:34:33 [140296]
ERROR:core:fix_actions: fixing failed (code=-6) at
/etc/opensips/opensips.cfg:126
Oct 27 12:34:33 proxy opensips[140296]: Oct 27 12:34:33 [140296]
CRITICAL:core:fix_expr: fix_actions error
Oct 27 12:34:33 proxy opensips[140296]: Oct 27 12:34:33 [140296]
ERROR:core:main: failed to fix configuration with err code -6
Oct 27 12:34:33 proxy systemd[1]: opensips.service: Control process
exited, code=exited, status=255/EXCEPTION
Oct 27 12:34:33 proxy systemd[1]: opensips.service: Failed with result
'exit-code'.

at the beginning of the code I added
loadmodule "gflags.so"
modparam("gflags", "initial", 0)

it does load with those two lines, but as soon as I try to use the
module, it blows up.



On Thu, Oct 27, 2022 at 2:55 AM Bogdan-Andrei Iancu  wrote:
>
> To be more specific here, use the suggested gflags to test for initial INVITE 
> and reject any new call if the gflag is set - and you can toggle the flag via 
> MI cmds.
>
> Regards,
>
> Bogdan-Andrei Iancu
>
> OpenSIPS Founder and Developer
>   https://www.opensips-solutions.com
> OpenSIPS Bootcamp 5-16 Dec 2022, online
>   https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/
>
> On 10/27/22 8:05 AM, mayamatakeshi wrote:
>
> It can be done with:
>   https://opensips.org/docs/modules/3.1.x/gflags.html
>
>
> On Thu, Oct 27, 2022 at 1:18 PM Saint Michael  wrote:
>>
>> Dear Friends
>> I successfully wrote a script that terminates all open calls in an
>> orderly fashion.
>> The question is, before I execute my script, is there any similar
>> command (like opensips-cli -x mi dlg_end_dlg "${callid}") that would
>> stop taking new calls?  Like "reject any call attempts with 503 or
>> 404", because, in a high-pressure environment, 2000 new calls may
>> arrive before I close all calls and shut down Opensips.
>> I use version:
>> opensips -V
>> version: opensips 3.1.12 (x86_64/linux)
>> flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC,
>> Q_MALLOC, F_MALLOC, HP_MALLOC, DBG_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
>> ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16,
>> MAX_URI_SIZE 1024, BUF_SIZE 65535
>> poll method support: poll, epoll, sigio_rt, select.
>> git revision: 15ef14a89
>> main.c compiled on 03:16:12 Oct 25 2022 with gcc 9
>>
>> On Wed, Oct 26, 2022 at 10:49 AM Bogdan-Andrei Iancu
>>  wrote:
>> >
>> > Hi,
>> >
>> > Sending a sig TERM to the opensips processes will trigger a controlled
>> > shutdown of opensips (meaning with flushing data to DB, if needed,
>> > cleanup, etc). Nevertheless, the opensips shutdown does not ends the
>> > call, as the calls may be continued after restarting opensips.
>> >
>> > Still, if you want to terminate all ongoing calls before shutting down,
>> > better use dialog module and check these MI cmds:
>> > https://opensips.org/html/docs/modules/3.2.x/dialog.html#mi_dlg_end_dlg
>> > https://opensips.org/html/docs/modules/3.2.x/dialog.html#mi_profile_end_dlgs
>> >
>> > Regards,
>> >
>> > Bogdan-Andrei Iancu
>> >
>> > OpenSIPS Founder and Developer
>> >https://www.opensips-solutions.com
>> > OpenSIPS Bootcamp 5-16 Dec 2022, online
>> >https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/
>> >
>> > On 10/25/22 2:15 PM, Saint Michael wrote:
>> > > Dear friends
>> > > is there a command I can send to Opensips 3.1, so all calls are shut
>> > > down and BYEs are sent to both the caller and the callee? Then of
>> > > course, opensips closes down.
>> > >
>> > > ___
>> > > Users mailing list
>> > > Users@lists.opensips.org
>> > > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>> >
>>
>> ___
>> Users mailing list
>> Users@lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] - topology_hiding and no ACK

2022-10-27 Thread Bogdan-Andrei Iancu

Hi Nitesh,

Do you do topology_hiding_match() for the sequential requests (instead 
of the typical loose_route()) ?  As it seems you cfg fails to properly 
handle the in-dialog / sequential requests.


Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  https://www.opensips-solutions.com
OpenSIPS Bootcamp 5-16 Dec 2022, online
  https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/

On 10/26/22 9:05 PM, Nitesh Divecha wrote:

Hello All,

I don't know if this is by design or me not implementing correctly! 
I'm a newbie to OpenSIPS...


So I generated a new opensips_residential.cfg file and only edited it 
with topology_hiding("UC"); under INVITE. Plus all the extras to make 
ATA register successfully and SIP trunk.


Every time I make a call two INVITE dialogs are created. One from ATA 
to OpenSIPS and second one from OpenSIPS to Outbound Provider. When a 
PSTN call is answered, the Outbound Provider sends 200 OK back to 
OpenSIPS, and OpenSIPS sends back 200 OK to ATA. Then ATA acknowledges 
with ACK back to OpenSIPS BUT OpenSIPS fails to send ACK to the 
Outbound Provider. So Outbound Provider sends 200 OK again to OpenSIPS 
and OpenSIPS sends 200 OK to ATA then ATA acknowledges with ACK back 
to OpenSIPS BUT OpenSIPS fails to send back ACK... This dance goes on 
for 30 secs and until Outbound Provider drops the call due to no ACK.


On the sngrep it shows that call from ATA to OpenSIPS "COMPLETED" 
while OpenSIPS to Outbound Provider "CALL SETUP".


If I comment out topology_hiding("UC"); then everything works 
perfectly and sngrep shows only one INVITE dialog from ATA to OpenSIPS 
to Outbound Provider except the Outbound Provider can see everything 
that is ATA's IP info, etc...


Here is my cfg:

route {
...
if (dp_translate(10 ,$rU ,$rU) ) {
              xlog("*** Dial plan translate from source $avp(src) to 
$rU ***\n");


              $avp(furi) = "sip:xxx...@gothamcity.com 
";

              uac_replace_from( , "$avp(furi)");
              #strip(1);
              if (!do_routing(0)) {
                      send_reply(500,"No PSTN Route found");
                      exit;
              }
              # t_on_branch("change_from");
              route(relay);
              exit;
      }
...
}

route[relay] {
      # for INVITEs enable some additional helper routes
      if (is_method("INVITE")) {
              # create_dialog();
              topology_hiding("UC");
              if(remove_hf("User-Agent")){
                      xlog("*** 4. User-Agent found and removed. ***\n");
              }

              if (isflagset("NAT") && has_body("application/sdp")) {
                      rtpproxy_offer("ro");
              }

              t_on_branch("per_branch_ops");
              t_on_reply("handle_nat");
              t_on_failure("missed_call");
      }

      if (isflagset("NAT")) {
              add_rr_param(";nat=yes");
      }

      if (!t_relay()) {
              send_reply(500,"Internal Error");
      }
      exit;
}

My eyes are sore and my head is spinning... Any help will be highly 
appreciated... Thanks!


Cheers,
Nitesh


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users