[OpenSIPS-Users] special characters on password field

2022-12-13 Thread Andrei G.
Hello,

I'm trying to add a user with password containing % character:

~# opensips-cli -i opensips-1 -f /etc/opensips-cli.cfg -x user password
1...@sip.domain.com '%1234'

ERROR: cannot execute query: UPDATE subscriber SET ha1 =
'1460228c41f725017708f4f684b7edb1', password = '%1234', ha1b =
'580f8f81d95fcec5e7044f9aba97868a' WHERE username = '1234' AND domain = '
sip.domain.com'
ERROR: (_mysql_exceptions.ProgrammingError) not enough arguments for format
string
[SQL: UPDATE subscriber SET ha1 = '1460228c41f725017708f4f684b7edb1',
 password = '%1234', ha1b = '580f8f81d95fcec5e7044f9aba97868a' WHERE
username = '1234' AND domain = ' sip.domain.com']
(Background on this error at: http://sqlalche.me/e/f405)

Please advice

Thanks
Andrei
___
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] 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


[OpenSIPS-Users] mid_registrar multi domains

2022-03-23 Thread 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


Re: [OpenSIPS-Users] registration status using mid_registrar

2022-03-21 Thread Andrei G.
Perfect

Thank you
Andrei

On Mon, Mar 21, 2022 at 8:43 PM Alexey Kazantsev via Users <
users@lists.opensips.org> wrote:

> Hi,
>
> what if to try to use some custom t_on_reply route ?
> Something like this:
>
>
> if (is__method("REGISTER")) {
> xlog("L_INFO", "forwarding REGISTER to main registrar...\n");
> $ru = "sip:10.0.0.3:5070";
> t_on_reply("main_reg_replies");
>
> if (!t_relay()) {
> send_reply(500, "Server Internal Error 1");
> }
>
> …
> }
>
> …
>
> onreply_route[main_reg_replies] {
> xlog("reply status: $rs\n");
> }
>
> ---
> BR, Alexey
> https://alexeyka.zantsev.com/
>
> ___
> 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] registration status using mid_registrar

2022-03-21 Thread Andrei G.
Hi,

I'm trying to implement  Opensips with mid_registrar module in front of
Asterisk
from manual:

if (is_method("REGISTER")) {
mid_registrar_save("location");
switch ($retcode) {
case 1:
xlog("L_INFO", "forwarding REGISTER to main registrar...\n");
$ru = "sip:10.0.0.3:5070";
if (!t_relay()) {
send_reply(500, "Server Internal Error 1");
}

break;
case 2:
xlog("L_INFO", "REGISTER has been absorbed!\n");
break;
default:
xlog("L_ERR", "mid-registrar error!\n");
send_reply(500, "Server Internal Error 2");
}

exit;
}

Is there any way to check the status for REGISTER messages from main
registrar?

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