kamailio.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
List overview
Download
sr-dev
October 2013
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
sr-dev@lists.kamailio.org
33 participants
254 discussions
Start a n
N
ew thread
git:master: avpops: add a note to the docs that avp_db_query is deprecated and sqlops is better
by Henning Westerholt
Module: sip-router Branch: master Commit: 0978c77d694cecd1b7813775a498f6495ae844dc URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0978c77…
Author: Henning Westerholt <hw(a)kamailio.org> Committer: Henning Westerholt <hw(a)kamailio.org> Date: Fri Oct 4 14:22:39 2013 +0200 avpops: add a note to the docs that avp_db_query is deprecated and sqlops is better --- modules/avpops/README | 53 +++++++++++++++++++---------------- modules/avpops/doc/avpops_admin.xml | 7 ++++ 2 files changed, 36 insertions(+), 24 deletions(-) diff --git a/modules/avpops/README b/modules/avpops/README index 95d529b..5e6d0c9 100644 --- a/modules/avpops/README +++ b/modules/avpops/README @@ -10,7 +10,7 @@ Ramona-Elena Modroiu <ramona(a)rosdev.ro> - Copyright � 2004, 2005 Voice Sistem SRL + Copyright © 2004, 2005 Voice Sistem SRL __________________________________________________________________ Table of Contents @@ -133,6 +133,9 @@ Chapter 1. Admin Guide AVPs and SIP messages and a function for testing/checking the value of an AVP. + If you just need a way to execute SQL statements in a Kamailio + configuration script, please consider use the sqlops module instead. + AVPs are persistent per SIP transaction, being available in "route", "branch_route" and "failure_route". A tutorial providing more information (detailed explanations and commented examples) can be found @@ -239,7 +242,7 @@ modparam("avpops","use_domain",1) Name of column containing the uuid (unique user id). - Default value is "uuid". + Default value is “uuid”. Example 1.5. Set uuid_column parameter ... @@ -250,7 +253,7 @@ modparam("avpops","uuid_column","uuid") Name of column containing the username. - Default value is "username". + Default value is “username”. Example 1.6. Set username_column parameter ... @@ -261,7 +264,7 @@ modparam("avpops","username_column","username") Name of column containing the domain name. - Default value is "domain". + Default value is “domain”. Example 1.7. Set domain_column parameter ... @@ -272,7 +275,7 @@ modparam("avpops","domain_column","domain") Name of column containing the attribute name (AVP name). - Default value is "attribute". + Default value is “attribute”. Example 1.8. Set attribute_column parameter ... @@ -283,7 +286,7 @@ modparam("avpops","attribute_column","attribute") Name of column containing the AVP value. - Default value is "value". + Default value is “value”. Example 1.9. Set value_column parameter ... @@ -294,7 +297,7 @@ modparam("avpops","value_column","value") Name of integer column containing the AVP type. - Default value is "type". + Default value is “type”. Possible column values are * 0 - AVP with string name and string value @@ -322,7 +325,7 @@ modparam("avpops","type_column","type") + 'value_type='('integer'|'string') + 'table='string - Default value is "NULL". + Default value is “NULL”. Example 1.11. Set db_scheme parameter ... @@ -346,7 +349,7 @@ modparam("avpops","db_scheme", 5.12. is_avp_set(name) 5.13. avp_print() -5.1. avp_db_load(source,name) +5.1. avp_db_load(source,name) Loads from DB into memory the AVPs corresponding to the given source. If given, it sets the script flags for loaded AVPs. It returns true if @@ -384,7 +387,7 @@ avp_db_load("$uuid","$avp(s:404fwd)/fwd_table"); avp_db_load("$ru","$avp(i1:123)/$some_scheme"); ... -5.2. avp_db_store(source,name) +5.2. avp_db_store(source,name) Stores to DB the AVPs corresponding to the given source. @@ -400,7 +403,7 @@ avp_db_store("$tu","$avp(i:678)"); avp_db_store("$ru/username","$avp(email)"); ... -5.3. avp_db_delete(source,name) +5.3. avp_db_delete(source,name) Deletes from DB the AVPs corresponding to the given source. @@ -417,9 +420,11 @@ avp_db_delete("$ru/username","$avp(email)"); avp_db_delete("$uuid","$avp(s:404fwd)/fwd_table"); ... -5.4. avp_db_query(query[,dest]) +5.4. avp_db_query(query[,dest]) - Make a database query and store the result in AVPs. + Make a database query and store the result in AVPs. This command is + deprecated, please use the more flexible and advanced sqlops module + instead. The meaning and usage of the parameters: * query - must be a valid SQL query. The parameter can contain @@ -431,8 +436,8 @@ avp_db_delete("$uuid","$avp(s:404fwd)/fwd_table"); used in the query makes you vulnerable to SQL injection, e.g. make it possible for an outside attacker to alter your database content. * dest - a list with AVP names where to store the result. The format - is "$avp(name1);$avp(name2);...". If this parameter is ommited, the - result is stored in "$avp(i:1);$avp(i:2);...". If the result gives + is “$avp(name1);$avp(name2);...”. If this parameter is ommited, the + result is stored in “$avp(i:1);$avp(i:2);...”. If the result gives many rows, then multiple AVPs with corresponding name will be added. The value type of the AVP (string or integer) will be derived from the type of the columns. Please note that only this @@ -455,7 +460,7 @@ avp_db_query("select password, ha1 from subscriber where username='$tu'", avp_db_query("delete from subscriber"); ... -5.5. avp_delete(name) +5.5. avp_delete(name) Deletes from memory the AVPs with name or, if empty, all AVPs. @@ -477,7 +482,7 @@ avp_delete("i"); avp_delete("a3"); ... -5.6. avp_pushto(destination,name) +5.6. avp_pushto(destination,name) Pushes the value of AVP(s) into the SIP message. @@ -507,7 +512,7 @@ avp_pushto("$du","$avp(i:679)"); avp_pushto("$br","$avp(i:680)"); ... -5.7. avp_check(name,op_value) +5.7. avp_check(name,op_value) Checks the value of the AVP(s) against an operator and value. @@ -562,7 +567,7 @@ $var(id)=2; avp_check("$xavp(op=>foo[*])","fm/$xavp(op=>fm[$var(id)])/g"); ... -5.8. avp_copy(old_name,new_name) +5.8. avp_copy(old_name,new_name) Copy / move an avp under a new name. @@ -583,7 +588,7 @@ avp_copy("$avp(i:678)", "$avp(s:345)/g"); avp_copy("$avp(old)","$avp(new)/gd"); ... -5.9. avp_printf(dest, format) +5.9. avp_printf(dest, format) NOTE: since Kamailio 1.3.0 the function has been moved to core and it is an alias to pv_printf(). @@ -607,7 +612,7 @@ avp_copy("$avp(old)","$avp(new)/gd"); avp_printf("$avp(i:20)", "This is a $rm request with call-id $hdr(call-id)"); ... -5.10. avp_subst(avps, subst) +5.10. avp_subst(avps, subst) Perl/sed-like subst applied to AVPs having string value. @@ -649,7 +654,7 @@ avp_subst("$avp(i:678)/$avp(i:679)/g", "/(.*)@(.*)/\1@$rd/"); after the first src_avp is processed, it will be added in avp list and next processing will use it. -5.11. avp_op(name,op_value) +5.11. avp_op(name,op_value) Different integer operations with avps. @@ -681,7 +686,7 @@ avp_op("$avp(i:678)", "add/i:345/g"); avp_op("$avp(number)","sub/$avp(number2)/d"); ... -5.12. is_avp_set(name) +5.12. is_avp_set(name) Check if any AVP with name is set. @@ -700,7 +705,7 @@ if(is_avp_set("$avp(i:678)")) log("AVP with integer id 678 exists\n"); ... -5.13. avp_print() +5.13. avp_print() Prints the list with all the AVPs from memory. This is only a helper/debug function. diff --git a/modules/avpops/doc/avpops_admin.xml b/modules/avpops/doc/avpops_admin.xml index 84434b7..aa3b85a 100644 --- a/modules/avpops/doc/avpops_admin.xml +++ b/modules/avpops/doc/avpops_admin.xml @@ -29,6 +29,11 @@ testing/checking the value of an AVP. </para> <para> + If you just need a way to execute SQL statements in a + &kamailio; configuration script, please consider use the + <emphasis>sqlops</emphasis> module instead. + </para> + <para> AVPs are persistent per SIP transaction, being available in "route", "branch_route" and "failure_route". A tutorial providing more information (detailed explanations and commented examples) can be found on the SIP-router web site. @@ -500,6 +505,8 @@ avp_db_delete("$uuid","$avp(s:404fwd)/fwd_table"); </title> <para> Make a database query and store the result in AVPs. + This command is deprecated, please use the more + flexible and advanced <emphasis>sqlops</emphasis> module instead. </para> <para> The meaning and usage of the parameters:
11 years, 1 month
3
2
0
0
git:master: nathelper: updated docs with udpping_from_path
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: 673243a06200b8961756ebe3957bf9bd9059c2bb URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=673243a…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Fri Oct 4 13:11:23 2013 +0200 nathelper: updated docs with udpping_from_path --- modules/nathelper/README | 60 ++++++++++++++++++---------- modules/nathelper/doc/nathelper_admin.xml | 20 ++++++++++ 2 files changed, 58 insertions(+), 22 deletions(-) diff --git a/modules/nathelper/README b/modules/nathelper/README index c9969b5..e27e29f 100644 --- a/modules/nathelper/README +++ b/modules/nathelper/README @@ -58,6 +58,7 @@ Ovidiu Sas 4.10. natping_disable_bflag (integer) 4.11. nortpproxy_str (string) 4.12. keepalive_timeout (int) + 4.13. udpping_from_path (int) 5. Functions @@ -100,17 +101,18 @@ Ovidiu Sas 1.10. Set natping_disable_bflag parameter 1.11. Set nortpproxy_str parameter 1.12. Set keepalive_timeout parameter - 1.13. fix_nated_contact usage - 1.14. fix_nated_sdp usage - 1.15. add_rcv_paramer usage - 1.16. fix_nated_register usage - 1.17. add_contact_alias usage - 1.18. handle_ruri_alias usage - 1.19. set_contact_alias usage - 1.20. $rr_count usage - 1.21. $rr_top_count usage - 1.22. nh_enable_ping usage - 1.23. @nathelper.rewrite_contact usage + 1.13. Set udpping_from_path parameter + 1.14. fix_nated_contact usage + 1.15. fix_nated_sdp usage + 1.16. add_rcv_paramer usage + 1.17. fix_nated_register usage + 1.18. add_contact_alias usage + 1.19. handle_ruri_alias usage + 1.20. set_contact_alias usage + 1.21. $rr_count usage + 1.22. $rr_top_count usage + 1.23. nh_enable_ping usage + 1.24. @nathelper.rewrite_contact usage Chapter 1. Admin Guide @@ -137,6 +139,7 @@ Chapter 1. Admin Guide 4.10. natping_disable_bflag (integer) 4.11. nortpproxy_str (string) 4.12. keepalive_timeout (int) + 4.13. udpping_from_path (int) 5. Functions @@ -237,6 +240,7 @@ Chapter 1. Admin Guide 4.10. natping_disable_bflag (integer) 4.11. nortpproxy_str (string) 4.12. keepalive_timeout (int) + 4.13. udpping_from_path (int) 4.1. force_socket (string) @@ -415,6 +419,18 @@ modparam("nathelper", "nortpproxy_str", "a=sdpmangled:yes\r\n") modparam("nathelper", "keepalive_timeout", 120) ... +4.13. udpping_from_path (int) + + Enable sending UDP pings (keepalives) using raw socket from Path + address. + + Default value is "0" (feature disabled). + + Example 1.13. Set udpping_from_path parameter +... +modparam("nathelper", "udpping_from_path", 1) +... + 5. Functions 5.1. fix_nated_contact() @@ -434,7 +450,7 @@ modparam("nathelper", "keepalive_timeout", 120) This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, BRANCH_ROUTE. - Example 1.13. fix_nated_contact usage + Example 1.14. fix_nated_contact usage ... if (search("User-Agent: Cisco ATA.*") {fix_nated_contact();}; ... @@ -464,7 +480,7 @@ if (search("User-Agent: Cisco ATA.*") {fix_nated_contact();}; This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE. - Example 1.14. fix_nated_sdp usage + Example 1.15. fix_nated_sdp usage ... if (search("User-Agent: Cisco ATA.*") {fix_nated_sdp("3");}; ... @@ -486,7 +502,7 @@ if (search("User-Agent: Cisco ATA.*") {fix_nated_sdp("3");}; This function can be used from REQUEST_ROUTE. - Example 1.15. add_rcv_paramer usage + Example 1.16. add_rcv_paramer usage ... add_rcv_param(); # add the parameter to the Contact header .... @@ -506,7 +522,7 @@ add_rcv_param("1"); # add the parameter to the Contact URI This function can be used from REQUEST_ROUTE. - Example 1.16. fix_nated_register usage + Example 1.17. fix_nated_register usage ... fix_nated_register(); ... @@ -553,7 +569,7 @@ fix_nated_register(); This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, BRANCH_ROUTE, and LOCAL_ROUTE. - Example 1.17. add_contact_alias usage + Example 1.18. add_contact_alias usage ... if (!is_present_hf("Record-Route")) { if (!add_contact_alias("$var(src_ip)", "$Rp", "tcp")) { @@ -580,7 +596,7 @@ fix_nated_register(); This function can be used from REQUEST_ROUTE, BRANCH_ROUTE, and LOCAL_ROUTE. - Example 1.18. handle_ruri_alias usage + Example 1.19. handle_ruri_alias usage ... if ($du == "") { handle_ruri_alias(); @@ -609,7 +625,7 @@ fix_nated_register(); This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, BRANCH_ROUTE, and FAILURE_ROUTE. - Example 1.19. set_contact_alias usage + Example 1.20. set_contact_alias usage ... if (!is_present_hf("Record-Route")) { if (!set_contact_alias()) { @@ -629,7 +645,7 @@ fix_nated_register(); Number of Record Routes in received SIP request or reply. - Example 1.20. $rr_count usage + Example 1.21. $rr_count usage ... $avp(rr_count) = $rr_count; ... @@ -641,7 +657,7 @@ fix_nated_register(); value of $rr_top_count is 1. If there is no Record Route(s), value of $rr_top_count is 0. - Example 1.21. $rr_top_count usage + Example 1.22. $rr_top_count usage ... if ($rr_count == $avp(rr_count) + $rr_top_count) { route(ADD_CONTACT_ALIAS); @@ -659,7 +675,7 @@ fix_nated_register(); The function takes only one parameter - a number in decimal format. - Example 1.22. nh_enable_ping usage + Example 1.23. nh_enable_ping usage ... $ kamctl fifo nh_enable_ping 1 ... @@ -674,7 +690,7 @@ $ kamctl fifo nh_enable_ping 1 counted from 1. Only IP:port is rewritten, remaining part are left unchanged. Full nameaddr is supported. - Example 1.23. @nathelper.rewrite_contact usage + Example 1.24. @nathelper.rewrite_contact usage ... $c = @nathelper.rewrite_contact[1]; ... diff --git a/modules/nathelper/doc/nathelper_admin.xml b/modules/nathelper/doc/nathelper_admin.xml index 7d8eebd..c80a2d7 100644 --- a/modules/nathelper/doc/nathelper_admin.xml +++ b/modules/nathelper/doc/nathelper_admin.xml @@ -404,6 +404,26 @@ modparam("nathelper", "keepalive_timeout", 120) </programlisting> </example> </section> + <section id="nathelper.p.udpping_from_path"> + <title><varname>udpping_from_path</varname> (int)</title> + <para> + Enable sending UDP pings (keepalives) using raw socket from Path + address. + </para> + <para> + <emphasis> + Default value is <quote>0</quote> (feature disabled). + </emphasis> + </para> + <example> + <title>Set <varname>udpping_from_path</varname> parameter</title> + <programlisting format="linespecific"> +... +modparam("nathelper", "udpping_from_path", 1) +... +</programlisting> + </example> + </section> </section>
11 years, 1 month
1
0
0
0
git:master: nathelper: new mod param - udpping_from_path
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: 565ba8d4b71ae5a43027c51e3caf06f20a10b14d URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=565ba8d…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Fri Oct 4 13:07:44 2013 +0200 nathelper: new mod param - udpping_from_path - enable sending UDP pings with raw sockets from Path address - patch by Marcus Hunger --- modules/nathelper/nathelper.c | 75 +++++++++++++++++++++++++++++++++++++++- 1 files changed, 73 insertions(+), 2 deletions(-) diff --git a/modules/nathelper/nathelper.c b/modules/nathelper/nathelper.c index 6f0d28e..8e9de7f 100644 --- a/modules/nathelper/nathelper.c +++ b/modules/nathelper/nathelper.c @@ -350,6 +350,7 @@ static unsigned short rcv_avp_type = 0; static int_str rcv_avp_name; static char *natping_socket = 0; +static int udpping_from_path = 0; static int raw_sock = -1; static unsigned int raw_ip = 0; static unsigned short raw_port = 0; @@ -421,6 +422,7 @@ static param_export_t params[] = { {"natping_processes", INT_PARAM, &natping_processes }, {"natping_socket", STR_PARAM, &natping_socket }, {"keepalive_timeout", INT_PARAM, &nh_keepalive_timeout }, + {"udpping_from_path", INT_PARAM, &udpping_from_path }, {0, 0, 0} }; @@ -633,8 +635,8 @@ mod_init(void) } /* create raw socket? */ - if (natping_socket && natping_socket[0]) { - if (get_natping_socket( natping_socket, &raw_ip, &raw_port)!=0) + if ((natping_socket && natping_socket[0]) || udpping_from_path) { + if ((!udpping_from_path) && get_natping_socket( natping_socket, &raw_ip, &raw_port)!=0) return -1; if (init_raw_socket() < 0) return -1; @@ -1986,6 +1988,53 @@ static int send_raw(const char *buf, int buf_len, union sockaddr_union *to, return sendto(raw_sock, packet, len, 0, (struct sockaddr *) to, sizeof(struct sockaddr_in)); } +/** + * quick function to extract ip:port from path + */ +static char *extract_last_path_ip(str path) +{ + /* used for raw UDP ping which works only on IPv4 */ + static char ip[24]; + char *start = NULL, *end = NULL, *p; + int i; + int path_depth = 0; + int max_path_depth; + + max_path_depth = udpping_from_path - 1; + + if (!path.len || !path.s) return NULL; + + p = path.s; + for (i = 0; i < path.len; i++) { + if (!strncmp("<sip:", p, 5) && i < path.len - 4) { + start = p + 5; + + end = NULL; + } + if ((*p == ';' || *p == '>') && !end) { + end = p; + if (max_path_depth) { + path_depth++; + if (path_depth >= max_path_depth) { + break; + } + } + } + p++; + } + if (start && end) { + int len = end - start; + if (len > sizeof(ip) -1) { + return NULL; + } + memcpy(ip, start, len); + ip[len] = '\0'; + return (char *) ip; + } else { + return NULL; + } +} + static void nh_timer(unsigned int ticks, void *timer_idx) @@ -2004,6 +2053,9 @@ nh_timer(unsigned int ticks, void *timer_idx) unsigned int flags; char proto; struct dest_info dst; + char *path_ip_str = NULL; + unsigned int path_ip = 0; + unsigned short path_port = 0; if((*natping_state) == 0) goto done; @@ -2079,6 +2131,20 @@ nh_timer(unsigned int ticks, void *timer_idx) LM_ERR("can't parse contact dst_uri\n"); continue; } + } else if (path.len && udpping_from_path) { + path_ip_str = extract_last_path_ip(path); + if (path_ip_str == NULL) { + LM_ERR( "ERROR:nathelper:nh_timer: unable to parse path from location\n"); + continue; + } + if (get_natping_socket(path_ip_str, &path_ip, &path_port)) { + LM_ERR("could not parse path host for udpping_from_path\n"); + continue; + } + if (parse_uri(c.s, c.len, &curi) < 0) { + LM_ERR("can't parse contact uri\n"); + continue; + } } else { /* send to the contact/received */ if (parse_uri(c.s, c.len, &curi) < 0) { @@ -2122,6 +2188,11 @@ nh_timer(unsigned int ticks, void *timer_idx) raw_port)<0) { LM_ERR("send_raw failed\n"); } + } else if (udpping_from_path) { + if (send_raw((char*)sbuf, sizeof(sbuf), &dst.to, path_ip, + path_port)<0) { + LM_ERR("send_raw from path failed\n"); + } } else { if (udp_send(&dst, (char *)sbuf, sizeof(sbuf))<0 ) { LM_ERR("udp_send failed\n");
11 years, 1 month
1
0
0
0
git:master: dialplan: improved debug messages so that used dpid is shown
by Juha Heinanen
Module: sip-router Branch: master Commit: 9bb88b5b22901b258fdbcd874264b823a8443869 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9bb88b5…
Author: Juha Heinanen <jh(a)tutpro.com> Committer: Juha Heinanen <jh(a)tutpro.com> Date: Fri Oct 4 14:04:22 2013 +0300 dialplan: improved debug messages so that used dpid is shown --- modules/dialplan/dialplan.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/modules/dialplan/dialplan.c b/modules/dialplan/dialplan.c index 1719528..07c3271 100644 --- a/modules/dialplan/dialplan.c +++ b/modules/dialplan/dialplan.c @@ -233,8 +233,8 @@ static int dp_get_ivalue(struct sip_msg* msg, dp_param_p dp, int *val) pv_value_t value; if(dp->type==DP_VAL_INT) { - LM_DBG("integer value\n"); *val = dp->v.id; + LM_DBG("dpid is %d from constant argument\n", *val); return 0; } @@ -246,6 +246,7 @@ static int dp_get_ivalue(struct sip_msg* msg, dp_param_p dp, int *val) return -1; } *val = value.ri; + LM_DBG("dpid is %d from pv argument\n", *val); return 0; }
11 years, 1 month
1
0
0
0
git:master: acc: new parameter acc_time_format
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: df4fbc220efd333fa638831167dd4fe5e69a89a2 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=df4fbc2…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Fri Oct 4 12:02:32 2013 +0200 acc: new parameter acc_time_format - specify the format to print time as string for acc_time_mode=3 (using localtime) and acc_time_mode=4 (using gmtime) - default value is "%Y-%m-%d %H:%M:%S" --- modules/acc/acc.c | 44 ++++++++++++++++++++++++++++++++++++++++---- modules/acc/acc_mod.c | 2 ++ 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/modules/acc/acc.c b/modules/acc/acc.c index 8a6f3cc..efaebc0 100644 --- a/modules/acc/acc.c +++ b/modules/acc/acc.c @@ -75,6 +75,7 @@ extern struct acc_extra *log_extra; extern struct acc_extra *leg_info; extern struct acc_enviroment acc_env; +extern char *acc_time_format; #ifdef RAD_ACC extern struct acc_extra *rad_extra; @@ -99,6 +100,9 @@ static str val_arr[ACC_CORE_LEN+MAX_ACC_EXTRA+MAX_ACC_LEG+3]; static int int_arr[ACC_CORE_LEN+MAX_ACC_EXTRA+MAX_ACC_LEG+3]; static char type_arr[ACC_CORE_LEN+MAX_ACC_EXTRA+MAX_ACC_LEG+3]; +#define ACC_TIME_FORMAT_SIZE 128 +static char acc_time_format_buf[ACC_TIME_FORMAT_SIZE]; + /******************************************** * acc CORE function ********************************************/ @@ -226,6 +230,7 @@ int acc_log_request( struct sip_msg *rq) int n; int m; int i; + struct tm *t; /* get default values */ m = core2strar( rq, val_arr, int_arr, type_arr); @@ -279,19 +284,34 @@ int acc_log_request( struct sip_msg *rq) if(acc_time_mode==1) { LM_GEN2(log_facility, log_level, "%.*stimestamp=%lu;%s=%u%s", - acc_env.text.len, acc_env.text.s,(unsigned long) acc_env.ts, + acc_env.text.len, acc_env.text.s,(unsigned long)acc_env.ts, acc_time_exten.s, (unsigned int)acc_env.tv.tv_usec, log_msg); } else if(acc_time_mode==2) { LM_GEN2(log_facility, log_level, "%.*stimestamp=%lu;%s=%.3f%s", - acc_env.text.len, acc_env.text.s,(unsigned long) acc_env.ts, + acc_env.text.len, acc_env.text.s,(unsigned long)acc_env.ts, acc_time_attr.s, (((double)(acc_env.tv.tv_sec * 1000) + (acc_env.tv.tv_usec / 1000)) / 1000), log_msg); + } else if(acc_time_mode==3 || acc_time_mode==4) { + if(acc_time_mode==3) { + t = localtime(&acc_env.ts); + } else { + t = gmtime(&acc_env.ts); + } + if(strftime(acc_time_format_buf, ACC_TIME_FORMAT_SIZE, + acc_time_format, t)<0) { + acc_time_format_buf[0] = '\0'; + } + LM_GEN2(log_facility, log_level, "%.*stimestamp=%lu;%s=%s%s", + acc_env.text.len, acc_env.text.s,(unsigned long)acc_env.ts, + acc_time_attr.s, + acc_time_format_buf, + log_msg); } else { LM_GEN2(log_facility, log_level, "%.*stimestamp=%lu%s", - acc_env.text.len, acc_env.text.s,(unsigned long) acc_env.ts, + acc_env.text.len, acc_env.text.s,(unsigned long)acc_env.ts, log_msg); } @@ -337,7 +357,8 @@ static void acc_db_init_keys(void) db_keys[n++] = &acc_sipreason_col; db_keys[n++] = &acc_time_col; time_idx = n-1; - if(acc_time_mode==1 || acc_time_mode==2) { + if(acc_time_mode==1 || acc_time_mode==2 + || acc_time_mode==3 || acc_time_mode==4) { db_keys[n++] = &acc_time_attr; if(acc_time_mode==1) { db_keys[n++] = &acc_time_exten; @@ -363,6 +384,8 @@ static void acc_db_init_keys(void) VAL_TYPE(db_vals+time_idx+2)=DB1_INT; } else if(acc_time_mode==2) { VAL_TYPE(db_vals+time_idx+1)=DB1_DOUBLE; + } else if(acc_time_mode==3 || acc_time_mode==4) { + VAL_TYPE(db_vals+time_idx+1)=DB1_STRING; } } @@ -414,6 +437,7 @@ int acc_db_request( struct sip_msg *rq) int m; int n; int i; + struct tm *t; /* formated database columns */ m = core2strar( rq, val_arr, int_arr, type_arr ); @@ -432,6 +456,18 @@ int acc_db_request( struct sip_msg *rq) VAL_DOUBLE(db_vals+(m++)) = ((double)(acc_env.tv.tv_sec * 1000) + (acc_env.tv.tv_usec / 1000)) / 1000; i++; + } else if(acc_time_mode==3 || acc_time_mode==4) { + if(acc_time_mode==3) { + t = localtime(&acc_env.ts); + } else { + t = gmtime(&acc_env.ts); + } + if(strftime(acc_time_format_buf, ACC_TIME_FORMAT_SIZE, + acc_time_format, t)<0) { + acc_time_format_buf[0] = '\0'; + } + VAL_STRING(db_vals+(m++)) = acc_time_format_buf; + i++; } /* extra columns */ diff --git a/modules/acc/acc_mod.c b/modules/acc/acc_mod.c index a36ecbe..2fb9258 100644 --- a/modules/acc/acc_mod.c +++ b/modules/acc/acc_mod.c @@ -109,6 +109,7 @@ unsigned short failed_filter[MAX_FAILED_FILTER_COUNT + 1]; static char* leg_info_str = 0; /*!< multi call-leg support */ struct acc_extra *leg_info = 0; int acc_prepare_flag = -1; /*!< should the request be prepared for later acc */ +char *acc_time_format = "%Y-%m-%d %H:%M:%S"; /* ----- time mode variables ------- */ /*! \name AccTimeModeVariables Time Mode Variables */ @@ -309,6 +310,7 @@ static param_export_t params[] = { {"time_attr", PARAM_STR, &acc_time_attr }, {"time_exten", PARAM_STR, &acc_time_exten }, {"cdrs_table", PARAM_STR, &acc_cdrs_table }, + {"time_format", STR_PARAM, &acc_time_format }, {0,0,0} };
11 years, 1 month
1
0
0
0
git:master: acc: time_format parameter documentation
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: 88e2da3c54a1cef967d96a5753b1f7f014ba689e URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=88e2da3…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Fri Oct 4 12:14:25 2013 +0200 acc: time_format parameter documentation - eclosed exaples in dotted lines like in most modules to highlight them on text output --- modules/acc/README | 139 ++++++++++++++++++++++++++++++++++++++--- modules/acc/doc/acc_admin.xml | 135 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 264 insertions(+), 10 deletions(-) Diff:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=88e…
11 years, 1 month
1
0
0
0
git:master: dialog: fixed typos in log messages
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: fed0a07d86c9e4d365cb7a5e25d4aaacb4b9adf2 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=fed0a07…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Thu Oct 3 10:00:22 2013 +0200 dialog: fixed typos in log messages --- modules/dialog/dlg_req_within.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/dialog/dlg_req_within.c b/modules/dialog/dlg_req_within.c index 90ec526..29ee23f 100644 --- a/modules/dialog/dlg_req_within.c +++ b/modules/dialog/dlg_req_within.c @@ -397,7 +397,7 @@ int dlg_send_ka(dlg_cell_t *dlg, int dir, str *hdrs) else di->loc_seq.value -= 1; - LM_DBG("sending BYE to %s\n", (dir==DLG_CALLER_LEG)?"caller":"callee"); + LM_DBG("sending OPTIONS to %s\n", (dir==DLG_CALLER_LEG)?"caller":"callee"); iuid = dlg_get_iuid_shm_clone(dlg); if(iuid==NULL) @@ -411,7 +411,7 @@ int dlg_send_ka(dlg_cell_t *dlg, int dir, str *hdrs) result = d_tmb.t_request_within(&uac_r); if(result < 0){ - LM_ERR("failed to send the BYE request\n"); + LM_ERR("failed to send the OPTIONS request\n"); goto err; }
11 years, 1 month
1
0
0
0
git:master: dialog: decode alias parameter from contact address and use it as dst uri
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: f12aa1b3c16b475029f0a3474b30f3b17ea18056 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f12aa1b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Thu Oct 3 09:58:04 2013 +0200 dialog: decode alias parameter from contact address and use it as dst uri - makes dialog module to work with set_contact_alias() as first hop after a nat router --- modules/dialog/dlg_req_within.c | 51 ++++++++++++++++++++++++++++++++------ 1 files changed, 43 insertions(+), 8 deletions(-) diff --git a/modules/dialog/dlg_req_within.c b/modules/dialog/dlg_req_within.c index 0d8a821..90ec526 100644 --- a/modules/dialog/dlg_req_within.c +++ b/modules/dialog/dlg_req_within.c @@ -34,6 +34,7 @@ #include "../../dprint.h" #include "../../config.h" #include "../../socket_info.h" +#include "../../dset.h" #include "../../modules/tm/dlg.h" #include "../../modules/tm/tm_load.h" #include "../../lib/kmi/tree.h" @@ -70,14 +71,39 @@ dlg_t * build_dlg_t(struct dlg_cell * cell, int dir){ dlg_t* td = NULL; str cseq; unsigned int loc_seq; + char nbuf[MAX_URI_SIZE]; + char dbuf[80]; + str nuri; + str duri; + size_t sz; + char *p; - td = (dlg_t*)pkg_malloc(sizeof(dlg_t)); + /*remote target--- Request URI*/ + if(cell->contact[dir].s==0 || cell->contact[dir].len==0){ + LM_ERR("no contact available\n"); + goto error; + } + /*restore alias parameter*/ + nuri.s = nbuf; + nuri.len = MAX_URI_SIZE; + duri.s = dbuf; + duri.len = 80; + if(uri_restore_rcv_alias(&cell->contact[dir], &nuri, &duri)<0) { + nuri.len = 0; + duri.len = 0; + } + if(nuri.len>0 && duri.len>0) { + sz = sizeof(dlg_t) + (nuri.len+duri.len+2)*sizeof(char); + } else { + sz = sizeof(dlg_t); + } + td = (dlg_t*)pkg_malloc(sz); if(!td){ LM_ERR("out of pkg memory\n"); return NULL; } - memset(td, 0, sizeof(dlg_t)); + memset(td, 0, sz); /*local sequence number*/ cseq = (dir == DLG_CALLER_LEG) ? cell->cseq[DLG_CALLEE_LEG]: @@ -100,13 +126,22 @@ dlg_t * build_dlg_t(struct dlg_cell * cell, int dir){ } } - /*remote target--- Request URI*/ - if(cell->contact[dir].s==0 || cell->contact[dir].len==0){ - - LM_ERR("no contact available\n"); - goto error; + if(nuri.len>0 && duri.len>0) { + /* req uri */ + p = (char*)td + sizeof(dlg_t); + strncpy(p, nuri.s, nuri.len); + p[nuri.len] = '\0'; + td->rem_target.s = p; + td->rem_target.len = nuri.len; + /* dst uri */ + p += nuri.len + 1; + strncpy(p, duri.s, duri.len); + p[duri.len] = '\0'; + td->dst_uri.s = p; + td->dst_uri.len = duri.len; + } else { + td->rem_target = cell->contact[dir]; } - td->rem_target = cell->contact[dir]; td->rem_uri = (dir == DLG_CALLER_LEG)? cell->from_uri: cell->to_uri; td->loc_uri = (dir == DLG_CALLER_LEG)? cell->to_uri: cell->from_uri;
11 years, 1 month
1
0
0
0
git:master: nathelper: documentation for set_contact_alias()
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: a41cb60d5171566e13f18b45f50d173f38d206c0 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a41cb60…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Thu Oct 3 09:37:54 2013 +0200 nathelper: documentation for set_contact_alias() --- modules/nathelper/README | 125 +++++++++++++++++------------ modules/nathelper/doc/nathelper_admin.xml | 30 +++++++ 2 files changed, 105 insertions(+), 50 deletions(-) Diff:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=a41…
11 years, 1 month
1
0
0
0
git:master: core: helper functions to add or restore alias parameter to an uri
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: 217f9fddbca31e06075132dd75a645d612d7af93 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=217f9fd…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Thu Oct 3 09:13:39 2013 +0200 core: helper functions to add or restore alias parameter to an uri --- dset.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ dset.h | 3 + 2 files changed, 161 insertions(+), 0 deletions(-) diff --git a/dset.c b/dset.c index 6ca3c02..13b000b 100644 --- a/dset.c +++ b/dset.c @@ -37,6 +37,7 @@ #include "dprint.h" #include "config.h" #include "parser/parser_f.h" +#include "parser/parse_uri.h" #include "parser/msg_parser.h" #include "ut.h" #include "hash_func.h" @@ -719,3 +720,160 @@ int msg_get_src_addr(sip_msg_t *msg, str *uri, int mode) return 0; } +/** + * add alias parameter with encoding of source address + * - nuri->s must point to a buffer of nuri->len size + */ +int uri_add_rcv_alias(sip_msg_t *msg, str *uri, str *nuri) +{ + char* p; + str ip, port; + int len; + + if (msg==NULL || uri==NULL || nuri==NULL) { + LM_ERR("invalid parameter value\n"); + return -1; + } + + ip.s = ip_addr2a(&msg->rcv.src_ip); + ip.len = strlen(ip.s); + + port.s = int2str(msg->rcv.src_port, &port.len); + + /*uri;alias=[ip]~port~proto*/ + len = uri->len+ip.len+port.len+12; + if(len>=nuri->len) { + LM_ERR("not enough space for new uri: %d\n", len); + return -1; + } + p = nuri->s; + memcpy(p, uri->s, uri->len); + p += uri->len; + memcpy(p, ";alias=", 7); + p += 7; + if (msg->rcv.src_ip.af == AF_INET6) + *p++ = '['; + memcpy(p, ip.s, ip.len); + p += ip.len; + if (msg->rcv.src_ip.af == AF_INET6) + *p++ = ']'; + *p++ = '~'; + memcpy(p, port.s, port.len); + p += port.len; + *p++ = '~'; + *p++ = msg->rcv.proto + '0'; + nuri->len = p - nuri->s; + nuri->s[nuri->len] = '\0'; + + LM_DBG("encoded <%.*s> => [%.*s]\n", + uri->len, uri->s, nuri->len, nuri->s); + return 0; +} + +/** + * restore from alias parameter with encoding of source address + * - nuri->s must point to a buffer of nuri->len size + * - suri->s must point to a buffer of suri->len size + */ +int uri_restore_rcv_alias(str *uri, str *nuri, str *suri) +{ + char* p; + str skip; + str ip, port, sproto; + int proto; + + if (uri==NULL || nuri==NULL || suri==NULL) { + LM_ERR("invalid parameter value\n"); + return -1; + } + + /* sip:x;alias=1.1.1.1~0~0 */ + if(uri->len < 23) { + /* no alias possible */ + return -2; + } + p = uri->s + uri->len-18; + skip.s = 0; + while(p>uri->s+5) { + if(strncmp(p, ";alias=", 7)==0) { + skip.s = p; + break; + } + p--; + } + if(skip.s==0) { + /* alias parameter not found */ + return -2; + } + p += 7; + ip.s = p; + p = (char*)memchr(ip.s, '~', (size_t)(uri->s+uri->len-ip.s)); + if(p==NULL) { + /* proper alias parameter not found */ + return -2; + } + ip.len = p - ip.s; + p++; + if(p>=uri->s+uri->len) { + /* proper alias parameter not found */ + return -2; + } + port.s = p; + p = (char*)memchr(port.s, '~', (size_t)(uri->s+uri->len-port.s)); + if(p==NULL) { + /* proper alias parameter not found */ + return -2; + } + port.len = p - port.s; + p++; + if(p>=uri->s+uri->len) { + /* proper alias parameter not found */ + return -2; + } + proto = (int)(*p - '0'); + p++; + + if(p!=uri->s+uri->len && *p!=';') { + /* proper alias parameter not found */ + return -2; + } + skip.len = (int)(p - skip.s); + + if(suri->len<=4+ip.len+1+port.len+11/*;transport=*/+4) { + LM_ERR("address buffer too small\n"); + return -1; + } + if(nuri->len<=uri->len - skip.len) { + LM_ERR("uri buffer too small\n"); + return -1; + } + + p = nuri->s; + memcpy(p, uri->s, (size_t)(skip.s-uri->s)); + p += skip.s-uri->s; + memcpy(p, skip.s+skip.len, (size_t)(uri->s+uri->len - skip.s - skip.len)); + p += uri->s+uri->len - skip.s - skip.len; + nuri->len = p - nuri->s; + + p = suri->s; + strncpy(p, "sip:", 4); + p += 4; + strncpy(p, ip.s, ip.len); + p += ip.len; + *p++ = ':'; + strncpy(p, port.s, port.len); + p += port.len; + proto_type_to_str((unsigned short)proto, &sproto); + if(sproto.len>0 && proto!=PROTO_UDP) { + strncpy(p, ";transport=", 11); + p += 11; + strncpy(p, sproto.s, sproto.len); + p += sproto.len; + } + suri->len = p - suri->s; + + LM_DBG("decoded <%.*s> => [%.*s] [%.*s]\n", + uri->len, uri->s, nuri->len, nuri->s, suri->len, suri->s); + + return 0; +} diff --git a/dset.h b/dset.h index c811cdb..af90312 100644 --- a/dset.h +++ b/dset.h @@ -255,4 +255,7 @@ int getbflagsval(unsigned int branch, flag_t* res); */ int setbflagsval(unsigned int branch, flag_t val); +int uri_add_rcv_alias(sip_msg_t *msg, str *uri, str *nuri); +int uri_restore_rcv_alias(str *uri, str *nuri, str *suri); + #endif /* _DSET_H */
11 years, 1 month
1
0
0
0
← Newer
1
...
18
19
20
21
22
23
24
25
26
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Results per page:
10
25
50
100
200