asterisk 和 freeswitch 定时器

freeswitch

SWITCH_DECLARE(uint32_t) switch_scheduler_add_task(time_t task_runtime,
  switch_scheduler_func_t func,
  const char *desc, const char *group, uint32_t cmd_id, void *cmd_arg, switch_scheduler_flag_t flags);

SWITCH_DECLARE(uint32_t) switch_scheduler_del_task_id(uint32_t task_id);

调用:

设置

taskid=switch_scheduler_add_task( switch_epoch_time_now(NULL) + meetme_task->seconds, meetme_retention_timer_callback, (char *) __SWITCH_FUNC__, NULL, 0, meetme_task, flags);

取消

 switch_scheduler_del_task_id(taskid);


asterisk:

  int ast_sched_add(struct sched_context *con, int when, ast_sched_cb callback, const void *data)

int ast_sched_del(struct sched_context *con, int id)

设置:

r->timeout = ast_sched_add(sched, global_reg_timeout * 1000, sip_sub_timeout, r);

取消: ast_sched_del(sched, r->timeout)

你可能感兴趣的:(asterisk 和 freeswitch 定时器)