Browse Source

tm: ignore avp timers with 0 or empty value

Kamailio compatibility: If an avp timer (fr_timer_avp or
fr_inv_timer_avp) is empty ("") or 0, use the default timer
value (fr_timer or fr_inv_timer).

Reported-by: Juha Heinanen  jh at tutpro com.
Andrei Pelinescu-Onciul 16 years ago
parent
commit
bcc993680c
1 changed files with 4 additions and 3 deletions
  1. 4 3
      modules/tm/t_funcs.c

+ 4 - 3
modules/tm/t_funcs.c

@@ -416,8 +416,9 @@ int init_avp_params(char *fr_timer_param, char *fr_inv_timer_param,
 }
 
 
-/*
- * Get the FR_{INV}_TIMER from corresponding AVP
+/** Get the FR_{INV}_TIMER from corresponding AVP.
+ * @return 0 on success (use *timer) or 1 on failure (avp non-existent,
+ *  avp present  but empty/0, avp value not numeric).
  */
 static inline int avp2timer(unsigned int* timer, int type, int_str name)
 {
@@ -443,7 +444,7 @@ static inline int avp2timer(unsigned int* timer, int type, int_str name)
 		*timer = val_istr.n;
 	}
 
-	return 0;
+	return *timer==0; /* 1 if 0 (use default), 0 if !=0 (use *timer) */
 }