Module: sip-router
Branch: 4.0
Commit: 5eced6635b0a2165c9c107fb6031901459159b2d
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5eced66…
Author: Vicente Hernando <vhernando(a)systemonenoc.com>
Committer: Vicente Hernando <vhernando(a)systemonenoc.com>
Date: Thu May 16 12:06:55 2013 +0200
modules/uac: avoid adding double quotes in uac_replace_* functions
- updated uac doc with a note and examples.
(cherry picked from commit 251c0218e7d5e09f43a2b834a5450c20bb4f6d60)
---
modules/uac/doc/uac_admin.xml | 14 +++++++++-
modules/uac/uac.c | 50 +---------------------------------------
2 files changed, 14 insertions(+), 50 deletions(-)
diff --git a/modules/uac/doc/uac_admin.xml b/modules/uac/doc/uac_admin.xml
index 3610f12..05dc713 100644
--- a/modules/uac/doc/uac_admin.xml
+++ b/modules/uac/doc/uac_admin.xml
@@ -484,6 +484,10 @@ modparam("uac", "reg_contact_addr", "192.168.1.2:5080")
<para>
This function can be used from REQUEST_ROUTE and from BRANCH_ROUTE.
</para>
+ <para>NOTE: Previous versions of this function added double quotes automatically to
+ display variable. That is no longer the case, if you expect that behavior, you will
+ have to add the quotes by yourself.
+ </para>
<para>
If you set restore_mode to AUTO, the URI will be modified automatically in
all subsequent requests and replies in that dialog.
@@ -512,7 +516,8 @@ modparam("uac", "reg_contact_addr", "192.168.1.2:5080")
# replace both display and uri
uac_replace_from("$avp(s:display)","$avp(s:uri)");
# replace only display and do not touch uri
-uac_replace_from("batman","");
+uac_replace_from("batman",""); # display is replaced with: batman
+uac_replace_from("\"batman\"",""); # display is replaced with: "batman"
# remove display and replace uri
uac_replace_from("","sip:robin@gotham.org");
# remove display and do not touch uri
@@ -580,6 +585,10 @@ uac_restore_from();
<para>
This function can be used from REQUEST_ROUTE and from BRANCH_ROUTE.
</para>
+ <para>NOTE: Previous versions of this function added double quotes automatically to
+ display variable. That is no longer the case, if you expect that behavior, you will
+ have to add the quotes by yourself.
+ </para>
<example>
<title><function>uac_replace_to</function> usage</title>
<programlisting format="linespecific">
@@ -587,7 +596,8 @@ uac_restore_from();
# replace both display and uri
uac_replace_to("$avp(display)","$avp(uri)");
# replace only display and do not touch uri
-uac_replace_to("batman","");
+uac_replace_to("batman",""); # display is replaced with: batman
+uac_replace_to("\"batman\"",""); # display is replaced with: "batman"
# remove display and replace uri
uac_replace_to("","sip:robin@gotham.org");
# remove display and do not touch uri
diff --git a/modules/uac/uac.c b/modules/uac/uac.c
index a7cd414..5142e03 100644
--- a/modules/uac/uac.c
+++ b/modules/uac/uac.c
@@ -98,7 +98,6 @@ static int w_uac_auth(struct sip_msg* msg, char* str, char* str2);
static int w_uac_reg_lookup(struct sip_msg* msg, char* src, char* dst);
static int w_uac_reg_request_to(struct sip_msg* msg, char* src, char* mode_s);
static int fixup_replace_uri(void** param, int param_no);
-static int fixup_replace_disp_uri(void** param, int param_no);
static int mod_init(void);
static void mod_destroy(void);
static int child_init(int rank);
@@ -114,13 +113,13 @@ static pv_export_t mod_pvs[] = {
/* Exported functions */
static cmd_export_t cmds[]={
- {"uac_replace_from", (cmd_function)w_replace_from, 2, fixup_replace_disp_uri, 0,
+ {"uac_replace_from", (cmd_function)w_replace_from, 2, fixup_replace_uri, 0,
REQUEST_ROUTE | BRANCH_ROUTE },
{"uac_replace_from", (cmd_function)w_replace_from, 1, fixup_replace_uri, 0,
REQUEST_ROUTE | BRANCH_ROUTE },
{"uac_restore_from", (cmd_function)w_restore_from, 0, 0, 0,
REQUEST_ROUTE },
- {"uac_replace_to", (cmd_function)w_replace_to, 2, fixup_replace_disp_uri, 0,
+ {"uac_replace_to", (cmd_function)w_replace_to, 2, fixup_replace_uri, 0,
REQUEST_ROUTE | BRANCH_ROUTE },
{"uac_replace_to", (cmd_function)w_replace_to, 1, fixup_replace_uri, 0,
REQUEST_ROUTE | BRANCH_ROUTE },
@@ -415,51 +414,6 @@ static int fixup_replace_uri(void** param, int param_no)
return 0;
}
-
-static int fixup_replace_disp_uri(void** param, int param_no)
-{
- pv_elem_t *model;
- char *p;
- str s;
-
- /* convert to str */
- s.s = (char*)*param;
- s.len = strlen(s.s);
-
- model=NULL;
- if (param_no==1)
- {
- if (s.len)
- {
- /* put " around display name */
- p = (char*)pkg_malloc(s.len+3);
- if (p==0)
- {
- LM_CRIT("no more pkg mem\n");
- return E_OUT_OF_MEM;
- }
- p[0] = '\"';
- memcpy(p+1, s.s, s.len);
- p[s.len+1] = '\"';
- p[s.len+2] = '\0';
- pkg_free(s.s);
- s.s = p;
- s.len += 2;
- }
- }
- if(pv_parse_format(&s ,&model)<0)
- {
- LM_ERR("wrong format [%s] for param no %d!\n", s.s, param_no);
- pkg_free(s.s);
- return E_UNSPEC;
- }
- *param = (void*)model;
-
- return 0;
-}
-
-
-
/************************** wrapper functions ******************************/
static int w_restore_from(struct sip_msg *msg)
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#296 - tm:branch-failure event_route is not executed on all branch failures
User who did this - Juha Heinanen (jh)
----------
currently t_fwd generates "477 sending to next hop failed" immediately, i.e., fr_timer does not apply dead tcp connections. for example, fr_tcp_timer module param would be fine with me. i could then set it to smaller value than fr_timer.
----------
More information can be found at the following URL:
https://sip-router.org/tracker/index.php?do=details&task_id=296#comment873
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#296 - tm:branch-failure event_route is not executed on all branch failures
User who did this - Daniel-Constantin Mierla (miconda)
----------
Maybe this timeout value should be set via mod param. Otherwise, it should be the fr_timer value.
----------
More information can be found at the following URL:
https://sip-router.org/tracker/index.php?do=details&task_id=296#comment872
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.
Hello,
I just added a framework to enable per module log level. Following IRC
devel meeting, I analyzed a bit and come up with a solution that relies
on debugger module registering a callback to core for getting the log
level per module. See my last commits related to debugger.
It still needs some enhancements to make it more flexible, maybe Hugh
can jump in and contribute, I won't have time for it in the near future.
Here is what I think will be nice to add:
- mi/rpc commands to change the log levels at runtime
- make log_level_mode accessible via cfg parameter reload framework so
it can be enabled/disabled at runtime
Of course, enabling this feature will slow down a bit printing the log
messages comparing with the case when this feature is disabled, but
should be not that much, as modules log level are kept in memory in a
hash table.
Cheers,
Daniel
--
Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, San Francisco, USA - June 24-27, 2013
* http://asipto.com/u/katu *
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#296 - tm:branch-failure event_route is not executed on all branch failures
User who did this - Juha Heinanen (jh)
----------
the second alternative sounds better to me, because it unifies the behavior of tcp and udp failures and also triggers failure route if all branches fail. the timer should trigger as soon as the implementation allows it to happen in order to avoid the long re-transmission wait that we currently have in case of udp failures.
----------
More information can be found at the following URL:
https://sip-router.org/tracker/index.php?do=details&task_id=296#comment871
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.