Module: kamailio
Branch: master
Commit: a5286513c56f2a6e94385cb75bff1fdca3110e93
URL: https://github.com/kamailio/kamailio/commit/a5286513c56f2a6e94385cb75bff1fd…
Author: Camille Oudot <camille.oudot(a)orange.com>
Committer: Federico Cabiddu <fcabiddu(a)libon.com>
Date: 2016-02-03T14:51:27+01:00
pv: export some PV functions
---
Added: modules/pv/pv_api.c
Added: modules/pv/pv_api.h
Modified: modules/pv/pv.c
---
Diff: https://github.com/kamailio/kamailio/commit/a5286513c56f2a6e94385cb75bff1fd…
Patch: https://github.com/kamailio/kamailio/commit/a5286513c56f2a6e94385cb75bff1fd…
---
diff --git a/modules/pv/pv.c b/modules/pv/pv.c
index 2ccc4ae..e8e717b 100644
--- a/modules/pv/pv.c
+++ b/modules/pv/pv.c
@@ -40,6 +40,7 @@
#ifdef WITH_XAVP
#include "pv_xavp.h"
#endif
+#include "pv_api.h"
MODULE_VERSION
@@ -502,6 +503,7 @@ static int w_var_to_xavp(sip_msg_t *msg, char *p1, char *p2);
static int w_xavp_to_var(sip_msg_t *msg, char *p1);
static int pv_init_rpc(void);
+int pv_register_api(pv_api_t*);
static cmd_export_t cmds[]={
{"pv_isset", (cmd_function)pv_isset, 1, fixup_pvar_null, 0,
@@ -533,7 +535,8 @@ static cmd_export_t cmds[]={
ANY_ROUTE },
{"sbranch_reset", (cmd_function)w_sbranch_reset, 0, 0, 0,
ANY_ROUTE },
-
+ /* API exports */
+ {"pv_register_api", (cmd_function)pv_register_api, NO_SCRIPT, 0, 0},
{0,0,0,0,0,0}
};
diff --git a/modules/pv/pv_api.c b/modules/pv/pv_api.c
new file mode 100644
index 0000000..e153756
--- /dev/null
+++ b/modules/pv/pv_api.c
@@ -0,0 +1,41 @@
+/**
+ * Copyright 2016 (C) Orange
+ * <camille.oudot(a)orange.com>
+ *
+ * This file is part of Kamailio, a free SIP server.
+ *
+ * This file 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
+ *
+ *
+ * This file 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "pv_api.h"
+#include "pv_core.h"
+
+int pv_register_api(pv_api_t* api)
+{
+ if (!api)
+ return 0;
+
+ api->get_body_size = pv_get_body_size;
+ api->get_hdr = pv_get_hdr;
+ api->get_msg_body = pv_get_msg_body;
+ api->get_msg_buf = pv_get_msg_buf;
+ api->get_msg_len = pv_get_msg_len;
+ api->get_reason = pv_get_reason;
+ api->get_status = pv_get_status;
+ api->parse_hdr_name = pv_parse_hdr_name;
+ return 1;
+}
diff --git a/modules/pv/pv_api.h b/modules/pv/pv_api.h
new file mode 100644
index 0000000..2f1de8b
--- /dev/null
+++ b/modules/pv/pv_api.h
@@ -0,0 +1,37 @@
+/**
+ * Copyright 2016 (C) Orange
+ * <camille.oudot(a)orange.com>
+ *
+ * This file is part of Kamailio, a free SIP server.
+ *
+ * This file 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
+ *
+ *
+ * This file 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "../../pvar.h"
+
+typedef struct _pv_api {
+ pv_getf_t get_reason;
+ pv_getf_t get_hdr;
+ pv_parse_name_f parse_hdr_name;
+ pv_getf_t get_status;
+ pv_getf_t get_msg_body;
+ pv_getf_t get_body_size;
+ pv_getf_t get_msg_buf;
+ pv_getf_t get_msg_len;
+} pv_api_t;
+
+typedef int (*pv_register_api_t)(pv_api_t*);
Hi
Can someone explain the reasoning behind not reconnecting when an ODBC error code of '08003' or '08S01' is received back in modules/db_unixodbc/dbase.c?
Such as on lines 120 and 121?
/* Connection broken */
if( !strncmp((char*)sqlstate,"08003",5) ||
!strncmp((char*)sqlstate,"08S01",5) ) {
ret = reconnect(_h);
if( !SQL_SUCCEEDED(ret) ) return ret;
} else {
return ret;
}
Those error codes equate to Communication link failure and Connection not open both of which are easily handled by a reconnect?
As that logic is used in a few places in dbase.c I figure there must be a reason to exclude those errors from a reconnect, but permit other non-connection related errors to trigger a reconnect? If the intent was to only allow connection based error codes to attempt a reconnect then wouldn't it make more sense to explicitly define the half dozen or so ODBC connection specific error codes (the 08xxx range denotes connection related errors) and only permit the ones which could be repaired by a reconnect?
08001 Client unable to establish connection - Can be caused by transient network issue, so a reconnect attempt is valid
08002 Connection name in use - Reconnect probably wouldnt help here
08003 Connection not open - Reconnect would reopen connection
08004 Server rejected the connection - Can be caused by transient network issue such as a reboot, so a reconnect attempt is valid
08007 Connection failure during transaction - Can be caused by transient network issue, so a reconnect attempt is valid
08S01 Communication link failure - Can be caused by transient network issue, so a reconnect attempt is valid
ODBC Error code definitions: https://msdn.microsoft.com/en-us/library/ms714687%28v=vs.85%29.aspx?f=255&M…
Of those 6 possible connection related errors only 08002 wouldn't be helped by a reconnect although a new connection could replace the one its attempting to use...
Just a questions on how to do this properly. The configuration below works if I dial the number like +18888888888(a)sip.ca.didlogic.net (thats the gateway). But it fails with below log if I try to dial it like +18888888888(a)mykamailioserver.com. I'm trying to get the kamailio to rewrite the request URI so the user doesn't have to type in the gateway. So the users just need to type in the phone number, but for some reason it's not working, any ideas what i'm doing wrong?.
Thanks again in advance!
```
Feb 12 01:18:38 sipr /usr/local/sbin/kamailio[24307]: INFO: <script>: Request coming from WS
Feb 12 01:18:38 sipr /usr/local/sbin/kamailio[24307]: ERROR: tm [t_fwd.c:755]: add_uac(): ERROR: add_uac: maximum number of branches exceeded
Feb 12 01:18:38 sipr /usr/local/sbin/kamailio[24307]: ERROR: tm [t_fwd.c:1711]: t_forward_nonack(): ERROR: t_forward_nonack: failure to add branches
Feb 12 01:18:38 sipr /usr/local/sbin/kamailio[24307]: ERROR: tm [tm.c:1466]: _w_t_relay_to(): ERROR: w_t_relay_to: t_relay_to failed
Feb 12 01:18:38 sipr /usr/local/sbin/kamailio[24307]: ERROR: <script>: RELAY -> !t_relay
Feb 12 01:18:38 sipr /usr/local/sbin/kamailio[24307]: ERROR: sl [sl_funcs.c:363]: sl_reply_error(): ERROR: sl_reply_error used: I'm terribly sorry, server error occurred (1/SL)
```
```
route[RELAY] {
if (is_method("INVITE")) {
dlg_manage();
route(SETUP_BY_TRANSPORT);
if(!t_is_set("failure_route")) t_on_failure("MANAGE_FAILURE");
}
t_set_disable_internal_reply(1); # turn off sending internal reply on error
rewritehostport("sip.ca.didlogic.net:5060");
if (!t_relay()) {
xlog("RELAY -> !t_relay");
sl_reply_error();
}
exit;
}
```
```
failure_route[MANAGE_FAILURE] {
xlog("DEBUG: MANAGE FAILURE ROUTE: ");
if ($T_reply_code == "407") # there's also 401
{
$avp(arealm) = GATEWAY;
$avp(auser) = USERNAME;
$avp(apass) = PASSWORD;
uac_auth();
rtpengine_offer("force trust-address replace-origin replace-session-connection ICE=remove RTP/AVP");
route(NATMANAGE);
route(RELAY);
exit;
}
}
```
---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/507
I'm on Kamailio version: kamailio 4.3.3 (x86_64/linux) 22e455
When booting up Kamailio I get a Nov 21 20:36:52 sipr kamailio[24460]: 0(24476) DEBUG: <core> [main.c:747]: handle_sigs(): terminating due to SIGCHLD
Kamailio log:
http://pastebin.com/7bHHyHqD
Redis log:
http://pastebin.com/jWyYnbRB
Any ideas is greatly appreciated thanks! :).
---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/407
send_bye(): failed to send the BYE request in dialog_ng modulewhen kamailio creating and sending BYE request to callee, it has to take callee 200OK record routes - caller record routes - self record routebut it is taking all 200OK record routes
---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/444