From Funky Motmot, 3 Years ago, written in C.
This paste is a reply to Untitled from Eratic Goat
- view diff
Embed
  1. static switch_digit_action_target_t str2target(const char *target_str)
  2. {
  3.         if (!strcasecmp(target_str, "peer")) {
  4.                 return DIGIT_TARGET_PEER;
  5.         }
  6.  
  7.         if (!strcasecmp(target_str, "both")) {
  8.                 return DIGIT_TARGET_BOTH;
  9.         }
  10.  
  11.         return DIGIT_TARGET_SELF;
  12. }
  13.  
  14. #define CLEAR_DIGIT_ACTION_USAGE "<realm>|all[,target]"
  15. SWITCH_STANDARD_APP(clear_digit_action_function)
  16. {
  17.         //switch_channel_t *channel = switch_core_session_get_channel(session);
  18.         switch_ivr_dmachine_t *dmachine;
  19.         char *realm = NULL;
  20.         char *target_str;
  21.         switch_digit_action_target_t target = DIGIT_TARGET_SELF;
  22.  
  23.         if (zstr((char *)data)) {
  24.                 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "clear_digit_action called with no args");
  25.                 return;
  26.         }
  27.