Re: [OpenSIPS-Users] Orderly shutdown

2022-10-26 Thread Bogdan-Andrei Iancu
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
mailto:bog...@opensips.org>> 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] Orderly shutdown

2022-10-26 Thread mayamatakeshi
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] Orderly shutdown

2022-10-26 Thread Saint Michael
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


Re: [OpenSIPS-Users] Local Route question

2022-10-26 Thread Jehanzaib Younis
Hi Micheal,

You can use t_on_reply and then something like this:
  if (t_check_status("200")) {
 ..your db query
  }

Regards,
Jehanzaib


On Thu, Oct 27, 2022 at 9:22 AM Saint Michael  wrote:

> Thank you for the clarification.
> But then how do you intercept the Connect?
> Where in the code?
> I need to fire a db query when the call connects.
> Is this even possible?
>
>
>
> On Wed, Oct 26, 2022, 10:51 AM Bogdan-Andrei Iancu 
> wrote:
>
>> Hi,
>>
>> please see
>> https://www.opensips.org/Documentation/Script-Routes-3-2#local_route -
>> the local route is triggered only for internally generated (UAC)
>> requests, so you will never have replies over there.
>>
>> 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 5:28 AM, Saint Michael wrote:
>> > Dear Friends
>> > local_route
>> > {
>> > if (is_method("200"))
>> > {
>> > }
>> > }
>> >
>> > I need to intercept the code at the moment when a call connects, so I
>> > may notify that information to the database. What specific code can I
>> > use inside a Local Route so the 200 OK corresponds with a real
>> > connection and not any other kind of 200?
>> > Is this doable?
>> >
>> > ___
>> > 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] Local Route question

2022-10-26 Thread Saint Michael
Thank you for the clarification.
But then how do you intercept the Connect?
Where in the code?
I need to fire a db query when the call connects.
Is this even possible?



On Wed, Oct 26, 2022, 10:51 AM Bogdan-Andrei Iancu 
wrote:

> Hi,
>
> please see
> https://www.opensips.org/Documentation/Script-Routes-3-2#local_route -
> the local route is triggered only for internally generated (UAC)
> requests, so you will never have replies over there.
>
> 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 5:28 AM, Saint Michael wrote:
> > Dear Friends
> > local_route
> > {
> > if (is_method("200"))
> > {
> > }
> > }
> >
> > I need to intercept the code at the moment when a call connects, so I
> > may notify that information to the database. What specific code can I
> > use inside a Local Route so the 200 OK corresponds with a real
> > connection and not any other kind of 200?
> > Is this doable?
> >
> > ___
> > 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] - topology_hiding and no ACK

2022-10-26 Thread Nitesh Divecha
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


Re: [OpenSIPS-Users] Local Route question

2022-10-26 Thread Bogdan-Andrei Iancu

Hi,

please see 
https://www.opensips.org/Documentation/Script-Routes-3-2#local_route - 
the local route is triggered only for internally generated (UAC) 
requests, so you will never have replies over there.


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 5:28 AM, Saint Michael wrote:

Dear Friends
local_route
{
if (is_method("200"))
{
}
}

I need to intercept the code at the moment when a call connects, so I
may notify that information to the database. What specific code can I
use inside a Local Route so the 200 OK corresponds with a real
connection and not any other kind of 200?
Is this doable?

___
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-26 Thread Bogdan-Andrei Iancu

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