Re: [OpenSIPS-Users] strange INVITE transmission

2022-03-28 Thread Daniel Zanutti
Hi Kiwon

You applied at beginning, before loose_route. Not sure it gonna work this
way, i sent you exactly line where to put the code.
Move this:
 if (nat_uac_test(23)) {
if (is_method("REGISTER")) {
fix_nated_register();
setbflag("NAT");
} else {
fix_nated_contact();
setflag("NAT");
}
}

After:
t_check_trans();

Anyway, I suggest you add some log to confirm messages are coming. Put this
line right after main route:
xlog("L_ERR","MESSAGE RECEIVED $rm [$fu/$tu/$ru/$ci/$si]");

There's no big deal on Opensips, everything comes to main route, internal
transaction responses comes from specific routes. (
https://www.opensips.org/Documentation/Script-Routes-3-1)

I have some spare time tomorrow, send me a direct message if you need help.


On Tue, Mar 29, 2022 at 12:43 AM 이기원  wrote:

> Hi Daniel and opensips users goup,
> Thank you for answering my questions.
>
> I missed to inform you about the opensips version I'm trying. It is 3.2.5.
>
> After modifying config, opensips does not respond for the REGISTER
> requests from phones.
> Actually I already tried the following
> https://kb.smartvox.co.uk/opensips/nat-contact-and-via-fixing-in-sip-part-3/
> article but I have the same problem - no response for REGISTERs.
>
> Is there any way to know why opensips ignores or does not respond for
> REGISTERs?
> Please find my new opensips.cfg that Diniel's advice is applied.
>
>
> Thank you
>
> Regards
> Kiwon
>
> 2022년 3월 28일 (월) 오후 10:47, Daniel Zanutti 님이 작성:
>
>> Hi Kiwon
>>
>> You need to handle NAT scenarios. Try putting this code on line 254,
>> right after "t_check_trans()":
>>
>> if (nat_uac_test("7"))
>> {
>>   #nathelper
>>   if(is_method("REGISTER"))
>> fix_nated_register();
>>   else
>> fix_nated_contact();
>>   xlog("L_NOTICE", "Fix contact - M=$rm RURI=$ru F=$fu T=$tu IP=$si
>> ID=$ci\n");
>> }
>>
>> You also need to enable nathelper module. The reason is that you need to
>> use the public IP/Port that sent data to opensips and ignore the Contact.
>>
>>
>> On Mon, Mar 28, 2022 at 5:20 AM 이기원  wrote:
>>
>>> Hi guys, I'm trying to introduce opensips into my company these days.
>>>
>>> I'm testing with many other phones. During the test, I had a very
>>> strange symptom.
>>>
>>> Please, take look at the picture below first. (Please find my screenshot
>>> from the link below)
>>> A. The most left one 14.52.252.236 is a phone (with hardware).
>>> B. 10.0.0.177 is proxy which is woking on cloud and its external IP is
>>> 58.79.209.75
>>> C. 175.223.34.31 is a zoiper softphone which is working on iphone
>>> D. 192.168.10.187 is the private IP address of A - a phone which is
>>> the most left one (14.52.252.236)
>>>
>>>
>>>
>>>
>>> https://drive.google.com/file/d/14zAREWLsluIa1TcU7tZJLSgff-iPqBDA/view?usp=sharing
>>>
>>> As you can see, C is calling A but opensips transmits the INVITE rqeuset
>>> to A's private IP address.
>>> INVITE request should be transmitted A's public IP address - In this
>>> scenario 14.52.252.236 (A)
>>>
>>> I also attach my opensips.cfg. What's wrong with me?
>>>
>>> Thank you
>>>
>>>
>>> Regards
>>> Kiwon
>>> ___
>>> 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] strange INVITE transmission

2022-03-28 Thread 이기원
Hi Daniel and opensips users goup,
Thank you for answering my questions.

I missed to inform you about the opensips version I'm trying. It is 3.2.5.

After modifying config, opensips does not respond for the REGISTER requests
from phones.
Actually I already tried the following
https://kb.smartvox.co.uk/opensips/nat-contact-and-via-fixing-in-sip-part-3/
article but I have the same problem - no response for REGISTERs.

Is there any way to know why opensips ignores or does not respond for
REGISTERs?
Please find my new opensips.cfg that Diniel's advice is applied.


Thank you

Regards
Kiwon

2022년 3월 28일 (월) 오후 10:47, Daniel Zanutti 님이 작성:

> Hi Kiwon
>
> You need to handle NAT scenarios. Try putting this code on line 254, right
> after "t_check_trans()":
>
> if (nat_uac_test("7"))
> {
>   #nathelper
>   if(is_method("REGISTER"))
> fix_nated_register();
>   else
> fix_nated_contact();
>   xlog("L_NOTICE", "Fix contact - M=$rm RURI=$ru F=$fu T=$tu IP=$si
> ID=$ci\n");
> }
>
> You also need to enable nathelper module. The reason is that you need to
> use the public IP/Port that sent data to opensips and ignore the Contact.
>
>
> On Mon, Mar 28, 2022 at 5:20 AM 이기원  wrote:
>
>> Hi guys, I'm trying to introduce opensips into my company these days.
>>
>> I'm testing with many other phones. During the test, I had a very strange
>> symptom.
>>
>> Please, take look at the picture below first. (Please find my screenshot
>> from the link below)
>> A. The most left one 14.52.252.236 is a phone (with hardware).
>> B. 10.0.0.177 is proxy which is woking on cloud and its external IP is
>> 58.79.209.75
>> C. 175.223.34.31 is a zoiper softphone which is working on iphone
>> D. 192.168.10.187 is the private IP address of A - a phone which is
>> the most left one (14.52.252.236)
>>
>>
>>
>>
>> https://drive.google.com/file/d/14zAREWLsluIa1TcU7tZJLSgff-iPqBDA/view?usp=sharing
>>
>> As you can see, C is calling A but opensips transmits the INVITE rqeuset
>> to A's private IP address.
>> INVITE request should be transmitted A's public IP address - In this
>> scenario 14.52.252.236 (A)
>>
>> I also attach my opensips.cfg. What's wrong with me?
>>
>> Thank you
>>
>>
>> Regards
>> Kiwon
>> ___
>> 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.cfg_new
Description: Binary data
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] mid_registrar multi domains

2022-03-28 Thread Andrei G.
Hello,

I'm using the following code in opensips.config

#
# absorb retransmissions, but do not create transaction
t_check_trans();

if (is_method("REGISTER")) {
uac_replace_to(,"sip:user1@asterisk1.local");
uac_replace_from(,"sip:user1@asterisk1.local");
mid_registrar_save("location","m");
  switch ($retcode) {
 case 1:
$ru = "sip:asterisk1.local";
t_on_reply("main_reg_replies");
t_relay();
break;
 case 2:
#xlog("[LOG] absorbing REGISTER! ($$ci=$ci)\n");
break;
 default:
xlog("[LOG] failed to save registration! ($$ci=$ci)\n");
 }
  exit;
}

if ( is_method("INVITE|MESSAGE|CANCEL|BYE|NOTIFY") && ($si !=
"IP_ASTERISK1" || $sp != 5060) ) {
$ru = "sip:" + $tU + "@asterisk1.local";
}
#


*U 2022/03/28 21:52:40.848274 IP_CLIENT:19606 -> IP_OPENSIPS:5060 #1*
REGISTER sip:OPENSIPS SIP/2.0.
Via: SIP/2.0/UDP 192.168.11.1:19606
;received=IP_CLIENT;rport=19606;branch=z9hG4bK-9p6796298349846258764r.
From: ;tag=8g7970426010400195798m.
To: .
Call-ID: 6e6985069689257392584k25377rmwpR.
CSeq: 7319 REGISTER.
Max-Forwards: 70.
Authorization: Digest
username="user1-asterisk",realm="asterisk",nonce="3aa213ca",uri="sip:IP_OPENSIPS:5060",response="89d2d2d37a0a348960a64f9caf40b96a",algorithm=MD5.
Contact: ;expires=0.
Supported: replaces.
Content-Length: 0.


*U 2022/03/28 21:52:40.853495 IP_OPENSIPS:5060 -> IP_ASTERISK1:5060 #2*
REGISTER sip:asterisk1.local:5060 SIP/2.0.
Via: SIP/2.0/UDP IP_OPENSIPS:5060;branch=z9hG4bKd2e8.d0acd904.0.
Via: SIP/2.0/UDP 192.168.11.1:19606
;received=IP_CLIENT;rport=19606;branch=z9hG4bK-9p6796298349846258764r.
From: ;tag=8g7970426010400195798m.
To: .
Call-ID: 6e6985069689257392584k25377rmwpR.
CSeq: 7319 REGISTER.
Max-Forwards: 69.
Authorization: Digest username="user1-asterisk"
,realm="asterisk",nonce="3aa213ca",uri="sip:IP_OPENSIPS:5060",response="89d2d2d37a0a348960a64f9caf40b96a",algorithm=MD5.
Contact: ;expires=0.
Supported: replaces.
Allow:
ACK,PRACK,BYE,CANCEL,INVITE,UPDATE,MESSAGE,INFO,OPTIONS,SUBSCRIBE,NOTIFY,REFER.
Content-Length: 0.

Please help me how to modify  Digest username="user1"

thanks
Andrei

On Mon, Mar 28, 2022 at 10:55 AM Andrei G.  wrote:

> Hi,
>
> How do I modify the field "Authorization: Digest username" in REGISTER
> packet?
>
> tried with uac_replace_to(,"user@asterisk1") and
> uac_replace_from(,"user@asterisk1") but it does affect only to and from
> headers not digest username
>
> thanks
> Andrei
>
>
> On Thu, Mar 24, 2022 at 4:20 AM Artiom Druz  wrote:
>
>> Hello, Andrei.
>> You can do that by taking $tU (user from "To" header) and using some
>> transformation function. In your example can be used s.select function. (
>> https://www.opensips.org/Documentation/Script-Tran-3-2#toc7)
>>
>> Best regards,
>> Artiom Druz
>>
>> ср, 23 мар. 2022 г., 21:11 Andrei G. :
>>
>>> Hey guys,
>>>
>>> I successfully tested opensips with mid_registrar for one domain
>>>
>>> Is it possible to use opensips in front of 2 asterisk boxes and redirect
>>> registrations based on a prefix username, not domain prefix?
>>>
>>> Something like
>>> asterisk1-user@mid-registrar.domain - where opensips manage
>>> registration for user@asterisk1
>>> asterisk2-user@mid-registrar.domain - where opensips manage
>>> registration for user@asterisk2
>>>
>>> Regards
>>> Andrei G.
>>>
>>> ___
>>> 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] strange INVITE transmission

2022-03-28 Thread Daniel Zanutti
Hi Kiwon

You need to handle NAT scenarios. Try putting this code on line 254, right
after "t_check_trans()":

if (nat_uac_test("7"))
{
  #nathelper
  if(is_method("REGISTER"))
fix_nated_register();
  else
fix_nated_contact();
  xlog("L_NOTICE", "Fix contact - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");
}

You also need to enable nathelper module. The reason is that you need to
use the public IP/Port that sent data to opensips and ignore the Contact.


On Mon, Mar 28, 2022 at 5:20 AM 이기원  wrote:

> Hi guys, I'm trying to introduce opensips into my company these days.
>
> I'm testing with many other phones. During the test, I had a very strange
> symptom.
>
> Please, take look at the picture below first. (Please find my screenshot
> from the link below)
> A. The most left one 14.52.252.236 is a phone (with hardware).
> B. 10.0.0.177 is proxy which is woking on cloud and its external IP is
> 58.79.209.75
> C. 175.223.34.31 is a zoiper softphone which is working on iphone
> D. 192.168.10.187 is the private IP address of A - a phone which is
> the most left one (14.52.252.236)
>
>
>
>
> https://drive.google.com/file/d/14zAREWLsluIa1TcU7tZJLSgff-iPqBDA/view?usp=sharing
>
> As you can see, C is calling A but opensips transmits the INVITE rqeuset
> to A's private IP address.
> INVITE request should be transmitted A's public IP address - In this
> scenario 14.52.252.236 (A)
>
> I also attach my opensips.cfg. What's wrong with me?
>
> Thank you
>
>
> Regards
> Kiwon
> ___
> 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] strange INVITE transmission

2022-03-28 Thread 이기원
Hi guys, I'm trying to introduce opensips into my company these days.

I'm testing with many other phones. During the test, I had a very strange
symptom.

Please, take look at the picture below first. (Please find my screenshot
from the link below)
A. The most left one 14.52.252.236 is a phone (with hardware).
B. 10.0.0.177 is proxy which is woking on cloud and its external IP is
58.79.209.75
C. 175.223.34.31 is a zoiper softphone which is working on iphone
D. 192.168.10.187 is the private IP address of A - a phone which is
the most left one (14.52.252.236)



https://drive.google.com/file/d/14zAREWLsluIa1TcU7tZJLSgff-iPqBDA/view?usp=sharing

As you can see, C is calling A but opensips transmits the INVITE rqeuset to
A's private IP address.
INVITE request should be transmitted A's public IP address - In this
scenario 14.52.252.236 (A)

I also attach my opensips.cfg. What's wrong with me?

Thank you


Regards
Kiwon


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


Re: [OpenSIPS-Users] mid_registrar multi domains

2022-03-28 Thread Andrei G.
Hi,

How do I modify the field "Authorization: Digest username" in REGISTER
packet?

tried with uac_replace_to(,"user@asterisk1") and
uac_replace_from(,"user@asterisk1") but it does affect only to and from
headers not digest username

thanks
Andrei


On Thu, Mar 24, 2022 at 4:20 AM Artiom Druz  wrote:

> Hello, Andrei.
> You can do that by taking $tU (user from "To" header) and using some
> transformation function. In your example can be used s.select function. (
> https://www.opensips.org/Documentation/Script-Tran-3-2#toc7)
>
> Best regards,
> Artiom Druz
>
> ср, 23 мар. 2022 г., 21:11 Andrei G. :
>
>> Hey guys,
>>
>> I successfully tested opensips with mid_registrar for one domain
>>
>> Is it possible to use opensips in front of 2 asterisk boxes and redirect
>> registrations based on a prefix username, not domain prefix?
>>
>> Something like
>> asterisk1-user@mid-registrar.domain - where opensips manage registration
>> for user@asterisk1
>> asterisk2-user@mid-registrar.domain - where opensips manage registration
>> for user@asterisk2
>>
>> Regards
>> Andrei G.
>>
>> ___
>> 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