[SR-Users] Kamailio delayed reponse in case of database load

2019-12-10 Thread Ali Taher
Hello,

I have Kamailio installed as SIP redirect for an SBC to make routing decisions.

I'm using SQLOps module with postgresql 11.5 where I have multiple tables 
containing each around 6M record of routing codes:
Code   options
392342  sup1|sup2|sup3
Where code field is of prefix_range data type and has a gist index.

I'm sending traffic of 300 CPS to SBC which is forwarding it to Kamailio, and 
Kamailio respond with 300 multiple choice with the routing decision.

In normal cases, everything is going smoothly where Kamailio repsonds up to 50 
ms.

But during the process of loading data to the routing tables, Kamailio response 
to SBC is dramatically delayed , where for some calls it takes up to 7 seconds 
to respond.

Noting that during this process the data are loaded to staging tables and not 
to live tables used by Kamailio.

Kamailio is installed on a VM with 32GB RAM and 16 vcores.

Following configuration is used in Kamailio:
fork=yes
children=10

following are the customized parameters in postgresql.conf
max_connections = 100
shared_buffers = 8GB
effective_cache_size = 24GB
maintenance_work_mem = 2GB
checkpoint_completion_target = 0.7
wal_buffers = 16MB
default_statistics_target = 100
random_page_cost = 1.1
effective_io_concurrency = 200
work_mem = 5242kB
min_wal_size = 1GB
max_wal_size = 2GB
max_worker_processes = 16
max_parallel_workers_per_gather = 8
max_parallel_workers = 16


Following is the routing logic I'm using:

route{

if (is_method("INVITE"))  {
$var(inc) = $(ct{param.value,tgrp});
xlog("L_INFO","CONTACT : $var(inc)" );
xlog("L_INFO","from number : $rU" );
if($var(inc)!=0)
route(customer);
route(block);

}
}

route[customer]
{
sql_query("cb", "select caid from customeridentification where  
trunk='$var(inc)'", "ra");
$var(cid)=$dbr(ra=>[0,0]);
sql_result_free("ra");
xlog("L_INFO","cid: $var(cid) \n");

sql_query("cb", "select routetablename from carrieraccount where  
caid=$var(cid)", "ra");
$var(tid)=$dbr(ra=>[0,0]);
sql_result_free("ra");


if($var(cid)!=0)
route(query);
else
route(block);

}

route[query]
{

#sql_query("cb", "select supplierid from route_$var(cid) where  prefix @>'$rU' 
order by prefix limit 1", "ra");
sql_query("cb", "select get_routing('$var(tid)','$rU')", "ra");
$var(sup)=$dbr(ra=>[0,0]);
sql_result_free("ra");
xlog("L_INFO","supplieris: $var(sup) \n");
#$var(x)=$(var(sup){s.replace,|,}{s.len})/4;

$var(a)=$(var(sup){s.len});
$var(z)=$(var(sup){s.replace,|,});
$var(b)=$(var(z){s.len});
$var(suplen)=$var(a) - $var(b);

if($var(sup)!=0)
route(send);
else
route(block);
}
route[send]
{
xlog("L_INFO","Inside Send \n");
$var(i)=0;
append_to_reply("Contact:");
while($var(i)<$var(suplen) + 1)
{
$var(s)=$(var(sup){s.select,$var(i),|});
$var(s)=$(var(s){s.select,0,;});
append_to_reply("");
if($var(i)<$var(suplen)) append_to_reply(",");
$var(i)=$var(i)+1;
}
append_to_reply("\r\n");
sl_send_reply("300","Multiple Choices");
exit;
}

route[block]
{
xlog("L_INFO","INSIDE BLOCK" );
append_to_reply("Contact:\r\n");
sl_send_reply("300","Multiple Choices");
exit;
}

How can we enhance the Kamailio response in case of load on the postgresql 
server.


Regards,
Ali Taher
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] Kamailio delayed reponse in case of database load

2019-12-10 Thread Ali Taher
Hello,

I have Kamailio installed as SIP redirect for an SBC to make routing decisions.
I'm using SQLOps module with postgresql 11.5 where I have multiple tables 
containing each around 6M record of routing codes:
Code   options
---
392342  sup1|sup2|sup3

Where code field is of prefix_range data type and has a gist index.
I'm sending traffic of 300 CPS to SBC which is forwarding it to Kamailio, and 
Kamailio respond with 300 multiple choice with the routing decision.
In normal cases, everything is going smoothly where Kamailio repsonds up to 50 
ms.
But during the process of loading data to the routing tables, Kamailio response 
to SBC is dramatically delayed , where for some calls it takes up to 7 seconds 
to respond.
Noting that during this process the data are loaded to staging tables and not 
to live tables used by Kamailio.
Kamailio is installed on a VM with 32GB RAM and 16 vcores.
Following configuration is used in Kamailio:
fork=yes
children=10

following are the customized parameters in postgresql.conf
max_connections = 100
shared_buffers = 8GB
effective_cache_size = 24GB
maintenance_work_mem = 2GB
checkpoint_completion_target = 0.7
wal_buffers = 16MB
default_statistics_target = 100
random_page_cost = 1.1
effective_io_concurrency = 200
work_mem = 5242kB
min_wal_size = 1GB
max_wal_size = 2GB
max_worker_processes = 16
max_parallel_workers_per_gather = 8
max_parallel_workers = 16

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Kamailio delayed reponse in case of database load

2019-12-10 Thread Ali Taher
Hello,

It normally takes few milliseconds to execute the query.

The issue is occurring only at specific times where another application is 
inserting data into routing tables (not the live tables used by Kamailio, which 
will be swapped later to the live tables) , where 300 CPS is flowing into 
kamailio.

Regards,
Ali Taher

From: sr-users  On Behalf Of David 
Villasmil
Sent: Tuesday, December 10, 2019 5:04 PM
To: Kamailio (SER) - Users Mailing List 
Subject: Re: [SR-Users] Kamailio delayed reponse in case of database load

Hello,

Have you checked yourself how long PGSQL takes to answer a query from a 
different host?
This really doesn't seem Kamalio-related, but PGSQL-related.

Regards,

David Villasmil
email: david.villasmil.w...@gmail.com<mailto:david.villasmil.w...@gmail.com>
phone: +34669448337


On Tue, Dec 10, 2019 at 12:41 PM Ali Taher 
mailto:ata...@vanrise.com>> wrote:
Hello,

I have Kamailio installed as SIP redirect for an SBC to make routing decisions.
I’m using SQLOps module with postgresql 11.5 where I have multiple tables 
containing each around 6M record of routing codes:
Code   options
---
392342  sup1|sup2|sup3

Where code field is of prefix_range data type and has a gist index.
I’m sending traffic of 300 CPS to SBC which is forwarding it to Kamailio, and 
Kamailio respond with 300 multiple choice with the routing decision.
In normal cases, everything is going smoothly where Kamailio repsonds up to 50 
ms.
But during the process of loading data to the routing tables, Kamailio response 
to SBC is dramatically delayed , where for some calls it takes up to 7 seconds 
to respond.
Noting that during this process the data are loaded to staging tables and not 
to live tables used by Kamailio.
Kamailio is installed on a VM with 32GB RAM and 16 vcores.
Following configuration is used in Kamailio:
fork=yes
children=10

following are the customized parameters in postgresql.conf
max_connections = 100
shared_buffers = 8GB
effective_cache_size = 24GB
maintenance_work_mem = 2GB
checkpoint_completion_target = 0.7
wal_buffers = 16MB
default_statistics_target = 100
random_page_cost = 1.1
effective_io_concurrency = 200
work_mem = 5242kB
min_wal_size = 1GB
max_wal_size = 2GB
max_worker_processes = 16
max_parallel_workers_per_gather = 8
max_parallel_workers = 16

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org<mailto:sr-users@lists.kamailio.org>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Kamailio delayed reponse in case of database load

2019-12-10 Thread Ali Taher
Thanks Alex for the detailed explanation, I will check the provided link.

Meanwhile, i would like to add that the application loading data into the 
postges tables uses 5 parallel processes to do so.

I’m worrying that the delay in response could be due to insufficient workers 
available for kamailio to process more calls.

For that I increased max_parallel_workers to 32, and kamailio children to 22.

I noticed a positive enhancement after this change , but still in some cases I 
have delayed response up to 5 seconds.

Here is a statistics of calls response during the table loading:

Response time Number of calls

  5 secs  2
  ~1 sec157
>500ms  231
>100ms   427
<100ms  110k

I also noticed that the delayed responses occurs mostly at a specific 
second,while during the whole process of table loading , response is 
resonnable. So I’m wondering what could be happening during this specific 
second to make this delay in response, knowing that the data loading rythm is 
same during the whole process.

Regards,
Ali
Sent from my iPhone

On Dec 10, 2019, at 5:53 PM, Alex Balashov 
mailto:abalas...@evaristesys.com>> wrote:

Ali,

If Kamailio is performing a database-bound workload, there's no way to
make it respond faster if the database is being slow. Excluding things
like caching of route responses, how would that be logically possible?
:-)

Since we use PostgreSQL (and prefix_range) very extensively, I can say
that such extreme slow-downs when loading data are abnormal; relational
databases in general, and Postgres's MVCC in particular, are
specifically designed to deal with concurrently servicing intensive read
operations amidst bulk writes. Speculating purely a priori, these delays
are probably caused by very high I/O demand of a slow storage subsystem;
you can attempt to ascertain that by running 'iostat -x 1' while loading
the new data and looking at percentage utilisation on the relevant
storage interface, or with 'iotop' or similar tools.

But if the database responds slowly due to high background I/O load,
you can't make Kamailio render an answer any faster. About the only
thing you can do is to try mitigate the negative effects of this on the
SIP level:

(1) Send a '100 Trying' pre-emptively before initiating the query; this
will dampen the retransmissions that otherwise occur, and whose
proliferation could cause a positive feedback loop and deepen your
problems in a database slow-down scenario;

(2) Do asynchronous processing of the SQL query with t_suspend() /
t_continue() -- though, you should carefully weigh the downsides of this
given the (small) additional overhead of suspending/resuming every
transaction under normal operating conditions.

These approaches will prevent an overall request processing stall, but 
certainly not lower response time.

For more background on this topic, consider a look at my blog post on
the subject from some years ago:

http://www.evaristesys.com/blog/tuning-kamailio-for-high-throughput-and-performance/

Hope that helps!

Cheers,

-- Alex

PS. You may wish to escape the value of '$rU' and not lift it directly
into your SQL queries, e.g.

https://www.kamailio.org/wiki/cookbooks/5.3.x/transformations#sescapecommon

https://www.kamailio.org/wiki/cookbooks/5.3.x/transformations#sqlval

Otherwise, you may be exposing yourself to a possible SQL injection
attack, i.e. if I get creative with what I put in the user part of the
request URI in a way that doesn't jam Kamailio's SIP parser.

—
Sent from mobile, with due apologies for brevity and errors.

On Dec 10, 2019, at 7:04 AM, David Villasmil 
mailto:david.villasmil.w...@gmail.com>> wrote:


Hello,

Have you checked yourself how long PGSQL takes to answer a query from a 
different host?
This really doesn't seem Kamalio-related, but PGSQL-related.

Regards,

David Villasmil
email: david.villasmil.w...@gmail.com<mailto:david.villasmil.w...@gmail.com>
phone: +34669448337


On Tue, Dec 10, 2019 at 12:41 PM Ali Taher 
mailto:ata...@vanrise.com>> wrote:
Hello,

I have Kamailio installed as SIP redirect for an SBC to make routing decisions.
I’m using SQLOps module with postgresql 11.5 where I have multiple tables 
containing each around 6M record of routing codes:
Code   options
---
392342  sup1|sup2|sup3

Where code field is of prefix_range data type and has a gist index.
I’m sending traffic of 300 CPS to SBC which is forwarding it to Kamailio, and 
Kamailio respond with 300 multiple choice with the routing decision.
In normal cases, everything is going smoothly where Kamailio repsonds up to 50 
ms.
But during the process of loading data to the routing tables, Kamailio response 
to SBC is dramatically delayed , where for some calls it takes up to 7 seconds 
to

Re: [SR-Users] Kamailio delayed reponse in case of database load

2019-12-12 Thread Ali Taher
Thanks Alex for drawing my attention regarding escaping $rU before using it in 
sql queries. But I'm not sure where to use sql.val in this case ? Do you mean I 
can use either {s.escape.common} or {sql.val} ?

Regarding the 100 trying , should I put modparam("tm", "auto_inv_100_reason", 
"Trying") in the beginning of if (is_method("INVITE"))   block ?

Regards,
Ali Taher

-Original Message-
From: sr-users  On Behalf Of Alex Balashov
Sent: Tuesday, December 10, 2019 11:21 AM
To: Kamailio (SER) - Users Mailing List 
Subject: Re: [SR-Users] Kamailio delayed reponse in case of database load

Ali,

If Kamailio is performing a database-bound workload, there's no way to make it 
respond faster if the database is being slow. Excluding things like caching of 
route responses, how would that be logically possible?
:-)

Since we use PostgreSQL (and prefix_range) very extensively, I can say that 
such extreme slow-downs when loading data are abnormal; relational databases in 
general, and Postgres's MVCC in particular, are specifically designed to deal 
with concurrently servicing intensive read operations amidst bulk writes. 
Speculating purely a priori, these delays are probably caused by very high I/O 
demand of a slow storage subsystem; you can attempt to ascertain that by 
running 'iostat -x 1' while loading the new data and looking at percentage 
utilisation on the relevant storage interface, or with 'iotop' or similar tools.

But if the database responds slowly due to high background I/O load, you can't 
make Kamailio render an answer any faster. About the only thing you can do is 
to try mitigate the negative effects of this on the SIP level:

(1) Send a '100 Trying' pre-emptively before initiating the query; this will 
dampen the retransmissions that otherwise occur, and whose proliferation could 
cause a positive feedback loop and deepen your problems in a database slow-down 
scenario;

(2) Do asynchronous processing of the SQL query with t_suspend() /
t_continue() -- though, you should carefully weigh the downsides of this given 
the (small) additional overhead of suspending/resuming every transaction under 
normal operating conditions.

For more background on this topic, consider a look at my blog post on the 
subject from some years ago:

http://www.evaristesys.com/blog/tuning-kamailio-for-high-throughput-and-performance/

Hope that helps!

Cheers,

-- Alex

PS. You may wish to escape the value of '$rU' and not lift it directly into 
your SQL queries, e.g. 

https://www.kamailio.org/wiki/cookbooks/5.3.x/transformations#sescapecommon

https://www.kamailio.org/wiki/cookbooks/5.3.x/transformations#sqlval

Otherwise, you may be exposing yourself to a possible SQL injection attack, 
i.e. if I get creative with what I put in the user part of the request URI in a 
way that doesn't jam Kamailio's SIP parser.

--
Alex Balashov | Principal | Evariste Systems LLC

Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Kamailio delayed reponse in case of database load

2019-12-12 Thread Ali Taher
Sorry I meant putting modparam("tm", "auto_inv_100_reason", "Trying") as 
parameter.
As per tm module , auto_inv_100 parameter is by default set as 1 , but still 
Kamailio is not sending it, is there some function that trigger it ?

-Original Message-
From: sr-users  On Behalf Of Ali Taher
Sent: Thursday, December 12, 2019 4:39 PM
To: Kamailio (SER) - Users Mailing List 
Subject: Re: [SR-Users] Kamailio delayed reponse in case of database load

Thanks Alex for drawing my attention regarding escaping $rU before using it in 
sql queries. But I'm not sure where to use sql.val in this case ? Do you mean I 
can use either {s.escape.common} or {sql.val} ?

Regarding the 100 trying , should I put modparam("tm", "auto_inv_100_reason", 
"Trying") in the beginning of if (is_method("INVITE"))   block ?

Regards,
Ali Taher

-Original Message-
From: sr-users  On Behalf Of Alex Balashov
Sent: Tuesday, December 10, 2019 11:21 AM
To: Kamailio (SER) - Users Mailing List 
Subject: Re: [SR-Users] Kamailio delayed reponse in case of database load

Ali,

If Kamailio is performing a database-bound workload, there's no way to make it 
respond faster if the database is being slow. Excluding things like caching of 
route responses, how would that be logically possible?
:-)

Since we use PostgreSQL (and prefix_range) very extensively, I can say that 
such extreme slow-downs when loading data are abnormal; relational databases in 
general, and Postgres's MVCC in particular, are specifically designed to deal 
with concurrently servicing intensive read operations amidst bulk writes. 
Speculating purely a priori, these delays are probably caused by very high I/O 
demand of a slow storage subsystem; you can attempt to ascertain that by 
running 'iostat -x 1' while loading the new data and looking at percentage 
utilisation on the relevant storage interface, or with 'iotop' or similar tools.

But if the database responds slowly due to high background I/O load, you can't 
make Kamailio render an answer any faster. About the only thing you can do is 
to try mitigate the negative effects of this on the SIP level:

(1) Send a '100 Trying' pre-emptively before initiating the query; this will 
dampen the retransmissions that otherwise occur, and whose proliferation could 
cause a positive feedback loop and deepen your problems in a database slow-down 
scenario;

(2) Do asynchronous processing of the SQL query with t_suspend() /
t_continue() -- though, you should carefully weigh the downsides of this given 
the (small) additional overhead of suspending/resuming every transaction under 
normal operating conditions.

For more background on this topic, consider a look at my blog post on the 
subject from some years ago:

http://www.evaristesys.com/blog/tuning-kamailio-for-high-throughput-and-performance/

Hope that helps!

Cheers,

-- Alex

PS. You may wish to escape the value of '$rU' and not lift it directly into 
your SQL queries, e.g. 

https://www.kamailio.org/wiki/cookbooks/5.3.x/transformations#sescapecommon

https://www.kamailio.org/wiki/cookbooks/5.3.x/transformations#sqlval

Otherwise, you may be exposing yourself to a possible SQL injection attack, 
i.e. if I get creative with what I put in the user part of the request URI in a 
way that doesn't jam Kamailio's SIP parser.

--
Alex Balashov | Principal | Evariste Systems LLC

Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] get first occurrence value of a param in a string

2020-01-28 Thread Ali Taher
Hello,

I need to get the value of first tgrp param in this string :
$var(x) = 


I'm trying $var(y) = $(var(x){param.value,tgrp});  but it's getting the last 
value of tgrp which is "237>".

Noting that first tgrp is not always in the second index , some other 
parameters can be added to the string.

How to get the value of first occurrence of  tgrp param ?

Regards,
Ali Taher
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] SIP Redirect CANCEL handling

2020-01-28 Thread Ali Taher
Hello,

I'm using Kamailio as sip redirect server where SBC forwards the calls to 
Kamailio which sends the routing back to SBC in 3xx response.

Now, I need to handle CANCEL requests sent from SBC to Kamailio. Here is the 
scenario:
the client sends CANCEL request to SBC which responds with 200 OK and 487 
Request Terminated and then sends CANCEL request to Kamailio.
I'm not sure how Kamailio should handle the CANCEL request here, should it send 
only 200 OK back to SBC or also should send 487 request terminated?

Regards,
Ali Taher
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] SIP Redirect CANCEL handling

2020-01-28 Thread Ali Taher
Hello Alex,

Kamailio sent 300 multiple choice back to SBC even after the SBC sent the 
CANCEL request , knowing that SBC sent the CANCEL 4 times as Kamailio didn’t 
respond to it , which is normal as in the routing logic I’m only handling 
INVITE packets (if (is_method("INVITE"))).
So I’m confused whether I have to handle it or not.

Regards,
Ali Taher

From: sr-users  On Behalf Of Alex Balashov
Sent: Tuesday, January 28, 2020 3:37 PM
To: Kamailio (SER) - Users Mailing List 
Subject: Re: [SR-Users] SIP Redirect CANCEL handling

Unless you have created a transaction in the course of processing the redirect, 
there is no transaction to terminate, and accordingly no 487 to generate. 
However, these decisions are made by the default CANCEL handling (with hooks 
into TM) from the stock Kamailio config. You should not need any special logic 
of your own here.

—
Sent from my iPad


On Jan 28, 2020, at 8:29 AM, Ali Taher 
mailto:ata...@vanrise.com>> wrote:

Hello,

I’m using Kamailio as sip redirect server where SBC forwards the calls to 
Kamailio which sends the routing back to SBC in 3xx response.

Now, I need to handle CANCEL requests sent from SBC to Kamailio. Here is the 
scenario:
the client sends CANCEL request to SBC which responds with 200 OK and 487 
Request Terminated and then sends CANCEL request to Kamailio.
I’m not sure how Kamailio should handle the CANCEL request here, should it send 
only 200 OK back to SBC or also should send 487 request terminated?

Regards,
Ali Taher
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org<mailto:sr-users@lists.kamailio.org>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] SIP Redirect CANCEL handling

2020-01-28 Thread Ali Taher
Hello Alex,

You mean handle the cancel from Kamailio side ? can you give me hint how to do 
it ?

Regards,
Ali Taher

From: sr-users  On Behalf Of Alex Balashov
Sent: Tuesday, January 28, 2020 4:07 PM
To: Kamailio (SER) - Users Mailing List 
Subject: Re: [SR-Users] SIP Redirect CANCEL handling

You should handle the cancel.
—
Sent from mobile, with due apologies for brevity and errors.


On Jan 28, 2020, at 8:45 AM, Ali Taher 
mailto:ata...@vanrise.com>> wrote:

Hello Alex,

Kamailio sent 300 multiple choice back to SBC even after the SBC sent the 
CANCEL request , knowing that SBC sent the CANCEL 4 times as Kamailio didn’t 
respond to it , which is normal as in the routing logic I’m only handling 
INVITE packets (if (is_method("INVITE"))).
So I’m confused whether I have to handle it or not.

Regards,
Ali Taher

From: sr-users 
mailto:sr-users-boun...@lists.kamailio.org>>
 On Behalf Of Alex Balashov
Sent: Tuesday, January 28, 2020 3:37 PM
To: Kamailio (SER) - Users Mailing List 
mailto:sr-users@lists.kamailio.org>>
Subject: Re: [SR-Users] SIP Redirect CANCEL handling

Unless you have created a transaction in the course of processing the redirect, 
there is no transaction to terminate, and accordingly no 487 to generate. 
However, these decisions are made by the default CANCEL handling (with hooks 
into TM) from the stock Kamailio config. You should not need any special logic 
of your own here.

—
Sent from my iPad



On Jan 28, 2020, at 8:29 AM, Ali Taher 
mailto:ata...@vanrise.com>> wrote:

Hello,

I’m using Kamailio as sip redirect server where SBC forwards the calls to 
Kamailio which sends the routing back to SBC in 3xx response.

Now, I need to handle CANCEL requests sent from SBC to Kamailio. Here is the 
scenario:
the client sends CANCEL request to SBC which responds with 200 OK and 487 
Request Terminated and then sends CANCEL request to Kamailio.
I’m not sure how Kamailio should handle the CANCEL request here, should it send 
only 200 OK back to SBC or also should send 487 request terminated?

Regards,
Ali Taher
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org<mailto:sr-users@lists.kamailio.org>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org<mailto:sr-users@lists.kamailio.org>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] sqlops multiple databases

2020-02-03 Thread Ali Taher
Hello,

Is there a way in sqlops module to use multiple postgres databases based on 
routing logic ?

Here is what I'm using right now:
modparam("sqlops","sqlcon","cb=>postgres://postgres:postgres@localhost:5432/db1")

Thanks
Ali Taher
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] change module parameter in routing logic

2020-04-28 Thread Ali Taher
Hi,

Is it possible to change a module parameter inside the routing logic ?

For example I want to change sqlcon parameter of sqlops module based on the 
originating IP.

Regards,
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] change module parameter in routing logic

2020-04-28 Thread Ali Taher
Hi Alex,

I just realized that I can set sqlcon multiple times which will solve my 
problem.

The scenario I’m trying to achieve is that based on the originating IP of the 
invite packet I will run some queries on the correspondent database  and then 
use the result in Kamailio routing logic.

Should I be worried about using same sqlres (ra) while fetching the result from 
the database?

Regards,
Ali Taher

From: sr-users  On Behalf Of Alex Balashov
Sent: Tuesday, April 28, 2020 1:30 PM
To: Kamailio (SER) - Users Mailing List 
Subject: Re: [SR-Users] change module parameter in routing logic

It is not.
—
Sent from mobile, with due apologies for brevity and errors.


On Apr 28, 2020, at 6:26 AM, Ali Taher 
mailto:ata...@vanrise.com>> wrote:

Hi,

Is it possible to change a module parameter inside the routing logic ?

For example I want to change sqlcon parameter of sqlops module based on the 
originating IP.

Regards,
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org<mailto:sr-users@lists.kamailio.org>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] change module parameter in routing logic

2020-04-28 Thread Ali Taher
Hi Alex,

What do you mean by multiple SQL results concurrently? 
I will have multiple calls coming at the same time which need to go to one of 
the databases based on the originating IP.

-Original Message-
From: sr-users  On Behalf Of Alex Balashov
Sent: Tuesday, April 28, 2020 4:01 PM
To: Kamailio (SER) - Users Mailing List 
Subject: Re: [SR-Users] change module parameter in routing logic

On Tue, Apr 28, 2020 at 12:57:16PM +, Ali Taher wrote:

> Should I be worried about using same sqlres (ra) while fetching the 
> result from the database?

No, as long you sql_result_free() it between operations. If you need multiple 
SQL results concurrently, you should use different result set identifiers.

-- Alex

--
Alex Balashov | Principal | Evariste Systems LLC

Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] worker processes

2020-09-01 Thread Ali Taher
Hi,

I just want to ask regarding the children number and listening interfaces set 
in Kamailio configuration.

I am given to understand that the total number of worker processes there will 
be (children_setting * listeners) , so assuming I have set children=12 and 
listen=udp:172.16.1.12:5060 (which is the interface IP where the SIP packets as 
received), in this case there will be 12 worker processes and 12 database 
connections to postgresql (I'm using SQLOPS).
My question is if I set listen=udp:0.0.0.0:5060 , knowing that I have 3 
interfaces, in this case the number of worker processes will be 36. Is this 
good configuration ? will the other 24 processes be used or they are reserved 
to the 2 other interfaces which are not receiving any SIP packets and then will 
be useless ?

Regards,
Ali Taher
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] worker processes

2020-09-01 Thread Ali Taher
Thanks for your answer.

Please note that I have set 3 connection strings in SQLOPS module for 3 
Postgres databases. How many connections per database does Kamailio open? 
(knowing that children=12 and only one listening interface).

Regards,
Ali Taher

From: Daniel-Constantin Mierla 
Sent: Tuesday, September 1, 2020 1:18 PM
To: Kamailio (SER) - Users Mailing List ; Ali 
Taher 
Subject: Re: [SR-Users] worker processes


Hello,

note that other processes are created by kamailio, not only sip worker 
processes. For example, there will be timer processes.

The dedicated worker processes are only for UDP sockets, not for tcp/tls (here 
is a single pool of workers for all tcp/tls sockets). If you do not receive 
traffic on a specific udp socket, then do not listen to it, you have a group of 
processes not doing anything. If you need to listen on a socket, but have less 
traffic (e.g., used for monitoring), then use workers parameter before listen, 
so you get less worker processes for that udp socket.

Cheers,
Daniel
On 01.09.20 12:03, Ali Taher wrote:
Hi,

I just want to ask regarding the children number and listening interfaces set 
in Kamailio configuration.

I am given to understand that the total number of worker processes there will 
be (children_setting * listeners) , so assuming I have set children=12 and 
listen=udp:172.16.1.12:5060 (which is the interface IP where the SIP packets as 
received), in this case there will be 12 worker processes and 12 database 
connections to postgresql (I'm using SQLOPS).
My question is if I set listen=udp:0.0.0.0:5060 , knowing that I have 3 
interfaces, in this case the number of worker processes will be 36. Is this 
good configuration ? will the other 24 processes be used or they are reserved 
to the 2 other interfaces which are not receiving any SIP packets and then will 
be useless ?

Regards,
Ali Taher



___

Kamailio (SER) - Users Mailing List

sr-users@lists.kamailio.org<mailto:sr-users@lists.kamailio.org>

https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

--

Daniel-Constantin Mierla -- www.asipto.com<http://www.asipto.com>

www.twitter.com/miconda<http://www.twitter.com/miconda> -- 
www.linkedin.com/in/miconda<http://www.linkedin.com/in/miconda>

Funding: https://www.paypal.me/dcmierla
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] worker processes

2020-09-01 Thread Ali Taher
Hi Daniel,

I meant that I'm defining 3 connection strings using sqlcon parameter of sqlops 
module as shown below:

modparam("sqlops","sqlcon","cb=>postgres://postgres:kamailio@localhost:5432/cataleya")
modparam("sqlops","sqlcon","mi=>postgres://postgres:kamailio@localhost:5432/cataleya_mitto")
modparam("sqlops","sqlcon","sp=>postgres://postgres:kamailio@localhost:5432/cataleya_spactron")

regards,
Ali Taher

From: Daniel-Constantin Mierla 
Sent: Tuesday, September 1, 2020 1:52 PM
To: Ali Taher ; Kamailio (SER) - Users Mailing List 

Subject: Re: [SR-Users] worker processes


hello,

what do you mean by "3 connection strings"? Maybe you can give similar example 
here.

Cheers,
Daniel
On 01.09.20 12:33, Ali Taher wrote:
Thanks for your answer.

Please note that I have set 3 connection strings in SQLOPS module for 3 
Postgres databases. How many connections per database does Kamailio open? 
(knowing that children=12 and only one listening interface).

Regards,
Ali Taher

From: Daniel-Constantin Mierla <mailto:mico...@gmail.com>
Sent: Tuesday, September 1, 2020 1:18 PM
To: Kamailio (SER) - Users Mailing List 
<mailto:sr-users@lists.kamailio.org>; Ali Taher 
<mailto:ata...@vanrise.com>
Subject: Re: [SR-Users] worker processes


Hello,

note that other processes are created by kamailio, not only sip worker 
processes. For example, there will be timer processes.

The dedicated worker processes are only for UDP sockets, not for tcp/tls (here 
is a single pool of workers for all tcp/tls sockets). If you do not receive 
traffic on a specific udp socket, then do not listen to it, you have a group of 
processes not doing anything. If you need to listen on a socket, but have less 
traffic (e.g., used for monitoring), then use workers parameter before listen, 
so you get less worker processes for that udp socket.

Cheers,
Daniel
On 01.09.20 12:03, Ali Taher wrote:
Hi,

I just want to ask regarding the children number and listening interfaces set 
in Kamailio configuration.

I am given to understand that the total number of worker processes there will 
be (children_setting * listeners) , so assuming I have set children=12 and 
listen=udp:172.16.1.12:5060 (which is the interface IP where the SIP packets as 
received), in this case there will be 12 worker processes and 12 database 
connections to postgresql (I'm using SQLOPS).
My question is if I set listen=udp:0.0.0.0:5060 , knowing that I have 3 
interfaces, in this case the number of worker processes will be 36. Is this 
good configuration ? will the other 24 processes be used or they are reserved 
to the 2 other interfaces which are not receiving any SIP packets and then will 
be useless ?

Regards,
Ali Taher




___

Kamailio (SER) - Users Mailing List

sr-users@lists.kamailio.org<mailto:sr-users@lists.kamailio.org>

https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

--

Daniel-Constantin Mierla -- www.asipto.com<http://www.asipto.com>

www.twitter.com/miconda<http://www.twitter.com/miconda> -- 
www.linkedin.com/in/miconda<http://www.linkedin.com/in/miconda>

Funding: https://www.paypal.me/dcmierla

--

Daniel-Constantin Mierla -- www.asipto.com<http://www.asipto.com>

www.twitter.com/miconda<http://www.twitter.com/miconda> -- 
www.linkedin.com/in/miconda<http://www.linkedin.com/in/miconda>

Funding: https://www.paypal.me/dcmierla
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] worker processes

2020-09-01 Thread Ali Taher
Hi Daniel,

So in my case :

  *   Server vcpus = 24
  *   Max_worker_processes in postgres  = 24
  *   Max_parallel_workers  in postgres = 24
  *   Children in Kamailio config = 12
  *   1 udp listener

I noticed that there is 48 database connections established by Kamailio (16 x 
3) , can this cause an issue knowing that maximum worker processes is 24 ?

Regards,
Ali Taher

From: Daniel-Constantin Mierla 
Sent: Tuesday, September 1, 2020 6:48 PM
To: Ali Taher ; Kamailio (SER) - Users Mailing List 

Subject: Re: [SR-Users] worker processes


Hello,

in this case there are 3 distinct connections per process, so you have to 
multiply the number of processes by 3 to get the overall number of connections. 
You can run 'kamctl ps' to see all the processes of a kamailio instance.

Actually a few kamailio processes may not open database connections, a matter 
of their purpose if they are created by specific modules, but for a rough upper 
limit, this is the formula.

Cheers,
Daniel
On 01.09.20 16:25, Ali Taher wrote:
Hi Daniel,

I meant that I'm defining 3 connection strings using sqlcon parameter of sqlops 
module as shown below:

modparam("sqlops","sqlcon","cb=>postgres://postgres:kamailio@localhost:5432/cataleya")
modparam("sqlops","sqlcon","mi=>postgres://postgres:kamailio@localhost:5432/cataleya_mitto")
modparam("sqlops","sqlcon","sp=>postgres://postgres:kamailio@localhost:5432/cataleya_spactron")

regards,
Ali Taher

From: Daniel-Constantin Mierla <mailto:mico...@gmail.com>
Sent: Tuesday, September 1, 2020 1:52 PM
To: Ali Taher <mailto:ata...@vanrise.com>; Kamailio (SER) - 
Users Mailing List 
<mailto:sr-users@lists.kamailio.org>
Subject: Re: [SR-Users] worker processes


hello,

what do you mean by "3 connection strings"? Maybe you can give similar example 
here.

Cheers,
Daniel
On 01.09.20 12:33, Ali Taher wrote:
Thanks for your answer.

Please note that I have set 3 connection strings in SQLOPS module for 3 
Postgres databases. How many connections per database does Kamailio open? 
(knowing that children=12 and only one listening interface).

Regards,
Ali Taher

From: Daniel-Constantin Mierla <mailto:mico...@gmail.com>
Sent: Tuesday, September 1, 2020 1:18 PM
To: Kamailio (SER) - Users Mailing List 
<mailto:sr-users@lists.kamailio.org>; Ali Taher 
<mailto:ata...@vanrise.com>
Subject: Re: [SR-Users] worker processes


Hello,

note that other processes are created by kamailio, not only sip worker 
processes. For example, there will be timer processes.

The dedicated worker processes are only for UDP sockets, not for tcp/tls (here 
is a single pool of workers for all tcp/tls sockets). If you do not receive 
traffic on a specific udp socket, then do not listen to it, you have a group of 
processes not doing anything. If you need to listen on a socket, but have less 
traffic (e.g., used for monitoring), then use workers parameter before listen, 
so you get less worker processes for that udp socket.

Cheers,
Daniel
On 01.09.20 12:03, Ali Taher wrote:
Hi,

I just want to ask regarding the children number and listening interfaces set 
in Kamailio configuration.

I am given to understand that the total number of worker processes there will 
be (children_setting * listeners) , so assuming I have set children=12 and 
listen=udp:172.16.1.12:5060 (which is the interface IP where the SIP packets as 
received), in this case there will be 12 worker processes and 12 database 
connections to postgresql (I'm using SQLOPS).
My question is if I set listen=udp:0.0.0.0:5060 , knowing that I have 3 
interfaces, in this case the number of worker processes will be 36. Is this 
good configuration ? will the other 24 processes be used or they are reserved 
to the 2 other interfaces which are not receiving any SIP packets and then will 
be useless ?

Regards,
Ali Taher





___

Kamailio (SER) - Users Mailing List

sr-users@lists.kamailio.org<mailto:sr-users@lists.kamailio.org>

https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

--

Daniel-Constantin Mierla -- www.asipto.com<http://www.asipto.com>

www.twitter.com/miconda<http://www.twitter.com/miconda> -- 
www.linkedin.com/in/miconda<http://www.linkedin.com/in/miconda>

Funding: https://www.paypal.me/dcmierla

--

Daniel-Constantin Mierla -- www.asipto.com<http://www.asipto.com>

www.twitter.com/miconda<http://www.twitter.com/miconda> -- 
www.linkedin.com/in/miconda<http://www.linkedin.com/in/miconda>

Funding: https://www.paypal.me/dcmierla

--

Daniel-Constantin Mierla -- www.asipto.com<http://www.asipto.com>

www.twitter.com/miconda<http://www.twitter.com/miconda> -- 
www.linkedin.com/in/miconda<http://www.linkedin.com/in/miconda>

Funding: https://www.paypal.me/dcmierla
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] worker processes

2020-09-01 Thread Ali Taher
Hi Alex,

That is clear. I decreased the max worker processes to 20 to be on the safe 
side. But what is confusing me is what about the 18 worker processes ran by 
Kamailio, will they overlap with postgres processes or they are the same , 
knowing that Kamailio role in my case is just getting routing decision by 
running a query on the database and send it back to the SBC. Excuse my lack of 
knowledge in how linux processes work.

Regards,
Ali Taher

-Original Message-
From: sr-users  On Behalf Of Alex Balashov
Sent: Tuesday, September 1, 2020 8:22 PM
To: sr-users@lists.kamailio.org
Subject: Re: [SR-Users] worker processes

On 2020-09-01 12:08, Ali Taher wrote:

> I noticed that there is 48 database connections established by 
> Kamailio
> (16 x 3) , can this cause an issue knowing that maximum worker 
> processes is 24 ?
Postgres's ability to serve clients and accommodate queries isn't limited by 
the number of max_worker_processes. The default is 8 if this value is unset, 
yet any stock PostgreSQL instance can accommodate more than 8 concurrent 
connections, clearly. max_worker_processes != max_connections.

As far as the wisdom of setting process limits to equal the number of available 
CPU cores ("VCPUs"), there's no absolute answer to that. The general danger 
with doing this is just that a particularly expensive or destructive statement 
can consume all of the hardware resources, with no safety margins for other 
processes, and perhaps not even enough for someone to log in and resolve the 
problem. So, the general recommendation is not allow PostgreSQL to consume 
every single VCPU or max out any other resource, and that's why most Linux 
distributions' 
server packages come with these types of settings conservatively tuned.

-- Alex

--
Alex Balashov | Principal | Evariste Systems LLC

Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] voltdb support

2020-12-14 Thread Ali Taher
Hello,

I just need to know if kamailio can communicate with Voltdb for sqlops 
operations for example.

Regards,
Ali Taher
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] voltdb support

2020-12-14 Thread Ali Taher
Hi Alex,

Thanks for your answer. How to proceed to let Kamailio talk manually to VoltDB ?

Regards,
Ali Taher

From: sr-users  On Behalf Of Alex Balashov
Sent: Monday, December 14, 2020 6:38 PM
To: Kamailio (SER) - Users Mailing List 
Subject: Re: [SR-Users] voltdb support

Is VoltDB’s wire protocol binary-compatible with Postgres, MySQL, Oracle, or 
anything reachable via UnixODBC?

From what I understand, no. So, you can’t use SQL-native modules to talk to it.

You can, of course, get Kamailio to talk to it “manually” for select purposes.
—
Sent from mobile, with due apologies for brevity and errors.


On Dec 14, 2020, at 11:28 AM, Ali Taher 
mailto:ata...@vanrise.com>> wrote:

Hello,

I just need to know if kamailio can communicate with Voltdb for sqlops 
operations for example.

Regards,
Ali Taher
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org<mailto:sr-users@lists.kamailio.org>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] voltdb support

2020-12-14 Thread Ali Taher
What I need is to fetch routing from VoltDB and send it back to switch using 
3xx response. So I think the API solution is the best approach here. 
Thanks for all this useful info.

-Original Message-
From: sr-users  On Behalf Of Alex Balashov
Sent: Monday, December 14, 2020 10:16 PM
To: sr-users@lists.kamailio.org
Subject: Re: [SR-Users] voltdb support

You'd have to devise some sort of API or use something that Kamailio can talk 
to, unless you're inclined to write a custom module that uses a library[1].

Otherwise, the usual integration paths are available, e.g.

1) You could put a REST API server in front of VoltDB and use:

https://kamailio.org/docs/modules/5.4.x/modules/http_async_client.html

https://kamailio.org/docs/modules/5.4.x/modules/http_client.html

2) Or, you could write a server of some kind which mediates these requests 
using EVAPI:

https://kamailio.org/docs/modules/5.4.x/modules/evapi.html

3) Or, you could write a minimal SIP redirect service using a library such as 
PJSUA/PJSIP, or JAIN,

https://www.oracle.com/technical-resources/articles/enterprise-architecture/introduction-jain-sip-part1.html

which would allow Kamailio to consume 3xx redirects as a transport for 
information queries. That is a common pattern for external routing services, 
for example.

It's also worth keeping in mind that even if you invent such a shim, you're not 
going to be able to use VoltDB to provide database backing for Kamailio's 
database-backed modules (e.g. htable, usrloc, dispatcher, carrierroute, etc). 
If your aim is to make VoltDB work transparently with those modules, then this 
isn't a viable project.

What you can do is query an API for some limited purposes. For example, you 
could get authentication credentials from VoltDB and store them in 
pseudovariables so as to feed them into functions which can use them, such as:

https://kamailio.org/docs/modules/5.4.x/modules/auth.html#auth.f.pv_auth_check

But most Kamailio modules which extensively utilise a relational database don't 
expose capabilities like that. That would, after all, contradict the basic 
purpose for which a lot of them exist, which is to transparently manage 
database interactions for you while providing terse and easy-to-use syntactical 
sugar.

So, it depends on what exactly you want to do. If it's something very specific, 
like getting routes or authentication credentials, you could potentially use an 
unsupported database if you devise a means of communicating with it indirectly, 
using a generic channel that Kamailio does support.

But if you're asking if Kamailio supports VoltDB in a rather general sense, the 
answer is no.

-- Alex

[1] https://docs.voltdb.com/UsingVoltDB/ChapAppDesign.php

On 12/14/20 2:57 PM, Ali Taher wrote:
> Hi Alex,
> 
> Thanks for your answer. How to proceed to let Kamailio talk manually 
> to VoltDB ?
> 
> Regards,
> 
> Ali Taher


--
Alex Balashov | Principal | Evariste Systems LLC

Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] voltdb support

2020-12-14 Thread Ali Taher
What do you recommend using : http sync or async client modules?

-Original Message-
From: sr-users  On Behalf Of Alex Balashov
Sent: Monday, December 14, 2020 10:31 PM
To: sr-users@lists.kamailio.org
Subject: Re: [SR-Users] voltdb support

On 12/14/20 3:28 PM, Ali Taher wrote:

> What I need is to fetch routing from VoltDB and send it back to switch 
> using 3xx response. So I think the API solution is the best approach 
> here. Thanks for all this useful info. >

If Kamailio is sending the 3xx response, then it sounds like using the HTTP 
modules to interact with VoltDB's JSON interface might be the best way to go.

You'll have to account for the latency inherent in such queries and make sure 
you have a sufficient number of worker processes to handle the load, whether 
you use the async or synchronous HTTP modules. For more information on that 
topic, you can read an old blog post of mine:

http://www.evaristesys.com/blog/tuning-kamailio-for-high-throughput-and-performance/

-- Alex

--
Alex Balashov | Principal | Evariste Systems LLC

Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] Kamailio bypassing RTP media

2019-05-03 Thread Ali Taher
Hi everyone,

I'm new to kamailio. I plan to setup a sip server cluster, Does
someone can give me some suggestions if I can use kamailio as front server,
which handle sip message and bypass rtp media
message to backendserver, this mean the kamailio handle only sip message,
the rtp packets are sent directed to backend server.

The sip sequences is
   1.softswitch send invite to kamailio
   2.kamailio send invite to backend server.
   3.backend server return 200 ok to kamailio
   4.kamailio return 200 ok to softswitch, the ip and port in sip is from
the backend server's msg, this make the softswitch send rtp direct to
backend server.
   5.rtp packets are transfered between softswitch and backend server.
   
   6.backend server send bye to kamailio
   7.kamailio send bye to softswitch.

Any help is appreciated.

Regards,
Ali Taher
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Kamailio bypassing RTP media

2019-05-03 Thread Ali Taher
Hi Alex,

What do I have to put in routing logic in this case ?

Regards,
Ali Taher

From: sr-users  On Behalf Of Alex Balashov
Sent: Friday, May 3, 2019 5:45 PM
To: Kamailio (SER) - Users Mailing List 
Subject: Re: [SR-Users] Kamailio bypassing RTP media

Yes, this is possible. In fact, this is Kamailio’s default behaviour, since it 
is inherently a SIP proxy. It would not touch the SDP unless you asked it to.
—
Sent from mobile, with due apologies for brevity and errors.

On May 3, 2019, at 4:39 PM, Ali Taher 
mailto:ata...@vanrise.com>> wrote:
Hi everyone,

I'm new to kamailio. I plan to setup a sip server cluster, Does
someone can give me some suggestions if I can use kamailio as front server,
which handle sip message and bypass rtp media
message to backendserver, this mean the kamailio handle only sip message,
the rtp packets are sent directed to backend server.

The sip sequences is
   1.softswitch send invite to kamailio
   2.kamailio send invite to backend server.
   3.backend server return 200 ok to kamailio
   4.kamailio return 200 ok to softswitch, the ip and port in sip is from
the backend server's msg, this make the softswitch send rtp direct to
backend server.
   5.rtp packets are transfered between softswitch and backend server.
   
   6.backend server send bye to kamailio
   7.kamailio send bye to softswitch.

Any help is appreciated.

Regards,
Ali Taher
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org<mailto:sr-users@lists.kamailio.org>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] Kamailio not responding in heavy load

2022-08-17 Thread Ali Taher
Hello all,

I'm using sqlops module to connect to postgres and get the routing of calls 
from postgresql database.

In order to troubleshoot issues in case they happened, I added each call 
details to Kamailio log.

In some cases, when there is heavy traffic load (around 100 cps), I don't find 
some calls in Kamailio log, knowing that I can find them on the switch log 
(switch sending the invite packets to Kamailio).

When checking the traces on these calls taken by the switch, it's clear that 
Kamailio is not responding to the invite packets sent by the switch. It could 
be because there are no available process to handle the call at this moment (I 
have set fork=14)

Is it possible to check if there are calls pending in the queue?

Regards,
__
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] packets exceeding MTU size

2022-08-18 Thread Ali Taher
Hello all,

Lately I faced an issue that Kamailio is not responding to some invite packets 
coming from SBC. When investigating I found that these packets exceeds MTU size.
Could this be the issue? Knowing that in Kamailio configuration I have a 
condition on is_method("INVITE"). Could be that in case of packet exceeding MTU 
size it's not considered as invite packet by Kamailio?

I have Kamailio 5.2.5.

Regards,
Ali Taher


__
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] Randomize calling number

2023-07-06 Thread Ali Taher
Hello,

What is the best way to change the calling number to a random number (based on 
specific pattern, like number of digits for example) in an invite packet 
without using a database.

So the scenario is :

  *   receive an invite packet from certain source
  *   change the calling number
  *   send back the invite packet including the new calling number to the 
original source.

Regards,
Ali Taher
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: Randomize calling number

2023-07-06 Thread Ali Taher
Hi Henning,

I used the uac_replace_from() function to replace the fU, but the value is 
still the same when i printed it using xlog.

I also dont know how to send the invite back to the switch. What function to 
use?

Thanks,

Sent from my iPhone

On Jul 6, 2023, at 5:31 PM, Henning Westerholt  wrote:


Hello,

Not 100% sure if I understood your question correctly.

There are probably many ways. One option is to use the $RANDOM pseudo-variable 
that can generate (pseudo-)random numbers. You can get it to the pattern you 
like with some script operations in the cfg.

Just rewrite the request URI user of the INVITE in Kamailio to the new 
generated number and send it out again.

Cheers,

Henning

--
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.com<https://gilawa.com/>

From: Ali Taher 
Sent: Donnerstag, 6. Juli 2023 15:15
To: sr-users@lists.kamailio.org
Subject: [SR-Users] Randomize calling number

Hello,

What is the best way to change the calling number to a random number (based on 
specific pattern, like number of digits for example) in an invite packet 
without using a database.

So the scenario is :

  *   receive an invite packet from certain source
  *   change the calling number
  *   send back the invite packet including the new calling number to the 
original source.

Regards,
Ali Taher
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: Randomize calling number

2023-07-06 Thread Ali Taher
Thanks Alex,

Yes I'm aware of that, this is just for testing purposes.

Regards,

-Original Message-
From: Alex Balashov  
Sent: Thursday, July 6, 2023 6:37 PM
To: Kamailio (SER) - Users Mailing List 
Subject: [SR-Users] Re: Randomize calling number

You can just modify the domain portion of the RURI, i.e. by manipulating $rd. 
For example, $rd = "some.ip"; Then, t_relay().

However, beware that sending the call back to the same gateway from which it 
came is likely to cause call loops. Proxies don't create new call legs, they 
are just part of the same logical call leg; call leg "A" comes in, and call leg 
"A" goes back out, with the same Call-ID, CSeq, etc. If you send the INVITE 
back to the same gateway that originated the request, it will likely reject it 
since it is literally the same request it itself created.

-- Alex

> On Jul 6, 2023, at 11:02 AM, Ali Taher  wrote:
> 
> Hi Henning,
> 
> I used the uac_replace_from() function to replace the fU, but the value is 
> still the same when i printed it using xlog.
> 
> I also dont know how to send the invite back to the switch. What function to 
> use?
> 
> Thanks,
> 
> Sent from my iPhone
> 
>> On Jul 6, 2023, at 5:31 PM, Henning Westerholt  wrote:
>> 
>> Hello,
>>  Not 100% sure if I understood your question correctly.
>>  There are probably many ways. One option is to use the $RANDOM 
>> pseudo-variable that can generate (pseudo-)random numbers. You can get it to 
>> the pattern you like with some script operations in the cfg.
>>  Just rewrite the request URI user of the INVITE in Kamailio to the new 
>> generated number and send it out again.
>>  Cheers,
>>  Henning
>>  -- Henning Westerholt – https://skalatan.de/blog/ Kamailio services 
>> – https://gilawa.com
>>  From: Ali Taher 
>> Sent: Donnerstag, 6. Juli 2023 15:15
>> To: sr-users@lists.kamailio.org
>> Subject: [SR-Users] Randomize calling number  Hello,  What is the 
>> best way to change the calling number to a random number (based on specific 
>> pattern, like number of digits for example) in an invite packet without 
>> using a database.
>>  So the scenario is :
>> • receive an invite packet from certain source
>> • change the calling number
>> • send back the invite packet including the new calling number to the 
>> original source.
>>  Regards,
>> Ali Taher
> 
> __
> Kamailio - Users Mailing List - Non Commercial Discussions To 
> unsubscribe send an email to sr-users-le...@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the 
> sender!
> Edit mailing list options or unsubscribe:


--
Alex Balashov
Principal Consultant
Evariste Systems LLC
Web: https://evaristesys.com
Tel: +1-706-510-6800

__
Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send 
an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: Randomize calling number

2023-07-06 Thread Ali Taher
Hi Henning,

Is there a way to change From URI user part without touching the domain ? As I 
can see in uac_replace_from there is an option to either change the display 
part or the whole URI part.

Regards,


From: Henning Westerholt 
Sent: Thursday, July 6, 2023 6:42 PM
To: Kamailio (SER) - Users Mailing List 
Cc: Ali Taher 
Subject: RE: Randomize calling number

Hello,

ah, you want to change the From URI user. Yes, uac_replace_from is a common 
approach for that.

This function will change the From URI when you send out the message, you will 
not see it with a xlog in the cfg.
https://www.kamailio.org/wikidocs/tutorials/faq/main/#why-changes-made-to-headers-or-body-are-not-visible-immediately

Regarding sending out the SIP message, a common approach is to use rewrite the 
request URI to the new destination and then use “t_relay” to send it.

Cheers,

Henning

--
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.com<https://gilawa.com/>

From: Ali Taher mailto:ata...@vanrise.com>>
Sent: Donnerstag, 6. Juli 2023 17:02
To: Henning Westerholt mailto:h...@gilawa.com>>
Cc: Kamailio (SER) - Users Mailing List 
mailto:sr-users@lists.kamailio.org>>
Subject: Re: Randomize calling number

Hi Henning,

I used the uac_replace_from() function to replace the fU, but the value is 
still the same when i printed it using xlog.

I also dont know how to send the invite back to the switch. What function to 
use?

Thanks,

Sent from my iPhone

On Jul 6, 2023, at 5:31 PM, Henning Westerholt 
mailto:h...@gilawa.com>> wrote:

Hello,

Not 100% sure if I understood your question correctly.

There are probably many ways. One option is to use the $RANDOM pseudo-variable 
that can generate (pseudo-)random numbers. You can get it to the pattern you 
like with some script operations in the cfg.

Just rewrite the request URI user of the INVITE in Kamailio to the new 
generated number and send it out again.

Cheers,

Henning

--
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.com<https://gilawa.com/>

From: Ali Taher mailto:ata...@vanrise.com>>
Sent: Donnerstag, 6. Juli 2023 15:15
To: sr-users@lists.kamailio.org<mailto:sr-users@lists.kamailio.org>
Subject: [SR-Users] Randomize calling number

Hello,

What is the best way to change the calling number to a random number (based on 
specific pattern, like number of digits for example) in an invite packet 
without using a database.

So the scenario is :

  1.  receive an invite packet from certain source
  2.  change the calling number
  3.  send back the invite packet including the new calling number to the 
original source.

Regards,
Ali Taher
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Random number

2023-07-07 Thread Ali Taher
Hello,

As per Kamailio documentation, $RANDOM returns a random value from the [0 - 
2^31) range. But when testing it it's always returning a random number of 9 or 
10 digits.
I'm not sure if it's always the case or if it can also returns numbers with 1 
or 2 digits as well.

Another question, how can I force it to return a number of specific digits 
starting with certain prefix.

Regards,
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] 180 and 183 SIP messages

2018-03-29 Thread Ali Taher
Hello everyone,

 

I'm working on freeswitch , where I have SIP calls coming from A-Party to my
freeswitch and I'm routing it to B-Party.

 

I'm facing an issue , when I'm getting back the 183 message from the
supplier(B-Party) and forwarding it to the customer(A-Party); the customer
is not hearing the RBT and asking to send 180 rather than 183 . (the
supplier is only sending 183 without 180).

 

Is it possible using kamailio to replace this 183 message with 180 message ,
or even add 180 message while keeping the same 183 message ?

 

Regards,

Ali Taher

 

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] 180 and 183 SIP messages

2018-03-29 Thread Ali Taher
Hi Arsen,

 

I know that such thing can be done through freeswitch , but I need to do it 
using Kamailio for specific reason.

 

Regards,

Ali Taher

 

From: sr-users [mailto:sr-users-boun...@lists.kamailio.org] On Behalf Of Arsen
Sent: Thursday, March 29, 2018 6:49 PM
To: Kamailio (SER) - Users Mailing List 
Subject: Re: [SR-Users] 180 and 183 SIP messages

 

Hi,

 

It should be possible with freeswitch as well, google for freeswitch cause code 
substitution and you will see example.

 

 

Regards,

 




 

Arsen Semionov

www.eurolan.info <http://www.eurolan.info> 

cell: +442035198881

 

On Thu, Mar 29, 2018 at 6:44 PM, Ali Taher mailto:ata...@vanrise.com> > wrote:

Hello everyone,

 

I’m working on freeswitch , where I have SIP calls coming from A-Party to my 
freeswitch and I’m routing it to B-Party.

 

I’m facing an issue , when I’m getting back the 183 message from the 
supplier(B-Party) and forwarding it to the customer(A-Party); the customer is 
not hearing the RBT and asking to send 180 rather than 183 . (the supplier is 
only sending 183 without 180).

 

Is it possible using kamailio to replace this 183 message with 180 message , or 
even add 180 message while keeping the same 183 message ?

 

Regards,

Ali Taher

 


___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org <mailto:sr-users@lists.kamailio.org> 
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

 

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] 180 and 183 SIP messages

2018-03-30 Thread Ali Taher
Thank you Alex for your response.

So if I want to add a header to the INVITE packet , and also  detect if the 
message is 183 and then change it to 180 then forward it back , does is do the 
job :

route{
if (is_method("INVITE"))
{   
append_hf("Test: this is a test");
}
forward(127.0.0.1,5060);
}
reply_route {
if (status == "183") {
change_reply_status(180, "Ringing");
    exit;
}
}

Regards,
Ali Taher
-Original Message-
From: sr-users [mailto:sr-users-boun...@lists.kamailio.org] On Behalf Of Alex 
Balashov
Sent: Thursday, March 29, 2018 9:02 PM
To: Kamailio (SER) - Users Mailing List 
Subject: Re: [SR-Users] 180 and 183 SIP messages

You can absolutely do it:

https://kamailio.org/docs/modules/5.1.x/modules/textopsx.html#textopsx.f.change_reply_status

You can even remove the embedded SDP if desired, using the various textops 
functions:

https://kamailio.org/docs/modules/5.1.x/modules/textops.html

Whether you _should_ do this just because you _can_, on the other hand, is a 
question I would consider very carefully.

On Thu, Mar 29, 2018 at 06:56:52PM +0300, Ali Taher wrote:

> Hi Arsen,
> 
>  
> 
> I know that such thing can be done through freeswitch , but I need to do it 
> using Kamailio for specific reason.
> 
>  
> 
> Regards,
> 
> Ali Taher
> 
>  
> 
> From: sr-users [mailto:sr-users-boun...@lists.kamailio.org] On Behalf 
> Of Arsen
> Sent: Thursday, March 29, 2018 6:49 PM
> To: Kamailio (SER) - Users Mailing List 
> Subject: Re: [SR-Users] 180 and 183 SIP messages
> 
>  
> 
> Hi,
> 
>  
> 
> It should be possible with freeswitch as well, google for freeswitch cause 
> code substitution and you will see example.
> 
>  
> 
>  
> 
> Regards,
> 
>  
> 
> 
> 
> 
>  
> 
> Arsen Semionov
> 
> www.eurolan.info <http://www.eurolan.info>
> 
> cell: +442035198881
> 
>  
> 
> On Thu, Mar 29, 2018 at 6:44 PM, Ali Taher  <mailto:ata...@vanrise.com> > wrote:
> 
> Hello everyone,
> 
>  
> 
> I’m working on freeswitch , where I have SIP calls coming from A-Party to my 
> freeswitch and I’m routing it to B-Party.
> 
>  
> 
> I’m facing an issue , when I’m getting back the 183 message from the 
> supplier(B-Party) and forwarding it to the customer(A-Party); the customer is 
> not hearing the RBT and asking to send 180 rather than 183 . (the supplier is 
> only sending 183 without 180).
> 
>  
> 
> Is it possible using kamailio to replace this 183 message with 180 message , 
> or even add 180 message while keeping the same 183 message ?
> 
>  
> 
> Regards,
> 
> Ali Taher
> 
>  
> 
> 
> ___
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org <mailto:sr-users@lists.kamailio.org>
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> 
>  
> 

> ___
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


--
Alex Balashov | Principal | Evariste Systems LLC

Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] 180 and 183 SIP messages

2018-03-30 Thread Ali Taher
Hello,

As I understand now , append_hf function must be called from either 
REQUEST_ROUTE, ONREPLY_ROUTE, FAILURE_ROUTE or BRANCH_ROUTE.

I'm not sure if this what I need in my case , where I want to insert a new 
header to the INVITE packet then forward it .

Any help would be appreciated.

Regards,
Ali Taher

-Original Message-
From: Ali Taher [mailto:ata...@vanrise.com] 
Sent: Friday, March 30, 2018 10:02 AM
To: 'Kamailio (SER) - Users Mailing List' 
Cc: 'Ali Taher~Vanrise Technical Support' 
Subject: RE: [SR-Users] 180 and 183 SIP messages

Thank you Alex for your response.

So if I want to add a header to the INVITE packet , and also  detect if the 
message is 183 and then change it to 180 then forward it back , does is do the 
job :

route{
if (is_method("INVITE"))
{   
append_hf("Test: this is a test");
}
forward(127.0.0.1,5060);
}
reply_route {
if (status == "183") {
change_reply_status(180, "Ringing");
exit;
}
}

Regards,
Ali Taher
-Original Message-
From: sr-users [mailto:sr-users-boun...@lists.kamailio.org] On Behalf Of Alex 
Balashov
Sent: Thursday, March 29, 2018 9:02 PM
To: Kamailio (SER) - Users Mailing List 
Subject: Re: [SR-Users] 180 and 183 SIP messages

You can absolutely do it:

https://kamailio.org/docs/modules/5.1.x/modules/textopsx.html#textopsx.f.change_reply_status

You can even remove the embedded SDP if desired, using the various textops 
functions:

https://kamailio.org/docs/modules/5.1.x/modules/textops.html

Whether you _should_ do this just because you _can_, on the other hand, is a 
question I would consider very carefully.

On Thu, Mar 29, 2018 at 06:56:52PM +0300, Ali Taher wrote:

> Hi Arsen,
> 
>  
> 
> I know that such thing can be done through freeswitch , but I need to do it 
> using Kamailio for specific reason.
> 
>  
> 
> Regards,
> 
> Ali Taher
> 
>  
> 
> From: sr-users [mailto:sr-users-boun...@lists.kamailio.org] On Behalf 
> Of Arsen
> Sent: Thursday, March 29, 2018 6:49 PM
> To: Kamailio (SER) - Users Mailing List 
> Subject: Re: [SR-Users] 180 and 183 SIP messages
> 
>  
> 
> Hi,
> 
>  
> 
> It should be possible with freeswitch as well, google for freeswitch cause 
> code substitution and you will see example.
> 
>  
> 
>  
> 
> Regards,
> 
>  
> 
> 
> 
> 
>  
> 
> Arsen Semionov
> 
> www.eurolan.info <http://www.eurolan.info>
> 
> cell: +442035198881
> 
>  
> 
> On Thu, Mar 29, 2018 at 6:44 PM, Ali Taher  <mailto:ata...@vanrise.com> > wrote:
> 
> Hello everyone,
> 
>  
> 
> I’m working on freeswitch , where I have SIP calls coming from A-Party to my 
> freeswitch and I’m routing it to B-Party.
> 
>  
> 
> I’m facing an issue , when I’m getting back the 183 message from the 
> supplier(B-Party) and forwarding it to the customer(A-Party); the customer is 
> not hearing the RBT and asking to send 180 rather than 183 . (the supplier is 
> only sending 183 without 180).
> 
>  
> 
> Is it possible using kamailio to replace this 183 message with 180 message , 
> or even add 180 message while keeping the same 183 message ?
> 
>  
> 
> Regards,
> 
> Ali Taher
> 
>  
> 
> 
> ___
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org <mailto:sr-users@lists.kamailio.org>
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> 
>  
> 

> ___
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


--
Alex Balashov | Principal | Evariste Systems LLC

Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] SIP re-invite Packets

2018-07-17 Thread Ali Taher
Hello,

 

I'm using below routing logic to change the 183 reply to 180 and send it
back to the origination.

 

Noting that Kamailio is listening on 5065.

route{

if (is_method("INVITE")) {

xlog("L_INFO","INSIDE request route $si \n");

  insert_hf("X-AUTH-IP: $si\r\n");

}

route(FWD);

}

 

reply_route {

#xlog("L_INFO","INSDE reply \n");

if (status == "183") {

change_reply_status(180, "Ringing");

exit;

}

}

 

route[FWD] {

#xlog("L_INFO","INSIDE FWD \n");

forward(x.x.x.x,5060);

}

 

 

Below is the scenario , where the customer is sending packets to Kamailio ,
and Kamailio is forwarding them the supplier (with IP x.x.x.x) , then the
supplier reply back to kamailio  and kamailio relay the reply to the
customer 

 

Customer --> Kamailio ---> ---Supplier---

 

I have a case where the supplier sends in some cases an in-dialog invite
(Re-Invite) , which is considered I think as SIP-Request and thus as per
above routing logic , kamailio is sending it back to the supplier , yet I
need to send it to the customer.

 

How can I solve this issue?

 

Thanks

Ali Taher

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] SIP re-invite Packets

2018-07-17 Thread Ali Taher
Hi Alex,

So loose_route() is only responsible of In-dialog requests ?

Can you please send me a simplified config that suit my case ?

Noting that I'm using Kamailio only as proxy between my customer and my 
supplier.

Much appreciated.

Ali Taher

-Original Message-
From: sr-users  On Behalf Of Alex Balashov
Sent: Tuesday, July 17, 2018 3:44 PM
To: Kamailio (SER) - Users Mailing List 
Cc: sr-us...@lists.sip-router.org
Subject: Re: [SR-Users] SIP re-invite Packets

Hi,

In-dialog requests must be handled using loose_route(). You can find the proper 
boilerplate in the stock configuration file:

https://github.com/kamailio/kamailio/blob/master/etc/kamailio.cfg#L587

To note, your config is not sufficient to handle all aspects of a call between 
endpoints in an adequate way. You will want to consider the main request_route 
in the main config file and adapt its most essential aspects accordingly:

https://github.com/kamailio/kamailio/blob/master/etc/kamailio.cfg#L455

-- Alex

On Tue, Jul 17, 2018 at 03:40:58PM +0300, Ali Taher wrote:

> Hello,
> 
>  
> 
> I'm using below routing logic to change the 183 reply to 180 and send 
> it back to the origination.
> 
>  
> 
> Noting that Kamailio is listening on 5065.
> 
> route{
> 
> if (is_method("INVITE")) {
> 
> xlog("L_INFO","INSIDE request route $si \n");
> 
>   insert_hf("X-AUTH-IP: $si\r\n");
> 
> }
> 
> route(FWD);
> 
> }
> 
>  
> 
> reply_route {
> 
> #xlog("L_INFO","INSDE reply \n");
> 
> if (status == "183") {
> 
> change_reply_status(180, "Ringing");
> 
> exit;
> 
> }
> 
> }
> 
>  
> 
> route[FWD] {
> 
> #xlog("L_INFO","INSIDE FWD \n");
> 
> forward(x.x.x.x,5060);
> 
> }
> 
>  
> 
>  
> 
> Below is the scenario , where the customer is sending packets to 
> Kamailio , and Kamailio is forwarding them the supplier (with IP 
> x.x.x.x) , then the supplier reply back to kamailio  and kamailio 
> relay the reply to the customer
> 
>  
> 
> Customer --> Kamailio ---> ---Supplier---
> 
>  
> 
> I have a case where the supplier sends in some cases an in-dialog 
> invite
> (Re-Invite) , which is considered I think as SIP-Request and thus as 
> per above routing logic , kamailio is sending it back to the supplier 
> , yet I need to send it to the customer.
> 
>  
> 
> How can I solve this issue?
> 
>  
> 
> Thanks
> 
> Ali Taher
> 

> ___
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


--
Alex Balashov | Principal | Evariste Systems LLC

Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] SIP re-invite Packets

2018-07-17 Thread Ali Taher
Hi Alex,

Thank you for your reply.

Does below config  forward all sip requests coming from the customer to the 
supplier , and relay sip replies back to customer ?

Where re-invite packets are handled in the below config file?

Thank you 
Ali Taher

-Original Message-
From: sr-users  On Behalf Of Alex Balashov
Sent: Tuesday, July 17, 2018 4:25 PM
To: Kamailio (SER) - Users Mailing List 
Cc: sr-us...@lists.sip-router.org
Subject: Re: [SR-Users] SIP re-invite Packets

On Tue, Jul 17, 2018 at 04:21:25PM +0300, Ali Taher wrote:

> Can you please send me a simplified config that suit my case ?

Try this for a main request route:

---

route {
if(!mf_process_maxfwd_header("10")) {
sl_send_reply("483", "Too Many Hops");
exit;
}

# Maybe some sanity_check() here. 

if(has_totag()) {
if(loose_route()) {
if(!t_relay())
sl_reply_error();

exit;
} else {
if(is_method("ACK")) {
if(t_check_trans())
t_relay();
} else
sl_send_reply("403", "Forbidden");
}

exit;
}

# CANCELs / branches.

if(is_method("CANCEL")) {
if(!t_relay_cancel()) {
sl_send_reply("500", "Server Internal Error");
exit;
}

exit;
}

t_check_trans();

if(is_method("OPTIONS")) {
sl_send_reply("200", "OK");
exit;
} 

else if(is_method("INVITE")) {
# Route your calls.

exit;
}

sl_send_reply("403", "Method unsupported");
exit;
}


-- 
Alex Balashov | Principal | Evariste Systems LLC

Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) 
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] SIP re-invite Packets

2018-07-18 Thread Ali Taher
Thank you for your reply.

 

I tried the config file shared by Alex below , but I noticed that kamailio is 
not dealing with CANCEL requests.

 

the scenario in my case is that I’m using Kamailio behind a switch to alter 
some packets (precisely 183 packets) , so I need to forward all packets coming 
from my customer to the switch , which will deal with it (send it to 
appropriate supplier).

 

So what I need is the config file that will forward all requests coming to 
Kamailio from my customer , to forward them to my switch , then reply back to 
customer the reply coming from the switch. 9after altering 183 packet to 180) , 
handling the in-dialog invites sent by my switch , which needs to be sent to 
the customer by kamailio.

 

Thanks

Ali Taher

 

From: sr-users  On Behalf Of 
y...@yu-boot.ru
Sent: Tuesday, July 17, 2018 9:41 PM
To: Kamailio (SER) - Users Mailing List 
Cc: sr-us...@lists.sip-router.org
Subject: Re: [SR-Users] SIP re-invite Packets

 

ReInvites like all in-dialog requests are processed in has_totag()/loose_route 
part. Default kamailio.cfg has almost identical part for this purpose.

Main idea is that an initial request (non in-dialog) hasn't To tag already. It 
appears only when your request "hits" remote side (called or callee, as you 
wish) and goes back to you. Simplified, but I hope you got an idea :)

--
sent from myMail for Android

вторник, 17 июля 2018г., 17:16 +03:00 от Ali Taher ata...@vanrise.com 
<mailto:ata...@vanrise.com> :




Hi Alex,

Thank you for your reply.

Does below config forward all sip requests coming from the customer to the 
supplier , and relay sip replies back to customer ?

Where re-invite packets are handled in the below config file?

Thank you 
Ali Taher

-Original Message-
From: sr-users mailto:sr-users-boun...@lists.kamailio.org> > On Behalf Of Alex Balashov
Sent: Tuesday, July 17, 2018 4:25 PM
To: Kamailio (SER) - Users Mailing List mailto:sr-users@lists.kamailio.org> >
Cc: sr-us...@lists.sip-router.org <mailto:sr-us...@lists.sip-router.org> 
Subject: Re: [SR-Users] SIP re-invite Packets

On Tue, Jul 17, 2018 at 04:21:25PM +0300, Ali Taher wrote:

> Can you please send me a simplified config that suit my case ?

Try this for a main request route:

---

route {
if(!mf_process_maxfwd_header("10")) {
sl_send_reply("483", "Too Many Hops");
exit;
}

# Maybe some sanity_check() here. 

if(has_totag()) {
if(loose_route()) {
if(!t_relay())
sl_reply_error();

exit;
} else {
if(is_method("ACK")) {
if(t_check_trans())
t_relay();
} else
sl_send_reply("403", "Forbidden");
}

exit;
}

# CANCELs / branches.

if(is_method("CANCEL")) {
if(!t_relay_cancel()) {
sl_send_reply("500", "Server Internal Error");
exit;
}

exit;
}

t_check_trans();

if(is_method("OPTIONS")) {
sl_send_reply("200", "OK");
exit;
} 

else if(is_method("INVITE")) {
# Route your calls.

exit;
}

sl_send_reply("403", "Method unsupported");
exit;
}


-- 
Alex Balashov | Principal | Evariste Systems LLC

Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) 
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org <mailto:sr-users@lists.kamailio.org> 
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org <mailto:sr-users@lists.kamailio.org> 
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] in-dialog requests

2018-07-18 Thread Ali Taher
Hello,

 

I'm using Kamailio as a proxy behind freeswitch to alter some packets (183
packets precisely).

 

Here is my scenario:

 

(---Customer---) --> ((port 5065)---Kamailio---) -->
((port5060)---Freeswitch---) --> (---Supplier---)

 

Here is my request route :

 

route{

 

if (is_method("INVITE")) {

xlog("L_INFO","INSIDE request route $si \n");

  insert_hf("X-AUTH-IP: $si\r\n");

}

 

route(FWD);

}

 

 

reply_route {

#xlog("L_INFO","INSDE reply \n");

if (status == "183") {

change_reply_status(180, "Ringing");

exit;

}

}

 

route[FWD] {

#xlog("L_INFO","INSIDE FWD \n");

forward(X.X.X.X,5060);

}

Where X.X.X.X is the Freeswitch IP

 

This script is working normally as long as the customer is sending the
requests(INVITE,BYE,ACK,CANCEL..) . But when the supplier or freeswitch
initiated the request , above script causes loop where the packet is bounced
between kamailio and freeswitch.

 

As I know , loose_route is used to handle such requests , but I'm not sure
how to forward these packets to the customer after receiving them from
freeswitch.

 

I'm not sure also if what's I'm doing is statefull or stateless.

 

Any help is appreciated.

 

Thanks,

Ali Taher

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] in-dialog requests

2018-07-18 Thread Ali Taher
Hi Alex,

Yes I did, but I noticed that all in-dialog requests sent by freeswitch to 
kamailio were ignored and no packet was generated from kamailio in this regard.

I'm not sure if t_relay is working as expected at my side.

Thanks.
Ali Taher

-Original Message-
From: sr-users  On Behalf Of Alex Balashov
Sent: Wednesday, July 18, 2018 4:34 PM
To: Kamailio (SER) - Users Mailing List 
Subject: Re: [SR-Users] in-dialog requests

Have you tried the config I suggested to you yesterday?

On July 18, 2018 9:32:01 AM EDT, Ali Taher  wrote:
>Hello,
>
> 
>
>I'm using Kamailio as a proxy behind freeswitch to alter some packets
>(183
>packets precisely).
>
> 
>
>Here is my scenario:
>
> 
>
>(---Customer---) --> ((port 5065)---Kamailio---) -->
>((port5060)---Freeswitch---) --> (---Supplier---)
>
> 
>
>Here is my request route :
>
> 
>
>route{
>
> 
>
>if (is_method("INVITE")) {
>
>xlog("L_INFO","INSIDE request route $si \n");
>
>  insert_hf("X-AUTH-IP: $si\r\n");
>
>}
>
> 
>
>route(FWD);
>
>}
>
> 
>
> 
>
>reply_route {
>
>#xlog("L_INFO","INSDE reply \n");
>
>if (status == "183") {
>
>change_reply_status(180, "Ringing");
>
>exit;
>
>}
>
>}
>
> 
>
>route[FWD] {
>
>#xlog("L_INFO","INSIDE FWD \n");
>
>forward(X.X.X.X,5060);
>
>}
>
>Where X.X.X.X is the Freeswitch IP
>
> 
>
>This script is working normally as long as the customer is sending the
>requests(INVITE,BYE,ACK,CANCEL..) . But when the supplier or freeswitch 
>initiated the request , above script causes loop where the packet is 
>bounced between kamailio and freeswitch.
>
> 
>
>As I know , loose_route is used to handle such requests , but I'm not 
>sure how to forward these packets to the customer after receiving them 
>from freeswitch.
>
> 
>
>I'm not sure also if what's I'm doing is statefull or stateless.
>
> 
>
>Any help is appreciated.
>
> 
>
>Thanks,
>
>Ali Taher


-- Alex

--
Sent via mobile, please forgive typos and brevity. 

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] in-dialog requests

2018-07-18 Thread Ali Taher
Hi Alex,

How can I troubleshoot the issue in this case ?

Noting that I'm using Kamailio 4.2.0

Thanks
Ali Taher

-Original Message-
From: sr-users  On Behalf Of Alex Balashov
Sent: Wednesday, July 18, 2018 4:50 PM
To: Kamailio (SER) - Users Mailing List 
Subject: Re: [SR-Users] in-dialog requests

That may be, but it's still the correct config to use. Your scaled-down version 
simply will not work.

On July 18, 2018 9:47:15 AM EDT, Ali Taher  wrote:
>Hi Alex,
>
>Yes I did, but I noticed that all in-dialog requests sent by freeswitch 
>to kamailio were ignored and no packet was generated from kamailio in 
>this regard.
>
>I'm not sure if t_relay is working as expected at my side.
>
>Thanks.
>Ali Taher
>
>-Original Message-
>From: sr-users  On Behalf Of Alex 
>Balashov
>Sent: Wednesday, July 18, 2018 4:34 PM
>To: Kamailio (SER) - Users Mailing List 
>Subject: Re: [SR-Users] in-dialog requests
>
>Have you tried the config I suggested to you yesterday?
>
>On July 18, 2018 9:32:01 AM EDT, Ali Taher  wrote:
>>Hello,
>>
>> 
>>
>>I'm using Kamailio as a proxy behind freeswitch to alter some packets
>>(183
>>packets precisely).
>>
>> 
>>
>>Here is my scenario:
>>
>> 
>>
>>(---Customer---) --> ((port 5065)---Kamailio---) -->
>>((port5060)---Freeswitch---) --> (---Supplier---)
>>
>> 
>>
>>Here is my request route :
>>
>> 
>>
>>route{
>>
>> 
>>
>>if (is_method("INVITE")) {
>>
>>xlog("L_INFO","INSIDE request route $si \n");
>>
>>  insert_hf("X-AUTH-IP: $si\r\n");
>>
>>}
>>
>> 
>>
>>route(FWD);
>>
>>}
>>
>> 
>>
>> 
>>
>>reply_route {
>>
>>#xlog("L_INFO","INSDE reply \n");
>>
>>if (status == "183") {
>>
>>change_reply_status(180, "Ringing");
>>
>>exit;
>>
>>}
>>
>>}
>>
>> 
>>
>>route[FWD] {
>>
>>#xlog("L_INFO","INSIDE FWD \n");
>>
>>forward(X.X.X.X,5060);
>>
>>}
>>
>>Where X.X.X.X is the Freeswitch IP
>>
>> 
>>
>>This script is working normally as long as the customer is sending the
>>requests(INVITE,BYE,ACK,CANCEL..) . But when the supplier or
>freeswitch
>>initiated the request , above script causes loop where the packet is 
>>bounced between kamailio and freeswitch.
>>
>> 
>>
>>As I know , loose_route is used to handle such requests , but I'm not 
>>sure how to forward these packets to the customer after receiving them
>
>>from freeswitch.
>>
>> 
>>
>>I'm not sure also if what's I'm doing is statefull or stateless.
>>
>> 
>>
>>Any help is appreciated.
>>
>> 
>>
>>Thanks,
>>
>>Ali Taher
>
>
>-- Alex
>
>--
>Sent via mobile, please forgive typos and brevity. 
>
>___
>Kamailio (SER) - Users Mailing List
>sr-users@lists.kamailio.org
>https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>
>___
>Kamailio (SER) - Users Mailing List
>sr-users@lists.kamailio.org
>https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


-- Alex

--
Sent via mobile, please forgive typos and brevity. 

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] NATHELPER issue

2018-07-20 Thread Ali Taher
Hello,

 

I'm using Kamailio 4.2 as proxy with nathelper enabled.

 

Yet , the ACK packet sent from the proxy to the origination's private IP.

 

The ACK is sent as reply on the following 200 OK sent from the origination :


 

8m2EJN41BN/6WSIP/2.0 200 OK

From: ;tag=XQBQNjvjgp4Ze

To: ;tag=12033368836000

Via: SIP/2.0/UDP
X.X.X.X:5065;branch=z9hG4bK2959.233ecbc5eff949f946d8763ce25e5e6d.0;received=
X.X.X.X,SIP/2.0/UDP
X.X.X.X;received=X.X.X.X;rport=5060;branch=z9hG4bKN93cXvv26vDDN

Record-Route: 

Call-ID: CbeX8453909200habfGhEfElPce@BC00.XX

CSeq: 125698370 INVITE

Accept: application/sdp

Allow: INVITE,ACK,OPTIONS,BYE,CANCEL,UPDATE

P-Charging-Vector:
icid-value=B0912C3D70-0720-09394507;icid-generated-at=BC00.XX.XX
;orig-ioi=MXX

Content-Type: application/sdp

Contact: 

Content-Length:  268

 

v=0

o=- 5838243 5838244 IN IP4 BC00.XX

s=-

c=IN IP4 172.16.45.144

t=0 0

a=sendrecv

m=audio 47588 RTP/AVP 18 96

c=IN IP4 172.16.45.144

a=rtpmap:18 G729/8000

a=fmtp:18 annexb=yes

a=rtpmap:96 telephone-event/8000

a=fmtp:96 0-15

a=maxptime:20

 

Following is the header of the sent ACK packet:

 

Request-Line: ACK sip:172.16.45.65:5060;transport=UDP SIP/2.0

Record-Route: 

Via: SIP/2.0/UDP
X.X.X.X:5065;branch=z9hG4bK2959.871535fd341bbe3099d0bf60d6460e18.0

Via: SIP/2.0/UDP
X.X.X.X;received=X.X.X.X;rport=5060;branch=z9hG4bKQUpy0jy90etjc

Max-Forwards: 69

From: ;tag=XQBQNjvjgp4Ze

To: ;tag=12033368836000

Call-ID: CbeX8453909200habfGhEfElPce@BC00.XX

CSeq: 125698370 ACK

Content-Length: 0

 

Where X.X.X.X is Kamailio server public IP.

 

Following is part of my config file :

 

route {

route(NATDETECT);

record_route();

 

if(!mf_process_maxfwd_header("10")) {

sl_send_reply("483", "Too Many Hops");

exit;

}

 

# Maybe some sanity_check() here.

 

if(has_totag()) {

   

if(loose_route()) {

route(DLGURI);

if(!t_relay())

sl_reply_error();

 

exit;

} else {

if(is_method("ACK")) {

route(DLGURI);

if(t_check_trans()) {

t_relay();

}

} else

sl_send_reply("403", "Forbidden");

}

exit;

}



.

}



 

route[NATDETECT] {

#!ifdef WITH_NAT

force_rport();

if (nat_uac_test("19")) {

if (is_method("REGISTER")) {

fix_nated_register();

} else {

add_contact_alias();

}

setflag(FLT_NATS);

}

#!endif

return;

}

 

route[DLGURI] {

#!ifdef WITH_NAT

if(!isdsturiset()) {

 handle_ruri_alias();

}

#!endif

return;

}      

 

Can you please check why the ACK is still sent on private IP ?

 

Thanks

Ali Taher

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] NATHELPER issue

2018-07-23 Thread Ali Taher
Thank you for your reply.

 

ACK is now sent correctly to public IP , yet I have another issue with RBT  
where it’s still sent to private IP .Yet the call media is sent correctly to 
the public IP.

 

There is something strange , as I hear two short different ringing tones then 
complete silence till the called party answer the call and RTP flow normally.

 

How can I handle this case?

 

Thanks,

Ali

 

From: Konstantin Polyakov  
Sent: Friday, July 20, 2018 3:01 PM
To: sr-users@lists.kamailio.org; Ali Taher 
Subject: Re: [SR-Users] NATHELPER issue

 

Hello Ali,

ACK is sent by UAC to the Contact which is received in OK from UAS.
So from my point of view you need to fix that Contact in OK on your proxy.

My NATDETECT looks like:

if (nat_uac_test("19")) {

   fix_nated_contact();

}


I call it for requests and responses.

Best regards.
Konstantin

 

Message: 23
Date: Fri, 20 Jul 2018 11:13:42 +0300
From: "Ali Taher" mailto:ata...@vanrise.com> >
To: mailto:sr-us...@lists.sip-router.org> >
Subject: [SR-Users] NATHELPER issue
Message-ID: <070901d42001$939be2b0$bad3a810$@vanrise.com 
<mailto:070901d42001$939be2b0$bad3a810$@vanrise.com> >
Content-Type: text/plain; charset="utf-8"

Hello,

 

I'm using Kamailio 4.2 as proxy with nathelper enabled.

 

Yet , the ACK packet sent from the proxy to the origination's private IP.

 

The ACK is sent as reply on the following 200 OK sent from the origination :


 

8m2EJN41BN/6WSIP/2.0 200 OK

From: ;tag=XQBQNjvjgp4Ze

To: ;tag=12033368836000

Via: SIP/2.0/UDP
X.X.X.X:5065;branch=z9hG4bK2959.233ecbc5eff949f946d8763ce25e5e6d.0;received=
X.X.X.X,SIP/2.0/UDP
X.X.X.X;received=X.X.X.X;rport=5060;branch=z9hG4bKN93cXvv26vDDN

Record-Route: 

Call-ID: CbeX8453909200habfGhEfElPce@BC00.XX 
<mailto:CbeX8453909200habfGhEfElPce@BC00.XX> 

CSeq: 125698370 INVITE

Accept: application/sdp

Allow: INVITE,ACK,OPTIONS,BYE,CANCEL,UPDATE

P-Charging-Vector:
icid-value=B0912C3D70-0720-09394507;icid-generated-at=BC00.XX.XX
;orig-ioi=MXX

Content-Type: application/sdp

Contact: 

Content-Length: 268

 

v=0

o=- 5838243 5838244 IN IP4 BC00.XX

s=-

c=IN IP4 172.16.45.144

t=0 0

a=sendrecv

m=audio 47588 RTP/AVP 18 96

c=IN IP4 172.16.45.144

a=rtpmap:18 G729/8000

a=fmtp:18 annexb=yes

a=rtpmap:96 telephone-event/8000

a=fmtp:96 0-15

a=maxptime:20

 

Following is the header of the sent ACK packet:

 

Request-Line: ACK sip:172.16.45.65:5060;transport=UDP SIP/2.0

Record-Route: 

Via: SIP/2.0/UDP
X.X.X.X:5065;branch=z9hG4bK2959.871535fd341bbe3099d0bf60d6460e18.0

Via: SIP/2.0/UDP
X.X.X.X;received=X.X.X.X;rport=5060;branch=z9hG4bKQUpy0jy90etjc

Max-Forwards: 69

From: ;tag=XQBQNjvjgp4Ze

To: ;tag=12033368836000

Call-ID: CbeX8453909200habfGhEfElPce@BC00.XX 
<mailto:CbeX8453909200habfGhEfElPce@BC00.XX> 

CSeq: 125698370 ACK

Content-Length: 0

 

Where X.X.X.X is Kamailio server public IP.

 

Following is part of my config file :

 

route {

route(NATDETECT);

record_route();

 

if(!mf_process_maxfwd_header("10")) {

sl_send_reply("483", "Too Many Hops");

exit;

}

 

# Maybe some sanity_check() here.

 

if(has_totag()) {

   

if(loose_route()) {

route(DLGURI);

if(!t_relay())

sl_reply_error();

 

exit;

} else {

if(is_method("ACK")) {

route(DLGURI);

if(t_check_trans()) {

t_relay();

}

} else

sl_send_reply("403", "Forbidden");

}

exit;

}



.

}



 

route[NATDETECT] {

#!ifdef WITH_NAT

force_rport();

if (nat_uac_test("19")) {

if (is_method("REGISTER")) {

fix_nated_register();

} else {

add_contact_alias();

}

setflag(FLT_NATS);

}

#!endif

return;

}

 

route[DLGURI] {

#!ifdef WITH_NAT

if(!isdsturiset()) {

     handle_ruri_alias();

}

#!endif

return;

} 

 

Can you please check why the ACK is still sent on private IP ?

 

Thanks

Ali Taher



 

"Ali Taher" https://e.mail.ru/compose?To=ata...@vanrise.com> >

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] NATHELPER issue

2018-07-23 Thread Ali Taher
Hi Konstantin,

 

INVITE:

 

INVITE sip:9613159370@X.X.X.X:5065 SIP/2.0

Record-Route: 

X-AUTH-IP: Y.Y.Y.Y

Via: SIP/2.0/UDP 
X.X.X.X:5065;branch=z9hG4bK0f8e.68a6417bb4b72bec0eb7c44427dc8731.0

Via: SIP/2.0/UDP 
192.168.26.3:31556;received=Y.Y.Y.Y;branch=z9hG4bK-d87543-6a165215a2441724-1--d87543-;rport=31556

Max-Forwards: 69

Contact: 

To: "9613159370"

From: "+967123456";tag=5269152d

Call-ID: c10f30782b42be0fNjNiNTdjNGM1MWIzNDlhNTM4MzAwYWI0NWY2NGRmOTM.

CSeq: 1 INVITE

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, 
INFO

Content-Type: application/sdp

User-Agent: eyeBeam release 1003s stamp 31159

Content-Length: 434

 

v=0

o=- 5 2 IN IP4 192.168.26.3

s=CounterPath eyeBeam 1.5

c=IN IP4 192.168.26.3

t=0 0

m=audio 8602 RTP/AVP 0 8 101

a=alt:1 4 : F4Vpy7HX BRVjd5rl 192.168.26.3 8602

a=alt:2 3 : ZTQ/VQpO 5uDGgHMJ 192.168.164.1 8602

a=alt:3 2 : ZZPaUsAW LVjbM9qy 192.168.74.1 8602

a=alt:4 1 : 5lOKe54U yTwyWfpC 11.11.0.122 8602

a=fmtp:101 0-15

a=rtpmap:101 telephone-event/8000

a=sendrecv

a=x-rtp-session-id:0CDBBC1F22564B72BDA5AD0B07C2AECF

 

 

200 OK

 

200 OK

Via: SIP/2.0/UDP 
192.168.26.3:31556;received=Y.Y.Y.Y;branch=z9hG4bK-d87543-6a165215a2441724-1--d87543-;rport=31556

Record-Route: 

From: "+967123456" ;tag=5269152d

To: "9613159370" ;tag=agtHmrp3Dccrg

Call-ID: c10f30782b42be0fNjNiNTdjNGM1MWIzNDlhNTM4MzAwYWI0NWY2NGRmOTM.

CSeq: 1 INVITE

Contact: 

User-Agent: FIKAR

Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, 
REFER, NOTIFY, PUBLISH, SUBSCRIBE

Supported: timer, path, replaces

Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, 
line-seize, call-info, sla, include-session-description, presence.winfo, 
message-summary, refer

Content-Type: application/sdp

Content-Disposition: session

Content-Length: 200

Remote-Party-ID: "Outbound Call" 
;party=calling;privacy=off;screen=no

 

v=0

o=FIKAR 4050780586 4050780588 IN IP4 X.X.X.X

s=FIKAR

c=IN IP4 X.X.X.X

t=0 0

m=audio 24496 RTP/AVP 8 101

a=rtpmap:8 PCMA/8000

a=rtpmap:101 telephone-event/8000

a=fmtp:101 0-15

 

 

Regards,

Ali

 

 

From: Konstantin Polyakov  
Sent: Monday, July 23, 2018 12:08 PM
To: Ali Taher 
Subject: Re[2]: [SR-Users] NATHELPER issue

 

Hello Ali,

Could you show your latest INVITE and OK?

Check you SDP bodies in those messages, if you still have there private IPs 
then you need to solve usual NAT traversal task in your media software (not 
proxy).
Kamailio doesn't process media as you know. 
Of course you can try fix_nated_sdp  function from nathelper module but it will 
not work for symmetric NAT because you fix SDP with public IP toward proxy but 
not toward UA.
Your media software or hardware should support STUN or ICE protocols to work 
correctly via NAT.

Best regards.

Понедельник, 23 июля 2018, 11:41 +03:00 от Ali Taher mailto:ata...@vanrise.com> >:

Thank you for your reply.

 

ACK is now sent correctly to public IP , yet I have another issue with RBT  
where it’s still sent to private IP .Yet the call media is sent correctly to 
the public IP.

 

There is something strange , as I hear two short different ringing tones then 
complete silence till the called party answer the call and RTP flow normally.

 

How can I handle this case?

 

Thanks,

Ali

 

From: Konstantin Polyakov mailto:piligrim...@mail.ru> > 
Sent: Friday, July 20, 2018 3:01 PM
To: sr-users@lists.kamailio.org <mailto:sr-users@lists.kamailio.org> ; Ali 
Taher mailto:ata...@vanrise.com> >
Subject: Re: [SR-Users] NATHELPER issue

 

Hello Ali,

ACK is sent by UAC to the Contact which is received in OK from UAS.
So from my point of view you need to fix that Contact in OK on your proxy.

My NATDETECT looks like:

if (nat_uac_test("19")) {

   fix_nated_contact();

}


I call it for requests and responses.

Best regards.
Konstantin

 

Message: 23
Date: Fri, 20 Jul 2018 11:13:42 +0300
From: "Ali Taher"  >
To: 
 >
Subject: [SR-Users] NATHELPER issue
Message-ID: <070901d42001$939be2b0$bad3a810$@vanrise.com 

 >
Content-Type: text/plain; charset="utf-8"

Hello,

 

I'm using Kamailio 4.2 as proxy with nathelper enabled.

 

Yet , the ACK packet sent from the proxy to the origination's private IP.

 

The ACK is sent as reply on the following 200 OK sent from the origination :


 

8m2EJN41BN/6WSIP/2.0 200 OK

From: ;tag=XQBQNjvjgp4Ze

To: ;tag=12033368836000

Via: SIP/2.0/UDP
X.X.X.X:5065;branch=z9hG4bK2959.233ecbc5eff949f946d8763ce25e5e6d.0;received=
X.X.X.X,SIP/2.0/UDP
X.X.X.X;received=X.X.X.X;rport=5060;branch=z9hG4bKN93cXvv26vDDN

Record-Route: 

Call-ID: CbeX8453909200habfGhEfElPce@BC00.XX 

 

CSeq: 125698370 INVITE

Accept: application/sdp

Allow: INVITE,ACK,OPTIONS,BYE,CANCEL,UPDATE

P-Charging-Vector:
icid-value=B0912C3D70-0720-09394507;icid-generated-at=BC00.XX.X

Re: [SR-Users] NATHELPER issue

2018-07-23 Thread Ali Taher
Hi Konstantin,

 

INVITE:

 

INVITE sip:9613159370@X.X.X.X:5065 SIP/2.0

Record-Route: 

X-AUTH-IP: Y.Y.Y.Y

Via: SIP/2.0/UDP 
X.X.X.X:5065;branch=z9hG4bK0f8e.68a6417bb4b72bec0eb7c44427dc8731.0

Via: SIP/2.0/UDP 
192.168.26.3:31556;received=Y.Y.Y.Y;branch=z9hG4bK-d87543-6a165215a2441724-1--d87543-;rport=31556

Max-Forwards: 69

Contact: 

To: "9613159370"

From: "+967123456";tag=5269152d

Call-ID: c10f30782b42be0fNjNiNTdjNGM1MWIzNDlhNTM4MzAwYWI0NWY2NGRmOTM.

CSeq: 1 INVITE

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, 
INFO

Content-Type: application/sdp

User-Agent: eyeBeam release 1003s stamp 31159

Content-Length: 434

 

v=0

o=- 5 2 IN IP4 192.168.26.3

s=CounterPath eyeBeam 1.5

c=IN IP4 192.168.26.3

t=0 0

m=audio 8602 RTP/AVP 0 8 101

a=alt:1 4 : F4Vpy7HX BRVjd5rl 192.168.26.3 8602

a=alt:2 3 : ZTQ/VQpO 5uDGgHMJ 192.168.164.1 8602

a=alt:3 2 : ZZPaUsAW LVjbM9qy 192.168.74.1 8602

a=alt:4 1 : 5lOKe54U yTwyWfpC 11.11.0.122 8602

a=fmtp:101 0-15

a=rtpmap:101 telephone-event/8000

a=sendrecv

a=x-rtp-session-id:0CDBBC1F22564B72BDA5AD0B07C2AECF

 

 

200 OK

 

200 OK

Via: SIP/2.0/UDP 
192.168.26.3:31556;received=Y.Y.Y.Y;branch=z9hG4bK-d87543-6a165215a2441724-1--d87543-;rport=31556

Record-Route: 

From: "+967123456" ;tag=5269152d

To: "9613159370" ;tag=agtHmrp3Dccrg

Call-ID: c10f30782b42be0fNjNiNTdjNGM1MWIzNDlhNTM4MzAwYWI0NWY2NGRmOTM.

CSeq: 1 INVITE

Contact: 

User-Agent: FIKAR

Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, 
REFER, NOTIFY, PUBLISH, SUBSCRIBE

Supported: timer, path, replaces

Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, 
line-seize, call-info, sla, include-session-description, presence.winfo, 
message-summary, refer

Content-Type: application/sdp

Content-Disposition: session

Content-Length: 200

Remote-Party-ID: "Outbound Call" 
;party=calling;privacy=off;screen=no

 

v=0

o=FIKAR 4050780586 4050780588 IN IP4 X.X.X.X

s=FIKAR

c=IN IP4 X.X.X.X

t=0 0

m=audio 24496 RTP/AVP 8 101

a=rtpmap:8 PCMA/8000

a=rtpmap:101 telephone-event/8000

a=fmtp:101 0-15

 

where:

X.X.X.X is Kamailio IP

Y.Y.Y.Y is origination public IP

 

 

Regards,

Ali

 

From: Konstantin Polyakov  
Sent: Monday, July 23, 2018 12:08 PM
To: Ali Taher 
Subject: Re[2]: [SR-Users] NATHELPER issue

 

Hello Ali,

Could you show your latest INVITE and OK?

Check you SDP bodies in those messages, if you still have there private IPs 
then you need to solve usual NAT traversal task in your media software (not 
proxy).
Kamailio doesn't process media as you know. 
Of course you can try fix_nated_sdp  function from nathelper module but it will 
not work for symmetric NAT because you fix SDP with public IP toward proxy but 
not toward UA.
Your media software or hardware should support STUN or ICE protocols to work 
correctly via NAT.

Best regards.

Понедельник, 23 июля 2018, 11:41 +03:00 от Ali Taher mailto:ata...@vanrise.com> >:

Thank you for your reply.

 

ACK is now sent correctly to public IP , yet I have another issue with RBT  
where it’s still sent to private IP .Yet the call media is sent correctly to 
the public IP.

 

There is something strange , as I hear two short different ringing tones then 
complete silence till the called party answer the call and RTP flow normally.

 

How can I handle this case?

 

Thanks,

Ali

 

From: Konstantin Polyakov mailto:piligrim...@mail.ru> > 
Sent: Friday, July 20, 2018 3:01 PM
To: sr-users@lists.kamailio.org <mailto:sr-users@lists.kamailio.org> ; Ali 
Taher mailto:ata...@vanrise.com> >
Subject: Re: [SR-Users] NATHELPER issue

 

Hello Ali,

ACK is sent by UAC to the Contact which is received in OK from UAS.
So from my point of view you need to fix that Contact in OK on your proxy.

My NATDETECT looks like:

if (nat_uac_test("19")) {

   fix_nated_contact();

}


I call it for requests and responses.

Best regards.
Konstantin

 

Message: 23
Date: Fri, 20 Jul 2018 11:13:42 +0300
From: "Ali Taher"  >
To: 
 >
Subject: [SR-Users] NATHELPER issue
Message-ID: <070901d42001$939be2b0$bad3a810$@vanrise.com 

 >
Content-Type: text/plain; charset="utf-8"

Hello,

 

I'm using Kamailio 4.2 as proxy with nathelper enabled.

 

Yet , the ACK packet sent from the proxy to the origination's private IP.

 

The ACK is sent as reply on the following 200 OK sent from the origination :


 

8m2EJN41BN/6WSIP/2.0 200 OK

From: ;tag=XQBQNjvjgp4Ze

To: ;tag=12033368836000

Via: SIP/2.0/UDP
X.X.X.X:5065;branch=z9hG4bK2959.233ecbc5eff949f946d8763ce25e5e6d.0;received=
X.X.X.X,SIP/2.0/UDP
X.X.X.X;received=X.X.X.X;rport=5060;branch=z9hG4bKN93cXvv26vDDN

Record-Route: 

Call-ID: CbeX8453909200habfGhEfElPce@BC00.XX 

 

CSeq: 125698370 INVITE

Accept: application/sdp

Allow: INVITE,ACK,OPTIONS,BYE,CANCEL,UPDATE

P-Charging-Vector:
icid-value=

Re: [SR-Users] NATHELPER issue

2018-07-23 Thread Ali Taher
Thank you Konstantin,

 

What I can’t understand is why media packets are sent correctly to the public 
IP , while early media (RBT) are sent on private.

 

Regards,

Ali

From: Konstantin Polyakov  
Sent: Monday, July 23, 2018 1:38 PM
To: Ali Taher 
Subject: Re[4]: [SR-Users] NATHELPER issue

 

Original INVITE  contains private IP in c= parameter, so you need to use STUN 
or TURN or ICE, something which is supported in your system or in your 
softphone.
See my comments in the previous mail.

Best regrads



Понедельник, 23 июля 2018, 12:25 +03:00 от Ali Taher mailto:ata...@vanrise.com> >:

Hi Konstantin,

 

INVITE:

 

INVITE sip:9613159370@X.X.X.X:5065 SIP/2.0

Record-Route: 

X-AUTH-IP: Y.Y.Y.Y

Via: SIP/2.0/UDP 
X.X.X.X:5065;branch=z9hG4bK0f8e.68a6417bb4b72bec0eb7c44427dc8731.0

Via: SIP/2.0/UDP 
192.168.26.3:31556;received=Y.Y.Y.Y;branch=z9hG4bK-d87543-6a165215a2441724-1--d87543-;rport=31556

Max-Forwards: 69

Contact: 

To: "9613159370"

From: "+967123456";tag=5269152d

Call-ID: c10f30782b42be0fNjNiNTdjNGM1MWIzNDlhNTM4MzAwYWI0NWY2NGRmOTM.

CSeq: 1 INVITE

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, 
INFO

Content-Type: application/sdp

User-Agent: eyeBeam release 1003s stamp 31159

Content-Length: 434

 

v=0

o=- 5 2 IN IP4 192.168.26.3

s=CounterPath eyeBeam 1.5

c=IN IP4 192.168.26.3

t=0 0

m=audio 8602 RTP/AVP 0 8 101

a=alt:1 4 : F4Vpy7HX BRVjd5rl 192.168.26.3 8602

a=alt:2 3 : ZTQ/VQpO 5uDGgHMJ 192.168.164.1 8602

a=alt:3 2 : ZZPaUsAW LVjbM9qy 192.168.74.1 8602

a=alt:4 1 : 5lOKe54U yTwyWfpC 11.11.0.122 8602

a=fmtp:101 0-15

a=rtpmap:101 telephone-event/8000

a=sendrecv

a=x-rtp-session-id:0CDBBC1F22564B72BDA5AD0B07C2AECF

 

 

200 OK

 

200 OK

Via: SIP/2.0/UDP 
192.168.26.3:31556;received=Y.Y.Y.Y;branch=z9hG4bK-d87543-6a165215a2441724-1--d87543-;rport=31556

Record-Route: 

From: "+967123456" ;tag=5269152d

To: "9613159370" ;tag=agtHmrp3Dccrg

Call-ID: c10f30782b42be0fNjNiNTdjNGM1MWIzNDlhNTM4MzAwYWI0NWY2NGRmOTM.

CSeq: 1 INVITE

Contact: 

User-Agent: FIKAR

Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, 
REFER, NOTIFY, PUBLISH, SUBSCRIBE

Supported: timer, path, replaces

Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, 
line-seize, call-info, sla, include-session-description, presence.winfo, 
message-summary, refer

Content-Type: application/sdp

Content-Disposition: session

Content-Length: 200

Remote-Party-ID: "Outbound Call" mailto:506251539613159370@X.X.X.X> >;party=calling;privacy=off;screen=no

 

v=0

o=FIKAR 4050780586 4050780588 IN IP4 X.X.X.X

s=FIKAR

c=IN IP4 X.X.X.X

t=0 0

m=audio 24496 RTP/AVP 8 101

a=rtpmap:8 PCMA/8000

a=rtpmap:101 telephone-event/8000

a=fmtp:101 0-15

 

where:

X.X.X.X is Kamailio IP

Y.Y.Y.Y is origination public IP

 

 

Regards,

Ali

 

From: Konstantin Polyakov mailto:piligrim...@mail.ru> > 
Sent: Monday, July 23, 2018 12:08 PM
To: Ali Taher mailto:ata...@vanrise.com> >
Subject: Re[2]: [SR-Users] NATHELPER issue

 

Hello Ali,

Could you show your latest INVITE and OK?

Check you SDP bodies in those messages, if you still have there private IPs 
then you need to solve usual NAT traversal task in your media software (not 
proxy).
Kamailio doesn't process media as you know. 
Of course you can try fix_nated_sdp  function from nathelper module but it will 
not work for symmetric NAT because you fix SDP with public IP toward proxy but 
not toward UA.
Your media software or hardware should support STUN or ICE protocols to work 
correctly via NAT.

Best regards.

Понедельник, 23 июля 2018, 11:41 +03:00 от Ali Taher  >:

Thank you for your reply.

 

ACK is now sent correctly to public IP , yet I have another issue with RBT  
where it’s still sent to private IP .Yet the call media is sent correctly to 
the public IP.

 

There is something strange , as I hear two short different ringing tones then 
complete silence till the called party answer the call and RTP flow normally.

 

How can I handle this case?

 

Thanks,

Ali

 

From: Konstantin Polyakov  > 
Sent: Friday, July 20, 2018 3:01 PM
To: sr-users@lists.kamailio.org 
 
; Ali Taher  >
Subject: Re: [SR-Users] NATHELPER issue

 

Hello Ali,

ACK is sent by UAC to the Contact which is received in OK from UAS.
So from my point of view you need to fix that Contact in OK on your proxy.

My NATDETECT looks like:

if (nat_uac_test("19")) {

   fix_nated_contact();

}


I call it for requests and responses.

Best regards.
Konstantin

 

Message: 23
Date: Fri, 20 Jul 2018 11:13:42 +0300
From: "Ali Taher" mailto:ata...@vanrise.com> >
To: mailto:sr-us...@lists.sip-router.org> >
Subject: [SR-Users] NATHELPER issue
Message-ID: <070901d42001$939be2b0$bad3a810$@vanrise.com 
<mailto:070901d42001$939be2b0$bad3a810$@vanrise.com> >
Content-Type: text/plain; charset="utf-8"

[SR-Users] change A number using a pool of numbers

2023-08-01 Thread Ali Taher
Hello,

I'm looking to change the A number (from number) to a number selected randomly 
from a pool of existing numbers (hundreds) and then relay the call to a certain 
gateway.

What is the best and more efficient way to do it in kamailio?

Thanks in advance
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: change A number using a pool of numbers

2023-08-02 Thread Ali Taher
Thanks Kaufman,

Relying on DB is of course one way to do it, but I thought that there are some 
modules that could be used and are faster, like app_lua but I'm not sure if it 
can be used to select a number randomly from a pool saved in a file.

Regards,


From: Kaufman 
Sent: Wednesday, August 2, 2023 7:36 PM
To: Kamailio (SER) - Users Mailing List 
Subject: [SR-Users] Re: change A number using a pool of numbers

There's functionally two parts to this question:


  1.  How to change a number
  2.  How to select a random number

For selection of the number it's probably easiest to rely on DB lookup. With 
one column as the original number and another column as the possible 
replacement numbers, then just select with an order by random to get the 
replacement number.

As far as changing the number, it can depend on specifically what number you're 
trying to change.  The RURI can be changed just by setting $rU.  Values in the 
To: or From: headers should be changed with the functions from the UAC module 
so that replies can have the original values restored.  For other miscellaneous 
headers like P-Asserted-Identity, just remove the old header and append a new 
one.

Regards,
Kaufman


From: Ali Taher mailto:ata...@vanrise.com>>
Sent: Wednesday, August 2, 2023 1:20 AM
To: Kamailio (SER) - Users Mailing List 
mailto:sr-users@lists.kamailio.org>>
Subject: [SR-Users] change A number using a pool of numbers


CAUTION: This email originated from outside the organization. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe.

Hello,

I'm looking to change the A number (from number) to a number selected randomly 
from a pool of existing numbers (hundreds) and then relay the call to a certain 
gateway.

What is the best and more efficient way to do it in kamailio?

Thanks in advance
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Modify To URI in Multiple Choices

2023-08-09 Thread Ali Taher
Hello,

I'm using Kamailio as SIP redirect where SBC sends INVITE packet to kamailio 
and "302","Multiple Choices" is sent back to SBC.

What I want is to modify the URI part in the To header of the Multiple Choices 
packet sent from kamailio. I tried to use 
uac_replace_to("","sip:$var(cdpn)@$td") where $var(cdpn) is already defined in 
the routing logic, but it's not reflected and the original TO URI is sent 
instead.

Any help to handle this issue is much appreciated.

Regards,
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: Modify To URI in Multiple Choices

2023-08-09 Thread Ali Taher
I used append_to_reply function to rebuild the To header, but the problem is 
that the old To header stays there even if I use remove_hf method to remove it.

What I’m doing wrong here?
My logic is set inside a route block.

Regards,

Sent from my iPhone

On Aug 9, 2023, at 2:55 PM, Ali Taher  wrote:


Hello,

I’m using Kamailio as SIP redirect where SBC sends INVITE packet to kamailio 
and "302","Multiple Choices" is sent back to SBC.

What I want is to modify the URI part in the To header of the Multiple Choices 
packet sent from kamailio. I tried to use 
uac_replace_to("”,"sip:$var(cdpn)@$td") where $var(cdpn) is already defined in 
the routing logic, but it’s not reflected and the original TO URI is sent 
instead.

Any help to handle this issue is much appreciated.

Regards,
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] kamailio-postgres on RHEL 9

2023-08-16 Thread Ali Taher
Hello,

I'm trying to install latest Kamailio version on RHEL 9.2.
All is good, but I couldn't find kamailio-postgres package related to postgres 
module, knowing that I have installed Postgresql 15.
Is there a rpm file that I can download to install kamailio-postgres ?

Regards,

__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Set a License for Kamailio

2023-09-05 Thread Ali Taher
Hello,

Is it possible to put a kind of license for Kamailio, in a way that it works 
for 1 week for example, and after that it will not process new requests?

Regards,

__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: Set a License for Kamailio

2023-09-13 Thread Ali Taher
Hi Alex,

Can you please put me on track how to proceed? I'm not familiar with JWT.

Regards,

-Original Message-
From: Alex Balashov  
Sent: Tuesday, September 5, 2023 4:38 PM
To: Kamailio (SER) - Users Mailing List 
Subject: [SR-Users] Re: Set a License for Kamailio

A JWT would be a reasonably stateless way to do that.

> On Sep 5, 2023, at 8:45 AM, Ali Taher  wrote:
> 
> Hello,
>  Is it possible to put a kind of license for Kamailio, in a way that it works 
> for 1 week for example, and after that it will not process new requests?
>  Regards,
>  __
> Kamailio - Users Mailing List - Non Commercial Discussions To 
> unsubscribe send an email to sr-users-le...@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the 
> sender!
> Edit mailing list options or unsubscribe:


--
Alex Balashov
Principal Consultant
Evariste Systems LLC
Web: https://evaristesys.com
Tel: +1-706-510-6800

__
Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send 
an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] 0.0.0.0 in VIA header

2023-10-09 Thread Ali Taher via sr-users
Hello,

I'm using Kamailio as SIP proxy to receive INVITE packets, randomize A-number 
and then relay it to a certain gateway.

I noticed that a Via header is added to the INVITE sent by Kamailio to the 
gateway with 0.0.0.0 as address as shown below:
Via: SIP/2.0/UDP 0.0.0.0;branch=z9hG4bK2d97.61de75dd58fa7ca7450cc8b9b01db62f.0

As far as I know, the IP that should be used in the new added VIA header must 
be Kamailio IP, but it's not the case here, knowing that Kamailio is not behind 
NAT.

Regards,
Ali Taher

__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Kamailio as SIP proxy

2023-10-12 Thread Ali Taher via sr-users
Hello,

I'm using Kamailio as SIP proxy between Session Manager and SBC

So here is the scenario :
Session Manager sends a call (Invite) to Kamailio, kamailio needs to relay it 
to SBC after doing some modification.
(-Session Manager-) --- > (Kamailio) --- >  
(-SBC-)


My routing logic is similar to the below:
route{
  if ((method==OPTIONS) && (! uri=~"sip:.*[@]+.*")) {
options_reply();
  }
if (is_method("INVITE"))  {
sql_query("cb", "select number from pool1 order by random() limit 1", "ra");
$var(rand)=$dbr(ra=>[0,0]);
uac_replace_from($var(rand),"sip:$var(rand)@192.168.1.1");
xlog("L_INFO","Random: $var(rand)");
$td = "192.168.1.10";
$rd = "192.168.1.10";
t_relay();
}
}
Where:
192.168.1.1 is Kamailio IP
192.168.1.10 is SBC IP

The issue is that I'm not sure to handle the other SIP packets like 183,CANCEL, 
BYE etc that can be received from both SBC and session Manager?
What to add to my configuration to handle it properly?

Regards,
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] 183 Session Progress Acknowledgment

2023-10-13 Thread Ali Taher via sr-users
Hello,

Is there a way to send PRACK as reply to a 183 Session Progress (with Require: 
100rel) sent to Kamailio sip proxy?

Regards,
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: 183 Session Progress Acknowledgment

2023-10-14 Thread Ali Taher via sr-users
Hi Alex,

That means that kamailio should forward the 183 session progress received from 
UAS as it to the UAC, which in their turn must send PRACK and kamailio forwards 
it back to UAS?


> On Oct 13, 2023, at 4:29 PM, Alex Balashov via sr-users 
>  wrote:
> 
> PRACKs are up to the UAs to send.
> 
>> On 13 Oct 2023, at 08:30, Ali Taher via sr-users 
>>  wrote:
>> 
>> Hello,
>> Is there a way to send PRACK as reply to a 183 Session Progress (with 
>> Require: 100rel) sent to Kamailio sip proxy?
>> Regards,
>> __
>> Kamailio - Users Mailing List - Non Commercial Discussions
>> To unsubscribe send an email to sr-users-le...@lists.kamailio.org
>> Important: keep the mailing list in the recipients, do not reply only to the 
>> sender!
>> Edit mailing list options or unsubscribe:
> 
> 
> -- 
> Alex Balashov
> Principal Consultant
> Evariste Systems LLC
> Web: https://evaristesys.com
> Tel: +1-706-510-6800
> 
> __
> Kamailio - Users Mailing List - Non Commercial Discussions
> To unsubscribe send an email to sr-users-le...@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the 
> sender!
> Edit mailing list options or unsubscribe:
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Kamailio SIP proxy role

2023-10-18 Thread Ali Taher via sr-users
Hello,

I'm using Kamailio as SIP proxy between Session Manager and SBC

So here is the scenario :
Session Manager sends a call (Invite) to Kamailio, kamailio needs to relay it 
to SBC after doing some modification.
(-Session Manager-) --- > (Kamailio) --- >  
(-SBC-)


My routing logic is similar to the below:
route{
  if ((method==OPTIONS) && (! uri=~"sip:.*[@]+.*")) {
options_reply();
  }
if (is_method("INVITE"))  {
sql_query("cb", "select number from pool1 order by random() limit 1", "ra");
$var(rand)=$dbr(ra=>[0,0]);
uac_replace_from($var(rand),"sip:$var(rand)@192.168.1.1");
xlog("L_INFO","Random: $var(rand)");

$var(ip) = $(ct{s.select,1,@}{s.select,0,;}{s.replace,>,});

remove_hf("Contact");
insert_hf("Contact: $var(rand) \r\n");

remove_hf("P-Asserted-Identity");
remove_hf("Route");
insert_hf("Route: \r\n","Route");
record_route();
t_relay();

$td = "192.168.1.10";
$rd = "192.168.1.10";
t_relay();
}
}
Where:
192.168.1.1 is Kamailio IP
192.168.1.10 is SBC IP

My question here is that Kamailio handle all in dialog messages between Session 
Manager and SBC?
For example, after forwarding the invite packet to SBC, SBC sends 183 Session 
Progress to Kamailio, which in its turn relay it to the session manager, 
knowing that this is not mentioned in my routing logic, so how Kamailio knew 
that it must relay it to session manager in this case?
Also I need to add to the 183 Session Progress sent to session manager by 
Kamailio record route and Via headers , how to do it ?

Regards,

__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] SIP Proxy : BYE next hop

2023-11-02 Thread Ali Taher via sr-users
Hello all,

I'm using Kamailio as SIP proxy between session manager and SBC.
I came across an issue in BYE request where the SBC sent in the header list of 
Routes where first route is Kamailio IP, and the second is SM IP, in addition 
to other routes (last route is the caller party)
What Kamailio did is to route the BYE to the address set in the Request-URI, 
which is the caller party.
What should be done instead is that Kamailio should remove the Route header 
including its own IP, and route the BYE to the next hop which is in this case 
the SM IP.

How to accomplish that?

Following is the Route header in the BYE request coming from SBC:
[truncated]Route: 
,,,sips:127.0.0.2:15061;ibmsid=local.xx_xx_;lr;ibmdrr,
 sip:SM1@SM_IP;transport=tls;lr;av-asset-uid=xx, 
sip:CALLER_PARTY_IP:5061;transport=tls;lr

Regards,
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: SIP Proxy : BYE next hop

2023-11-02 Thread Ali Taher via sr-users
Hi James,

Yes I'm using loose_route() and it's returning 1, but BYE message is not routed 
anywhere.

Frame 6213: 673 bytes on wire (5384 bits), 673 bytes captured (5384 bits)
Ethernet II, Src: Cisco_f8:19:ff (00:22:bd:f8:19:ff), Dst: VMware_bf:27:0b 
(00:50:56:bf:27:0b)
Internet Protocol Version 4, Src: 192.168.1.5, Dst: 192.168.1.2
User Datagram Protocol, Src Port: 16368, Dst Port: 5060
Session Initiation Protocol (BYE)
Request-Line: BYE sip:192.168.1.1:5060;transport=udp SIP/2.0
Message Header
Via: SIP/2.0/UDP 
192.168.1.5:16368;branch=z9hG4bK-d87543-c147891e677a1f19-1--d87543-;rport
Max-Forwards: 70
Route: 
Route: 
Contact: 
To: "121";tag=gtyrzghr-CC-1047-OFC-39
From: "69079514";tag=7d4a7c3c
Call-ID: 085d9048b81abc1eNDUwODVhMjI2NDk5NDM3YmZiZWZiYzI0YWZkOTU1Njc.
[Generated Call-ID: 
085d9048b81abc1eNDUwODVhMjI2NDk5NDM3YmZiZWZiYzI0YWZkOTU1Njc.]
CSeq: 2 BYE
User-Agent: eyeBeam release 1003s stamp 31159
Reason: SIP;description="User Hung Up"
Content-Length: 0

Here is routing block related to BYE:
if (is_method("BYE")) {
xlog("L_INFO","INSIDE BYE");
$var(loose) = loose_route();
xlog("L_INFO","LOOSE : $var(loose)");
}


Regards,

-Original Message-
From: James Browne  
Sent: Thursday, November 2, 2023 12:31 PM
To: Kamailio (SER) - Users Mailing List 
Cc: Ali Taher 
Subject: Re: [SR-Users] SIP Proxy : BYE next hop

Hello
Did you call the loose_route() function for the BYE? It should just work; 
that's one of the basics of how kamailio works, so I'll be very surprised if 
there's somehow a bug in kamailio.
If that does not work, perhaps send a list of the listen directives in the 
kamailio.cfg, along with the headers of the two SIP BYE messages (incoming and 
outgoing) and I'll see what I can figure out for you.

James

On Thu, 2 Nov 2023 at 09:35, Ali Taher via sr-users 
 wrote:
>
> Hello all,
>
>
>
> I’m using Kamailio as SIP proxy between session manager and SBC.
>
> I came across an issue in BYE request where the SBC sent in the header 
> list of Routes where first route is Kamailio IP, and the second is SM 
> IP, in addition to other routes (last route is the caller party)
>
> What Kamailio did is to route the BYE to the address set in the Request-URI, 
> which is the caller party.
>
> What should be done instead is that Kamailio should remove the Route header 
> including its own IP, and route the BYE to the next hop which is in this case 
> the SM IP.
>
>
>
> How to accomplish that?
>
>
>
> Following is the Route header in the BYE request coming from SBC:
>
> [truncated]Route: 
> , port=udp;lr;av-asset-uid=xx>, p;ibmsid=local._x_x;lr;ibmdrr>,sips:127.0.
> 0.2:15061;ibmsid=local.xx_xx_;lr;ibmdrr, 
> sip:SM1@SM_IP;transport=tls;lr;av-asset-uid=xx, 
> sip:CALLER_PARTY_IP:5061;transport=tls;lr
>
>
>
> Regards,
>
> __
> Kamailio - Users Mailing List - Non Commercial Discussions To 
> unsubscribe send an email to sr-users-le...@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the 
> sender!
> Edit mailing list options or unsubscribe:
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: SIP Proxy : BYE next hop

2023-11-02 Thread Ali Taher via sr-users
Hi James,

Here are my listen directives:
listen=udp:192.168.1.2:5060
listen=tcp: 192.168.1.2:5060

knowing that:
Kamailio IP: 192.168.1.2
SBC IP: 192.168.1.1
Caller IP: 192.168.1.5

-Original Message-
From: Ali Taher via sr-users  
Sent: Thursday, November 2, 2023 1:42 PM
To: James Browne ; Kamailio (SER) - Users Mailing List 

Cc: Ali Taher 
Subject: [SR-Users] Re: SIP Proxy : BYE next hop

Hi James,

Yes I'm using loose_route() and it's returning 1, but BYE message is not routed 
anywhere.

Frame 6213: 673 bytes on wire (5384 bits), 673 bytes captured (5384 bits) 
Ethernet II, Src: Cisco_f8:19:ff (00:22:bd:f8:19:ff), Dst: VMware_bf:27:0b 
(00:50:56:bf:27:0b) Internet Protocol Version 4, Src: 192.168.1.5, Dst: 
192.168.1.2 User Datagram Protocol, Src Port: 16368, Dst Port: 5060 Session 
Initiation Protocol (BYE)
Request-Line: BYE sip:192.168.1.1:5060;transport=udp SIP/2.0
Message Header
Via: SIP/2.0/UDP 
192.168.1.5:16368;branch=z9hG4bK-d87543-c147891e677a1f19-1--d87543-;rport
Max-Forwards: 70
Route: 
Route: 
Contact: 
To: "121";tag=gtyrzghr-CC-1047-OFC-39
From: "69079514";tag=7d4a7c3c
Call-ID: 085d9048b81abc1eNDUwODVhMjI2NDk5NDM3YmZiZWZiYzI0YWZkOTU1Njc.
[Generated Call-ID: 
085d9048b81abc1eNDUwODVhMjI2NDk5NDM3YmZiZWZiYzI0YWZkOTU1Njc.]
CSeq: 2 BYE
User-Agent: eyeBeam release 1003s stamp 31159
Reason: SIP;description="User Hung Up"
Content-Length: 0

Here is routing block related to BYE:
if (is_method("BYE")) {
xlog("L_INFO","INSIDE BYE");
$var(loose) = loose_route();
xlog("L_INFO","LOOSE : $var(loose)");
}


Regards,

-Original Message-
From: James Browne 
Sent: Thursday, November 2, 2023 12:31 PM
To: Kamailio (SER) - Users Mailing List 
Cc: Ali Taher 
Subject: Re: [SR-Users] SIP Proxy : BYE next hop

Hello
Did you call the loose_route() function for the BYE? It should just work; 
that's one of the basics of how kamailio works, so I'll be very surprised if 
there's somehow a bug in kamailio.
If that does not work, perhaps send a list of the listen directives in the 
kamailio.cfg, along with the headers of the two SIP BYE messages (incoming and 
outgoing) and I'll see what I can figure out for you.

James

On Thu, 2 Nov 2023 at 09:35, Ali Taher via sr-users 
 wrote:
>
> Hello all,
>
>
>
> I’m using Kamailio as SIP proxy between session manager and SBC.
>
> I came across an issue in BYE request where the SBC sent in the header 
> list of Routes where first route is Kamailio IP, and the second is SM 
> IP, in addition to other routes (last route is the caller party)
>
> What Kamailio did is to route the BYE to the address set in the Request-URI, 
> which is the caller party.
>
> What should be done instead is that Kamailio should remove the Route header 
> including its own IP, and route the BYE to the next hop which is in this case 
> the SM IP.
>
>
>
> How to accomplish that?
>
>
>
> Following is the Route header in the BYE request coming from SBC:
>
> [truncated]Route: 
> , port=udp;lr;av-asset-uid=xx>, p;ibmsid=local._x_x;lr;ibmdrr>,sips:127.0.
> 0.2:15061;ibmsid=local.xx_xx_;lr;ibmdrr,
> sip:SM1@SM_IP;transport=tls;lr;av-asset-uid=xx,
> sip:CALLER_PARTY_IP:5061;transport=tls;lr
>
>
>
> Regards,
>
> __
> Kamailio - Users Mailing List - Non Commercial Discussions To 
> unsubscribe send an email to sr-users-le...@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the 
> sender!
> Edit mailing list options or unsubscribe:
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: SIP Proxy : BYE next hop

2023-11-02 Thread Ali Taher via sr-users
Hi Yuriy,

Thanks, I used what you suggested below, and still getting 1 as result for 
loose_route(), but BYE message is not routed anywhere.

Regards,

From: Yuriy G 
Sent: Thursday, November 2, 2023 3:05 PM
To: Kamailio (SER) - Users Mailing List 
Cc: James Browne ; Ali Taher 
Subject: Re: [SR-Users] Re: SIP Proxy : BYE next hop

loose_route returns result in the $rc variable
Return code should be handed like this:
https://www.kamailio.org/wikidocs/cookbooks/5.6.x/pseudovariables/#rc-returned-code

чт, 2 нояб. 2023 г. в 13:27, Ali Taher via sr-users 
mailto:sr-users@lists.kamailio.org>>:
Hi James,

Here are my listen directives:
listen=udp:192.168.1.2:5060<http://192.168.1.2:5060>
listen=tcp: 192.168.1.2:5060<http://192.168.1.2:5060>

knowing that:
Kamailio IP: 192.168.1.2
SBC IP: 192.168.1.1
Caller IP: 192.168.1.5

-Original Message-----
From: Ali Taher via sr-users 
mailto:sr-users@lists.kamailio.org>>
Sent: Thursday, November 2, 2023 1:42 PM
To: James Browne mailto:ja...@frideo.com>>; Kamailio (SER) - 
Users Mailing List 
mailto:sr-users@lists.kamailio.org>>
Cc: Ali Taher mailto:ata...@vanrise.com>>
Subject: [SR-Users] Re: SIP Proxy : BYE next hop

Hi James,

Yes I'm using loose_route() and it's returning 1, but BYE message is not routed 
anywhere.

Frame 6213: 673 bytes on wire (5384 bits), 673 bytes captured (5384 bits) 
Ethernet II, Src: Cisco_f8:19:ff (00:22:bd:f8:19:ff), Dst: VMware_bf:27:0b 
(00:50:56:bf:27:0b) Internet Protocol Version 4, Src: 192.168.1.5, Dst: 
192.168.1.2 User Datagram Protocol, Src Port: 16368, Dst Port: 5060 Session 
Initiation Protocol (BYE)
Request-Line: BYE 
sip:192.168.1.1:5060<http://192.168.1.1:5060>;transport=udp SIP/2.0
Message Header
Via: SIP/2.0/UDP 
192.168.1.5:16368;branch=z9hG4bK-d87543-c147891e677a1f19-1--d87543-;rport
Max-Forwards: 70
Route: 
Route: 
Contact: http://sip:131@192.168.1.5:16368>>
To: 
"121"mailto:sip%3A121@192.168.1.1>>;tag=gtyrzghr-CC-1047-OFC-39
From: 
"69079514"mailto:sip%3A69079514@192.168.1.2>>;tag=7d4a7c3c
Call-ID: 085d9048b81abc1eNDUwODVhMjI2NDk5NDM3YmZiZWZiYzI0YWZkOTU1Njc.
[Generated Call-ID: 
085d9048b81abc1eNDUwODVhMjI2NDk5NDM3YmZiZWZiYzI0YWZkOTU1Njc.]
CSeq: 2 BYE
User-Agent: eyeBeam release 1003s stamp 31159
Reason: SIP;description="User Hung Up"
Content-Length: 0

Here is routing block related to BYE:
if (is_method("BYE")) {
xlog("L_INFO","INSIDE BYE");
$var(loose) = loose_route();
xlog("L_INFO","LOOSE : $var(loose)");
}


Regards,

-Original Message-
From: James Browne mailto:ja...@frideo.com>>
Sent: Thursday, November 2, 2023 12:31 PM
To: Kamailio (SER) - Users Mailing List 
mailto:sr-users@lists.kamailio.org>>
Cc: Ali Taher mailto:ata...@vanrise.com>>
Subject: Re: [SR-Users] SIP Proxy : BYE next hop

Hello
Did you call the loose_route() function for the BYE? It should just work; 
that's one of the basics of how kamailio works, so I'll be very surprised if 
there's somehow a bug in kamailio.
If that does not work, perhaps send a list of the listen directives in the 
kamailio.cfg, along with the headers of the two SIP BYE messages (incoming and 
outgoing) and I'll see what I can figure out for you.

James

On Thu, 2 Nov 2023 at 09:35, Ali Taher via sr-users 
mailto:sr-users@lists.kamailio.org>> wrote:
>
> Hello all,
>
>
>
> I’m using Kamailio as SIP proxy between session manager and SBC.
>
> I came across an issue in BYE request where the SBC sent in the header
> list of Routes where first route is Kamailio IP, and the second is SM
> IP, in addition to other routes (last route is the caller party)
>
> What Kamailio did is to route the BYE to the address set in the Request-URI, 
> which is the caller party.
>
> What should be done instead is that Kamailio should remove the Route header 
> including its own IP, and route the BYE to the next hop which is in this case 
> the SM IP.
>
>
>
> How to accomplish that?
>
>
>
> Following is the Route header in the BYE request coming from SBC:
>
> [truncated]Route:
> ,> 
port=udp;lr;av-asset-uid=xx>,http://127.0.0.2>:15060;transport=ud
> p;ibmsid=local._x_x;lr;ibmdrr>,sips:127.0.
> 0.2:15061;ibmsid=local.xx_xx_;lr;ibmdrr,
> sip:SM1@SM_IP;transport=tls;lr;av-asset-uid=xx,
> sip:CALLER_PARTY_IP:5061;transport=tls;lr
>
>
>
> Regards,
>
> __
> Kamailio - Users Mailing List - Non Commercial Discussions To
> unsubscribe send an email to 
> sr-users-le...@lists.kamailio.org<mailto:sr-users-le...@lists.kamailio.org&

[SR-Users] Redis issue when getting results in Kamailio

2023-11-07 Thread Ali Taher via sr-users
Hello all,

I have redis database where the data is inserted in JSON format:

#Redis Command

JSON.GET Index1J:12345678

#Redis Result
[
  {
"SupplierID": "7",
"BCode": "987654",
"Rate": 0.159
  },
  {
"SupplierID": "7",
"BCode": "765432",
"Rate": 0.159
  },
  {
"SupplierID": "7",
"BCode": "5432159",
"Rate": 0.159
  }
]

When I try to get the result using Lua script in Kamailio like the following:
#kamailio command
  if KSR.ndb_redis.redis_cmd("srvN", "JSON.GET pricelistJ:441246890", "ra") then
KSR.xlog.xinfo("array size: $redis(ra=>size)\n");
KSR.xlog.xinfo("Redis Response: " .. tostring(ra) .. "\n")
KSR.xlog.xinfo("first values: $redis(ra=>value[0]) , 
$redis(ra=>value[1])\n");
end

Nov 7 07:58:15 868d08ee318d /usr/sbin/kamailio[72]: INFO: LUA {INVITE}: 

[SR-Users] Re: Redis issue when getting results in Kamailio

2023-11-08 Thread Ali Taher via sr-users
I'm still stuck... I appreciate any assistance here.

From: Ali Taher via sr-users 
Sent: Tuesday, November 7, 2023 12:47 PM
To: Kamailio (SER) - Users Mailing List 
Cc: Ali Taher 
Subject: [SR-Users] Redis issue when getting results in Kamailio

Hello all,

I have redis database where the data is inserted in JSON format:

#Redis Command

JSON.GET Index1J:12345678

#Redis Result
[
  {
"SupplierID": "7",
"BCode": "987654",
"Rate": 0.159
  },
  {
"SupplierID": "7",
"BCode": "765432",
"Rate": 0.159
  },
  {
"SupplierID": "7",
"BCode": "5432159",
"Rate": 0.159
  }
]

When I try to get the result using Lua script in Kamailio like the following:
#kamailio command
  if KSR.ndb_redis.redis_cmd("srvN", "JSON.GET pricelistJ:441246890", "ra") then
KSR.xlog.xinfo("array size: $redis(ra=>size)\n");
KSR.xlog.xinfo("Redis Response: " .. tostring(ra) .. "\n")
KSR.xlog.xinfo("first values: $redis(ra=>value[0]) , 
$redis(ra=>value[1])\n");
end

Nov 7 07:58:15 868d08ee318d /usr/sbin/kamailio[72]: INFO: LUA {INVITE}: 

[SR-Users] Re: Redis issue when getting results in Kamailio

2023-11-09 Thread Ali Taher via sr-users
Hi Yurig,

Yes, GET/SET is working normally from kamailio if not using JSON.

Honestly, I didn’t get what do you mean by the below. Can you please elaborate 
how to fix the issue?

Regards,

From: Yuriy G 
Sent: Thursday, November 9, 2023 10:55 AM
To: Kamailio (SER) - Users Mailing List 
Cc: Ali Taher 
Subject: Re: [SR-Users] Re: Redis issue when getting results in Kamailio

Did you try to use not JSON but usual GET/SET? Do you have the same issue?
AFAIK - ndb_redis is a wrapper oven hiredis wrapper and doesn't implement 
serialisation protocol for redis, so, whatever you send delivered to redis 
being only wrapped via hirer's client library.

Btw if uou use lua < 5.2 you may try redis-lua library. It is easier to use 
with lua.

On Thu, 9 Nov 2023, 09:34 Ali Taher via sr-users, 
mailto:sr-users@lists.kamailio.org>> wrote:
I’m still stuck… I appreciate any assistance here.

From: Ali Taher via sr-users 
mailto:sr-users@lists.kamailio.org>>
Sent: Tuesday, November 7, 2023 12:47 PM
To: Kamailio (SER) - Users Mailing List 
mailto:sr-users@lists.kamailio.org>>
Cc: Ali Taher mailto:ata...@vanrise.com>>
Subject: [SR-Users] Redis issue when getting results in Kamailio

Hello all,

I have redis database where the data is inserted in JSON format:

#Redis Command

JSON.GET Index1J:12345678

#Redis Result
[
  {
"SupplierID": "7",
"BCode": "987654",
"Rate": 0.159
  },
  {
"SupplierID": "7",
"BCode": "765432",
"Rate": 0.159
  },
  {
"SupplierID": "7",
"BCode": "5432159",
"Rate": 0.159
  }
]

When I try to get the result using Lua script in Kamailio like the following:
#kamailio command
  if KSR.ndb_redis.redis_cmd("srvN", "JSON.GET pricelistJ:441246890", "ra") then
KSR.xlog.xinfo("array size: $redis(ra=>size)\n");
KSR.xlog.xinfo("Redis Response: " .. tostring(ra) .. "\n")
KSR.xlog.xinfo("first values: $redis(ra=>value[0]) , 
$redis(ra=>value[1])\n");
end

Nov 7 07:58:15 868d08ee318d /usr/sbin/kamailio[72]: INFO: LUA {INVITE}: 

[SR-Users] pv cache limit is going to be exceeded

2023-11-15 Thread Ali Taher via sr-users
Hello all,

I'm using the following Lua script to fetch data from Redis, which is in form 
of list:

function split(str, delimiter)
for token in string.gmatch(str, "[^" .. delimiter .. "]+") do
return token
end
end

function contains(mainString, subString)
return string.find(mainString, subString, 1, true) ~= nil
end

function longest_match_acode()

local currentSeconds = os.time()
local milliseconds = os.clock() * 1000
local ddate = os.date("%Y-%m-%d %H:%M:%S", currentSeconds) .. 
string.format(".%03d", milliseconds)
KSR.xlog.xinfo("starting date:" ..ddate)

local size = 0
local result

local acode = "29192"
local inputbcode = "4474173"
local delimiter = ":"

while size == 0 do
local currentSeconds = os.time()
acode = string.sub(acode, 1, string.len(acode) 
- 1)
KSR.ndb_redis.redis_cmd("srvN", "LRANGE price:" 
.. acode .." 0 -1", "r")
size = tonumber(KSR.pv.get("$redis(r=>size)"))
end

local left = 0
local right = size - 1

while left <= right do
local currentSeconds = os.time()
local milliseconds = os.clock() * 1000
local ddate = os.date("%Y-%m-%d %H:%M:%S", currentSeconds) .. 
string.format(".%03d", milliseconds)

resultRight = 
tostring(KSR.pv.get("$redis(r=>value[" .. right .. "])"))
resultLeft = 
tostring(KSR.pv.get("$redis(r=>value[" .. left .. "])"))

local bcodeLeft = split(resultLeft, delimiter)
local bcodeRight = split(resultRight, delimiter)

if contains(inputbcode, bcodeRight) then
KSR.xlog.xinfo("Input bcode 
contains bcode value from Redis: " .. resultRight .. " at index: " .. right .. 
" with date: " .. ddate)
end

if contains(inputbcode, bcodeLeft) then
   KSR.xlog.xinfo("Input bcode contains bcode 
value from Redis: " .. resultLeft .. " at index: " .. left .. " with date: " .. 
ddate)
end
left = left + 1
right = right - 1
end
local currentSeconds = os.time()
local milliseconds = os.clock() * 1000
local ddate = os.date("%Y-%m-%d %H:%M:%S", currentSeconds) .. 
string.format(".%03d", milliseconds)
KSR.xlog.xinfo("ending date:" ..ddate)

end

function ksr_request_route()

if KSR.is_INVITE() then
longest_match_acode()
KSR.sl.send_reply("404", "Not found");
end
end

I'm getting the following warning in the log : WARNING: LUA {INVITE}:  
[core/pvapi.c:340]: pv_cache_add(): pv cache limit is going to be exceeded - 
pkg memory may get filled with pv declarations
I think the issue is in the following lines:
resultRight = tostring(KSR.pv.get("$redis(r=>value[" .. right .. "])"))
resultLeft = tostring(KSR.pv.get("$redis(r=>value[" .. left .. "])"))

the list coming from Redis has around 30k items, which I'm iterating through 
using value[x] which is exhausting the pv declaration as per my understanding.
How to overcome this issue? Is it possible to save the list as an array 
variable and then iterate through that array?

Regards,
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: pv cache limit is going to be exceeded

2023-11-16 Thread Ali Taher via sr-users
Hello all,

If the data returned from redis is of type array, and if I want to iterate 
through all the elements in the array, then I have to get $redis(r=>value[x]) 
for each element, and a pseudo variable for each element is allocated in the 
memory, is that correct?

Regards,


From: Ali Taher via sr-users 
Sent: Wednesday, November 15, 2023 4:51 PM
To: Kamailio (SER) - Users Mailing List 
Cc: Ali Taher 
Subject: [SR-Users] pv cache limit is going to be exceeded

Hello all,

I'm using the following Lua script to fetch data from Redis, which is in form 
of list:

function split(str, delimiter)
for token in string.gmatch(str, "[^" .. delimiter .. "]+") do
return token
end
end

function contains(mainString, subString)
return string.find(mainString, subString, 1, true) ~= nil
end

function longest_match_acode()

local currentSeconds = os.time()
local milliseconds = os.clock() * 1000
local ddate = os.date("%Y-%m-%d %H:%M:%S", currentSeconds) .. 
string.format(".%03d", milliseconds)
KSR.xlog.xinfo("starting date:" ..ddate)

local size = 0
local result

local acode = "29192"
local inputbcode = "4474173"
local delimiter = ":"

while size == 0 do
local currentSeconds = os.time()
acode = string.sub(acode, 1, string.len(acode) 
- 1)
KSR.ndb_redis.redis_cmd("srvN", "LRANGE price:" 
.. acode .." 0 -1", "r")
size = tonumber(KSR.pv.get("$redis(r=>size)"))
end

local left = 0
local right = size - 1

while left <= right do
local currentSeconds = os.time()
local milliseconds = os.clock() * 1000
local ddate = os.date("%Y-%m-%d %H:%M:%S", currentSeconds) .. 
string.format(".%03d", milliseconds)

resultRight = 
tostring(KSR.pv.get("$redis(r=>value[" .. right .. "])"))
resultLeft = 
tostring(KSR.pv.get("$redis(r=>value[" .. left .. "])"))

local bcodeLeft = split(resultLeft, delimiter)
local bcodeRight = split(resultRight, delimiter)

if contains(inputbcode, bcodeRight) then
KSR.xlog.xinfo("Input bcode 
contains bcode value from Redis: " .. resultRight .. " at index: " .. right .. 
" with date: " .. ddate)
end

if contains(inputbcode, bcodeLeft) then
   KSR.xlog.xinfo("Input bcode contains bcode 
value from Redis: " .. resultLeft .. " at index: " .. left .. " with date: " .. 
ddate)
end
left = left + 1
right = right - 1
end
local currentSeconds = os.time()
local milliseconds = os.clock() * 1000
local ddate = os.date("%Y-%m-%d %H:%M:%S", currentSeconds) .. 
string.format(".%03d", milliseconds)
KSR.xlog.xinfo("ending date:" ..ddate)

end

function ksr_request_route()

if KSR.is_INVITE() then
longest_match_acode()
KSR.sl.send_reply("404", "Not found");
end
end

I'm getting the following warning in the log : WARNING: LUA {INVITE}:  
[core/pvapi.c:340]: pv_cache_add(): pv cache limit is going to be exceeded - 
pkg memory may get filled with pv declarations
I think the issue is in the following lines:
resultRight = tostring(KSR.pv.get("$redis(r=>value[" .. right .. "])"))
resultLeft = tostring(KSR.pv.get("$redis(r=>value[" .. left .. "])"))

the list coming from Redis has around 30k items, which I'm iterating through 
using value[x] which is exhausting the pv declaration as per my understanding.
How to overcome this issue? Is it possible to save the list as an array 
variable and then iterate through that array?

Regards,
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: pv cache limit is going to be exceeded

2023-11-17 Thread Ali Taher via sr-users
Thanks Daniel,

Works like a charm!

Regards,


From: Daniel-Constantin Mierla 
Sent: Friday, November 17, 2023 10:17 AM
To: Kamailio (SER) - Users Mailing List 
Cc: Ali Taher 
Subject: Re: [SR-Users] Re: pv cache limit is going to be exceeded


Hello,

the way the pseudo-variables were designed makes different definitions for 
$redis(r=>value[i] and $redis(r=>value[j], practically, if you have the index 
going on a large range, then you define a lot of variables. The solution is to 
leverage another pseduo-variable that you set with the index, like:

KSR.pvx.var_seti("i", right);

resultRight = tostring(KSR.pv.get("$redis(r=>value[$var(i)])"));

KSR.pvx.var_seti("i", left);

resultLeft = tostring(KSR.pv.get("$redis(r=>value[$var(i)])"));

Cheers,
Daniel
On 16.11.23 10:46, Ali Taher via sr-users wrote:
Hello all,

If the data returned from redis is of type array, and if I want to iterate 
through all the elements in the array, then I have to get $redis(r=>value[x]) 
for each element, and a pseudo variable for each element is allocated in the 
memory, is that correct?

Regards,


From: Ali Taher via sr-users 
<mailto:sr-users@lists.kamailio.org>
Sent: Wednesday, November 15, 2023 4:51 PM
To: Kamailio (SER) - Users Mailing List 
<mailto:sr-users@lists.kamailio.org>
Cc: Ali Taher <mailto:ata...@vanrise.com>
Subject: [SR-Users] pv cache limit is going to be exceeded

Hello all,

I’m using the following Lua script to fetch data from Redis, which is in form 
of list:

function split(str, delimiter)
for token in string.gmatch(str, "[^" .. delimiter .. "]+") do
return token
end
end

function contains(mainString, subString)
return string.find(mainString, subString, 1, true) ~= nil
end

function longest_match_acode()

local currentSeconds = os.time()
local milliseconds = os.clock() * 1000
local ddate = os.date("%Y-%m-%d %H:%M:%S", currentSeconds) .. 
string.format(".%03d", milliseconds)
KSR.xlog.xinfo("starting date:" ..ddate)

local size = 0
local result

local acode = "29192"
local inputbcode = "4474173"
local delimiter = ":"

while size == 0 do
local currentSeconds = os.time()
acode = string.sub(acode, 1, string.len(acode) 
- 1)
KSR.ndb_redis.redis_cmd("srvN", "LRANGE price:" 
.. acode .." 0 -1", "r")
size = tonumber(KSR.pv.get("$redis(r=>size)"))
end

local left = 0
local right = size - 1

while left <= right do
local currentSeconds = os.time()
local milliseconds = os.clock() * 1000
local ddate = os.date("%Y-%m-%d %H:%M:%S", currentSeconds) .. 
string.format(".%03d", milliseconds)

resultRight = 
tostring(KSR.pv.get("$redis(r=>value[" .. right .. "])"))
resultLeft = 
tostring(KSR.pv.get("$redis(r=>value[" .. left .. "])"))

local bcodeLeft = split(resultLeft, delimiter)
local bcodeRight = split(resultRight, delimiter)

if contains(inputbcode, bcodeRight) then
KSR.xlog.xinfo("Input bcode 
contains bcode value from Redis: " .. resultRight .. " at index: " .. right .. 
" with date: " .. ddate)
end

if contains(inputbcode, bcodeLeft) then
   KSR.xlog.xinfo("Input bcode contains bcode 
value from Redis: " .. resultLeft .. " at index: " .. left .. " with date: " .. 
ddate)
end
left = left + 1
right = right - 1
end
local currentSeconds = os.time()
local milliseconds = os.clock() * 1000
local ddate = os.date("%Y-%m-%d %H:%M:%S", currentSeconds) .. 
string.format(".%03d", milliseconds)
KSR.xlog.xinfo("ending date:" ..ddate)

end

function ksr_request_route()

if KSR.is_INVITE() then
longest_match_acode()
KSR.sl.send_reply("404", "Not found");
end
end

I’m getting the following warning in the log : WARNING: LUA {INVITE}:  
[core/pvapi.c:340]: pv_cache_add(): pv cache limit is going to be exceeded - 
pkg memory may get fil

[SR-Users] print_dset(): no r-uri or branches

2023-12-06 Thread Ali Taher via sr-users
Hello all,

I'm using Kamailio as SIP redirect where I'm appending the contact header then 
send reply back using sl_send_reply("300","Multiple Choices").

But I'm getting "print_dset(): no r-uri or branches" as warning in the log and 
no packet is sent back from Kamailio to the original sender.

I'm using same Kamailio configuration in another setup and it's working 
correctly without facing this error.

I'm not able to detect the issue. Can you please assist?

Regards,
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Kamailio cluster options

2024-08-22 Thread Ali Taher via sr-users
Hello all,

I'm using Kamailio as SIP redirect (act as routing decision for SBC) depending 
mainly on sqlops and db_postgres modules, and it's working perfectly.

What I need now is to have a kind of cluster of Kamailio servers for high 
availability purpose.

What is the best option for me ?

BR
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe: