Re: [SR-Users] database reconnection db_unixodbc

2019-01-26 Thread Karthik Srinivasan
Hello Henning,

Regarding your question about whether the auto_reconnect parameter was set
or not, I had it set to auto_reconnect but unfortunately it made no
difference.

On another note,  I received your comment on github about core file and gdb
trace.  I will look into getting that info to you.

Thank you.

Karthik

On Fri, Jan 25, 2019 at 3:16 AM Henning Westerholt  wrote:

> Am Mittwoch, 23. Januar 2019, 18:13:26 CET schrieb Karthik Srinivasan:
> > An update regarding this item:
> >
> > I have tested release 5.1.x and 5.2.x and neither release resolves the
> > issue.
> >
> > However I did notice in the master branch that there is new code that is
> > related to this issue.
> >
> > https://github.com/kamailio/kamailio/issues/1681
>
> Hello Karthik,
>
> indeed in current git master there is an extension in the sqlops module to
> allow the startup with an offline database.
>
> > In issue 1681 there is code that allows Kamailio to start even if a
> > database connection can not be established.  Queries attempting to run
> > against the offline database fail gracefully.  And once the database is
> > back online, a connection is established and queries against it are
> > successful.
> >
> > However, if at some later point I shut down the database, we're back to
> the
> > original issue that i reported.  Kamailio crashes with the same output as
> > listed before except the first query that is attempted against the
> offline
> > db causes the crash in this master branch unlike previously (branch
> 5.0.x,
> > 5.1.x, 5.2.x) the first attempt fails, tries again and fails, and the
> > second attempt causes the crash.  Regardless, the output is more or less
> > the same and Kamailio is down.
>
> This is probably because the purpose of this extensions was extending the
> startup process and not especially targeted to this re-connection. This is
> usually handled in the db_* modules.
>
> > I suspect this might be the same behavior even if one is not using an
> odbc
> > driver; but maybe not.
>
> The db_unixodbc module supports the auto_reconnect (as other db_*
> modules). Do
> you enabled or disabled this parameter?
>
> > Anyways, i will open an issue on github for this and hopefully the code
> > change to resolve this is relatively straightforward.
>
> Thank you.
>
> Best regards,
>
> Henning
>
> > Henning, thanks again for your feedback on this.
> >
> > Karthik
> >
> >
> >
> >
> > On Mon, Jan 21, 2019 at 9:09 AM Karthik Srinivasan <
> ksriniva2...@gmail.com>
> >
> > wrote:
> > > Henning,
> > >
> > > Thank you for the response.
> > >
> > > I will open an issue and test out the latest releases.
> > >
> > > Thanks again for the feedback.
> > >
> > > Karthik
> > >
> > > On Sun, Jan 20, 2019 at 9:31 AM Henning Westerholt 
> > >
> > > wrote:
> > >> Am Freitag, 18. Januar 2019, 18:28:09 CET schrieb Karthik Srinivasan:
> > >> > I am testing how kamailio reacts to various database conditions.
>  One
> > >>
> > >> such
> > >>
> > >> > condition is if the database engine is simply shut down (that is,
> > >>
> > >> database
> > >>
> > >> > server process no longer running, tcp listening socket closed,
> etc...)
> > >> >
> > >> > I am utilizing the db_unixodbc module to connect to an Informix
> > >> > database
> > >> > engine.
> > >> >
> > >> > I am currently running on Kamailio version 5.0.
> > >> >
> > >> > I have a test query that executes against the database engine every
> 10
> > >> > seconds.
> > >> >
> > >> > Here is what i have noticed if i shut down the database engine at
> some
> > >> > point after i run Kamailio.
> > >> >
> > >> > the first test query that attempts to run against the db engine
> fails;
> > >>
> > >> it
> > >>
> > >> > tries to reconnect and fails.
> > >> >
> > >> > The second test query (10 seconds after the 1st) results in a
> SIG_CHILD
> > >>
> > >> and
> > >>
> > >> > shuts down the entire Kamailio process.
> > >> >
> > >> > Has anyone experienced this?  Is there a solution to this?   Ideally
> > >> > the
> > >> > second query should also

Re: [SR-Users] database reconnection db_unixodbc

2019-01-23 Thread Karthik Srinivasan
An update regarding this item:

I have tested release 5.1.x and 5.2.x and neither release resolves the
issue.

However I did notice in the master branch that there is new code that is
related to this issue.

https://github.com/kamailio/kamailio/issues/1681

In issue 1681 there is code that allows Kamailio to start even if a
database connection can not be established.  Queries attempting to run
against the offline database fail gracefully.  And once the database is
back online, a connection is established and queries against it are
successful.

However, if at some later point I shut down the database, we're back to the
original issue that i reported.  Kamailio crashes with the same output as
listed before except the first query that is attempted against the offline
db causes the crash in this master branch unlike previously (branch 5.0.x,
5.1.x, 5.2.x) the first attempt fails, tries again and fails, and the
second attempt causes the crash.  Regardless, the output is more or less
the same and Kamailio is down.

I suspect this might be the same behavior even if one is not using an odbc
driver; but maybe not.

Anyways, i will open an issue on github for this and hopefully the code
change to resolve this is relatively straightforward.

Henning, thanks again for your feedback on this.

Karthik




On Mon, Jan 21, 2019 at 9:09 AM Karthik Srinivasan 
wrote:

> Henning,
>
> Thank you for the response.
>
> I will open an issue and test out the latest releases.
>
> Thanks again for the feedback.
>
> Karthik
>
> On Sun, Jan 20, 2019 at 9:31 AM Henning Westerholt 
> wrote:
>
>> Am Freitag, 18. Januar 2019, 18:28:09 CET schrieb Karthik Srinivasan:
>> > I am testing how kamailio reacts to various database conditions.   One
>> such
>> > condition is if the database engine is simply shut down (that is,
>> database
>> > server process no longer running, tcp listening socket closed, etc...)
>> >
>> > I am utilizing the db_unixodbc module to connect to an Informix database
>> > engine.
>> >
>> > I am currently running on Kamailio version 5.0.
>> >
>> > I have a test query that executes against the database engine every 10
>> > seconds.
>> >
>> > Here is what i have noticed if i shut down the database engine at some
>> > point after i run Kamailio.
>> >
>> > the first test query that attempts to run against the db engine fails;
>> it
>> > tries to reconnect and fails.
>> >
>> > The second test query (10 seconds after the 1st) results in a SIG_CHILD
>> and
>> > shuts down the entire Kamailio process.
>> >
>> > Has anyone experienced this?  Is there a solution to this?   Ideally the
>> > second query should also fail and return gracefully; and ideally queries
>> > continue to fail until the database engine is back up.
>>
>> Hello Karthik,
>>
>> Kamailio should not crash because of this error. The db_unixodbc module
>> is not
>> that widely used (compared to db_mysql), but nevertheless it shouldn't
>> crash.
>>
>> Can you create an issue in our tracker on github for this:
>> https://github.com/kamailio/kamailio/issues
>>
>> It would be great if you can also try with the latest stable version of
>> 5.1.x
>> or 5.2.x, there have been some changes in the db_unixodbc module since
>> the
>> release of 5.0.
>>
>> Best regards,
>>
>> Henning
>>
>> > See logs below:
>> >
>> > Jan 17 20:07:25 [29297]: INFO: (s)  SQL query: FIRST TEST QUERY
>> > Jan 17 20:07:25 [29297]: ERROR: db_unixodbc [dbase.c:135]:
>> > db_unixodbc_submit_query(): rv=-1. Query= FIRST TEST QUERY
>> > Jan 17 20:07:25 [29297]: ERROR: db_unixodbc [connection.c:220]:
>> > db_unixodbc_extract_error():
>> > unixodbc:SQLExecDirect=08S01:1:-11020:[Informix][Informix ODBC
>> > Driver]Communication link failure.
>> > Jan 17 20:07:25 [29297]: ERROR: db_unixodbc [dbase.c:59]: reconnect():
>> > Attempting DB reconnect
>> > Jan 17 20:07:25 [29297]: ERROR: db_unixodbc [dbase.c:74]: reconnect():
>> > failed to connect
>> > Jan 17 20:07:25 [29297]: ERROR: db_unixodbc [connection.c:220]:
>> > db_unixodbc_extract_error():
>> > unixodbc:SQLDriverConnect=08002:1:0:[unixODBC][Driver Manager]Connection
>> > name in use
>> > Jan 17 20:07:25 [29297]: ERROR: db_unixodbc [connection.c:220]:
>> > db_unixodbc_extract_error():
>> > unixodbc:SQLDriverConnect=HY010:2:-11067:[Informix][Informix ODBC
>> > Driver]Function sequence error.
>> > Jan 17 20:07:25 [29297]: ERROR:  [db_query.c:181]:
&

Re: [SR-Users] database reconnection db_unixodbc

2019-01-21 Thread Karthik Srinivasan
Henning,

Thank you for the response.

I will open an issue and test out the latest releases.

Thanks again for the feedback.

Karthik

On Sun, Jan 20, 2019 at 9:31 AM Henning Westerholt  wrote:

> Am Freitag, 18. Januar 2019, 18:28:09 CET schrieb Karthik Srinivasan:
> > I am testing how kamailio reacts to various database conditions.   One
> such
> > condition is if the database engine is simply shut down (that is,
> database
> > server process no longer running, tcp listening socket closed, etc...)
> >
> > I am utilizing the db_unixodbc module to connect to an Informix database
> > engine.
> >
> > I am currently running on Kamailio version 5.0.
> >
> > I have a test query that executes against the database engine every 10
> > seconds.
> >
> > Here is what i have noticed if i shut down the database engine at some
> > point after i run Kamailio.
> >
> > the first test query that attempts to run against the db engine fails;
> it
> > tries to reconnect and fails.
> >
> > The second test query (10 seconds after the 1st) results in a SIG_CHILD
> and
> > shuts down the entire Kamailio process.
> >
> > Has anyone experienced this?  Is there a solution to this?   Ideally the
> > second query should also fail and return gracefully; and ideally queries
> > continue to fail until the database engine is back up.
>
> Hello Karthik,
>
> Kamailio should not crash because of this error. The db_unixodbc module is
> not
> that widely used (compared to db_mysql), but nevertheless it shouldn't
> crash.
>
> Can you create an issue in our tracker on github for this:
> https://github.com/kamailio/kamailio/issues
>
> It would be great if you can also try with the latest stable version of
> 5.1.x
> or 5.2.x, there have been some changes in the db_unixodbc module since the
> release of 5.0.
>
> Best regards,
>
> Henning
>
> > See logs below:
> >
> > Jan 17 20:07:25 [29297]: INFO: (s)  SQL query: FIRST TEST QUERY
> > Jan 17 20:07:25 [29297]: ERROR: db_unixodbc [dbase.c:135]:
> > db_unixodbc_submit_query(): rv=-1. Query= FIRST TEST QUERY
> > Jan 17 20:07:25 [29297]: ERROR: db_unixodbc [connection.c:220]:
> > db_unixodbc_extract_error():
> > unixodbc:SQLExecDirect=08S01:1:-11020:[Informix][Informix ODBC
> > Driver]Communication link failure.
> > Jan 17 20:07:25 [29297]: ERROR: db_unixodbc [dbase.c:59]: reconnect():
> > Attempting DB reconnect
> > Jan 17 20:07:25 [29297]: ERROR: db_unixodbc [dbase.c:74]: reconnect():
> > failed to connect
> > Jan 17 20:07:25 [29297]: ERROR: db_unixodbc [connection.c:220]:
> > db_unixodbc_extract_error():
> > unixodbc:SQLDriverConnect=08002:1:0:[unixODBC][Driver Manager]Connection
> > name in use
> > Jan 17 20:07:25 [29297]: ERROR: db_unixodbc [connection.c:220]:
> > db_unixodbc_extract_error():
> > unixodbc:SQLDriverConnect=HY010:2:-11067:[Informix][Informix ODBC
> > Driver]Function sequence error.
> > Jan 17 20:07:25 [29297]: ERROR:  [db_query.c:181]:
> db_do_raw_query():
> > error while submitting query
> > Jan 17 20:07:25 [29297]: ERROR: sqlops [sql_api.c:265]: sql_do_query():
> > cannot do the query FIRST TEST QUERY
> > Jan 17 20:07:25 [29297]: INFO: (s) [123] SQL ret: fail (-1)
> > Jan 17 20:07:25 [29297]: INFO: (s) [123] SQL res: no rows
> > Jan 17 20:07:35 [29297]: INFO: (s) [123] SQL query: 10 seconds later the
> > SECOND TEST QUERY (it's the same query as the first one)
> > Jan 17 20:07:35 [29301]: CRITICAL:  [core/pass_fd.c:277]:
> > receive_fd(): EOF on 28
> > Jan 17 20:07:35 [29283]: ALERT:  [main.c:744]: handle_sigs(): child
> > process 29297 exited by a signal 11
> > Jan 17 20:07:35 [29283]: ALERT:  [main.c:747]: handle_sigs(): core
> > was not generated
> > Jan 17 20:07:35 [29283]: INFO:  [main.c:759]: handle_sigs():
> > terminating due to SIGCHLD
> > Jan 17 20:07:35 [29301]: INFO:  [main.c:814]: sig_usr(): signal 15
> > received
> > Jan 17 20:07:35 [29295]: INFO:  [main.c:814]: sig_usr(): signal 15
> > received
> > Jan 17 20:07:35 [29291]: INFO:  [main.c:814]: sig_usr(): signal 15
> > received
> > Jan 17 20:07:35 [29288]: INFO:  [main.c:814]: sig_usr(): signal 15
> > received
> > Jan 17 20:07:35 [29300]: INFO:  [main.c:814]: sig_usr(): signal 15
> > received
> > Jan 17 20:07:35 [29284]: INFO:  [main.c:814]: sig_usr(): signal 15
> > received
> > Jan 17 20:07:35 [29286]: INFO:  [main.c:814]: sig_usr(): signal 15
> > received
> > Jan 17 20:07:35 [29293]: INFO:  [main.c:814]: sig_usr(): signal 15
> > received
> > Jan 17 20:07:35 [29289]: INFO:  [main

[SR-Users] database reconnection db_unixodbc

2019-01-18 Thread Karthik Srinivasan
Hello,

I am testing how kamailio reacts to various database conditions.   One such
condition is if the database engine is simply shut down (that is, database
server process no longer running, tcp listening socket closed, etc...)

I am utilizing the db_unixodbc module to connect to an Informix database
engine.

I am currently running on Kamailio version 5.0.

I have a test query that executes against the database engine every 10
seconds.

Here is what i have noticed if i shut down the database engine at some
point after i run Kamailio.

the first test query that attempts to run against the db engine fails;  it
tries to reconnect and fails.

The second test query (10 seconds after the 1st) results in a SIG_CHILD and
shuts down the entire Kamailio process.

Has anyone experienced this?  Is there a solution to this?   Ideally the
second query should also fail and return gracefully; and ideally queries
continue to fail until the database engine is back up.

See logs below:

Jan 17 20:07:25 [29297]: INFO: (s)  SQL query: FIRST TEST QUERY
Jan 17 20:07:25 [29297]: ERROR: db_unixodbc [dbase.c:135]:
db_unixodbc_submit_query(): rv=-1. Query= FIRST TEST QUERY
Jan 17 20:07:25 [29297]: ERROR: db_unixodbc [connection.c:220]:
db_unixodbc_extract_error():
unixodbc:SQLExecDirect=08S01:1:-11020:[Informix][Informix ODBC
Driver]Communication link failure.
Jan 17 20:07:25 [29297]: ERROR: db_unixodbc [dbase.c:59]: reconnect():
Attempting DB reconnect
Jan 17 20:07:25 [29297]: ERROR: db_unixodbc [dbase.c:74]: reconnect():
failed to connect
Jan 17 20:07:25 [29297]: ERROR: db_unixodbc [connection.c:220]:
db_unixodbc_extract_error():
unixodbc:SQLDriverConnect=08002:1:0:[unixODBC][Driver Manager]Connection
name in use
Jan 17 20:07:25 [29297]: ERROR: db_unixodbc [connection.c:220]:
db_unixodbc_extract_error():
unixodbc:SQLDriverConnect=HY010:2:-11067:[Informix][Informix ODBC
Driver]Function sequence error.
Jan 17 20:07:25 [29297]: ERROR:  [db_query.c:181]: db_do_raw_query():
error while submitting query
Jan 17 20:07:25 [29297]: ERROR: sqlops [sql_api.c:265]: sql_do_query():
cannot do the query FIRST TEST QUERY
Jan 17 20:07:25 [29297]: INFO: (s) [123] SQL ret: fail (-1)
Jan 17 20:07:25 [29297]: INFO: (s) [123] SQL res: no rows
Jan 17 20:07:35 [29297]: INFO: (s) [123] SQL query: 10 seconds later the
SECOND TEST QUERY (it's the same query as the first one)
Jan 17 20:07:35 [29301]: CRITICAL:  [core/pass_fd.c:277]:
receive_fd(): EOF on 28
Jan 17 20:07:35 [29283]: ALERT:  [main.c:744]: handle_sigs(): child
process 29297 exited by a signal 11
Jan 17 20:07:35 [29283]: ALERT:  [main.c:747]: handle_sigs(): core
was not generated
Jan 17 20:07:35 [29283]: INFO:  [main.c:759]: handle_sigs():
terminating due to SIGCHLD
Jan 17 20:07:35 [29301]: INFO:  [main.c:814]: sig_usr(): signal 15
received
Jan 17 20:07:35 [29295]: INFO:  [main.c:814]: sig_usr(): signal 15
received
Jan 17 20:07:35 [29291]: INFO:  [main.c:814]: sig_usr(): signal 15
received
Jan 17 20:07:35 [29288]: INFO:  [main.c:814]: sig_usr(): signal 15
received
Jan 17 20:07:35 [29300]: INFO:  [main.c:814]: sig_usr(): signal 15
received
Jan 17 20:07:35 [29284]: INFO:  [main.c:814]: sig_usr(): signal 15
received
Jan 17 20:07:35 [29286]: INFO:  [main.c:814]: sig_usr(): signal 15
received
Jan 17 20:07:35 [29293]: INFO:  [main.c:814]: sig_usr(): signal 15
received
Jan 17 20:07:35 [29289]: INFO:  [main.c:814]: sig_usr(): signal 15
received
Jan 17 20:07:35 [29287]: INFO:  [main.c:814]: sig_usr(): signal 15
received
Jan 17 20:07:35 [29292]: INFO:  [main.c:814]: sig_usr(): signal 15
received
Jan 17 20:07:35 [29296]: INFO:  [main.c:814]: sig_usr(): signal 15
received
Jan 17 20:07:35 [29298]: INFO:  [main.c:814]: sig_usr(): signal 15
received
Jan 17 20:07:35 [29299]: INFO:  [main.c:814]: sig_usr(): signal 15
received
Jan 17 20:07:35 [29285]: INFO:  [main.c:814]: sig_usr(): signal 15
received
Jan 17 20:07:35 [29294]: INFO:  [main.c:814]: sig_usr(): signal 15
received
Jan 17 20:07:35 [29290]: INFO:  [main.c:814]: sig_usr(): signal 15
received
Jan 17 20:07:35 [29283]: INFO:  [core/sctp_core.c:53]:
sctp_core_destroy(): SCTP API not initialized

Thank you,

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


Re: [SR-Users] database connections per child process

2018-11-22 Thread Karthik Srinivasan
Thank you, Daniel and Mojtaba, for your responses.

This was more of a curiosity factor for me as i was trying to nail down
what governed the database connection count behavior.

The answers you have provided me are more than adequate.  No need to
further debug this item;

I appreciate the prompt responses and I thank you again.

Karthik

On Thu, Nov 22, 2018 at 4:40 AM Daniel-Constantin Mierla 
wrote:

> Hello,
>
> in general, kamailio modules reuse the connection if the target is the
> same database server and database name. That makes it like one connection
> to database server per kamailio process.
>
> However, there are some modules that may request a dedicated database
> connection, not willing to reuse with other modules (iirc, some of the
> presence related modules should need it).
>
> Then note that there are more processed than the value of children and the
> relation with the listen socket, for example timer processes.
>
> You can execute 'kamctl ps' and you will get the list of the processes
> created by kamailio with a short description about their purposes.
>
> In other words, there is no exact formula, what we can do is to check if
> you got the expected number of connections, for that you have to provide:
>
>   * the output of 'kamctl srv sockets'
>   * the output of 'kamctl ps'
>   * the list of loaded modules (enabled loadmodule lines in the config)
>   * after that, we may need extra details, like the values for some
> modparams set for couple of modules(like db_url, sqlcon, ...)
>
> Cheers,
> Daniel
> On 22.11.18 05:01, Karthik Srinivasan wrote:
>
> Hello,
>
> Is there a formula/algorithm that determines how many TCP connections are
> made per child process to a database server defined by sqlops' sqlcon
> parameter?
>
> ex: if i have 1 database on a database server defined by sqlcon, and i
> have 1 UDP child process, i notice that the child process has made 2 TCP
> connections to the database server.
> ex: if i have 3 databases on the same database server defined by 3 sqlcon
> statements (1 pertaining to each database) and i have 4 UDP child
> processes, i notice that each child process makes 4 TCP connections to the
> database server.
> ex: if i have 3 databases on the same database server defined by 3 sqlcon
> statements (1 pertaining to each database) and i have 6 TCP child
> processes, i notice that each child process makes 4 TCP connections to the
> database server.
>
> Basically wanting to know what governs the number of tcp connections a
> child process makes to a particular database server.
>
> Thank you,
>
> Karthik
>
> ___
> Kamailio (SER) - Users Mailing 
> Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
> --
> Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- 
> www.linkedin.com/in/miconda
> Kamailio World Conference -- www.kamailioworld.com
> Kamailio Advanced Training, Nov 12-14, 2018, in Berlin -- www.asipto.com
>
>
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] database connections per child process

2018-11-21 Thread Karthik Srinivasan
Hello,

Is there a formula/algorithm that determines how many TCP connections are
made per child process to a database server defined by sqlops' sqlcon
parameter?

ex: if i have 1 database on a database server defined by sqlcon, and i have
1 UDP child process, i notice that the child process has made 2 TCP
connections to the database server.
ex: if i have 3 databases on the same database server defined by 3 sqlcon
statements (1 pertaining to each database) and i have 4 UDP child
processes, i notice that each child process makes 4 TCP connections to the
database server.
ex: if i have 3 databases on the same database server defined by 3 sqlcon
statements (1 pertaining to each database) and i have 6 TCP child
processes, i notice that each child process makes 4 TCP connections to the
database server.

Basically wanting to know what governs the number of tcp connections a
child process makes to a particular database server.

Thank you,

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


Re: [SR-Users] uri==myself

2018-07-20 Thread Karthik Srinivasan
Please disregard the follow up question i posted.

I misled myself in thinking the variables themselves were being populated
by defaulted ports.  rather it's the check to ==myself that's doing it.

thanks again.

Karthik

On Fri, Jul 20, 2018 at 11:36 AM, Karthik Srinivasan  wrote:

> One follow up question here:
>
> Can you point me to the location of the source code that unpacks the
> request uri/from uri and sticks them into the $ru/$fu pseudo vars please.
>
> I already have confirmed (via testing) that $ru won't have a defaulted
> port set to it if no port exists in the request uri.
>
> I want to confirm within the code that $fu behaves the same.   That is, no
> default port is going to get set if no port exists in the from uri.
> Confirming via code will help me put this issue; provide confidence that i
> am using the right variables here.
>
> I did confirm via code (thank to your help) that the variable "from_uri"
> will have a default port set just like the "uri" variable.
>
> Thanks,
>
> Karthik
>
>
> On Fri, Jul 20, 2018 at 10:26 AM, Karthik Srinivasan <
> ksriniva2...@gmail.com> wrote:
>
>> Yes, i see it defaulting there.  Thanks again for the help.
>>
>> Karthik
>>
>> On Fri, Jul 20, 2018 at 7:57 AM, Daniel-Constantin Mierla <
>> mico...@gmail.com> wrote:
>>
>>> The evaluation for uri==myself condition is done inside src/core/route.c
>>> starting with line 1817. I see there that it takes default SIP port if none
>>> is set in the r-uri.
>>>
>>> Cheers,
>>> Daniel
>>>
>>> On 20.07.18 06:48, Karthik Srinivasan wrote:
>>>
>>> So, i think i have determined the root cause of my issue:
>>>
>>> Background info:
>>>  - I have a request URI of an INVITE that contains no port number.
>>>  - My application is not listening on the default port of 5060
>>>
>>> The is_myself(...) function handles a 'no port in request uri'
>>> differently than uri==myself.
>>>
>>> By that i mean, is_myself(...) does not default the port to 5060 when
>>> looking up aliases/(which ip addresses and ports the process is bound to);
>>> it simply does not take port number into account (if no port exists in
>>> request uri) when searching the alias list.  BUT,  uri==myself does default
>>> to 5060 and hence tries to find an alias binding to 5060.
>>>
>>> So, is_myself("$ru") passes in my case;  uri==myself fails.
>>>
>>> Can you point me to the place in the source code where 5060 is being set
>>> as default to the uri variable when request uri has no port number please?
>>>
>>> I don't intend to change this defaulting behavior; I am just curious
>>> where it is set.
>>>
>>> Thanks,
>>>
>>> Karthik
>>>
>>> On Thu, Jul 19, 2018 at 3:37 PM, Karthik Srinivasan <
>>> ksriniva2...@gmail.com> wrote:
>>>
>>>> standby,  i have the debug mode spitting out tons of logs now.
>>>>
>>>> time for me to review.
>>>>
>>>> will let you know if i need help.
>>>>
>>>> thanks,
>>>>
>>>> karthik
>>>>
>>>> On Thu, Jul 19, 2018 at 3:15 PM, Karthik Srinivasan <
>>>> ksriniva2...@gmail.com> wrote:
>>>>
>>>>> Unfortunately same result as before:
>>>>>
>>>>>  $var(myself) = 0;
>>>>>if (uri =~ "" || uri == myself){
>>>>>   $var(myself) = 1;
>>>>>   xlog("L_INFO", "[$ci] in uri == myself check: var myself =
>>>>> $var(myself)");
>>>>>}
>>>>>
>>>>>if (uri =~ "" || is_myself("$ru")){
>>>>>   $var(myself) = 1;
>>>>>   xlog("L_INFO", "[$ci] in is_myself check: var myself =
>>>>> $var(myself)");
>>>>>}
>>>>>
>>>>> The only log that prints out is the one that says 'in is_myself check
>>>>> ...'(the second if statement.)
>>>>>
>>>>> I have verified that if there's a regular expression match then both
>>>>> log writes print.  Regular expression match happens when a SIP REGISTER
>>>>> request comes across the pipe.
>>>>>
>>>>> Something odd is going on with the computation of  uri == myself vs
>>>>> is_myself("$ru").
>>>>>
>>

Re: [SR-Users] uri==myself

2018-07-20 Thread Karthik Srinivasan
One follow up question here:

Can you point me to the location of the source code that unpacks the
request uri/from uri and sticks them into the $ru/$fu pseudo vars please.

I already have confirmed (via testing) that $ru won't have a defaulted port
set to it if no port exists in the request uri.

I want to confirm within the code that $fu behaves the same.   That is, no
default port is going to get set if no port exists in the from uri.
Confirming via code will help me put this issue; provide confidence that i
am using the right variables here.

I did confirm via code (thank to your help) that the variable "from_uri"
will have a default port set just like the "uri" variable.

Thanks,

Karthik


On Fri, Jul 20, 2018 at 10:26 AM, Karthik Srinivasan  wrote:

> Yes, i see it defaulting there.  Thanks again for the help.
>
> Karthik
>
> On Fri, Jul 20, 2018 at 7:57 AM, Daniel-Constantin Mierla <
> mico...@gmail.com> wrote:
>
>> The evaluation for uri==myself condition is done inside src/core/route.c
>> starting with line 1817. I see there that it takes default SIP port if none
>> is set in the r-uri.
>>
>> Cheers,
>> Daniel
>>
>> On 20.07.18 06:48, Karthik Srinivasan wrote:
>>
>> So, i think i have determined the root cause of my issue:
>>
>> Background info:
>>  - I have a request URI of an INVITE that contains no port number.
>>  - My application is not listening on the default port of 5060
>>
>> The is_myself(...) function handles a 'no port in request uri'
>> differently than uri==myself.
>>
>> By that i mean, is_myself(...) does not default the port to 5060 when
>> looking up aliases/(which ip addresses and ports the process is bound to);
>> it simply does not take port number into account (if no port exists in
>> request uri) when searching the alias list.  BUT,  uri==myself does default
>> to 5060 and hence tries to find an alias binding to 5060.
>>
>> So, is_myself("$ru") passes in my case;  uri==myself fails.
>>
>> Can you point me to the place in the source code where 5060 is being set
>> as default to the uri variable when request uri has no port number please?
>>
>> I don't intend to change this defaulting behavior; I am just curious
>> where it is set.
>>
>> Thanks,
>>
>> Karthik
>>
>> On Thu, Jul 19, 2018 at 3:37 PM, Karthik Srinivasan <
>> ksriniva2...@gmail.com> wrote:
>>
>>> standby,  i have the debug mode spitting out tons of logs now.
>>>
>>> time for me to review.
>>>
>>> will let you know if i need help.
>>>
>>> thanks,
>>>
>>> karthik
>>>
>>> On Thu, Jul 19, 2018 at 3:15 PM, Karthik Srinivasan <
>>> ksriniva2...@gmail.com> wrote:
>>>
>>>> Unfortunately same result as before:
>>>>
>>>>  $var(myself) = 0;
>>>>if (uri =~ "" || uri == myself){
>>>>   $var(myself) = 1;
>>>>   xlog("L_INFO", "[$ci] in uri == myself check: var myself =
>>>> $var(myself)");
>>>>}
>>>>
>>>>if (uri =~ "" || is_myself("$ru")){
>>>>   $var(myself) = 1;
>>>>   xlog("L_INFO", "[$ci] in is_myself check: var myself =
>>>> $var(myself)");
>>>>}
>>>>
>>>> The only log that prints out is the one that says 'in is_myself check
>>>> ...'(the second if statement.)
>>>>
>>>> I have verified that if there's a regular expression match then both
>>>> log writes print.  Regular expression match happens when a SIP REGISTER
>>>> request comes across the pipe.
>>>>
>>>> Something odd is going on with the computation of  uri == myself vs
>>>> is_myself("$ru").
>>>>
>>>> Is there a way i can inspect what myself and uri have in them?
>>>>
>>>> Karthik
>>>>
>>>>
>>>>
>>>>
>>>> On Thu, Jul 19, 2018 at 2:18 PM, Daniel-Constantin Mierla <
>>>> mico...@gmail.com> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> things are different that one may expect from evaluation of an
>>>>> expression compared with other established scripting/programming 
>>>>> languages.
>>>>> One thing to be sure you are aware of are the return code evaluation:
>>>>>
>>>>>   - http

Re: [SR-Users] uri==myself

2018-07-20 Thread Karthik Srinivasan
Yes, i see it defaulting there.  Thanks again for the help.

Karthik

On Fri, Jul 20, 2018 at 7:57 AM, Daniel-Constantin Mierla  wrote:

> The evaluation for uri==myself condition is done inside src/core/route.c
> starting with line 1817. I see there that it takes default SIP port if none
> is set in the r-uri.
>
> Cheers,
> Daniel
>
> On 20.07.18 06:48, Karthik Srinivasan wrote:
>
> So, i think i have determined the root cause of my issue:
>
> Background info:
>  - I have a request URI of an INVITE that contains no port number.
>  - My application is not listening on the default port of 5060
>
> The is_myself(...) function handles a 'no port in request uri' differently
> than uri==myself.
>
> By that i mean, is_myself(...) does not default the port to 5060 when
> looking up aliases/(which ip addresses and ports the process is bound to);
> it simply does not take port number into account (if no port exists in
> request uri) when searching the alias list.  BUT,  uri==myself does default
> to 5060 and hence tries to find an alias binding to 5060.
>
> So, is_myself("$ru") passes in my case;  uri==myself fails.
>
> Can you point me to the place in the source code where 5060 is being set
> as default to the uri variable when request uri has no port number please?
>
> I don't intend to change this defaulting behavior; I am just curious where
> it is set.
>
> Thanks,
>
> Karthik
>
> On Thu, Jul 19, 2018 at 3:37 PM, Karthik Srinivasan <
> ksriniva2...@gmail.com> wrote:
>
>> standby,  i have the debug mode spitting out tons of logs now.
>>
>> time for me to review.
>>
>> will let you know if i need help.
>>
>> thanks,
>>
>> karthik
>>
>> On Thu, Jul 19, 2018 at 3:15 PM, Karthik Srinivasan <
>> ksriniva2...@gmail.com> wrote:
>>
>>> Unfortunately same result as before:
>>>
>>>  $var(myself) = 0;
>>>if (uri =~ "" || uri == myself){
>>>   $var(myself) = 1;
>>>   xlog("L_INFO", "[$ci] in uri == myself check: var myself =
>>> $var(myself)");
>>>}
>>>
>>>if (uri =~ "" || is_myself("$ru")){
>>>   $var(myself) = 1;
>>>   xlog("L_INFO", "[$ci] in is_myself check: var myself =
>>> $var(myself)");
>>>}
>>>
>>> The only log that prints out is the one that says 'in is_myself check
>>> ...'(the second if statement.)
>>>
>>> I have verified that if there's a regular expression match then both log
>>> writes print.  Regular expression match happens when a SIP REGISTER request
>>> comes across the pipe.
>>>
>>> Something odd is going on with the computation of  uri == myself vs
>>> is_myself("$ru").
>>>
>>> Is there a way i can inspect what myself and uri have in them?
>>>
>>> Karthik
>>>
>>>
>>>
>>>
>>> On Thu, Jul 19, 2018 at 2:18 PM, Daniel-Constantin Mierla <
>>> mico...@gmail.com> wrote:
>>>
>>>> Hello,
>>>>
>>>> things are different that one may expect from evaluation of an
>>>> expression compared with other established scripting/programming languages.
>>>> One thing to be sure you are aware of are the return code evaluation:
>>>>
>>>>   - https://www.kamailio.org/wiki/tutorials/faq/main#how_is_the_
>>>> function_return_cod
>>>>
>>>> To be sure of proper behaviour, you should do:
>>>>
>>>> if(uri =~ "" || uri == myself) {
>>>>
>>>> $var(myself) =1;
>>>>
>>>> } else {
>>>>
>>>> $var(myself) = 0;
>>>>
>>>> }
>>>>
>>>> Same with is_myself("$ru") instead of uri == myself.
>>>>
>>>> Try and see if you get different values for $var(myself).
>>>> Cheers,
>>>> Daniel
>>>>
>>>> On 19.07.18 19:09, Karthik Srinivasan wrote:
>>>>
>>>> Yes, they are used at the very same place. here is a code snippet of
>>>> where i added it for testing purposes:
>>>>
>>>>
>>>> route[INIT_VARS] {
>>>>
>>>> $var(myself) = uri =~ "" || uri == myself;
>>>> //if i print $var(myself) it prints 0
>>>> $var(myself) = uri =~ "" || is_myself("$ru");
>>>> //if i print $var(myself) it prints

Re: [SR-Users] uri==myself

2018-07-19 Thread Karthik Srinivasan
So, i think i have determined the root cause of my issue:

Background info:
 - I have a request URI of an INVITE that contains no port number.
 - My application is not listening on the default port of 5060

The is_myself(...) function handles a 'no port in request uri' differently
than uri==myself.

By that i mean, is_myself(...) does not default the port to 5060 when
looking up aliases/(which ip addresses and ports the process is bound to);
it simply does not take port number into account (if no port exists in
request uri) when searching the alias list.  BUT,  uri==myself does default
to 5060 and hence tries to find an alias binding to 5060.

So, is_myself("$ru") passes in my case;  uri==myself fails.

Can you point me to the place in the source code where 5060 is being set as
default to the uri variable when request uri has no port number please?

I don't intend to change this defaulting behavior; I am just curious where
it is set.

Thanks,

Karthik

On Thu, Jul 19, 2018 at 3:37 PM, Karthik Srinivasan 
wrote:

> standby,  i have the debug mode spitting out tons of logs now.
>
> time for me to review.
>
> will let you know if i need help.
>
> thanks,
>
> karthik
>
> On Thu, Jul 19, 2018 at 3:15 PM, Karthik Srinivasan <
> ksriniva2...@gmail.com> wrote:
>
>> Unfortunately same result as before:
>>
>>  $var(myself) = 0;
>>if (uri =~ "" || uri == myself){
>>   $var(myself) = 1;
>>   xlog("L_INFO", "[$ci] in uri == myself check: var myself =
>> $var(myself)");
>>}
>>
>>if (uri =~ "" || is_myself("$ru")){
>>   $var(myself) = 1;
>>   xlog("L_INFO", "[$ci] in is_myself check: var myself =
>> $var(myself)");
>>}
>>
>> The only log that prints out is the one that says 'in is_myself check
>> ...'(the second if statement.)
>>
>> I have verified that if there's a regular expression match then both log
>> writes print.  Regular expression match happens when a SIP REGISTER request
>> comes across the pipe.
>>
>> Something odd is going on with the computation of  uri == myself vs
>> is_myself("$ru").
>>
>> Is there a way i can inspect what myself and uri have in them?
>>
>> Karthik
>>
>>
>>
>>
>> On Thu, Jul 19, 2018 at 2:18 PM, Daniel-Constantin Mierla <
>> mico...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> things are different that one may expect from evaluation of an
>>> expression compared with other established scripting/programming languages.
>>> One thing to be sure you are aware of are the return code evaluation:
>>>
>>>   - https://www.kamailio.org/wiki/tutorials/faq/main#how_is_the_
>>> function_return_cod
>>>
>>> To be sure of proper behaviour, you should do:
>>>
>>> if(uri =~ "" || uri == myself) {
>>>
>>> $var(myself) =1;
>>>
>>> } else {
>>>
>>> $var(myself) = 0;
>>>
>>> }
>>>
>>> Same with is_myself("$ru") instead of uri == myself.
>>>
>>> Try and see if you get different values for $var(myself).
>>> Cheers,
>>> Daniel
>>>
>>> On 19.07.18 19:09, Karthik Srinivasan wrote:
>>>
>>> Yes, they are used at the very same place. here is a code snippet of
>>> where i added it for testing purposes:
>>>
>>>
>>> route[INIT_VARS] {
>>>
>>> $var(myself) = uri =~ "" || uri == myself;
>>> //if i print $var(myself) it prints 0
>>> $var(myself) = uri =~ "" || is_myself("$ru");
>>> //if i print $var(myself) it prints 1
>>>
>>> // in both cases above the regex part isn't supposed to match and hence
>>> correctly returns false.
>>> ...
>>>
>>> }
>>>
>>> route{
>>>
>>>route(INIT_VARS);
>>>
>>> ...
>>> }
>>>
>>> Thanks,
>>>
>>> Karthik
>>>
>>> On Thu, Jul 19, 2018 at 11:46 AM, Daniel-Constantin Mierla <
>>> mico...@gmail.com> wrote:
>>>
>>>> Hello,
>>>>
>>>>
>>>> On 19.07.18 18:32, Karthik Srinivasan wrote:
>>>> > Hello,
>>>> >
>>>> > Can someone explain to me why statement A returns True and statement B
>>>> > returns False.
>>>> >
>>>> > Statement A:
>>>> > is_myself("$ru")
>>>> >
>>>> > Statement B:
>>>> > uri == myself
>>>> >
>>>> >
>>>> > Isn't uri and $ru referencing the same data?
>>>> >
>>>> > With my current config i am expecting the is_myself to return True;  i
>>>> > was expecting the same for Statement B but unfortunately it is
>>>> > returning False.
>>>> >
>>>> they are supposed to be the same in this case.
>>>>
>>>> Are they used at the same place in config? Note that $ru can be changed
>>>> by different functions such as those from registrar, dispatcher, lcr,
>>>> ...
>>>>
>>>> Cheers,
>>>> Daniel
>>>>
>>>> --
>>>> Daniel-Constantin Mierla -- www.asipto.com
>>>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>>>> Kamailio World Conference -- www.kamailioworld.com
>>>>
>>>>
>>>
>>> --
>>> Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- 
>>> www.linkedin.com/in/miconda
>>> Kamailio World Conference -- www.kamailioworld.com
>>>
>>>
>>
>
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] uri==myself

2018-07-19 Thread Karthik Srinivasan
standby,  i have the debug mode spitting out tons of logs now.

time for me to review.

will let you know if i need help.

thanks,

karthik

On Thu, Jul 19, 2018 at 3:15 PM, Karthik Srinivasan 
wrote:

> Unfortunately same result as before:
>
>  $var(myself) = 0;
>if (uri =~ "" || uri == myself){
>   $var(myself) = 1;
>   xlog("L_INFO", "[$ci] in uri == myself check: var myself =
> $var(myself)");
>}
>
>if (uri =~ "" || is_myself("$ru")){
>   $var(myself) = 1;
>   xlog("L_INFO", "[$ci] in is_myself check: var myself =
> $var(myself)");
>}
>
> The only log that prints out is the one that says 'in is_myself check
> ...'(the second if statement.)
>
> I have verified that if there's a regular expression match then both log
> writes print.  Regular expression match happens when a SIP REGISTER request
> comes across the pipe.
>
> Something odd is going on with the computation of  uri == myself vs
> is_myself("$ru").
>
> Is there a way i can inspect what myself and uri have in them?
>
> Karthik
>
>
>
>
> On Thu, Jul 19, 2018 at 2:18 PM, Daniel-Constantin Mierla <
> mico...@gmail.com> wrote:
>
>> Hello,
>>
>> things are different that one may expect from evaluation of an expression
>> compared with other established scripting/programming languages. One thing
>> to be sure you are aware of are the return code evaluation:
>>
>>   - https://www.kamailio.org/wiki/tutorials/faq/main#how_is_the_
>> function_return_cod
>>
>> To be sure of proper behaviour, you should do:
>>
>> if(uri =~ "" || uri == myself) {
>>
>> $var(myself) =1;
>>
>> } else {
>>
>> $var(myself) = 0;
>>
>> }
>>
>> Same with is_myself("$ru") instead of uri == myself.
>>
>> Try and see if you get different values for $var(myself).
>> Cheers,
>> Daniel
>>
>> On 19.07.18 19:09, Karthik Srinivasan wrote:
>>
>> Yes, they are used at the very same place. here is a code snippet of
>> where i added it for testing purposes:
>>
>>
>> route[INIT_VARS] {
>>
>> $var(myself) = uri =~ "" || uri == myself;
>> //if i print $var(myself) it prints 0
>> $var(myself) = uri =~ "" || is_myself("$ru");
>> //if i print $var(myself) it prints 1
>>
>> // in both cases above the regex part isn't supposed to match and hence
>> correctly returns false.
>> ...
>>
>> }
>>
>> route{
>>
>>route(INIT_VARS);
>>
>> ...
>> }
>>
>> Thanks,
>>
>> Karthik
>>
>> On Thu, Jul 19, 2018 at 11:46 AM, Daniel-Constantin Mierla <
>> mico...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>>
>>> On 19.07.18 18:32, Karthik Srinivasan wrote:
>>> > Hello,
>>> >
>>> > Can someone explain to me why statement A returns True and statement B
>>> > returns False.
>>> >
>>> > Statement A:
>>> > is_myself("$ru")
>>> >
>>> > Statement B:
>>> > uri == myself
>>> >
>>> >
>>> > Isn't uri and $ru referencing the same data?
>>> >
>>> > With my current config i am expecting the is_myself to return True;  i
>>> > was expecting the same for Statement B but unfortunately it is
>>> > returning False.
>>> >
>>> they are supposed to be the same in this case.
>>>
>>> Are they used at the same place in config? Note that $ru can be changed
>>> by different functions such as those from registrar, dispatcher, lcr, ...
>>>
>>> Cheers,
>>> Daniel
>>>
>>> --
>>> Daniel-Constantin Mierla -- www.asipto.com
>>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>>> Kamailio World Conference -- www.kamailioworld.com
>>>
>>>
>>
>> --
>> Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- 
>> www.linkedin.com/in/miconda
>> Kamailio World Conference -- www.kamailioworld.com
>>
>>
>
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] uri==myself

2018-07-19 Thread Karthik Srinivasan
Unfortunately same result as before:

 $var(myself) = 0;
   if (uri =~ "" || uri == myself){
  $var(myself) = 1;
  xlog("L_INFO", "[$ci] in uri == myself check: var myself =
$var(myself)");
   }

   if (uri =~ "" || is_myself("$ru")){
  $var(myself) = 1;
  xlog("L_INFO", "[$ci] in is_myself check: var myself = $var(myself)");
   }

The only log that prints out is the one that says 'in is_myself check
...'(the second if statement.)

I have verified that if there's a regular expression match then both log
writes print.  Regular expression match happens when a SIP REGISTER request
comes across the pipe.

Something odd is going on with the computation of  uri == myself vs
is_myself("$ru").

Is there a way i can inspect what myself and uri have in them?

Karthik




On Thu, Jul 19, 2018 at 2:18 PM, Daniel-Constantin Mierla  wrote:

> Hello,
>
> things are different that one may expect from evaluation of an expression
> compared with other established scripting/programming languages. One thing
> to be sure you are aware of are the return code evaluation:
>
>   - https://www.kamailio.org/wiki/tutorials/faq/main#how_is_the_
> function_return_cod
>
> To be sure of proper behaviour, you should do:
>
> if(uri =~ "" || uri == myself) {
>
> $var(myself) =1;
>
> } else {
>
> $var(myself) = 0;
>
> }
>
> Same with is_myself("$ru") instead of uri == myself.
>
> Try and see if you get different values for $var(myself).
> Cheers,
> Daniel
>
> On 19.07.18 19:09, Karthik Srinivasan wrote:
>
> Yes, they are used at the very same place. here is a code snippet of where
> i added it for testing purposes:
>
>
> route[INIT_VARS] {
>
> $var(myself) = uri =~ "" || uri == myself;
> //if i print $var(myself) it prints 0
> $var(myself) = uri =~ "" || is_myself("$ru");
> //if i print $var(myself) it prints 1
>
> // in both cases above the regex part isn't supposed to match and hence
> correctly returns false.
> ...
>
> }
>
> route{
>
>route(INIT_VARS);
>
> ...
> }
>
> Thanks,
>
> Karthik
>
> On Thu, Jul 19, 2018 at 11:46 AM, Daniel-Constantin Mierla <
> mico...@gmail.com> wrote:
>
>> Hello,
>>
>>
>> On 19.07.18 18:32, Karthik Srinivasan wrote:
>> > Hello,
>> >
>> > Can someone explain to me why statement A returns True and statement B
>> > returns False.
>> >
>> > Statement A:
>> > is_myself("$ru")
>> >
>> > Statement B:
>> > uri == myself
>> >
>> >
>> > Isn't uri and $ru referencing the same data?
>> >
>> > With my current config i am expecting the is_myself to return True;  i
>> > was expecting the same for Statement B but unfortunately it is
>> > returning False.
>> >
>> they are supposed to be the same in this case.
>>
>> Are they used at the same place in config? Note that $ru can be changed
>> by different functions such as those from registrar, dispatcher, lcr, ...
>>
>> Cheers,
>> Daniel
>>
>> --
>> Daniel-Constantin Mierla -- www.asipto.com
>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>> Kamailio World Conference -- www.kamailioworld.com
>>
>>
>
> --
> Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- 
> www.linkedin.com/in/miconda
> Kamailio World Conference -- www.kamailioworld.com
>
>
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] uri==myself

2018-07-19 Thread Karthik Srinivasan
Also,  the INIT_VARS route is the very first thing that executes within the
main routing block.

The case that i am interested in that results in one statement returning
false and the other true is for an INVITE.

I tried printing the uri variable but was unsuccessful in doing so.  Maybe
if that's the next best step, i can pursue that with some advice on how to
print that variable.

Thanks,

Karthik

On Thu, Jul 19, 2018 at 12:09 PM, Karthik Srinivasan  wrote:

> Yes, they are used at the very same place. here is a code snippet of where
> i added it for testing purposes:
>
>
> route[INIT_VARS] {
>
> $var(myself) = uri =~ "" || uri == myself;
> //if i print $var(myself) it prints 0
> $var(myself) = uri =~ "" || is_myself("$ru");
> //if i print $var(myself) it prints 1
>
> // in both cases above the regex part isn't supposed to match and hence
> correctly returns false.
> ...
>
> }
>
> route{
>
>route(INIT_VARS);
>
> ...
> }
>
> Thanks,
>
> Karthik
>
> On Thu, Jul 19, 2018 at 11:46 AM, Daniel-Constantin Mierla <
> mico...@gmail.com> wrote:
>
>> Hello,
>>
>>
>> On 19.07.18 18:32, Karthik Srinivasan wrote:
>> > Hello,
>> >
>> > Can someone explain to me why statement A returns True and statement B
>> > returns False.
>> >
>> > Statement A:
>> > is_myself("$ru")
>> >
>> > Statement B:
>> > uri == myself
>> >
>> >
>> > Isn't uri and $ru referencing the same data?
>> >
>> > With my current config i am expecting the is_myself to return True;  i
>> > was expecting the same for Statement B but unfortunately it is
>> > returning False.
>> >
>> they are supposed to be the same in this case.
>>
>> Are they used at the same place in config? Note that $ru can be changed
>> by different functions such as those from registrar, dispatcher, lcr, ...
>>
>> Cheers,
>> Daniel
>>
>> --
>> Daniel-Constantin Mierla -- www.asipto.com
>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>> Kamailio World Conference -- www.kamailioworld.com
>>
>>
>
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] uri==myself

2018-07-19 Thread Karthik Srinivasan
Yes, they are used at the very same place. here is a code snippet of where
i added it for testing purposes:


route[INIT_VARS] {

$var(myself) = uri =~ "" || uri == myself;
//if i print $var(myself) it prints 0
$var(myself) = uri =~ "" || is_myself("$ru");
//if i print $var(myself) it prints 1

// in both cases above the regex part isn't supposed to match and hence
correctly returns false.
...

}

route{

   route(INIT_VARS);

...
}

Thanks,

Karthik

On Thu, Jul 19, 2018 at 11:46 AM, Daniel-Constantin Mierla <
mico...@gmail.com> wrote:

> Hello,
>
>
> On 19.07.18 18:32, Karthik Srinivasan wrote:
> > Hello,
> >
> > Can someone explain to me why statement A returns True and statement B
> > returns False.
> >
> > Statement A:
> > is_myself("$ru")
> >
> > Statement B:
> > uri == myself
> >
> >
> > Isn't uri and $ru referencing the same data?
> >
> > With my current config i am expecting the is_myself to return True;  i
> > was expecting the same for Statement B but unfortunately it is
> > returning False.
> >
> they are supposed to be the same in this case.
>
> Are they used at the same place in config? Note that $ru can be changed
> by different functions such as those from registrar, dispatcher, lcr, ...
>
> Cheers,
> Daniel
>
> --
> Daniel-Constantin Mierla -- www.asipto.com
> www.twitter.com/miconda -- www.linkedin.com/in/miconda
> Kamailio World Conference -- www.kamailioworld.com
>
>
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] can't assign values to $fU

2018-06-14 Thread Karthik Srinivasan
Daniel,

I appreciate the information.  Than you very much.

Karthik

On Thu, Jun 14, 2018 at 1:18 AM, Daniel-Constantin Mierla  wrote:

> Hello,
>
> you have to put this from the perspective of: changes to the SIP message
> (headers and body) are not immediately reflected. So even if you do a
> replace or subst operation, changes are not visible. If you do remove_hf()
> or append_hf(), it happens the same.
>
> The FAQ has an entry for it:
>
>   - https://www.kamailio.org/wiki/tutorials/faq/main#why_
> changes_made_to_headers_or
>
> $fu/U/d used to be read only, we made them r/w for convenience, as a
> variable based operation instead of uac_replace_from().
>
> The r-uri variables ($ru, $rU, $rd, ...) are not pointing to the SIP
> message buffer, there is a special field (and buffer) inside the internal
> structure of Kamailio, that's why changes to it are visible. The
> corresponding variables pointing to the SIP message buffer are $ou, $oU, ...
> Cheers,
> Daniel
>
> On 13.06.18 23:05, Karthik Srinivasan wrote:
>
> Henning,
>
> Thanks for the explanation.  This does clear it up for me.
>
> Do you happen to know if there is a list of pseudo vars that fall under
> the non special case?   (a list for those psedo vars where
> msg_apply_changes needs to be called for the update to be reflected while
> in routing file processing that is.)
>
> Thanks,
>
> Karthik
>
> On Wed, Jun 13, 2018 at 1:39 PM, Henning Westerholt 
> wrote:
>
>> Am Mittwoch, 13. Juni 2018, 20:28:13 CEST schrieb Alex Balashov:
>> > On Wed, Jun 13, 2018 at 01:26:07PM -0500, Karthik Srinivasan wrote:
>> > > Could you explain why we need to call this function when manipulating
>> $fU
>> > > ?
>> >
>> > Some PV manipulations work that way, others don't. :-) "Because
>> > Kamailio".
>>
>> Don't want to dig into to much technical details here..
>>
>> But to give a bit more context, the Kamailio architecture related to SIP
>> message processing is optimized to avoid re-parsing of the message during
>> configuration processing. This works with so called "lumps" which are
>> more or
>> less like a programming patch file (e.g. change, delete parts). This
>> lumps are
>> applied shortly before sending the message out or if you call
>> msg_apply_changes().
>>
>> Some parts of the SIP message are accessed directly, because they are
>> "more
>> important" (like the request URI) are handled specially, some like the
>> From
>> user are done like a normal SIP header part as described above.
>>
>> For a bit more details and to look into the details, have a look to the
>> dbg_sip_msg([log_level], [facility]) function in the debugger module.
>>
>> Best regards,
>>
>> Henning
>>
>>
>
>
> ___
> Kamailio (SER) - Users Mailing 
> Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>
> --
> Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- 
> www.linkedin.com/in/miconda
> Kamailio World Conference -- www.kamailioworld.com
>
>
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] can't assign values to $fU

2018-06-13 Thread Karthik Srinivasan
or rather a list of the pseudo vars that fall under the special case;
 assuming this list is smaller.

On Wed, Jun 13, 2018 at 4:05 PM, Karthik Srinivasan 
wrote:

> Henning,
>
> Thanks for the explanation.  This does clear it up for me.
>
> Do you happen to know if there is a list of pseudo vars that fall under
> the non special case?   (a list for those psedo vars where
> msg_apply_changes needs to be called for the update to be reflected while
> in routing file processing that is.)
>
> Thanks,
>
> Karthik
>
> On Wed, Jun 13, 2018 at 1:39 PM, Henning Westerholt 
> wrote:
>
>> Am Mittwoch, 13. Juni 2018, 20:28:13 CEST schrieb Alex Balashov:
>> > On Wed, Jun 13, 2018 at 01:26:07PM -0500, Karthik Srinivasan wrote:
>> > > Could you explain why we need to call this function when manipulating
>> $fU
>> > > ?
>> >
>> > Some PV manipulations work that way, others don't. :-) "Because
>> > Kamailio".
>>
>> Don't want to dig into to much technical details here..
>>
>> But to give a bit more context, the Kamailio architecture related to SIP
>> message processing is optimized to avoid re-parsing of the message during
>> configuration processing. This works with so called "lumps" which are
>> more or
>> less like a programming patch file (e.g. change, delete parts). This
>> lumps are
>> applied shortly before sending the message out or if you call
>> msg_apply_changes().
>>
>> Some parts of the SIP message are accessed directly, because they are
>> "more
>> important" (like the request URI) are handled specially, some like the
>> From
>> user are done like a normal SIP header part as described above.
>>
>> For a bit more details and to look into the details, have a look to the
>> dbg_sip_msg([log_level], [facility]) function in the debugger module.
>>
>> Best regards,
>>
>> Henning
>>
>>
>
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] can't assign values to $fU

2018-06-13 Thread Karthik Srinivasan
Alex,

You are correct.  msg_apply_changes works.

I am a bit confused on why this is so.   I have manipulated $rU for example
without having to call msg_apply_changes.

Could you explain why we need to call this function when manipulating $fU ?

Thanks,

Karthik



On Wed, Jun 13, 2018 at 12:44 PM, Alex Balashov 
wrote:

> You may need to run msg_apply_changes() before this change is
> immediately visible in route script.
>
> On Wed, Jun 13, 2018 at 12:45:19PM -0500, Karthik Srinivasan wrote:
>
> >  From the online documentation:$fU - From URI username
> >
> > *$fU* - reference to username in URI of 'From' header
> >
> > It is R/W variable (you can assign values to it directly in configuration
> > file)
> > But i am no able to assign values to $fU.  Has anyone experienced this?
> >
> > Snippet of code in the configuration file of mine and its respective logs
> > showing that $fU is not getting overwritten.  I have tried to hard code
> > values to it assign variables to it, all to no avail.
> >
> > configuration file code snippet:
> >
> >   xlog("L_INFO", "[$ci]   from header username pre mod: $fU");
> >   $fU = "55";
> >   xlog("L_INFO", "[$ci]   from header username post mod: $fU");
> >
> > Logfile snippet:
> >
> > INFO: (s) [7EAB8FECD723E8444E36C659F331068B41EC6BB0]   from header
> username
> > pre mod: 3224567880
> > INFO: (s) [7EAB8FECD723E8444E36C659F331068B41EC6BB0]   from header
> username
> > post mod: 3224567880
> >
> > Thanks,
> >
> > Karthik
>
> > ___
> > 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] can't assign values to $fU

2018-06-13 Thread Karthik Srinivasan
 From the online documentation:$fU - From URI username

*$fU* - reference to username in URI of 'From' header

It is R/W variable (you can assign values to it directly in configuration
file)
But i am no able to assign values to $fU.  Has anyone experienced this?

Snippet of code in the configuration file of mine and its respective logs
showing that $fU is not getting overwritten.  I have tried to hard code
values to it assign variables to it, all to no avail.

configuration file code snippet:

  xlog("L_INFO", "[$ci]   from header username pre mod: $fU");
  $fU = "55";
  xlog("L_INFO", "[$ci]   from header username post mod: $fU");

Logfile snippet:

INFO: (s) [7EAB8FECD723E8444E36C659F331068B41EC6BB0]   from header username
pre mod: 3224567880
INFO: (s) [7EAB8FECD723E8444E36C659F331068B41EC6BB0]   from header username
post mod: 3224567880

Thanks,

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


Re: [SR-Users] count of registered users or count of tls connections

2018-05-23 Thread Karthik Srinivasan
Thank you;  I will take a look.

On Wed, May 23, 2018 at 7:13 PM, Julien Chavanton <jchavan...@gmail.com>
wrote:

> I see, never done it, but mayne this article can help
>
> http://blog.miconda.eu/2014/12/kamailio-42-tips-12-execute-rpc.html
>
> The parameter has to be a valid full JSON-RPC document. It can be a
> dynamic string with variables. The result of the command can be accessed
> via $jsonrpl(key) pseudo variables.
>
> On Wed, May 23, 2018 at 5:20 PM, Karthik Srinivasan <
> ksriniva2...@gmail.com> wrote:
>
>> Hi Julien,
>>
>> The routing file i am referring to is the kamailio.cfg configuration file.
>>
>> I am trying to find a way to access this information within that file.
>>
>> Thanks,
>>
>> Karthik
>>
>> On Wed, May 23, 2018 at 3:35 PM, Julien Chavanton <jchavan...@gmail.com>
>> wrote:
>>
>>> Hi Karthik,
>>>
>>> You can retrieve this information using kamcmd
>>>
>>> kamcmd stats.get_statistics all | grep usrloc
>>> kamcmd tls.info
>>>
>>> Not sure what you meant by "via the routing file"
>>>
>>>
>>>
>>> On Wed, May 23, 2018 at 10:32 AM, Karthik Srinivasan <
>>> ksriniva2...@gmail.com> wrote:
>>>
>>>> sorry, i hit the send key a bit too quickly.
>>>>
>>>> i am trying to access two items via the routing file:  a.) number of
>>>> registered users.   b.) number of active TLS connections.
>>>>
>>>> I am not pushing the registrations to the database.  usrloc is stored
>>>> in memory.
>>>>
>>>> any ideas?
>>>>
>>>> On Wed, May 23, 2018 at 12:30 PM, Karthik Srinivasan <
>>>> ksriniva2...@gmail.com> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> Via the routing file i am trying to find access two items:
>>>>>
>>>>>
>>>>>
>>>>
>>>> ___
>>>> 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
>>
>>
>
> ___
> 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] count of registered users or count of tls connections

2018-05-23 Thread Karthik Srinivasan
Hi Julien,

The routing file i am referring to is the kamailio.cfg configuration file.

I am trying to find a way to access this information within that file.

Thanks,

Karthik

On Wed, May 23, 2018 at 3:35 PM, Julien Chavanton <jchavan...@gmail.com>
wrote:

> Hi Karthik,
>
> You can retrieve this information using kamcmd
>
> kamcmd stats.get_statistics all | grep usrloc
> kamcmd tls.info
>
> Not sure what you meant by "via the routing file"
>
>
>
> On Wed, May 23, 2018 at 10:32 AM, Karthik Srinivasan <
> ksriniva2...@gmail.com> wrote:
>
>> sorry, i hit the send key a bit too quickly.
>>
>> i am trying to access two items via the routing file:  a.) number of
>> registered users.   b.) number of active TLS connections.
>>
>> I am not pushing the registrations to the database.  usrloc is stored in
>> memory.
>>
>> any ideas?
>>
>> On Wed, May 23, 2018 at 12:30 PM, Karthik Srinivasan <
>> ksriniva2...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> Via the routing file i am trying to find access two items:
>>>
>>>
>>>
>>
>> ___
>> 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


Re: [SR-Users] count of registered users or count of tls connections

2018-05-23 Thread Karthik Srinivasan
sorry, i hit the send key a bit too quickly.

i am trying to access two items via the routing file:  a.) number of
registered users.   b.) number of active TLS connections.

I am not pushing the registrations to the database.  usrloc is stored in
memory.

any ideas?

On Wed, May 23, 2018 at 12:30 PM, Karthik Srinivasan <ksriniva2...@gmail.com
> wrote:

> Hello,
>
> Via the routing file i am trying to find access two items:
>
>
>
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] count of registered users or count of tls connections

2018-05-23 Thread Karthik Srinivasan
Hello,

Via the routing file i am trying to find access two items:
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] logging sip messages

2018-03-15 Thread Karthik Srinivasan
Thank you;  I will take a look.

Karthik

On Tue, Mar 6, 2018 at 8:16 AM, Daniel-Constantin Mierla <mico...@gmail.com>
wrote:

> Hello,
>
> look at sipdump module, it is a simple solution for getting the traffic
> stored in a file (with rotation):
>
>   - https://www.kamailio.org/docs/modules/stable/modules/sipdump.html
> The look also at siptrace, it can do it to datebase, or, as suggested in
> another reply, homer sipcapture project.
>
> Cheers,
> Daniel
>
> On 02.03.18 21:12, Karthik Srinivasan wrote:
>
> Hello:
>
> I am trying to find a simple way to log each and every SIP message that
> Kamailio receives or Kamailio sends. In a nutshell, here is what i'm trying
> to accomplish:
>
> - log sip message received;  log ip address and port of where message was
> received from
> - log sip message to be sent or sent;  log ip address and port of
> destination.
>
> I am trying to achieve this in the context of my general log file that
> contains routing/event logic from the kamailio.cfg file.  By this i mean i
> don't want to have to run an external program like tcpdump to capture the
> packets and log them.
>
> I have tried a few thing but haven't been able to capture all conditions.
>
> examples:
>
> i have included things like  event_routes for [tm:local-response];
> [sl:local-response]; [sl:filtered-ack], onreply_route...   I can capture
> most replies and responses via those but am not able to capture a 200ok
> relayed response from Kamailio back to the originating UA for example.
>
> I can log incoming messages without problem.
>
> I have also tried to activate IO interrupt to route to
> event_route[NETWORK:MSG] but unfortunately i can't access the source/dest
> ip address/port info or other pseudo variables.
>
> So back to the original question:  How does one log every SIP message that
> Kamailio gets?  How does one log every SIP message that Kamailio sends?
> via the context of the routing/replies/event routes in kamailio.cfg.
>
> Thanks,
>
> Karthik
>
>
>
> ___
> Kamailio (SER) - Users Mailing 
> Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>
> --
> Daniel-Constantin Mierlawww.twitter.com/miconda -- www.linkedin.com/in/miconda
> Kamailio Advanced Training - March 5-7, 2018, Berlin - www.asipto.com
> Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com
>
>
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] logging sip messages

2018-03-02 Thread Karthik Srinivasan
Hello:

I am trying to find a simple way to log each and every SIP message that
Kamailio receives or Kamailio sends. In a nutshell, here is what i'm trying
to accomplish:

- log sip message received;  log ip address and port of where message was
received from
- log sip message to be sent or sent;  log ip address and port of
destination.

I am trying to achieve this in the context of my general log file that
contains routing/event logic from the kamailio.cfg file.  By this i mean i
don't want to have to run an external program like tcpdump to capture the
packets and log them.

I have tried a few thing but haven't been able to capture all conditions.

examples:

i have included things like  event_routes for [tm:local-response];
[sl:local-response]; [sl:filtered-ack], onreply_route...   I can capture
most replies and responses via those but am not able to capture a 200ok
relayed response from Kamailio back to the originating UA for example.

I can log incoming messages without problem.

I have also tried to activate IO interrupt to route to
event_route[NETWORK:MSG] but unfortunately i can't access the source/dest
ip address/port info or other pseudo variables.

So back to the original question:  How does one log every SIP message that
Kamailio gets?  How does one log every SIP message that Kamailio sends?
via the context of the routing/replies/event routes in kamailio.cfg.

Thanks,

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