Re: [OpenSIPS-Devel] [opensips] [drouting] Testing roules through MI now posssible (#293)

2014-08-11 Thread Răzvan Crainea
 +
 +static struct mi_root* mi_dr_test_number(struct mi_root *cmd_tree, void 
 *param)
 +{
 +struct mi_node *node = cmd_tree-node.kids;
 +struct head_db *partition;
 +str s;
 +int grp_id;
 +rt_info_t *route;
 +
 +if (node == NULL)
 +return init_mi_tree(400, MI_MISSING_PARM_S, MI_MISSING_PARM_LEN);
 +
 +if (use_db_config) {
 +s = node-value;
 +if((partition = get_partition(s)) == NULL) {
 +LM_CRIT(Partition %.*s was not found.\n, s.len, s.s);

I don't think we should have a CRIT message here. Nothing critical happens if 
the partition is not found. Probably a WARNING would be more suitable.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/293/files#r16039847___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] [drouting] Testing roules through MI now posssible (#293)

2014-08-11 Thread Răzvan Crainea
 +unsigned int i;
 +static const str gw_str = str_init(GATEWAY);
 +static const str carrier_str = str_init(CARRIER);
 +str chosen_desc;
 +str chosen_id;
 +for (i = 0; i  route-pgwa_len; ++i){
 +if (route-pgwl[i].is_carrier) {
 +chosen_desc = carrier_str;
 +chosen_id = route-pgwl[i].dst.carrier-id;
 +}
 +else {
 +chosen_desc = gw_str;
 +chosen_id = route-pgwl[i].dst.gw-id;
 +}
 +
 +if (add_mi_node_child(rpl_tree-node, MI_IS_ARRAY, chosen_desc.s,

The MI_IS_ARRAY flag is used to indicate that a node has multiple children. 
Therefore I think the flag should be set on the rpl_tree-node, not on the 
child.



---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/293/files#r16039912___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] [drouting] Testing roules through MI now posssible (#293)

2014-08-11 Thread Răzvan Crainea
  static mi_export_t mi_cmds[] = {
   { dr_reload, HLP1, dr_reload_cmd,0, 0,  0},
   { dr_gw_status,  HLP2, mi_dr_gw_status,  0,0,  0},
   { dr_carrier_status, HLP3, mi_dr_cr_status,  0,0,  0},
 +{ dr_test_number,HLP4, mi_dr_test_number, 0,   0,  0},

Let's call the function dr_number_routing, or something similar.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/293/files#r16040029___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [opensips] Feature sipmsgvalidate for tofrom (#294)

2014-08-11 Thread Mihai Tiganus

You can merge this Pull Request by running:

  git pull https://github.com/tallicamike/opensips 
feature-sipmsgvalidate-for-tofrom

Or you can view, comment on it, or merge it online at:

  https://github.com/OpenSIPS/opensips/pull/294

-- Commit Summary --

  * check validity for to/from in sipmsg_validate
  * sanity check for contact header(s)

-- File Changes --

M modules/sipmsgops/README (10)
M modules/sipmsgops/doc/sipmsgops_admin.xml (18)
M modules/sipmsgops/sipmsgops.c (451)

-- Patch Links --

https://github.com/OpenSIPS/opensips/pull/294.patch
https://github.com/OpenSIPS/opensips/pull/294.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/294
___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] Feature sipmsgvalidate for tofrom (#294)

2014-08-11 Thread Walter Doekes
  
 - return 1;
 +return 1;

You're reindenting huge bits of file here.

Looks like your replacing tabs with four spaces. That doesn't help the review, 
nor the code base. Please use tabs for every 4 spaces and force-push over this.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/294/files#r16042488___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] Feature sipmsgvalidate for tofrom (#294)

2014-08-11 Thread Walter Doekes
 +if ((hdrs_len+2=msg-len)  
 (strncmp(CRLF,msg-unparsed,CRLF_LEN)==0) )
 +body.s = msg-unparsed + CRLF_LEN;
 +else if ( (hdrs_len+1=msg-len) 
 +(*(msg-unparsed)=='\n' || *(msg-unparsed)=='\r' ) )
 +body.s = msg-unparsed + 1;
 +else {
 +/* no body */
 +body.s = NULL;
 +body.len = 0;
 +}
 +
 +/* determine the length of the body */
 +body.len = msg-buf + msg-len - body.s;
 +
 +if (get_content_length(msg) != body.len) {
 +snprintf(reason, MAX_REASON-1, invalid body - content length 
 %ld different then 

different *than

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/294/files#r16042525___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] Feature sipmsgvalidate for tofrom (#294)

2014-08-11 Thread Walter Doekes
 - goto failed;
 - }
 -
 - if (body.len  body.s) {
 - /* if it really has body, check for content type */
 - ret = SV_NO_CONTENT_TYPE;
 - CHECK_HEADER(, content_type);
 - }
 - }
 +if(flags  SIP_PARSE_CONTACT) {
 +/* iterate through Contact headers */
 +for(ptr = msg-contact; ptr; ptr = ptr-sibling) {
 +/* parse Contact header */
 +if(!ptr-parsed  (parse_contact(ptr)  0 
 +|| !ptr-parsed)) {
 +strcpy(reason, failed to parse \'Contact\' 
 header);

No need to escape single quotes within double quoted strings.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/294/files#r16042545___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] [drouting] Testing roules through MI now posssible (#293)

2014-08-11 Thread Răzvan Crainea
Merged #293.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/293#event-151286816___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] 522b40: [drouting] Testing roules through MI now posssible

2014-08-11 Thread Răzvan Crainea
  Branch: refs/heads/master
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 522b405a76e05623a038b4a76173aae9a9bb20d5
  
https://github.com/OpenSIPS/opensips/commit/522b405a76e05623a038b4a76173aae9a9bb20d5
  Author: Andrei Datcu datcuand...@gmail.com
  Date:   2014-08-08 (Fri, 08 Aug 2014)

  Changed paths:
M modules/drouting/drouting.c

  Log Message:
  ---
  [drouting] Testing roules through MI now posssible


  Commit: f5a20b63439445633214fed7cf41b274bf197f32
  
https://github.com/OpenSIPS/opensips/commit/f5a20b63439445633214fed7cf41b274bf197f32
  Author: Andrei Datcu datcuand...@gmail.com
  Date:   2014-08-11 (Mon, 11 Aug 2014)

  Changed paths:
M modules/drouting/drouting.c

  Log Message:
  ---
  [drouting] Changed name to dr_number_routing. Corect flags for nodes


  Commit: c05142bf6d1ce50cad3148f78bf4e1e2d0abafb5
  
https://github.com/OpenSIPS/opensips/commit/c05142bf6d1ce50cad3148f78bf4e1e2d0abafb5
  Author: Răzvan Crainea raz...@opensips.org
  Date:   2014-08-11 (Mon, 11 Aug 2014)

  Changed paths:
M modules/drouting/drouting.c

  Log Message:
  ---
  Merge pull request #293 from andrei-datcu/dr_api

[drouting] Testing roules through MI now posssible


Compare: 
https://github.com/OpenSIPS/opensips/compare/f4fb9fb60b47...c05142bf6d1c___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] b85d1f: dialog: suppress parsing errors when hiding topolo...

2014-08-11 Thread Liviu Chircu
  Branch: refs/heads/master
  Home:   https://github.com/OpenSIPS/opensips
  Commit: b85d1f47bd773a3a71e5a40e9a46d09eb247728d
  
https://github.com/OpenSIPS/opensips/commit/b85d1f47bd773a3a71e5a40e9a46d09eb247728d
  Author: Liviu Chircu li...@opensips.org
  Date:   2014-08-11 (Mon, 11 Aug 2014)

  Changed paths:
M modules/dialog/dlg_tophiding.c

  Log Message:
  ---
  dialog: suppress parsing errors when hiding topology

Ultimately a revert of commit 7f562f91c99


___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [opensips] Dr time of last update (#295)

2014-08-11 Thread Mihai Tiganus

You can merge this Pull Request by running:

  git pull https://github.com/tallicamike/opensips dr-time-of-last-update

Or you can view, comment on it, or merge it online at:

  https://github.com/OpenSIPS/opensips/pull/295

-- Commit Summary --

  * save time to partition
  * [drouting] indentation with tabs
  * resolve conflicts for merge
  * update dbg message

-- File Changes --

M modules/drouting/dr_bl.c (200)
M modules/drouting/dr_load.c (93)
M modules/drouting/dr_load.h (4)
M modules/drouting/dr_partitions.h (57)
M modules/drouting/drouting.c (7466)

-- Patch Links --

https://github.com/OpenSIPS/opensips/pull/295.patch
https://github.com/OpenSIPS/opensips/pull/295.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/295
___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [opensips] Using {s.substr}{s.hex2dec} is bogus (#296)

2014-08-11 Thread gergelypeli
When these two transformations are used in this order, the result can be wrong 
in multiple ways. Pseudocode:

100{s.substr,0,2}{s.hex2dec} is 256 instead of 16
10x{s.substr,0,2}{s.hex2dec} is null instead of 16

The reason seems to be that the substr transformation just indexes into the 
original string, while the hex2dec does not check for the string length, so any 
character that is already chopped off the variable still affects the 
conversion. If the trailing characters are valid hex digits, they're 
incorrectly included in the conversion, if not, the conversion incorrectly 
fails.

The hex2dec transformation checking for the string length should solve both 
issues.


---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/issues/296___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel