THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A new Flyspray task has been opened. Details are below.
User who did this - Markus Bucher (MarkCDSys)
Attached to Project - sip-router
Summary - db_postgres: Prepared statements do not work
Task Type - Improvement
Category - Module
Status - Unconfirmed
Assigned To -
Operating System - Linux
Severity - Medium
Priority - Normal
Reported Version - Development
Due in Version - Undecided
Due Date - Undecided
Details - Hi,
I recently tried to do some DB-Queries from my PostgreSQL-DB using modules db_postgres and db2_ops, finding out that queries using parameters did not work.
E.g.:
modparam("db2_ops", "declare_query", "sel1=select uid from sip_user where number=$1/%(a)from.uri.user");
I looked at the sources and saw that this has not been implemented, yet (PQprepare() is always called with 0 as number of parameters).
Using db_mysql as a draft, I created the attached patch, which fixes the issue for me (tested with PostgreSQL 8.4.16).
Notice that with PostgreSQL the parameters are marked within the SQL-query using '$1', '$2', etc. instead of '?' like it is in MySQL.
This should be mentioned in db2_ops' documentation.
It would be nice if you would consider using my patch.
Best Regards,
Markus
One or more files have been attached.
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=272
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
Hi Govoiper
Free Memory on my server 2309 MB
total used free shared buffers
cached
Mem: 2795 486 2309 0 70
180
-/+ buffers/cache: 234 2561
Swap: 2927 0 2927
*Kamailio error:*
*
*
ERROR: PID file /var/run/kamailio.pid does not exist -- Kamailio start
failed
*tail -f /var/log/messages:*
Feb 12 23:41:28 localhost /usr/local/sbin/kamailio[4280]: INFO: <core>
[udp_server.c:230]: INFO: udp_init: SO_RCVBUF is finally 262142
Feb 12 23:41:30 localhost /usr/local/sbin/kamailio[4281]: ERROR: db_mysql
[km_my_con.c:109]: driver error: Can't connect to MySQL server on
'192.168.1.170' (4)
Feb 12 23:41:30 localhost /usr/local/sbin/kamailio[4281]: ERROR: <core>
[db.c:320]: could not add connection to the pool
Feb 12 23:41:30 localhost /usr/local/sbin/kamailio[4281]: ERROR: usrloc
[ul_mod.c:407]: child(1): failed to connect to database
Feb 12 23:41:30 localhost /usr/local/sbin/kamailio[4281]: ERROR: <core>
[sr_module.c:896]: init_mod_child(): Error while initializing module usrloc
(/usr/local/lib64/kamailio/modules_k/usrloc.so)
Feb 12 23:41:30 localhost /usr/local/sbin/kamailio[4283]: ERROR: db_mysql
[km_my_con.c:109]: driver error: Can't connect to MySQL server on
'192.168.1.170' (4)
Feb 12 23:41:30 localhost /usr/local/sbin/kamailio[4283]: ERROR: <core>
[db.c:320]: could not add connection to the pool
Feb 12 23:41:30 localhost /usr/local/sbin/kamailio[4283]: ERROR: auth_db
[authdb_mod.c:174]: unable to connect to the database
Feb 12 23:41:30 localhost /usr/local/sbin/kamailio[4283]: ERROR: <core>
[sr_module.c:896]: init_mod_child(): Error while initializing module
auth_db (/usr/local/lib64/kamailio/modules_k/auth_db.so)
Feb 12 23:41:30 localhost /usr/local/sbin/kamailio[4283]: ERROR: <core>
[pt.c:350]: ERROR: fork_process(): init_child failed for process 3, pid
4283, "udp receiver child=2 sock=127.0.0.1:5060"
Feb 12 23:41:30 localhost /usr/local/sbin/kamailio[4283]: : <core>
[main.c:1625]: main_loop: Cannot fork
With Regards
N.Prakash
---------- Forwarded message ----------
> From: SamyGo <govoiper(a)gmail.com>
> Date: Tue, Feb 12, 2013 at 5:49 PM
> Subject: Re: [SR-Users] [sr-dev] openser db on an external mysql server
> To: "SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users
> Mailing List" <sr-users(a)lists.sip-router.org>
> Cc: Muhammad Shahzad <shaheryarkh(a)gmail.com>, sr-dev(a)lists.sip-router.org,
> Prabhakaran B <prabhakaran(a)tevatel.com>, Indu Priya <indu(a)tevatel.com>
>
>
> Hi Prakash,
>
> Please paste All ERROR appearing and Warnings when you start your
> kamailio. What is the free memory situation on your server ?
>
> Regards,
> Sammy
>
>
>
>
> On Tue, Feb 12, 2013 at 5:12 PM, Prakash N <prakash.n(a)tevatel.com> wrote:
>
>> Hi Muhammad,
>>
>> Yes, I have define Mysql on top in Kamailio.cfg
>>
>> DBURL "mysql://openser:openserrw@192.168.1.170/openser"
>>
>>
>> I have attached Kamailio.cfg ,please advice
>>
>> With Regards
>>
>> N.Prakash
>>
>>
>> On Tue, Feb 12, 2013 at 5:37 PM, Muhammad Shahzad <shaheryarkh(a)gmail.com>wrote:
>>
>>> What is your connection string in kamailio i.e. DBURL? Also make sure
>>> you have defined WITH_MYSQL on the top of kamailio.cfg to load necessary
>>> drivers.
>>>
>>> #!define WITH_MYSQL
>>>
>>> Thank you.
>>>
>>>
>>> On Tue, Feb 12, 2013 at 12:56 PM, Prakash N <prakash.n(a)tevatel.com>wrote:
>>>
>>>> Hi Shahzad ,
>>>>
>>>> It is not ,We can able to connect remote mysql ( please find
>>>> the detail below),moreover we can able create openser db from Kamailio
>>>> server to remote mysql server
>>>>
>>>> *Mysql server : 192.168.1.170*
>>>> *Kamailio server : 192.168.1.101*
>>>>
>>>>
>>>> *Mysql output :*
>>>> *
>>>> *
>>>> *mysql -u openser -h 192.168.1.170 -p*
>>>> Enter password:
>>>> Welcome to the MySQL monitor. Commands end with ; or \g.
>>>> Your MySQL connection id is 68
>>>> Server version: 5.1.67 Source distribution
>>>>
>>>> Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights
>>>> reserved.
>>>>
>>>> Oracle is a registered trademark of Oracle Corporation and/or its
>>>> affiliates. Other names may be trademarks of their respective
>>>> owners.
>>>>
>>>> Type 'help;' or '\h' for help. Type '\c' to clear the current input
>>>> statement.
>>>>
>>>> mysql>
>>>>
>>>> With Regards
>>>>
>>>> N.Prakash
>>>>
>>>>
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Muhammad Shahzad <shaheryarkh(a)gmail.com>
>>>>> Date: Tue, Feb 12, 2013 at 5:16 PM
>>>>> Subject: Re: [sr-dev] [SR-Users] openser db on an external mysql server
>>>>> To: Development mailing list of the sip-router project <
>>>>> sr-dev(a)lists.sip-router.org>
>>>>> Cc: Daniel-Constantin Mierla <miconda(a)gmail.com>,
>>>>> sr-users(a)lists.sip-router.org, Indu Priya <indu(a)tevatel.com>,
>>>>> Prabhakaran B <prabhakaran(a)tevatel.com>
>>>>>
>>>>>
>>>>> Its not a Kamailio error, it is problem with connecting to mysql
>>>>> server. Error 4 means No MySQL Server Running On Specified Host.
>>>>>
>>>>> May be MySQL server is down or there is some firewall running or MySQL
>>>>> not listening on IP you specified.
>>>>>
>>>>> Thank you.
>>>>>
>>>>>
>>>>> On Tue, Feb 12, 2013 at 12:11 PM, Prakash N <prakash.n(a)tevatel.com>wrote:
>>>>>
>>>>>> Dear Daniel,
>>>>>>
>>>>>> Thanks for your quick response
>>>>>>
>>>>>> We can able to create operseb db on remote mysql server ,but
>>>>>> Kamailio not getting start
>>>>>>
>>>>>> Error detail:
>>>>>>
>>>>>> ERROR: db_mysql [km_my_con.c:109]: driver error: Can't connect to
>>>>>> MySQL server on '192.168.1.170' (4)
>>>>>> ERROR: <core> [db.c:32 0]: could not add connection to the pool
>>>>>> ERROR: auth_db [authdb _mod.c:174]: unable to connect to the database
>>>>>> ERROR: <core> [sr_modu le.c:896]: init_mod_child(): Error while
>>>>>> initializing module auth_db (/usr/local/lib64/kamailio/modules_k/auth_db.so)
>>>>>>
>>>>>>
>>>>>> I have attached my kamailo.cfg ( we followed Kamailio and
>>>>>> Asterisk real time installation) ,please advice
>>>>>>
>>>>>> With Regards
>>>>>>
>>>>>> N.Prakash
>>>>>>
>>>>>>>
>>>>>>> ---------- Forwarded message ----------
>>>>>>> From: Daniel-Constantin Mierla <miconda(a)gmail.com>
>>>>>>> Date: Tue, Feb 12, 2013 at 2:41 PM
>>>>>>> Subject: Re: [SR-Users] openser db on an external mysql server
>>>>>>> To: "SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) -
>>>>>>> Users Mailing List" <sr-users(a)lists.sip-router.org>,
>>>>>>> sr-dev(a)lists.sip-router.org, miconda(a)gmail.com
>>>>>>> Cc: Prabhakaran B <prabhakaran(a)tevatel.com>
>>>>>>>
>>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> kamailio database is created with:
>>>>>>>
>>>>>>> kamdbctl create
>>>>>>>
>>>>>>> the host of mysql server has to be specified in kamctlrc file via
>>>>>>> DBHOST variable - kamctlrc is located in same directory as kamailio.cfg.
>>>>>>>
>>>>>>> In kamailio.cfg, update the db_url value (or DBURL define) to
>>>>>>> reflect the mysql server host.
>>>>>>>
>>>>>>> Cheers,
>>>>>>> Daniel
>>>>>>>
>>>>>>>
>>>>>>> On 2/12/13 4:16 AM, Prakash N wrote:
>>>>>>>
>>>>>>> Hi All,
>>>>>>>
>>>>>>> I am new this Kamailo ,ther is any step by step document to set
>>>>>>> up openser db on an external mysql server ?
>>>>>>>
>>>>>>> With Regards
>>>>>>>
>>>>>>> N.Prakash
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>>>>>>> Kamailio World Conference, April 16-17, 2013, Berlin
>>>>>>> - http://conference.kamailio.com -
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> sr-dev mailing list
>>>>>> sr-dev(a)lists.sip-router.org
>>>>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Muhammad Shahzad
>>>>> -----------------------------------
>>>>> CISCO Rich Media Communication Specialist (CRMCS)
>>>>> CISCO Certified Network Associate (CCNA)
>>>>> Cell: +49 176 99 83 10 85
>>>>> MSN: shari_786pk(a)hotmail.com
>>>>> Email: shaheryarkh(a)googlemail.com
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> Muhammad Shahzad
>>> -----------------------------------
>>> CISCO Rich Media Communication Specialist (CRMCS)
>>> CISCO Certified Network Associate (CCNA)
>>> Cell: +49 176 99 83 10 85
>>> MSN: shari_786pk(a)hotmail.com
>>> Email: shaheryarkh(a)googlemail.com
>>>
>>
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users(a)lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>>
>
>
Hi, I have Kamailio as SIP server and RTP server. Client is PJSIP.
I read that STUN is for non-symmetric NAT, and RTP server is for symmetric
NAT.
Supposed A calls B.
If A, B both use symmetric NAT and STUN, they cannot hear each other
If A or B use non-symmetric NAT and NOT using STUN, they cannot hear each
other.
Why is that?
I read http://tools.ietf.org/id/draft-takeda-symmetric-nat-traversal-00.txt
for Prediction Failure, is that related to this problem ?
--
Khoa Pham
HCMC University of Science
Faculty of Information Technology
Module: sip-router
Branch: pd/outbound
Commit: 936b6892a8a0ff25b108635e48a146b7cbc3a7ff
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=936b689…
Author: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Date: Wed Feb 27 14:03:27 2013 +0000
lib/kcore: added parser for Require: header
---
lib/kcore/parse_require.c | 71 +++++++++++++++++++++++++++++++++++++++++++++
lib/kcore/parse_require.h | 48 ++++++++++++++++++++++++++++++
2 files changed, 119 insertions(+), 0 deletions(-)
diff --git a/lib/kcore/parse_require.c b/lib/kcore/parse_require.c
new file mode 100644
index 0000000..7bb1a3d
--- /dev/null
+++ b/lib/kcore/parse_require.c
@@ -0,0 +1,71 @@
+/*
+ * $Id$
+ *
+ * This file is part of Kamailio, a free SIP server.
+ *
+ * Kamailio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version
+ *
+ * Kamailio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*!
+ * \file
+ * \brief Require parser
+ * \ingroup parser
+ */
+
+#include "../../mem/mem.h"
+#include "parse_require.h"
+
+/*!
+ * Parse all Require headers
+ */
+int parse_require( struct sip_msg *msg)
+{
+ unsigned int require;
+ struct hdr_field *hdr;
+ struct option_tag_body *rb;
+
+ /* maybe the header is already parsed! */
+ if (msg->require && msg->require->parsed)
+ return 0;
+
+ /* parse to the end in order to get all SUPPORTED headers */
+ if (parse_headers(msg,HDR_EOH_F,0)==-1 || !msg->require)
+ return -1;
+
+ /* bad luck! :-( - we have to parse them */
+ require = 0;
+ for( hdr=msg->require ; hdr ; hdr=next_sibling_hdr(hdr)) {
+ if (hdr->parsed) {
+ require |= ((struct option_tag_body*)hdr->parsed)->option_tags;
+ continue;
+ }
+
+ rb = (struct option_tag_body*)pkg_malloc(sizeof(struct option_tag_body));
+ if (rb == 0) {
+ LM_ERR("out of pkg_memory\n");
+ return -1;
+ }
+
+ parse_option_tag_body(&(hdr->body), &(rb->option_tags));
+ rb->hfree = hf_free_option_tag;
+ rb->option_tags_all = 0;
+ hdr->parsed = (void*)rb;
+ require |= rb->option_tags;
+ }
+
+ ((struct option_tag_body*)msg->require->parsed)->option_tags_all =
+ require;
+ return 0;
+}
diff --git a/lib/kcore/parse_require.h b/lib/kcore/parse_require.h
new file mode 100644
index 0000000..9214455
--- /dev/null
+++ b/lib/kcore/parse_require.h
@@ -0,0 +1,48 @@
+/*
+ * $Id$
+ *
+ * This file is part of Kamailio, a free SIP server.
+ *
+ * Kamailio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version
+ *
+ * Kamailio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/*!
+ * \file
+ * \brief Require parser
+ * \ingroup parser
+ */
+
+#ifndef PARSE_REQUIRE_H
+#define PARSE_REQUIRE_H
+
+#include "../../parser/msg_parser.h"
+#include "../../parser/hf.h"
+#include "../../mem/mem.h"
+#include "option-tags.h"
+
+#define get_require(p_msg) \
+ ((p_msg)->require ? ((struct option_tag_body*)(p_msg)->require->parsed)->option_tags_all : 0)
+
+
+/*!
+ * Parse all Require headers.
+ */
+int parse_require( struct sip_msg *msg);
+
+
+void free_require(struct option_tag_body **rb);
+
+#endif /* PARSE_REQUIRE_H */