Module: sip-router
Branch: master
Commit: a68e48bc3c322be79a608d91f40d10329c2e9664
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a68e48b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Sep 16 20:31:44 2013 +0200
corex: new pv $cfg(key) - return attributes for config file
- $cfg(line) - the line of the current action.
- $cfg(name) - the name of the current conf file
Example of usage:
append_to_reply("P-Cfg-Line: $cfg(line)\r\n");
---
modules/corex/corex_mod.c | 10 +++++-
modules/corex/corex_var.c | 83 +++++++++++++++++++++++++++++++++++++++++++++
modules/corex/corex_var.h | 28 +++++++++++++++
3 files changed, 120 insertions(+), 1 deletions(-)
diff --git a/modules/corex/corex_mod.c b/modules/corex/corex_mod.c
index bddba03..8d62498 100644
--- a/modules/corex/corex_mod.c
+++ b/modules/corex/corex_mod.c
@@ -30,6 +30,7 @@
#include "corex_lib.h"
#include "corex_rpc.h"
+#include "corex_var.h"
MODULE_VERSION
@@ -43,6 +44,13 @@ static int mod_init(void);
static int child_init(int);
static void mod_destroy(void);
+static pv_export_t mod_pvs[] = {
+ { {"cfg", (sizeof("cfg")-1)}, PVT_OTHER, pv_get_cfg, 0,
+ pv_parse_cfg_name, 0, 0, 0 },
+
+ { {0, 0}, 0, 0, 0, 0, 0, 0, 0 }
+};
+
static cmd_export_t cmds[]={
{"append_branch", (cmd_function)w_append_branch, 0, 0,
0, REQUEST_ROUTE | FAILURE_ROUTE },
@@ -76,7 +84,7 @@ struct module_exports exports = {
params,
0,
0, /* exported MI functions */
- 0, /* exported pseudo-variables */
+ mod_pvs, /* exported pseudo-variables */
0, /* extra processes */
mod_init, /* module initialization function */
0, /* response function */
diff --git a/modules/corex/corex_var.c b/modules/corex/corex_var.c
new file mode 100644
index 0000000..2beaf70
--- /dev/null
+++ b/modules/corex/corex_var.c
@@ -0,0 +1,83 @@
+/**
+ * $Id$
+ *
+ * Copyright (C) 2013 Daniel-Constantin Mierla (asipto.com)
+ *
+ * This file is part of Kamailio, a free SIP server.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "../../dprint.h"
+#include "../../action.h"
+
+#include "corex_var.h"
+
+/**
+ *
+ */
+int pv_parse_cfg_name(pv_spec_p sp, str *in)
+{
+ if(sp==NULL || in==NULL || in->len<=0)
+ return -1;
+
+ switch(in->len)
+ {
+ case 4:
+ if(strncmp(in->s, "line", 4)==0)
+ sp->pvp.pvn.u.isname.name.n = 0;
+ else if(strncmp(in->s, "name", 4)==0)
+ sp->pvp.pvn.u.isname.name.n = 1;
+ else goto error;
+ break;
+ default:
+ goto error;
+ }
+ sp->pvp.pvn.type = PV_NAME_INTSTR;
+ sp->pvp.pvn.u.isname.type = 0;
+
+ return 0;
+
+error:
+ LM_ERR("unknown PV af key: %.*s\n", in->len, in->s);
+ return -1;
+}
+
+/**
+ *
+ */
+int pv_get_cfg(sip_msg_t *msg, pv_param_t *param, pv_value_t *res)
+{
+ char *n;
+
+ if(param==NULL)
+ return -1;
+
+ switch(param->pvn.u.isname.name.n)
+ {
+ case 1:
+ n = get_cfg_crt_name();
+ if(n==0)
+ return pv_get_null(msg, param, res);
+ return pv_get_strzval(msg, param, res, n);
+ default:
+ return pv_get_sintval(msg, param, res, get_cfg_crt_line());
+ }
+}
+
diff --git a/modules/corex/corex_var.h b/modules/corex/corex_var.h
new file mode 100644
index 0000000..c5c2a23
--- /dev/null
+++ b/modules/corex/corex_var.h
@@ -0,0 +1,28 @@
+/**
+ * Copyright (C) 2013 Daniel-Constantin Mierla (asipto.com)
+ *
+ * This file is part of Kamailio, a free SIP server.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifndef _COREX_VAR_H_
+#define _COREX_VAR_H_
+
+#include "../../pvar.h"
+
+int pv_parse_cfg_name(pv_spec_p sp, str *in);
+int pv_get_cfg(sip_msg_t *msg, pv_param_t *param, pv_value_t *res);
+
+#endif
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A new Flyspray task has been opened. Details are below.
User who did this - Michel de Weerd (mweerd)
Attached to Project - sip-router
Summary - Notify has incorrect information when q=0.5 in the Contact header
Task Type - Bug Report
Category - Modules kamailio
Status - Unconfirmed
Assigned To -
Operating System - All
Severity - Medium
Priority - Normal
Reported Version - 4.0
Due in Version - Undecided
Due Date - Undecided
Details - When the ims_registar_scscf module sends a Notify after a deregistration and the contact has q= parameter, the XML contains state terminated for the AOR, and for the contact the state is active.
<?xml version="1.0"?>
<reginfo xmlns="urn:ietf:params:xml:ns:reginfo" version="1" state="partial">
<registration aor="sip:+351915639755@nl.intinfra.com" id="0x2aeaf52ebb80" state="terminated">
<contact id="0x2aeaf52ebdd0" state="active" event="registered" expires="3558" q="0.500">
<uri>sip:+351915639755@192.168.230.47:5060;ep=192.168.137.206:49856;transport=udp</uri>
</contact>
</registration>
</reginfo>
When q= parameter is not added in the contact field, the XML in the notify contains the following information after deregistration, AOR is terminated and also contact id in the state terminated.
<?xml version="1.0"?>
<reginfo xmlns="urn:ietf:params:xml:ns:reginfo" version="1" state="partial">
<registration aor="sip:+31652526347@nl.intinfra.com" id="0x2b3396aecd60" state="terminated">
<contact id="0x2b3396af1e60" state="terminated" event="unregistered" expires="0">
<uri>sip:+31652526347@10.38.102.75:49844;transport=tcp</uri>
</contact>
</registration>
</reginfo>
The contact in the XML of the notify seems to be incorrectly constructed when q=.. used in the contact header.
Attached a patch which creates the correct contact info when the subscriber deregisters
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=342
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.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A new Flyspray task has been opened. Details are below.
User who did this - Devs Voicenter (voicenter)
Attached to Project - sip-router
Summary - presence_dialoginfo -> force_single doesn't sent most relevant xml
Task Type - Improvement
Category - Modules kamailio
Status - Unconfirmed
Assigned To -
Operating System - All
Severity - Low
Priority - Normal
Reported Version - Development
Due in Version - Undecided
Due Date - Undecided
Details - When single xml mode is turned on(some phones do not support/treat right multiple xmls). Not always most relevant xml is sent.
The order should be according to priority: early/confirmed/terminated. And it shouldn't be allocated due time. Other option is to make it optional. Here is the sample of patch:
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=341
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.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A new Flyspray task has been opened. Details are below.
User who did this - Devs Voicenter (voicenter)
Attached to Project - sip-router
Summary - module pua_reginfo, function reginfo_handle_notify
Task Type - Bug Report
Category - Modules kamailio
Status - Unconfirmed
Assigned To -
Operating System - All
Severity - Low
Priority - Normal
Reported Version - 4.0
Due in Version - Undecided
Due Date - Undecided
Details - According to the documentation (http://www.kamailio.org/docs/modules/4.0.x/modules/pua_reginfo.html) function reginfo_handle_notify () doesn't accept any parameters, though the code says different:
{"reginfo_handle_notify", (cmd_function)reginfo_handle_notify, 1, domain_fixup, 0, REQUEST_ROUTE}
the quick fix would be:
- {"reginfo_handle_notify", (cmd_function)reginfo_handle_notify, 1, domain_fixup, 0, REQUEST_ROUTE},
+ {"reginfo_handle_notify", (cmd_function)reginfo_handle_notify, 0, domain_fixup, 0, REQUEST_ROUTE},
but not sure if it's the right one
AFAIK it's in all 4.0.0 (maybe not including -pre release)
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=340
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,
For the above, does it make sense to add new modules - dmq_dialog,
dmq_presence, etc? Or just to add to existing code?
Cheers,
Charles
--
www.sipcentric.com
Follow us on twitter @sipcentric <http://twitter.com/sipcentric>
Sipcentric Ltd. Company registered in England & Wales no. 7365592. Registered
office: Unit 10 iBIC, Birmingham Science Park, Holt Court South, Birmingham
B7 4EJ.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#339 - pua_reginfo: Fails to insert the contact into the location table
User who did this - Wonbin Cho (wbcho)
----------
That will be really appreciated.
:)
----------
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=339#comment1080
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.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#339 - pua_reginfo: Fails to insert the contact into the location table
User who did this - Daniel-Constantin Mierla (miconda)
----------
OK. I'm not the developer of the module, I just commented by looking at the patch. If the developer doesn't get to it soon, I will apply the patches to fix the issue and he can jump in later for tunings.
----------
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=339#comment1079
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.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#339 - pua_reginfo: Fails to insert the contact into the location table
User who did this - Wonbin Cho (wbcho)
----------
Hi,
In fact, I left a comment on FS#338 about that.
The code gets there not because of the length of aor but because the first loop in the while statement hits following lines:
/* Only process registration sub-items */
if (xmlStrcasecmp(registrations->name, BAD_CAST "registration") != 0)
goto next_registration;
It seems that the first "registration" item of "reginfo" XML node is not properly loaded.
The first loop hits "goto next_registration" (as quoted above) and 'ul.unlock_udomain' function is called there.
But it seems that aor is initialized by 'ul.lock_domain' function which is not called in the first loop.
This causes the segfault I reported in FS#338.
So I added if (aor.len > 0) condition to avoid it.
I think that is not a real solution that causes the problem. It's only my humble workaround so please feel free to change as you fit.
Thanks!
----------
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=339#comment1078
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.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#339 - pua_reginfo: Fails to insert the contact into the location table
User who did this - Daniel-Constantin Mierla (miconda)
----------
Besides the ruid part, I see that you changed in notify.c:
- ul.unlock_udomain(domain, &aor);
+ if (aor.len > 0)
+ ul.unlock_udomain(domain, &aor);
Any reason for it? Is the code getting here if aor.len<=0?
----------
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=339#comment1077
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.