[OpenSIPS-Users] b2b_logic - add/modifiy custom header on script_req_route/script_reply_route

2023-02-15 Thread Eagle Cheung
Hi,

I want to know how to add/modifiy custom header on 
script_req_route/script_reply_route.


cfg file statement
--
loadmodule "b2b_logic.so"
modparam("b2b_logic", "script_req_route", "b2b_request")
modparam("b2b_logic", "script_reply_route", "b2b_reply")
modparam("b2b_logic", "custom_headers", "P-Local-Header")


rotue {
...
if (is_method("INVITE") && !has_totag()) {
b2b_server_new("caller");
b2b_client_new("media", "sip:1234@192.168.216.1");
# !work fine, add header succeed.
append_hf("P-Local-Header: test1\r\n");
b2b_init_request("base");
exit;
}
...

}


route[b2b_request] {
# dosen't work, could not to add.
append_hf("P-Local-Header: test2\r\n");
b2b_pass_request();
}


route[b2b_reply] {
# !!dosen't work, could not to add.
append_hf("P-Local-Header: test2\r\n");
b2b_handle_reply();
}
--
looking forward your reply!
BR
Sam Cheung







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


Re: [OpenSIPS-Users] Version 3.1 it stops writing cdrs

2023-02-15 Thread Kingsley Tart
In addition to Daniel's reply, on Debian (also easily available on
other Linux distros) I use keepalived, which uses VRRP under the hood.

On our OpenSIPS clusters, I use the clusterer module to replicate
dialogs and other things across several nodes, and keepalived to
maintain "floating" (virtual) IP addresses which can move from one node
to another. It's these virtual IP addresses (VIPs) that we advertise as
the addresses for our SIP proxies.

keepalived is configured with several tests, which it polls every
couple of seconds. These tests include things like whether the node is
administratively enabled or disabled (a 0 or 1 in a status file),
whether OpenSIPS is responsive (a script to send a UDP packet to
OpenSIPS and see whether there's a response) and other things.

We have other tests but I don't want to over complicate things here.

If a node becomes less favourable (eg administratively disabled,
OpenSIPS not responding), keepalived moves the VIP to another node.
This, in conjunction with OpenSIPS clustering (the clusterer module)
means that service continues without interruption[1][2]

[1] eg you can mark your node as disabled, wait for the VIP to move to
another node, then restart OpenSIPS

[2] OpenSIPS clustering doesn't replicate early dialogs, so if your VIP
moves whilst there are early dialogs, those calls will be lost when the
VIP moves to another node. I have built some extra stuff to avoid this
problem when we want to restart a node, but I don't want to over
complicate this email.

I strongly recommend you look into keepalived, and if you do this, also
add (this on debian) net.ipv4.ip_nonlocal_bind=1 into sysctl (for IPv4
sockets).

Cheers,
Kingsley.

On Wed, 2023-02-15 at 13:18 -0500, Saint Michael wrote:
> what is VRRP ?
> 
> On Wed, Feb 15, 2023 at 1:16 PM Kingsley Tart 
> wrote:
> > FWIW, I set up OpenSIPS here in a couple of clusters with VRRP
> > managing
> > the service "floating" IP addresses. If I want to restart a node, I
> > mark it as disabled, which then means that
> > 
> > * it stops replying to OPTIONS
> > * it responds 503 to INVITE if other nodes are still up
> > * when all early dialogs have ended, the IP moves to another node
> > 
> > I can then restart OpenSIPS on this node without losing anything.
> > 
> > Cheers,
> > Kingsley.
> > 
> > On Thu, 2023-01-12 at 23:29 -0500, Saint Michael wrote:
> > > Is there a command that I may run without restarting opensips
> > that
> > > restarts the process, internally?
> > > if I restart opensips I lose all the records.
> > 
> > 
> > ___
> > 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] Version 3.1 it stops writing cdrs

2023-02-15 Thread Saint Michael
Amazing, thanks
What I need urgently and cannot figure out, is how to verify a Stir Shaken
token using Bas and openssl
This is a real example:
token="eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiIsInR5cCI6InBhc3Nwb3J0IiwieDV1IjoiaHR0cHM6Ly9hei50YXgvMSJ9.eyJhdHRlc3QiOiJBIiwiZGVzdCI6eyJ0biI6WyIxOTU0NDQ0NzQwOCJdfSwiaWF0IjoxNjc2MjY1NTE0LCJvcmlnIjp7InRuIjoiMTcyNzQ0MzMwMTkifSwib3Jp
Z2lkIjoiMzU4ZDA0OGItZTAwNy0xMWVhLWFjMzctNDctMjA1LTE3Mi04OSJ9.YD9kpeGaKFa6Gh-TIX7mAJWl9W3EpitTCpHxS7UEmddfT0E3DfRvpwEIsGqC8ouKxwmuYGKq1hvgucKqLLYFhA"

echo "${token}" > token.txt
echo "-BEGIN PUBLIC KEY-
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEkCmapE3ygZFy5ZDAjFSGh5rp766W
EZ2+adZvlPeVk5kJzenhDJROfhh7aIKiG/npK8VnYE0WOf2OjyJU6LE9OQ==
-END PUBLIC KEY-" > pk.pem
IFS='.' read -r header payload signature <<< "$token"
echo "${signature}" > signature.bin

#echo -n "$signature"|basenc -d --base64url > signature.bin #ERROR
echo "${header}.${payload}"|openssl dgst -sha256 -binary > payload_hash.bin
openssl pkeyutl -verify -inkey pk.pem -pubin -sigfile signature.bin -in
payload_hash.bin



On Wed, Feb 15, 2023 at 2:14 PM Daniel Zanutti 
wrote:

> Virtual Router Redundancy Protocol (VRRP)
>
>
> https://www.techopedia.com/definition/13483/virtual-router-redundancy-protocol-vrrp
>
>
> On Wed, Feb 15, 2023 at 3:21 PM Saint Michael  wrote:
> >
> > what is VRRP ?
> >
> > On Wed, Feb 15, 2023 at 1:16 PM Kingsley Tart 
> wrote:
> >>
> >> FWIW, I set up OpenSIPS here in a couple of clusters with VRRP managing
> >> the service "floating" IP addresses. If I want to restart a node, I
> >> mark it as disabled, which then means that
> >>
> >> * it stops replying to OPTIONS
> >> * it responds 503 to INVITE if other nodes are still up
> >> * when all early dialogs have ended, the IP moves to another node
> >>
> >> I can then restart OpenSIPS on this node without losing anything.
> >>
> >> Cheers,
> >> Kingsley.
> >>
> >> On Thu, 2023-01-12 at 23:29 -0500, Saint Michael wrote:
> >> > Is there a command that I may run without restarting opensips that
> >> > restarts the process, internally?
> >> > if I restart opensips I lose all the records.
> >>
> >>
> >> ___
> >> 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
>
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Version 3.1 it stops writing cdrs

2023-02-15 Thread Daniel Zanutti
Virtual Router Redundancy Protocol (VRRP)

https://www.techopedia.com/definition/13483/virtual-router-redundancy-protocol-vrrp


On Wed, Feb 15, 2023 at 3:21 PM Saint Michael  wrote:
>
> what is VRRP ?
>
> On Wed, Feb 15, 2023 at 1:16 PM Kingsley Tart 
wrote:
>>
>> FWIW, I set up OpenSIPS here in a couple of clusters with VRRP managing
>> the service "floating" IP addresses. If I want to restart a node, I
>> mark it as disabled, which then means that
>>
>> * it stops replying to OPTIONS
>> * it responds 503 to INVITE if other nodes are still up
>> * when all early dialogs have ended, the IP moves to another node
>>
>> I can then restart OpenSIPS on this node without losing anything.
>>
>> Cheers,
>> Kingsley.
>>
>> On Thu, 2023-01-12 at 23:29 -0500, Saint Michael wrote:
>> > Is there a command that I may run without restarting opensips that
>> > restarts the process, internally?
>> > if I restart opensips I lose all the records.
>>
>>
>> ___
>> 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] trunking connection expires?

2023-02-15 Thread JC Lee

-Original Message-
From: "JC Lee"
To: ;
Cc:
Sent: 2023-02-10 (금) 15:03:42 (GMT+09:00)
Subject: [OpenSIPS-Users] trunking connection expires?

I am using opensips 3.2.10 with trunking service.
First the opensips service starts, it goes well with first 120 second.
And after that, the call is not connected and there is no incoming logs.
'opensips-cli -x mi reg_list' command shows that the same status as when it 
goes well.

I got some logs from trunking service, they sent invite and ack message 
normally but opensips received nothing.

What is the problem?

--
I found some log that seems to be related while uac_registrant

opensips[42303]: DBG:uac_registrant:reg_tm_cback: tm [0x7fd5c68f27b0] 
notification cb for  [200] reply at [1674579393]
opensips[42303]: DBG:uac_registrant:reg_print_record: checking 
uac=[0x7fd5c673d3c8] state=[2][AUTHENTICATING_STATE] expires=[-970240579] 
last_register_sent=[1674579393] registration_timeout=[0] 
auth_user[0x7fd5c673d5dd][11]->[070**] 
auth_password=[0x7fd5c673d5e8][7]->[R2nbWZ5] sock=[0x7fd5c8372140] 
clustering=[/0] enabled=[yes]
opensips[42303]: DBG:uac_registrant:reg_print_record: 
RURI=[0x7fd5c673d5cb][18]->[sip:211.233.***]
opensips[42303]: DBG:uac_registrant:reg_print_record:   
To=[0x7fd5c673d5a8][35]->[sip:070***@211.233.***:5060]
opensips[42303]: DBG:uac_registrant:reg_print_record: 
From=[0x7fd5c673d5a8][35]->[sip:070***@211.233.***:5060] 
tag=[0x7fd5c673d5a3][5]->[3df50]
opensips[42303]: DBG:uac_registrant:reg_print_record:  
Call-Id=[0x7fd5c673d588][27]->[56895a842ce5f806ae37f29dc43]
opensips[42303]: DBG:uac_registrant:reg_print_record:  
Contact=[0x7fd5c673d5ef][30]->[sip:070***@211.233.***] [(nil)][0]->[]
opensips[42303]: DBG:core:parse_headers: flags=
opensips[42303]: DBG:core:parse_params: Parsing params for:[expires=120]

with opensips 3.2, the value of last line is 120 and the trunk connection seems 
to be expired about 120 seconds,
and opensips 2.2, the value of 3600 and it seems to last an hour.

I edited tcp_connection_lifetime and uac_registrant timer inverval and 
registrar default expires, but the log is not changed.

what is the expires value from?



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


Re: [OpenSIPS-Users] Version 3.1 it stops writing cdrs

2023-02-15 Thread Saint Michael
what is VRRP ?

On Wed, Feb 15, 2023 at 1:16 PM Kingsley Tart  wrote:

> FWIW, I set up OpenSIPS here in a couple of clusters with VRRP managing
> the service "floating" IP addresses. If I want to restart a node, I
> mark it as disabled, which then means that
>
> * it stops replying to OPTIONS
> * it responds 503 to INVITE if other nodes are still up
> * when all early dialogs have ended, the IP moves to another node
>
> I can then restart OpenSIPS on this node without losing anything.
>
> Cheers,
> Kingsley.
>
> On Thu, 2023-01-12 at 23:29 -0500, Saint Michael wrote:
> > Is there a command that I may run without restarting opensips that
> > restarts the process, internally?
> > if I restart opensips I lose all the records.
>
>
> ___
> 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] Version table

2023-02-15 Thread Kingsley Tart
Could you set up a federated table on the separate database that maps
to the version table on the DB server that has this table?

Cheers,
Kingsley.

On Tue, 2023-02-14 at 10:14 +, Pat M via Users wrote:
> Hello
> 
> I am using auth_db and querying a seperate mysql database that does
> not have the version table
> is there a way to ignore that table? or can i make a seperate
> connection to a local db just for version?
> 
> Thanks 
> Pat
> 
> Sent with Proton Mail secure email.
> ___
> 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] Version 3.1 it stops writing cdrs

2023-02-15 Thread Kingsley Tart
FWIW, I set up OpenSIPS here in a couple of clusters with VRRP managing
the service "floating" IP addresses. If I want to restart a node, I
mark it as disabled, which then means that

* it stops replying to OPTIONS
* it responds 503 to INVITE if other nodes are still up
* when all early dialogs have ended, the IP moves to another node

I can then restart OpenSIPS on this node without losing anything.

Cheers,
Kingsley.

On Thu, 2023-01-12 at 23:29 -0500, Saint Michael wrote:
> Is there a command that I may run without restarting opensips that
> restarts the process, internally?
> if I restart opensips I lose all the records.


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