소스 검색

dialog: detect the param value type for setting by routing block

Daniel-Constantin Mierla 11 년 전
부모
커밋
69d67c01e0
2개의 변경된 파일4개의 추가작업 그리고 5개의 파일을 삭제
  1. 1 1
      modules/dialog/dlg_profile.c
  2. 3 4
      modules/dialog/dlg_var.c

+ 1 - 1
modules/dialog/dlg_profile.c

@@ -802,7 +802,7 @@ int	dlg_set_timeout_by_profile(struct dlg_profile_table *profile,
 				}
 
 				ph = ph->next;
-			} while(ph != profile->entries[i].first);
+			} while(ph && ph != profile->entries[i].first);
 		}
 
 		lock_release(&profile->lock);

+ 3 - 4
modules/dialog/dlg_var.c

@@ -430,9 +430,8 @@ int pv_set_dlg_ctx(struct sip_msg* msg, pv_param_t *param,
 	if(param==NULL)
 		return -1;
 
-	if(val==NULL)
-		n = 0;
-	else
+	n = 0;
+	if(val!=NULL && val->flags&PV_VAL_INT)
 		n = val->ri;
 
 	switch(param->pvn.u.isname.name.n)
@@ -447,7 +446,7 @@ int pv_set_dlg_ctx(struct sip_msg* msg, pv_param_t *param,
 			_dlg_ctx.to_bye = n;
 		break;
 		case 4:
-			if(val->flags&PV_VAL_STR) {
+			if(val && val->flags&PV_VAL_STR) {
 				if(val->rs.s[val->rs.len]=='\0'
 						&& val->rs.len<DLG_TOROUTE_SIZE) {
 					_dlg_ctx.to_route = route_lookup(&main_rt, val->rs.s);