Re: [OpenSIPS-Users] Remove Route Header!

2023-06-02 Thread morris edery
i put the remove_hf()  below

it will remove from the header   Contact and User-Agent and will rename the
new User-Agent but Route won't remove and still appear on the outgoing
invite message

route[RELAY] {

 remove_hf("Route");
 remove_hf("Contact");
 remove_hf("User-Agent");
 append_hf("User-Agent: New Agent");


if (!t_relay()) {
 sl_reply_error();
}

exit;
}

On Fri, Jun 2, 2023 at 6:13 AM Răzvan Crainea  wrote:

> Hi, Morris!
>
> The code you are trying to run removes the Route header for the outgoing
> message, but the inbound/received INVITE still has the Route header,
> hence loose_route() sees it and denies it.
> Do note that loose_route() itself removes the route, if its preloaded,
> so if you do want to accept preloaded routes, simply don't drop them :)
> (i.e. comment the send_reply(403...))
>
> Best regards,
>
> Răzvan Crainea
> OpenSIPS Core Developer
> http://www.opensips-solutions.com
>
> On 6/1/23 20:06, morris edery wrote:
> > Hello Team,
> > I am trying to remove Route Header (seems like preloaded)
> > remove_hf("Route")  but  it's not being removed.
> >
> > i tried to put it in several places on the code but no success
> >
> >if (is_method("INVITE"))
> >  {
> >if (is_present_hf("Route"))
> >{
> >  xlog("removing Route Header: $(hdr(Route)[0])\n");
> >
> >   remove_hf("Route");
> >  xlog ( "Route Header still present?:
> > $(hdr(Route)[0])\n");
> >}
> >   route(RELAY);
> >  }
> >
> >
> > instead of it goes to
> >
> >
> >  if (loose_route())
> >  {
> >xlog("L_ERR","Attempt to route with preloaded Route's
> > [$fu/$tu/$ru/$ci]")
> >  if (!is_method("ACK")){
> >   send_reply("403","Preload Route denied");
> >  exit;
> >  }
> >  }
> >
> >
> >
> > opensips 2.4.8
> >
> >
> > what i am doing wrong ?
> >
> >
> >
> > ___
> > 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


[OpenSIPS-Users] Dispatcher state exchange in an anycast clusterer

2023-06-02 Thread Denys Pozniak
Hello!

I need advice on how best to implement the anycast + clusterer + dispatcher
scheme.
In short, we want to build an additional upper layer in front of our sip
legacy servers, on which traffic balancing will take place.
Most likely it will look like several nodes of the same clusterer with a
single public anycast address, from which traffic will also go to the
public interfaces of the legacy sip servers (via the dispatcher list).
During testing, it turned out that if we include the dispatcher module in
the clusterer, then the inactive nodes of the cluster begin to affect the
general state of the legacy sip servers on active node, since replays to
SIP OPTIONS reach only one active node, though all nodes ping.

Thus, the sip server status is constantly flapping on active node.
Is it possible to somehow make all other nodes believe the active node at a
given time and inherit its dispatcher state?

*node1:*
modparam("clusterer", "sharing_tag", "anycast1/1=active")
modparam("clusterer", "sharing_tag", "anycast2/1=backup")
modparam("clusterer", "sharing_tag", "anycast3/1=backup")
modparam("clusterer", "sharing_tag", "anycast4/1=backup")

modparam("dispatcher", "cluster_sharing_tag", "anycast1")

modparam("dispatcher", "db_url", "text:///etc/opensips/dbtext")
modparam("dispatcher", "attrs_avp", "$avp(dsp_attrs_avp)")
modparam("dispatcher", "script_attrs_avp", "$avp(dsp_script_attrs_avp)")
modparam("dispatcher", "hash_pvar", "$avp(dsp_hash_pvar)")
modparam("dispatcher", "ds_ping_method", "OPTIONS")
modparam("dispatcher", "ds_ping_from", "sip:ping@dispatcher")
modparam("dispatcher", "ds_ping_interval", 10)
modparam("dispatcher", "ds_probing_threshold", 2)
modparam("dispatcher", "ds_probing_mode", 1)
modparam("dispatcher", "options_reply_codes", "501,403,404,400,200")
modparam("dispatcher", "dst_avp", "$avp(dsp_dst_avp)")
modparam("dispatcher", "grp_avp", "$avp(dsp_grp_avp)")
modparam("dispatcher", "cnt_avp", "$avp(dsp_cnt_avp)")
modparam("dispatcher", "persistent_state", 1)
modparam("dispatcher", "cluster_id", 1)
modparam("dispatcher", "cluster_probing_mode", "by-shtag")

*dispatcher:*
id(int,auto) setid(int) destination(string) socket(string,null) state(int)
probe_mode(int) weight(string) priority(int) attrs(string)
description(string)
0:1:sip\:1.1.1.1\:5060;transport=udp::2:1:1:1:'':''
1:1:sip\:2.2.2.2\:5060;transport=udp::2:1:1:1:'':''
2:1:sip\:3.3.3.3\:5060;transport=udp::2:1:1:1:'':''

Sure, it is possible to attach an additional public address to each node
and do not share dispatcher state, but still I would like to somehow find a
solution for the current scheme

--

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


Re: [OpenSIPS-Users] Registration passthrough

2023-06-02 Thread nutxase via Users
Hi Daniel

Yes i did check

sure i will send you the opensips.cfg off list now(will remove my hosts)

Thanks!!!

Sent with [Proton Mail](https://proton.me/) secure email.

--- Original Message ---
On Friday, June 2nd, 2023 at 1:41 PM, Daniel Zanutti  
wrote:

> Did you check SIP messages inside your opensips box? I saw home routers 
> changing the Contact some time ago.
>
> I could help if you send the whole script, cannot help further without seeing 
> the whole picture.
>
> Regards
>
> On Fri, Jun 2, 2023 at 7:51 AM nutxase  wrote:
>
>> So i now have only
>> if (is_method("REGISTER")) {
>> forward("myasterisk.server.com[:5060](http://node3.sipalto.com:5080)");
>>
>> exit;
>> }
>>
>> but the contact shows as
>>
>> sip:zyq5d7rf@opensips-ip:5060^...so i need it to be
>> sip:extensionnumber@deviceip:5060xxx
>>
>> Sent with [Proton Mail](https://proton.me/) secure email.
>>
>> --- Original Message ---
>> On Thursday, June 1st, 2023 at 9:31 PM, Daniel Zanutti 
>>  wrote:
>>
>>> Check if you are manipulating contact with some function like fix_contact() 
>>> or usage of media proxy solutions like rtpproxy, rtpengine or mediaproxy.
>>>
>>> Opensips doesn't change Contact if you don't tell to do it.
>>>
>>> On Thu, Jun 1, 2023 at 12:57 PM nutxase  wrote:
>>>
 even with a stateless forward asterisk see's this

 Contact: 1000/sip:609q2255@opensipsip:5060 ee32101394 NonQual nan

 but i wanted it to be
 Contact: 1000/sip:609q2255@uacip:5060 ee32101394 NonQual nan

 Sent with [Proton Mail](https://proton.me/) secure email.

 --- Original Message ---
 On Thursday, June 1st, 2023 at 3:00 PM, nutxase via Users 
  wrote:

> Hi Daniel
>
> Thanks for the reply
>
> So it seems asterisk pjsip shows the contact as the ip of opensips not 
> the uac
> i will try with stateless as i just want to forward it via opensips and 
> asterisk to not know opensips
>
> Sent with [Proton Mail](https://proton.me/) secure email.
>
> --- Original Message ---
> On Thursday, June 1st, 2023 at 1:59 PM, Daniel Zanutti 
>  wrote:
>
>> Hi
>>
>> By standard, opensips does not change the Contact and your asterisk box 
>> should receive the original Contact, sent by UAC. Are you sure the 
>> contact is being changed by Opensips? I saw asterisk ignoring the 
>> contact and putting source IP and origin some times. Long time I don't 
>> work with asterisk...
>>
>> Also, you can check the stateless forward, it may be enough for you (not 
>> sure):
>> https://www.opensips.org/Documentation/Script-CoreFunctions-3-1#toc17
>>
>> Suggestion:
>>
>> Monitore SIP trace and confirm if Opensips is changing the contact 
>> (probably not)
>>
>> On Wed, May 31, 2023 at 10:54 AM nutxase via Users 
>>  wrote:
>>
>>> Hey guys
>>>
>>> I have set opensips to take registrations and pass them through to 
>>> asterisk using the below
>>> but my question is how can i make it set the contact to the ip of the 
>>> uac and not the ip of opensips ?
>>>
>>> if (is_method("REGISTER")) {
>>> sethostport("[sip.asterisk.xyz:50](http://node3.sipalto.com:5080)60");
>>> route(toasterisk);}
>>>
>>> route[toasterisk] {
>>> if (!t_relay()) {
>>> xlog("(Rewriting) t_relay 1 - M=$rm RURI=$ru F=$fu T=$tu IP=$si 
>>> ID=$ci\n");
>>> sl_reply_error(); }
>>>
>>> Sent with [Proton Mail](https://proton.me/) 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] Registration passthrough

2023-06-02 Thread Daniel Zanutti
Did you check SIP messages inside your opensips box? I saw home routers
changing the Contact some time ago.

I could help if you send the whole script, cannot help further without
seeing the whole picture.

Regards



On Fri, Jun 2, 2023 at 7:51 AM nutxase  wrote:

> So i now have only
> if (is_method("REGISTER")) {
> forward("myasterisk.server.com:5060 ");
> exit;
> }
>
> but the contact shows as
> sip:zyq5d7rf@opensips-ip:5060^...so i need it to be
> sip:extensionnumber@deviceip:5060xxx
>
>
> Sent with Proton Mail  secure email.
>
> --- Original Message ---
> On Thursday, June 1st, 2023 at 9:31 PM, Daniel Zanutti <
> daniel.zanu...@gmail.com> wrote:
>
> Check if you are manipulating contact with some function like
> fix_contact() or usage of media proxy solutions like rtpproxy, rtpengine or
> mediaproxy.
>
> Opensips doesn't change Contact if you don't tell to do it.
>
> On Thu, Jun 1, 2023 at 12:57 PM nutxase  wrote:
>
>> even with a stateless forward asterisk see's this
>>
>>
>> Contact: 1000/sip:609q2255@opensipsip:5060 ee32101394 NonQual nan
>>
>> but i wanted it to be
>> Contact: 1000/sip:609q2255@uacip:5060 ee32101394 NonQual nan
>>
>> Sent with Proton Mail  secure email.
>>
>> --- Original Message ---
>> On Thursday, June 1st, 2023 at 3:00 PM, nutxase via Users <
>> users@lists.opensips.org> wrote:
>>
>> Hi Daniel
>>
>> Thanks for the reply
>>
>> So it seems asterisk pjsip shows the contact as the ip of opensips not
>> the uac
>> i will try with stateless as i just want to forward it via opensips and
>> asterisk to not know opensips
>>
>>
>> Sent with Proton Mail  secure email.
>>
>> --- Original Message ---
>> On Thursday, June 1st, 2023 at 1:59 PM, Daniel Zanutti <
>> daniel.zanu...@gmail.com> wrote:
>>
>> Hi
>>
>> By standard, opensips does not change the Contact and your asterisk box
>> should receive the original Contact, sent by UAC. Are you sure the contact
>> is being changed by Opensips? I saw asterisk ignoring the contact and
>> putting source IP and origin some times. Long time I don't work with
>> asterisk...
>>
>> Also, you can check the stateless forward, it may be enough for you (not
>> sure):
>> https://www.opensips.org/Documentation/Script-CoreFunctions-3-1#toc17
>>
>> Suggestion:
>>
>> Monitore SIP trace and confirm if Opensips is changing the contact
>> (probably not)
>>
>>
>>
>>
>> On Wed, May 31, 2023 at 10:54 AM nutxase via Users <
>> users@lists.opensips.org> wrote:
>>
>>> Hey guys
>>>
>>> I have set opensips to take registrations and pass them through to
>>> asterisk using the below
>>> but my question is how can i make it set the contact to the ip of the
>>> uac and not the ip of opensips ?
>>>
>>> if (is_method("REGISTER")) {
>>> sethostport("sip.asterisk.xyz:50 60");
>>> route(toasterisk);
>>> }
>>>
>>> route[toasterisk] {
>>> if (!t_relay()) {
>>> xlog("(Rewriting) t_relay 1 - M=$rm RURI=$ru F=$fu T=$tu IP=$si
>>> ID=$ci\n");
>>> sl_reply_error();
>>> }
>>>
>>> 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] Registration passthrough

2023-06-02 Thread nutxase via Users
So i now have only
if (is_method("REGISTER")) {
forward("myasterisk.server.com[:5060](http://node3.sipalto.com:5080)");

exit;
}

but the contact shows as

sip:zyq5d7rf@opensips-ip:5060^...so i need it to be
sip:extensionnumber@deviceip:5060xxx

Sent with [Proton Mail](https://proton.me/) secure email.

--- Original Message ---
On Thursday, June 1st, 2023 at 9:31 PM, Daniel Zanutti 
 wrote:

> Check if you are manipulating contact with some function like fix_contact() 
> or usage of media proxy solutions like rtpproxy, rtpengine or mediaproxy.
>
> Opensips doesn't change Contact if you don't tell to do it.
>
> On Thu, Jun 1, 2023 at 12:57 PM nutxase  wrote:
>
>> even with a stateless forward asterisk see's this
>>
>> Contact: 1000/sip:609q2255@opensipsip:5060 ee32101394 NonQual nan
>>
>> but i wanted it to be
>> Contact: 1000/sip:609q2255@uacip:5060 ee32101394 NonQual nan
>>
>> Sent with [Proton Mail](https://proton.me/) secure email.
>>
>> --- Original Message ---
>> On Thursday, June 1st, 2023 at 3:00 PM, nutxase via Users 
>>  wrote:
>>
>>> Hi Daniel
>>>
>>> Thanks for the reply
>>>
>>> So it seems asterisk pjsip shows the contact as the ip of opensips not the 
>>> uac
>>> i will try with stateless as i just want to forward it via opensips and 
>>> asterisk to not know opensips
>>>
>>> Sent with [Proton Mail](https://proton.me/) secure email.
>>>
>>> --- Original Message ---
>>> On Thursday, June 1st, 2023 at 1:59 PM, Daniel Zanutti 
>>>  wrote:
>>>
 Hi

 By standard, opensips does not change the Contact and your asterisk box 
 should receive the original Contact, sent by UAC. Are you sure the contact 
 is being changed by Opensips? I saw asterisk ignoring the contact and 
 putting source IP and origin some times. Long time I don't work with 
 asterisk...

 Also, you can check the stateless forward, it may be enough for you (not 
 sure):
 https://www.opensips.org/Documentation/Script-CoreFunctions-3-1#toc17

 Suggestion:

 Monitore SIP trace and confirm if Opensips is changing the contact 
 (probably not)

 On Wed, May 31, 2023 at 10:54 AM nutxase via Users 
  wrote:

> Hey guys
>
> I have set opensips to take registrations and pass them through to 
> asterisk using the below
> but my question is how can i make it set the contact to the ip of the uac 
> and not the ip of opensips ?
>
> if (is_method("REGISTER")) {
> sethostport("[sip.asterisk.xyz:50](http://node3.sipalto.com:5080)60");
> route(toasterisk);}
>
> route[toasterisk] {
> if (!t_relay()) {
> xlog("(Rewriting) t_relay 1 - M=$rm RURI=$ru F=$fu T=$tu IP=$si 
> ID=$ci\n");
> sl_reply_error(); }
>
> Sent with [Proton Mail](https://proton.me/) 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] Remove Route Header!

2023-06-02 Thread Răzvan Crainea

Hi, Morris!

The code you are trying to run removes the Route header for the outgoing 
message, but the inbound/received INVITE still has the Route header, 
hence loose_route() sees it and denies it.
Do note that loose_route() itself removes the route, if its preloaded, 
so if you do want to accept preloaded routes, simply don't drop them :) 
(i.e. comment the send_reply(403...))


Best regards,

Răzvan Crainea
OpenSIPS Core Developer
http://www.opensips-solutions.com

On 6/1/23 20:06, morris edery wrote:

Hello Team,
I am trying to remove Route Header (seems like preloaded) 
remove_hf("Route")  but  it's not being removed.


i tried to put it in several places on the code but no success

   if (is_method("INVITE"))
                 {
                   if (is_present_hf("Route"))
                   {
                     xlog("removing Route Header: $(hdr(Route)[0])\n");

                      remove_hf("Route");
                     xlog ( "Route Header still present?: 
$(hdr(Route)[0])\n");

                   }
                  route(RELAY);
                 }


instead of it goes to


     if (loose_route())
                 {
                   xlog("L_ERR","Attempt to route with preloaded Route's 
[$fu/$tu/$ru/$ci]")

                     if (!is_method("ACK")){
                      send_reply("403","Preload Route denied");
                     exit;
                     }
                 }



opensips 2.4.8


what i am doing wrong ?



___
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