mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-05-01 06:21:07 +00:00
adding new "fax-detect-evevt-type" field in config
This commit is contained in:
parent
0c49449746
commit
a425177bbf
@ -191,9 +191,33 @@ switch_status_t megaco_activate_termination(mg_termination_t *term)
|
|||||||
|
|
||||||
switch_core_event_hook_add_recv_dtmf(session, mg_on_dtmf);
|
switch_core_event_hook_add_recv_dtmf(session, mg_on_dtmf);
|
||||||
|
|
||||||
if (term->type == MG_TERM_TDM) {
|
if ((term->type == MG_TERM_TDM) && (term->profile)){
|
||||||
|
switch(term->profile->fax_detect_evt_type){
|
||||||
|
case MG_FAX_DETECT_EVENT_TYPE_CED:
|
||||||
|
{
|
||||||
|
switch_core_session_execute_application_async(session, "spandsp_start_fax_detect", "mg_notify ced 120 ced");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MG_FAX_DETECT_EVENT_TYPE_CNG:
|
||||||
|
{
|
||||||
|
switch_core_session_execute_application_async(session, "spandsp_start_fax_detect", "mg_notify cng 120 cng");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MG_FAX_DETECT_EVENT_TYPE_CNG_CED:
|
||||||
|
{
|
||||||
switch_core_session_execute_application_async(session, "spandsp_start_fax_detect", "mg_notify cng 120 cng");
|
switch_core_session_execute_application_async(session, "spandsp_start_fax_detect", "mg_notify cng 120 cng");
|
||||||
switch_core_session_execute_application_async(session, "spandsp_start_fax_detect", "mg_notify ced 120 ced");
|
switch_core_session_execute_application_async(session, "spandsp_start_fax_detect", "mg_notify ced 120 ced");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MG_FAX_DETECT_EVENT_TYPE_DISABLE:
|
||||||
|
{
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "FAX detection Disable\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid FAX detection Event[%d]\n",term->profile->fax_detect_evt_type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +71,7 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"rtp_ipaddr[%s], local ip[%s]\n", profile->rtp_ipaddr, profile->my_ipaddr);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"rtp_ipaddr[%s], local ip[%s]\n", profile->rtp_ipaddr, profile->my_ipaddr);
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"fax_detect_evt_type[%s]\n", mg_fax_detect_evt_type2str(profile->fax_detect_evt_type));
|
||||||
|
|
||||||
if(SWITCH_STATUS_FALSE == (status = modify_mg_profile_mid(profile, &profile->mid))){
|
if(SWITCH_STATUS_FALSE == (status = modify_mg_profile_mid(profile, &profile->mid))){
|
||||||
goto done;
|
goto done;
|
||||||
@ -337,6 +338,13 @@ static switch_xml_config_item_t *get_instructions(megaco_profile_t *profile) {
|
|||||||
{ "ILBC", MEGACO_CODEC_ILBC },
|
{ "ILBC", MEGACO_CODEC_ILBC },
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
static switch_xml_config_enum_item_t opt_fax_detect_type_enum[] = {
|
||||||
|
{ "CED", MG_FAX_DETECT_EVENT_TYPE_CED},
|
||||||
|
{ "CNG", MG_FAX_DETECT_EVENT_TYPE_CNG},
|
||||||
|
{ "CED_CNG", MG_FAX_DETECT_EVENT_TYPE_CNG_CED},
|
||||||
|
{ "DISABLE", MG_FAX_DETECT_EVENT_TYPE_DISABLE},
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
switch_xml_config_item_t instructions[] = {
|
switch_xml_config_item_t instructions[] = {
|
||||||
/* parameter name type reloadable pointer default value options structure */
|
/* parameter name type reloadable pointer default value options structure */
|
||||||
@ -355,6 +363,7 @@ static switch_xml_config_item_t *get_instructions(megaco_profile_t *profile) {
|
|||||||
SWITCH_CONFIG_ITEM("codec-prefs", SWITCH_CONFIG_STRING, 0, &profile->codec_prefs, "", &switch_config_string_strdup, "", "codec preferences, coma-separated"),
|
SWITCH_CONFIG_ITEM("codec-prefs", SWITCH_CONFIG_STRING, 0, &profile->codec_prefs, "", &switch_config_string_strdup, "", "codec preferences, coma-separated"),
|
||||||
SWITCH_CONFIG_ITEM("license", SWITCH_CONFIG_STRING, 0, &profile->license, "/usr/local/nsg/conf/license.txt", &switch_config_string_strdup, "", "License file"),
|
SWITCH_CONFIG_ITEM("license", SWITCH_CONFIG_STRING, 0, &profile->license, "/usr/local/nsg/conf/license.txt", &switch_config_string_strdup, "", "License file"),
|
||||||
SWITCH_CONFIG_ITEM("rtp-ip", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->rtp_ipaddr, "" , &switch_config_string_strdup, "", "rtp ip"),
|
SWITCH_CONFIG_ITEM("rtp-ip", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->rtp_ipaddr, "" , &switch_config_string_strdup, "", "rtp ip"),
|
||||||
|
SWITCH_CONFIG_ITEM("fax-detect-event-type", SWITCH_CONFIG_ENUM, CONFIG_RELOADABLE, &profile->fax_detect_evt_type, MG_FAX_DETECT_EVENT_TYPE_CNG_CED , &opt_fax_detect_type_enum, "", "fax-detect-event-type"),
|
||||||
SWITCH_CONFIG_ITEM_END()
|
SWITCH_CONFIG_ITEM_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -150,6 +150,31 @@ static inline mg_media_type_t mg_media_type_parse(const char *str) {
|
|||||||
return MGM_INVALID;
|
return MGM_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
MG_FAX_DETECT_EVENT_TYPE_NONE = 0,
|
||||||
|
MG_FAX_DETECT_EVENT_TYPE_CED,
|
||||||
|
MG_FAX_DETECT_EVENT_TYPE_CNG,
|
||||||
|
MG_FAX_DETECT_EVENT_TYPE_CNG_CED,
|
||||||
|
MG_FAX_DETECT_EVENT_TYPE_DISABLE,
|
||||||
|
MG_FAX_DETECT_EVENT_TYPE_INVALID,
|
||||||
|
} mg_fax_detect_event_type_t;
|
||||||
|
|
||||||
|
static inline const char *mg_fax_detect_evt_type2str(mg_fax_detect_event_type_t type) {
|
||||||
|
switch (type) {
|
||||||
|
case MG_FAX_DETECT_EVENT_TYPE_CED:
|
||||||
|
return "CED";
|
||||||
|
case MG_FAX_DETECT_EVENT_TYPE_CNG:
|
||||||
|
return "CNG";
|
||||||
|
case MG_FAX_DETECT_EVENT_TYPE_CNG_CED:
|
||||||
|
return "CED AND CNG";
|
||||||
|
case MG_FAX_DETECT_EVENT_TYPE_DISABLE:
|
||||||
|
return "DISABLE";
|
||||||
|
default:
|
||||||
|
return "Invalid";
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
struct mg_context_s {
|
struct mg_context_s {
|
||||||
uint32_t context_id;
|
uint32_t context_id;
|
||||||
mg_termination_t *terminations[MG_CONTEXT_MAX_TERMS];
|
mg_termination_t *terminations[MG_CONTEXT_MAX_TERMS];
|
||||||
@ -232,6 +257,7 @@ struct megaco_profile_s {
|
|||||||
int inact_tmr; /* inactivity timer value */
|
int inact_tmr; /* inactivity timer value */
|
||||||
int peer_active; /* inactivity timer value */
|
int peer_active; /* inactivity timer value */
|
||||||
uint32_t inact_tmr_task_id; /* FS timer scheduler task-id */
|
uint32_t inact_tmr_task_id; /* FS timer scheduler task-id */
|
||||||
|
mg_fax_detect_event_type_t fax_detect_evt_type;
|
||||||
|
|
||||||
switch_thread_rwlock_t *contexts_rwlock;
|
switch_thread_rwlock_t *contexts_rwlock;
|
||||||
uint32_t next_context_id;
|
uint32_t next_context_id;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user