Merge remote branch 'origin/master'
This commit is contained in:
commit
92f51bd603
|
@ -33,6 +33,12 @@
|
|||
*.ilk
|
||||
*.bsc
|
||||
*.pch
|
||||
*.tar
|
||||
*.gz
|
||||
*.tgz
|
||||
*.xz
|
||||
*.bz2
|
||||
*.tbz2
|
||||
core.*
|
||||
/Path
|
||||
/w32/Library/lastversion
|
||||
|
@ -79,7 +85,6 @@ configure.lineno
|
|||
/scripts/fsxs
|
||||
/scripts/gentls_cert
|
||||
/a.out.dSYM
|
||||
/freeswitch-sounds-*
|
||||
src/mod/applications/mod_easyroute/Makefile
|
||||
src/mod/applications/mod_lcr/Makefile
|
||||
src/mod/applications/mod_nibblebill/Makefile
|
||||
|
|
|
@ -188,6 +188,7 @@
|
|||
<ClInclude Include="..\src\include\ftdm_os.h" />
|
||||
<ClInclude Include="..\src\include\private\ftdm_sched.h" />
|
||||
<ClInclude Include="..\src\include\ftdm_threadmutex.h" />
|
||||
<ClInclude Include="..\src\include\private\ftdm_state.h" />
|
||||
<ClInclude Include="..\src\include\private\ftdm_types.h" />
|
||||
<ClInclude Include="..\src\include\private\g711.h" />
|
||||
<ClInclude Include="..\src\include\private\hashtable.h" />
|
||||
|
@ -209,6 +210,7 @@
|
|||
<ClCompile Include="..\src\ftdm_io.c" />
|
||||
<ClCompile Include="..\src\ftdm_queue.c" />
|
||||
<ClCompile Include="..\src\ftdm_sched.c" />
|
||||
<ClCompile Include="..\src\ftdm_state.c" />
|
||||
<ClCompile Include="..\src\ftdm_threadmutex.c" />
|
||||
<ClCompile Include="..\src\g711.c" />
|
||||
<ClCompile Include="..\src\hashtable.c" />
|
||||
|
|
|
@ -71,6 +71,9 @@
|
|||
<ClInclude Include="..\src\include\private\uart.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\include\private\ftdm_state.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\fsk.c">
|
||||
|
@ -124,5 +127,8 @@
|
|||
<ClCompile Include="..\src\uart.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\ftdm_state.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -873,38 +873,32 @@ ftdm_status_t set_bear_cap_ie(ftdm_channel_t *ftdmchan, BearCap *bearCap)
|
|||
bearCap->tranMode.pres = PRSNT_NODEF;
|
||||
bearCap->tranMode.val = IN_TM_CIRCUIT;
|
||||
|
||||
if (!FTDM_SPAN_IS_BRI(ftdmchan->span)) {
|
||||
/* Trillium stack rejests lyr1Ident on BRI, but Netbricks always sends it.
|
||||
Check with Trillium if this ever causes calls to fail in the field */
|
||||
bearCap->usrInfoLyr1Prot.pres = PRSNT_NODEF;
|
||||
bearCap->usrInfoLyr1Prot.val = sngisdn_get_usrInfoLyr1Prot_from_user(ftdmchan->caller_data.bearer_layer1);
|
||||
|
||||
/* PRI only params */
|
||||
bearCap->usrInfoLyr1Prot.pres = PRSNT_NODEF;
|
||||
bearCap->usrInfoLyr1Prot.val = sngisdn_get_usrInfoLyr1Prot_from_user(ftdmchan->caller_data.bearer_layer1);
|
||||
|
||||
switch (signal_data->switchtype) {
|
||||
case SNGISDN_SWITCH_NI2:
|
||||
case SNGISDN_SWITCH_4ESS:
|
||||
case SNGISDN_SWITCH_5ESS:
|
||||
case SNGISDN_SWITCH_DMS100:
|
||||
case SNGISDN_SWITCH_INSNET:
|
||||
if (bearCap->usrInfoLyr1Prot.val == IN_UIL1_G711ALAW) {
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Overriding bearer cap to u-law\n");
|
||||
bearCap->usrInfoLyr1Prot.val = IN_UIL1_G711ULAW;
|
||||
}
|
||||
break;
|
||||
case SNGISDN_SWITCH_EUROISDN:
|
||||
case SNGISDN_SWITCH_QSIG:
|
||||
if (bearCap->usrInfoLyr1Prot.val == IN_UIL1_G711ULAW) {
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Overriding bearer cap to a-law\n");
|
||||
bearCap->usrInfoLyr1Prot.val = IN_UIL1_G711ALAW;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
bearCap->lyr1Ident.pres = PRSNT_NODEF;
|
||||
bearCap->lyr1Ident.val = IN_L1_IDENT;
|
||||
switch (signal_data->switchtype) {
|
||||
case SNGISDN_SWITCH_NI2:
|
||||
case SNGISDN_SWITCH_4ESS:
|
||||
case SNGISDN_SWITCH_5ESS:
|
||||
case SNGISDN_SWITCH_DMS100:
|
||||
case SNGISDN_SWITCH_INSNET:
|
||||
if (bearCap->usrInfoLyr1Prot.val == IN_UIL1_G711ALAW) {
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Overriding bearer cap to u-law\n");
|
||||
bearCap->usrInfoLyr1Prot.val = IN_UIL1_G711ULAW;
|
||||
}
|
||||
break;
|
||||
case SNGISDN_SWITCH_EUROISDN:
|
||||
case SNGISDN_SWITCH_QSIG:
|
||||
if (bearCap->usrInfoLyr1Prot.val == IN_UIL1_G711ULAW) {
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Overriding bearer cap to a-law\n");
|
||||
bearCap->usrInfoLyr1Prot.val = IN_UIL1_G711ALAW;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
bearCap->lyr1Ident.pres = PRSNT_NODEF;
|
||||
bearCap->lyr1Ident.val = IN_L1_IDENT;
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,12 +61,7 @@ while ($sock->recv($newmsg, 1024)) {
|
|||
}
|
||||
print "Sending option 66 as $opt_u\n";
|
||||
|
||||
$handle = IO::Socket::INET->new(Proto => 'udp',
|
||||
PeerPort => '68',
|
||||
LocalPort => '67',
|
||||
ReuseAddr => 1,
|
||||
PeerAddr => $dhcpreq->ciaddr(),
|
||||
) or die "socket: $@";
|
||||
$handle->send($dhcpresp->serialize())
|
||||
|
||||
$sock->send($dhcpresp->serialize())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2372,7 +2372,7 @@ SWITCH_STANDARD_API(uuid_media_function)
|
|||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#define BROADCAST_SYNTAX "<uuid> <path> [aleg|bleg|both]"
|
||||
#define BROADCAST_SYNTAX "<uuid> <path> [aleg|bleg|holdb|both]"
|
||||
SWITCH_STANDARD_API(uuid_broadcast_function)
|
||||
{
|
||||
char *mycmd = NULL, *argv[4] = { 0 };
|
||||
|
@ -2389,15 +2389,26 @@ SWITCH_STANDARD_API(uuid_broadcast_function)
|
|||
switch_media_flag_t flags = SMF_NONE;
|
||||
|
||||
if (argv[2]) {
|
||||
if (!strcasecmp(argv[2], "both")) {
|
||||
if (switch_stristr("both", (argv[2]))) {
|
||||
flags |= (SMF_ECHO_ALEG | SMF_ECHO_BLEG);
|
||||
} else if (!strcasecmp(argv[2], "aleg")) {
|
||||
}
|
||||
|
||||
if (switch_stristr("aleg", argv[2])) {
|
||||
flags |= SMF_ECHO_ALEG;
|
||||
} else if (!strcasecmp(argv[2], "bleg")) {
|
||||
}
|
||||
|
||||
if (switch_stristr("bleg", argv[2])) {
|
||||
flags &= ~SMF_HOLD_BLEG;
|
||||
flags |= SMF_ECHO_BLEG;
|
||||
}
|
||||
|
||||
if (switch_stristr("holdb", argv[2])) {
|
||||
flags &= ~SMF_ECHO_BLEG;
|
||||
flags |= SMF_HOLD_BLEG;
|
||||
}
|
||||
|
||||
} else {
|
||||
flags |= SMF_ECHO_ALEG;
|
||||
flags = SMF_ECHO_ALEG | SMF_HOLD_BLEG;
|
||||
}
|
||||
|
||||
status = switch_ivr_broadcast(argv[0], argv[1], flags);
|
||||
|
|
|
@ -152,7 +152,8 @@ typedef enum {
|
|||
CFLAG_BRIDGE_TO = (1 << 6),
|
||||
CFLAG_WAIT_MOD = (1 << 7),
|
||||
CFLAG_VID_FLOOR = (1 << 8),
|
||||
CFLAG_WASTE_BANDWIDTH = (1 << 9)
|
||||
CFLAG_WASTE_BANDWIDTH = (1 << 9),
|
||||
CFLAG_OUTCALL = (1 << 10)
|
||||
} conf_flag_t;
|
||||
|
||||
typedef enum {
|
||||
|
@ -288,6 +289,8 @@ typedef struct conference_obj {
|
|||
uint32_t avg_tally;
|
||||
switch_time_t run_time;
|
||||
char *uuid_str;
|
||||
uint32_t originating;
|
||||
switch_call_cause_t cancel_cause;
|
||||
} conference_obj_t;
|
||||
|
||||
/* Relationship with another member */
|
||||
|
@ -395,11 +398,16 @@ SWITCH_STANDARD_API(conf_api_main);
|
|||
static switch_status_t conference_outcall(conference_obj_t *conference,
|
||||
char *conference_name,
|
||||
switch_core_session_t *session,
|
||||
char *bridgeto, uint32_t timeout, char *flags, char *cid_name, char *cid_num, switch_call_cause_t *cause);
|
||||
char *bridgeto, uint32_t timeout,
|
||||
char *flags,
|
||||
char *cid_name,
|
||||
char *cid_num,
|
||||
switch_call_cause_t *cause,
|
||||
switch_call_cause_t *cancel_cause);
|
||||
static switch_status_t conference_outcall_bg(conference_obj_t *conference,
|
||||
char *conference_name,
|
||||
switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_name,
|
||||
const char *cid_num, const char *call_uuid);
|
||||
const char *cid_num, const char *call_uuid, switch_call_cause_t *cancel_cause);
|
||||
SWITCH_STANDARD_APP(conference_function);
|
||||
static void launch_conference_thread(conference_obj_t *conference);
|
||||
static void launch_conference_video_thread(conference_obj_t *conference);
|
||||
|
@ -1381,6 +1389,14 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v
|
|||
/* Rinse ... Repeat */
|
||||
end:
|
||||
|
||||
if (switch_test_flag(conference, CFLAG_OUTCALL)) {
|
||||
conference->cancel_cause = SWITCH_CAUSE_ORIGINATOR_CANCEL;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Ending pending outcall channels for Conference: '%s'\n", conference->name);
|
||||
while(conference->originating) {
|
||||
switch_yield(200000);
|
||||
}
|
||||
}
|
||||
|
||||
if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", conference->name);
|
||||
|
@ -2404,6 +2420,8 @@ static void conference_loop_output(conference_member_t *member)
|
|||
|
||||
switch_channel_set_private(channel, "_conference_autocall_list_", NULL);
|
||||
|
||||
switch_set_flag(member->conference, CFLAG_OUTCALL);
|
||||
|
||||
if (toval) {
|
||||
to = atoi(toval);
|
||||
if (to < 10 || to > 500) {
|
||||
|
@ -2422,7 +2440,8 @@ static void conference_loop_output(conference_member_t *member)
|
|||
for (x = 0; x < argc; x++) {
|
||||
char *dial_str = switch_mprintf("%s%s", switch_str_nil(prefix), argv[x]);
|
||||
switch_assert(dial_str);
|
||||
conference_outcall_bg(member->conference, NULL, NULL, dial_str, to, switch_str_nil(flags), cid_name, cid_num, NULL);
|
||||
conference_outcall_bg(member->conference, NULL, NULL, dial_str, to, switch_str_nil(flags), cid_name, cid_num, NULL,
|
||||
&member->conference->cancel_cause);
|
||||
switch_safe_free(dial_str);
|
||||
}
|
||||
switch_safe_free(cpstr);
|
||||
|
@ -4244,9 +4263,9 @@ static switch_status_t conf_api_sub_dial(conference_obj_t *conference, switch_st
|
|||
}
|
||||
|
||||
if (conference) {
|
||||
conference_outcall(conference, NULL, NULL, argv[2], 60, NULL, argv[4], argv[3], &cause);
|
||||
conference_outcall(conference, NULL, NULL, argv[2], 60, NULL, argv[4], argv[3], &cause, NULL);
|
||||
} else {
|
||||
conference_outcall(NULL, argv[0], NULL, argv[2], 60, NULL, argv[4], argv[3], &cause);
|
||||
conference_outcall(NULL, argv[0], NULL, argv[2], 60, NULL, argv[4], argv[3], &cause, NULL);
|
||||
}
|
||||
stream->write_function(stream, "Call Requested: result: [%s]\n", switch_channel_cause2str(cause));
|
||||
|
||||
|
@ -4269,9 +4288,9 @@ static switch_status_t conf_api_sub_bgdial(conference_obj_t *conference, switch_
|
|||
switch_uuid_format(uuid_str, &uuid);
|
||||
|
||||
if (conference) {
|
||||
conference_outcall_bg(conference, NULL, NULL, argv[2], 60, NULL, argv[4], argv[3], uuid_str);
|
||||
conference_outcall_bg(conference, NULL, NULL, argv[2], 60, NULL, argv[4], argv[3], uuid_str, NULL);
|
||||
} else {
|
||||
conference_outcall_bg(NULL, argv[0], NULL, argv[2], 60, NULL, argv[4], argv[3], uuid_str);
|
||||
conference_outcall_bg(NULL, argv[0], NULL, argv[2], 60, NULL, argv[4], argv[3], uuid_str, NULL);
|
||||
}
|
||||
|
||||
stream->write_function(stream, "OK Job-UUID: %s\n", uuid_str);
|
||||
|
@ -4785,7 +4804,11 @@ SWITCH_STANDARD_API(conf_api_main)
|
|||
static switch_status_t conference_outcall(conference_obj_t *conference,
|
||||
char *conference_name,
|
||||
switch_core_session_t *session,
|
||||
char *bridgeto, uint32_t timeout, char *flags, char *cid_name, char *cid_num, switch_call_cause_t *cause)
|
||||
char *bridgeto, uint32_t timeout,
|
||||
char *flags, char *cid_name,
|
||||
char *cid_num,
|
||||
switch_call_cause_t *cause,
|
||||
switch_call_cause_t *cancel_cause)
|
||||
{
|
||||
switch_core_session_t *peer_session = NULL;
|
||||
switch_channel_t *peer_channel;
|
||||
|
@ -4831,8 +4854,15 @@ static switch_status_t conference_outcall(conference_obj_t *conference,
|
|||
|
||||
/* establish an outbound call leg */
|
||||
|
||||
if (switch_ivr_originate(session, &peer_session, cause, bridgeto, timeout, NULL, cid_name, cid_num, NULL, NULL, SOF_NO_LIMITS, NULL) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
switch_mutex_lock(conference->mutex);
|
||||
conference->originating++;
|
||||
switch_mutex_unlock(conference->mutex);
|
||||
status = switch_ivr_originate(session, &peer_session, cause, bridgeto, timeout, NULL, cid_name, cid_num, NULL, NULL, SOF_NO_LIMITS, cancel_cause);
|
||||
switch_mutex_lock(conference->mutex);
|
||||
conference->originating--;
|
||||
switch_mutex_unlock(conference->mutex);
|
||||
|
||||
if (status != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot create outgoing channel, cause: %s\n",
|
||||
switch_channel_cause2str(*cause));
|
||||
if (caller_channel) {
|
||||
|
@ -4909,6 +4939,7 @@ struct bg_call {
|
|||
char *cid_num;
|
||||
char *conference_name;
|
||||
char *uuid;
|
||||
switch_call_cause_t *cancel_cause;
|
||||
switch_memory_pool_t *pool;
|
||||
};
|
||||
|
||||
|
@ -4921,7 +4952,7 @@ static void *SWITCH_THREAD_FUNC conference_outcall_run(switch_thread_t *thread,
|
|||
switch_event_t *event;
|
||||
|
||||
conference_outcall(call->conference, call->conference_name,
|
||||
call->session, call->bridgeto, call->timeout, call->flags, call->cid_name, call->cid_num, &cause);
|
||||
call->session, call->bridgeto, call->timeout, call->flags, call->cid_name, call->cid_num, &cause, call->cancel_cause);
|
||||
|
||||
if (call->conference && test_eflag(call->conference, EFLAG_BGDIAL_RESULT) &&
|
||||
switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
|
||||
|
@ -4949,7 +4980,7 @@ static void *SWITCH_THREAD_FUNC conference_outcall_run(switch_thread_t *thread,
|
|||
static switch_status_t conference_outcall_bg(conference_obj_t *conference,
|
||||
char *conference_name,
|
||||
switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_name,
|
||||
const char *cid_num, const char *call_uuid)
|
||||
const char *cid_num, const char *call_uuid, switch_call_cause_t *cancel_cause)
|
||||
{
|
||||
struct bg_call *call = NULL;
|
||||
switch_thread_t *thread;
|
||||
|
@ -4963,6 +4994,7 @@ static switch_status_t conference_outcall_bg(conference_obj_t *conference,
|
|||
call->conference = conference;
|
||||
call->session = session;
|
||||
call->timeout = timeout;
|
||||
call->cancel_cause = cancel_cause;
|
||||
|
||||
if (conference) {
|
||||
pool = conference->pool;
|
||||
|
@ -5717,7 +5749,7 @@ SWITCH_STANDARD_APP(conference_function)
|
|||
/* if we're using "bridge:" make an outbound call and bridge it in */
|
||||
if (!zstr(bridgeto) && strcasecmp(bridgeto, "none")) {
|
||||
switch_call_cause_t cause;
|
||||
if (conference_outcall(conference, NULL, session, bridgeto, 60, NULL, NULL, NULL, &cause) != SWITCH_STATUS_SUCCESS) {
|
||||
if (conference_outcall(conference, NULL, session, bridgeto, 60, NULL, NULL, NULL, &cause, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -40,6 +40,9 @@
|
|||
#define MAX_FEC_ENTRIES 4
|
||||
#define MAX_FEC_SPAN 4
|
||||
|
||||
#define SPANDSP_EVENT_TXFAXRESULT "spandsp::txfaxresult"
|
||||
#define SPANDSP_EVENT_RXFAXRESULT "spandsp::rxfaxresult"
|
||||
|
||||
/*****************************************************************************
|
||||
OUR DEFINES AND STRUCTS
|
||||
*****************************************************************************/
|
||||
|
@ -305,7 +308,14 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result)
|
|||
switch_core_session_t *session;
|
||||
switch_channel_t *channel;
|
||||
pvt_t *pvt;
|
||||
char *tmp;
|
||||
char *fax_document_transferred_pages = NULL;
|
||||
char *fax_document_total_pages = NULL;
|
||||
char *fax_image_resolution = NULL;
|
||||
char *fax_image_size = NULL;
|
||||
char *fax_bad_rows = NULL;
|
||||
char *fax_transfer_rate = NULL;
|
||||
char *fax_result_code = NULL;
|
||||
switch_event_t *event;
|
||||
|
||||
pvt = (pvt_t *) user_data;
|
||||
switch_assert(pvt);
|
||||
|
@ -353,13 +363,12 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result)
|
|||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "==============================================================================\n");
|
||||
|
||||
/*
|
||||
Set our channel variables
|
||||
Set our channel variables, variables are also used in event
|
||||
*/
|
||||
|
||||
tmp = switch_mprintf("%i", result);
|
||||
if (tmp) {
|
||||
switch_channel_set_variable(channel, "fax_result_code", tmp);
|
||||
switch_safe_free(tmp);
|
||||
fax_result_code = switch_core_session_sprintf(session, "%i", result);
|
||||
if (fax_result_code) {
|
||||
switch_channel_set_variable(channel, "fax_result_code", fax_result_code);
|
||||
}
|
||||
|
||||
switch_channel_set_variable(channel, "fax_result_text", t30_completion_code_to_str(result));
|
||||
|
@ -368,49 +377,56 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result)
|
|||
switch_channel_set_variable(channel, "fax_local_station_id", local_ident);
|
||||
switch_channel_set_variable(channel, "fax_remote_station_id", far_ident);
|
||||
|
||||
tmp = switch_mprintf("%i", pvt->app_mode == FUNCTION_TX ? t.pages_tx : t.pages_rx);
|
||||
if (tmp) {
|
||||
switch_channel_set_variable(channel, "fax_document_transferred_pages", tmp);
|
||||
switch_safe_free(tmp);
|
||||
fax_document_transferred_pages = switch_core_session_sprintf(session, "%i", pvt->app_mode == FUNCTION_TX ? t.pages_tx : t.pages_rx);
|
||||
if (fax_document_transferred_pages) {
|
||||
switch_channel_set_variable(channel, "fax_document_transferred_pages", fax_document_transferred_pages);
|
||||
}
|
||||
|
||||
tmp = switch_mprintf("%i", t.pages_in_file);
|
||||
if (tmp) {
|
||||
switch_channel_set_variable(channel, "fax_document_total_pages", tmp);
|
||||
switch_safe_free(tmp);
|
||||
fax_document_total_pages = switch_core_session_sprintf(session, "%i", t.pages_in_file);
|
||||
if (fax_document_total_pages) {
|
||||
switch_channel_set_variable(channel, "fax_document_total_pages", fax_document_total_pages);
|
||||
}
|
||||
|
||||
tmp = switch_mprintf("%ix%i", t.x_resolution, t.y_resolution);
|
||||
if (tmp) {
|
||||
switch_channel_set_variable(channel, "fax_image_resolution", tmp);
|
||||
switch_safe_free(tmp);
|
||||
fax_image_resolution = switch_core_session_sprintf(session, "%ix%i", t.x_resolution, t.y_resolution);
|
||||
if (fax_image_resolution) {
|
||||
switch_channel_set_variable(channel, "fax_image_resolution", fax_image_resolution);
|
||||
}
|
||||
|
||||
tmp = switch_mprintf("%d", t.image_size);
|
||||
if (tmp) {
|
||||
switch_channel_set_variable(channel, "fax_image_size", tmp);
|
||||
switch_safe_free(tmp);
|
||||
fax_image_size = switch_core_session_sprintf(session, "%d", t.image_size);
|
||||
if (fax_image_size) {
|
||||
switch_channel_set_variable(channel, "fax_image_size", fax_image_size);
|
||||
}
|
||||
|
||||
tmp = switch_mprintf("%d", t.bad_rows);
|
||||
if (tmp) {
|
||||
switch_channel_set_variable(channel, "fax_bad_rows", tmp);
|
||||
switch_safe_free(tmp);
|
||||
fax_bad_rows = switch_core_session_sprintf(session, "%d", t.bad_rows);
|
||||
if (fax_bad_rows) {
|
||||
switch_channel_set_variable(channel, "fax_bad_rows", fax_bad_rows);
|
||||
}
|
||||
|
||||
tmp = switch_mprintf("%i", t.bit_rate);
|
||||
if (tmp) {
|
||||
switch_channel_set_variable(channel, "fax_transfer_rate", tmp);
|
||||
switch_safe_free(tmp);
|
||||
fax_transfer_rate = switch_core_session_sprintf(session, "%i", t.bit_rate);
|
||||
if (fax_transfer_rate) {
|
||||
switch_channel_set_variable(channel, "fax_transfer_rate", fax_transfer_rate);
|
||||
}
|
||||
|
||||
/* switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); */
|
||||
|
||||
pvt->done = 1;
|
||||
|
||||
/*
|
||||
TODO Fire events
|
||||
*/
|
||||
/* Fire event */
|
||||
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, pvt->app_mode == FUNCTION_TX ? SPANDSP_EVENT_TXFAXRESULT : SPANDSP_EVENT_RXFAXRESULT) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-document-transferred-pages", fax_document_transferred_pages);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-document-total-pages", fax_document_total_pages);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-image-resolution", fax_image_resolution);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-image-size", fax_image_size);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-bad-rows", fax_bad_rows);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-transfer-rate", fax_transfer_rate);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-result-code", fax_result_code);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-result-text", t30_completion_code_to_str(result));
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-ecm-used", (t.error_correcting_mode) ? "on" : "off");
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-local-station-id", local_ident);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-remote-station-id", far_ident);
|
||||
switch_core_session_queue_private_event(session, &event, SWITCH_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count)
|
||||
|
@ -1026,7 +1042,6 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat
|
|||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Fax TX filename not set.\n");
|
||||
goto done;
|
||||
} else if (pvt->app_mode == FUNCTION_RX) {
|
||||
char *fname;
|
||||
const char *prefix;
|
||||
switch_time_t time;
|
||||
|
||||
|
@ -1036,11 +1051,7 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat
|
|||
prefix = globals.prepend_string;
|
||||
}
|
||||
|
||||
fname = switch_mprintf("%s/%s-%ld-%ld.tif", globals.spool, prefix, globals.total_sessions, time);
|
||||
if (fname) {
|
||||
pvt->filename = switch_core_session_strdup(session, fname);
|
||||
switch_safe_free(fname);
|
||||
} else {
|
||||
if (!(pvt->filename = switch_core_session_sprintf(session, "%s/%s-%ld-%ld.tif", globals.spool, prefix, globals.total_sessions, time))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot automatically set fax RX destination file\n");
|
||||
goto done;
|
||||
}
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
!/gsmlib/gsmlib-*/aclocal.m4
|
||||
!/gsmlib/gsmlib-*/configure
|
||||
!/gsmlib/gsmlib-1.10.tar.gz
|
||||
!/gsmlib/gsmlib_1.10-12ubuntu1.diff.gz
|
||||
|
|
|
@ -77,11 +77,11 @@ struct private_object {
|
|||
|
||||
switch_frame_t cng_frame;
|
||||
unsigned char cng_databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
|
||||
switch_timer_t timer;
|
||||
switch_caller_profile_t *caller_profile;
|
||||
int32_t bowout_frame_count;
|
||||
char *other_uuid;
|
||||
switch_queue_t *frame_queue;
|
||||
switch_codec_implementation_t read_impl;
|
||||
};
|
||||
|
||||
typedef struct private_object private_t;
|
||||
|
@ -111,7 +111,6 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses
|
|||
int interval = 20;
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
const switch_codec_implementation_t *read_impl;
|
||||
|
||||
if (codec) {
|
||||
iananame = codec->implementation->iananame;
|
||||
|
@ -166,15 +165,7 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses
|
|||
switch_core_session_set_read_codec(session, &tech_pvt->read_codec);
|
||||
switch_core_session_set_write_codec(session, &tech_pvt->write_codec);
|
||||
|
||||
if (tech_pvt->flag_mutex) {
|
||||
switch_core_timer_destroy(&tech_pvt->timer);
|
||||
}
|
||||
|
||||
read_impl = tech_pvt->read_codec.implementation;
|
||||
|
||||
switch_core_timer_init(&tech_pvt->timer, "soft",
|
||||
read_impl->microseconds_per_packet / 1000, read_impl->samples_per_packet * 4, switch_core_session_get_pool(session));
|
||||
|
||||
tech_pvt->read_impl = *tech_pvt->read_codec.implementation;
|
||||
|
||||
if (!tech_pvt->flag_mutex) {
|
||||
switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
|
||||
|
@ -376,7 +367,6 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
|
|||
tech_pvt = switch_core_session_get_private(session);
|
||||
|
||||
if (tech_pvt) {
|
||||
switch_core_timer_destroy(&tech_pvt->timer);
|
||||
|
||||
if (switch_core_codec_ready(&tech_pvt->read_codec)) {
|
||||
switch_core_codec_destroy(&tech_pvt->read_codec);
|
||||
|
@ -568,12 +558,10 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
|||
goto end;
|
||||
}
|
||||
|
||||
switch_core_timer_next(&tech_pvt->timer);
|
||||
|
||||
mutex = tech_pvt->mutex;
|
||||
switch_mutex_lock(mutex);
|
||||
|
||||
if (switch_queue_trypop(tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
|
||||
|
||||
if (switch_queue_pop_timeout(tech_pvt->frame_queue, &pop, tech_pvt->read_impl.microseconds_per_packet) == SWITCH_STATUS_SUCCESS && pop) {
|
||||
if (tech_pvt->write_frame) {
|
||||
switch_frame_free(&tech_pvt->write_frame);
|
||||
}
|
||||
|
@ -585,6 +573,8 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
|||
switch_set_flag(tech_pvt, TFLAG_CNG);
|
||||
}
|
||||
|
||||
switch_mutex_lock(mutex);
|
||||
|
||||
if (switch_test_flag(tech_pvt, TFLAG_CNG)) {
|
||||
unsigned char data[SWITCH_RECOMMENDED_BUFFER_SIZE];
|
||||
uint32_t flag = 0;
|
||||
|
@ -775,8 +765,6 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
|||
switch_frame_free(&frame);
|
||||
}
|
||||
|
||||
switch_core_timer_sync(&tech_pvt->timer);
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -4850,7 +4850,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
|
|||
sofia_endpoint_interface->state_handler = &sofia_event_handlers;
|
||||
|
||||
management_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_MANAGEMENT_INTERFACE);
|
||||
management_interface->relative_oid = "1";
|
||||
management_interface->relative_oid = "1001";
|
||||
management_interface->management_function = sofia_manage;
|
||||
|
||||
SWITCH_ADD_API(api_interface, "sofia", "Sofia Controls", sofia_function, "<cmd> <args>");
|
||||
|
|
|
@ -808,6 +808,18 @@ void sofia_event_callback(nua_event_t event,
|
|||
}
|
||||
}
|
||||
|
||||
if ((event == nua_i_invite) && (!session)) {
|
||||
uint32_t sess_count = switch_core_session_count();
|
||||
uint32_t sess_max = switch_core_session_limit(0);
|
||||
|
||||
if (sess_count >= sess_max || !sofia_test_pflag(profile, PFLAG_RUNNING) || !switch_core_ready()) {
|
||||
nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No more sessions allowed at this time.\n");
|
||||
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (sofia_test_pflag(profile, PFLAG_AUTH_ALL) && tech_pvt && tech_pvt->key && sip) {
|
||||
sip_authorization_t const *authorization = NULL;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <switch.h>
|
||||
#define CMD_BUFLEN 1024 * 1000
|
||||
#define MAX_QUEUE_LEN 25000
|
||||
#define MAX_MISSED 2000
|
||||
#define MAX_MISSED 500
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_event_socket_load);
|
||||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_event_socket_shutdown);
|
||||
SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_socket_runtime);
|
||||
|
@ -143,7 +143,7 @@ static const char *format2str(event_format_t format)
|
|||
}
|
||||
|
||||
static void remove_listener(listener_t *listener);
|
||||
static void kill_listener(listener_t *l);
|
||||
static void kill_listener(listener_t *l, const char *message);
|
||||
static void kill_all_listeners(void);
|
||||
|
||||
static uint32_t next_id(void)
|
||||
|
@ -170,7 +170,7 @@ static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_l
|
|||
if (switch_test_flag(l, LFLAG_LOG) && l->level >= node->level) {
|
||||
switch_log_node_t *dnode = switch_log_node_dup(node);
|
||||
|
||||
if (switch_queue_push(l->log_queue, dnode) == SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_queue_trypush(l->log_queue, dnode) == SWITCH_STATUS_SUCCESS) {
|
||||
if (l->lost_logs) {
|
||||
int ll = l->lost_logs;
|
||||
switch_event_t *event;
|
||||
|
@ -184,7 +184,7 @@ static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_l
|
|||
} else {
|
||||
switch_log_node_free(&dnode);
|
||||
if (++l->lost_logs > MAX_MISSED) {
|
||||
kill_listener(l);
|
||||
kill_listener(l, "Disconnected due to log queue failure.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ static void event_handler(switch_event_t *event)
|
|||
|
||||
if (send) {
|
||||
if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_queue_push(l->event_queue, clone) == SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_queue_trypush(l->event_queue, clone) == SWITCH_STATUS_SUCCESS) {
|
||||
if (l->lost_events) {
|
||||
int le = l->lost_events;
|
||||
l->lost_events = 0;
|
||||
|
@ -379,7 +379,7 @@ static void event_handler(switch_event_t *event)
|
|||
}
|
||||
} else {
|
||||
if (++l->lost_events > MAX_MISSED) {
|
||||
kill_listener(l);
|
||||
kill_listener(l, "Disconnected due to event queue failure.\n");
|
||||
}
|
||||
switch_event_destroy(&clone);
|
||||
}
|
||||
|
@ -579,8 +579,41 @@ static void remove_listener(listener_t *listener)
|
|||
switch_mutex_unlock(globals.listener_mutex);
|
||||
}
|
||||
|
||||
static void kill_listener(listener_t *l)
|
||||
static void send_disconnect(listener_t *listener, const char *message)
|
||||
{
|
||||
|
||||
char disco_buf[512] = "";
|
||||
switch_size_t len, mlen;
|
||||
|
||||
if (zstr(message)) {
|
||||
message = "Disconnected.\n";
|
||||
}
|
||||
|
||||
mlen = strlen(message);
|
||||
|
||||
if (listener->session) {
|
||||
switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\n"
|
||||
"Controlled-Session-UUID: %s\n"
|
||||
"Content-Disposition: disconnect\n" "Content-Length: %d\n\n", switch_core_session_get_uuid(listener->session), mlen);
|
||||
} else {
|
||||
switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\nContent-Length: %d\n\n", mlen);
|
||||
}
|
||||
|
||||
len = strlen(disco_buf);
|
||||
switch_socket_send(listener->sock, disco_buf, &len);
|
||||
if (len > 0) {
|
||||
len = mlen;
|
||||
switch_socket_send(listener->sock, message, &len);
|
||||
}
|
||||
}
|
||||
|
||||
static void kill_listener(listener_t *l, const char *message)
|
||||
{
|
||||
|
||||
if (message) {
|
||||
send_disconnect(l, message);
|
||||
}
|
||||
|
||||
switch_clear_flag(l, LFLAG_RUNNING);
|
||||
if (l->sock) {
|
||||
switch_socket_shutdown(l->sock, SWITCH_SHUTDOWN_READWRITE);
|
||||
|
@ -595,7 +628,7 @@ static void kill_all_listeners(void)
|
|||
|
||||
switch_mutex_lock(globals.listener_mutex);
|
||||
for (l = listen_list.listeners; l; l = l->next) {
|
||||
kill_listener(l);
|
||||
kill_listener(l, "The system is being shut down.\n");
|
||||
}
|
||||
switch_mutex_unlock(globals.listener_mutex);
|
||||
}
|
||||
|
@ -1233,7 +1266,7 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event,
|
|||
if (switch_channel_get_state(chan) < CS_HANGUP && switch_channel_test_flag(chan, CF_DIVERT_EVENTS)) {
|
||||
switch_event_t *e = NULL;
|
||||
while (switch_core_session_dequeue_event(listener->session, &e, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_queue_push(listener->event_queue, e) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_queue_trypush(listener->event_queue, e) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_core_session_queue_event(listener->session, &e);
|
||||
break;
|
||||
}
|
||||
|
@ -2540,22 +2573,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
|
|||
}
|
||||
|
||||
if (listener->sock) {
|
||||
char disco_buf[512] = "";
|
||||
const char message[] = "Disconnected, goodbye.\nSee you at ClueCon! http://www.cluecon.com/\n";
|
||||
int mlen = strlen(message);
|
||||
|
||||
if (listener->session) {
|
||||
switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\n"
|
||||
"Controlled-Session-UUID: %s\n"
|
||||
"Content-Disposition: disconnect\n" "Content-Length: %d\n\n", switch_core_session_get_uuid(listener->session), mlen);
|
||||
} else {
|
||||
switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\nContent-Length: %d\n\n", mlen);
|
||||
}
|
||||
|
||||
len = strlen(disco_buf);
|
||||
switch_socket_send(listener->sock, disco_buf, &len);
|
||||
len = mlen;
|
||||
switch_socket_send(listener->sock, message, &len);
|
||||
send_disconnect(listener, "Disconnected, goodbye.\nSee you at ClueCon! http://www.cluecon.com/\n");
|
||||
close_socket(&listener->sock);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
static struct {
|
||||
switch_memory_pool_t *pool;
|
||||
switch_mutex_t *mutex;
|
||||
int shutdown;
|
||||
} globals;
|
||||
|
||||
|
@ -47,6 +48,20 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_snmp_runtime);
|
|||
SWITCH_MODULE_DEFINITION(mod_snmp, mod_snmp_load, mod_snmp_shutdown, mod_snmp_runtime);
|
||||
|
||||
|
||||
static switch_status_t snmp_manage(char *relative_oid, switch_management_action_t action, char *data, switch_size_t datalen)
|
||||
{
|
||||
if (action == SMA_GET) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Mutex lock request from relative OID %s.\n", relative_oid);
|
||||
switch_mutex_lock(globals.mutex);
|
||||
} else if (action == SMA_SET) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Mutex unlock request from relative OID %s.\n", relative_oid);
|
||||
switch_mutex_unlock(globals.mutex);
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int snmp_callback_log(int major, int minor, void *serverarg, void *clientarg)
|
||||
{
|
||||
struct snmp_log_message *slm = (struct snmp_log_message *) serverarg;
|
||||
|
@ -55,27 +70,13 @@ static int snmp_callback_log(int major, int minor, void *serverarg, void *client
|
|||
}
|
||||
|
||||
|
||||
static switch_state_handler_table_t state_handlers = {
|
||||
/*.on_init */ NULL,
|
||||
/*.on_routing */ NULL,
|
||||
/*.on_execute */ NULL,
|
||||
/*.on_hangup */ NULL,
|
||||
/*.on_exchange_media */ NULL,
|
||||
/*.on_soft_execute */ NULL,
|
||||
/*.on_consume_media */ NULL,
|
||||
/*.on_hibernate */ NULL,
|
||||
/*.on_reset */ NULL,
|
||||
/*.on_park */ NULL,
|
||||
/*.on_reporting */ NULL
|
||||
};
|
||||
|
||||
|
||||
static switch_status_t load_config(switch_memory_pool_t *pool)
|
||||
{
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
globals.pool = pool;
|
||||
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -84,11 +85,14 @@ static switch_status_t load_config(switch_memory_pool_t *pool)
|
|||
SWITCH_MODULE_LOAD_FUNCTION(mod_snmp_load)
|
||||
{
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
switch_management_interface_t *management_interface;
|
||||
|
||||
load_config(pool);
|
||||
|
||||
switch_core_add_state_handler(&state_handlers);
|
||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||
management_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_MANAGEMENT_INTERFACE);
|
||||
management_interface->relative_oid = "1000";
|
||||
management_interface->management_function = snmp_manage;
|
||||
|
||||
/* Register callback function so we get Net-SNMP logging handled by FreeSWITCH */
|
||||
snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_LOGGING, snmp_callback_log, NULL);
|
||||
|
@ -100,10 +104,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_snmp_load)
|
|||
init_agent("mod_snmp");
|
||||
|
||||
/*
|
||||
* Override master/subagent ping interval to 5s, to ensure that
|
||||
* Override master/subagent ping interval to 2s, to ensure that
|
||||
* agent_check_and_process() never blocks for longer than that.
|
||||
*/
|
||||
netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL, 5);
|
||||
netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL, 2);
|
||||
|
||||
init_subagent();
|
||||
init_snmp("mod_snmp");
|
||||
|
@ -114,11 +118,15 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_snmp_load)
|
|||
|
||||
SWITCH_MODULE_RUNTIME_FUNCTION(mod_snmp_runtime)
|
||||
{
|
||||
while (!globals.shutdown) {
|
||||
if (!globals.shutdown) {
|
||||
switch_mutex_lock(globals.mutex);
|
||||
/* Block on select() */
|
||||
agent_check_and_process(1);
|
||||
switch_mutex_unlock(globals.mutex);
|
||||
}
|
||||
|
||||
switch_yield(5000);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -126,9 +134,12 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_snmp_runtime)
|
|||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_snmp_shutdown)
|
||||
{
|
||||
globals.shutdown = 1;
|
||||
switch_core_remove_state_handler(&state_handlers);
|
||||
|
||||
switch_mutex_lock(globals.mutex);
|
||||
snmp_shutdown("mod_snmp");
|
||||
switch_mutex_unlock(globals.mutex);
|
||||
|
||||
switch_mutex_destroy(globals.mutex);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -37,72 +37,47 @@
|
|||
#include "subagent.h"
|
||||
|
||||
|
||||
static oid identity_oid[] = { 1,3,6,1,4,1,27880,1,1 };
|
||||
static oid systemStats_oid[] = { 1,3,6,1,4,1,27880,1,2 };
|
||||
|
||||
/* identity sub-IDs - these must match MIB */
|
||||
enum {
|
||||
versionString_oid = 1,
|
||||
uuid_oid
|
||||
};
|
||||
|
||||
|
||||
/* systemStats sub-IDs - these must match MIB */
|
||||
enum {
|
||||
uptime_oid = 1,
|
||||
sessionsSinceStartup_oid,
|
||||
currentSessions_oid,
|
||||
maxSessions_oid,
|
||||
currentCalls_oid,
|
||||
sessionsPerSecond_oid,
|
||||
maxSessionsPerSecond_oid
|
||||
};
|
||||
|
||||
|
||||
void init_subagent(void)
|
||||
{
|
||||
DEBUGMSGTL(("init_nstAgentSubagentObject", "Initializing\n"));
|
||||
static oid identity_oid[] = { 1,3,6,1,4,1,27880,1,1 };
|
||||
static oid systemStats_oid[] = { 1,3,6,1,4,1,27880,1,2 };
|
||||
|
||||
netsnmp_register_handler(netsnmp_create_handler_registration("identity", handle_identity, identity_oid, OID_LENGTH(identity_oid), HANDLER_CAN_RONLY));
|
||||
netsnmp_register_handler(netsnmp_create_handler_registration("systemStats", handle_systemStats, systemStats_oid, OID_LENGTH(systemStats_oid), HANDLER_CAN_RONLY));
|
||||
DEBUGMSGTL(("init_subagent", "Initializing\n"));
|
||||
|
||||
netsnmp_register_scalar_group(netsnmp_create_handler_registration("identity", handle_identity, identity_oid, OID_LENGTH(identity_oid), HANDLER_CAN_RONLY), 1, 2);
|
||||
netsnmp_register_scalar_group(netsnmp_create_handler_registration("systemStats", handle_systemStats, systemStats_oid, OID_LENGTH(systemStats_oid), HANDLER_CAN_RONLY), 1, 7);
|
||||
}
|
||||
|
||||
|
||||
int handle_identity(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)
|
||||
{
|
||||
static char const version[] = SWITCH_VERSION_FULL;
|
||||
char uuid[40] = "";
|
||||
netsnmp_request_info *request = NULL;
|
||||
oid subid;
|
||||
static char const version[] = SWITCH_VERSION_FULL;
|
||||
char uuid[40] = "";
|
||||
|
||||
switch(reqinfo->mode) {
|
||||
case MODE_GET:
|
||||
for (request = requests; request; request = request->next) {
|
||||
subid = request->requestvb->name[OID_LENGTH(systemStats_oid)];
|
||||
case MODE_GET:
|
||||
subid = requests->requestvb->name[reginfo->rootoid_len - 2];
|
||||
|
||||
switch (subid) {
|
||||
case versionString_oid:
|
||||
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &version, strlen(version));
|
||||
break;
|
||||
case uuid_oid:
|
||||
strncpy(uuid, switch_core_get_uuid(), sizeof(uuid));
|
||||
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &uuid, strlen(uuid));
|
||||
break;
|
||||
default:
|
||||
snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid);
|
||||
netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
|
||||
}
|
||||
}
|
||||
switch (subid) {
|
||||
case ID_VERSION_STR:
|
||||
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &version, strlen(version));
|
||||
break;
|
||||
|
||||
case MODE_GETNEXT:
|
||||
snmp_log(LOG_ERR, "MODE_GETNEXT not supported (yet)\n");
|
||||
case ID_UUID:
|
||||
strncpy(uuid, switch_core_get_uuid(), sizeof(uuid));
|
||||
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &uuid, strlen(uuid));
|
||||
break;
|
||||
|
||||
default:
|
||||
/* we should never get here, so this is a really bad error */
|
||||
snmp_log(LOG_ERR, "Unknown mode (%d) in handle_versionString\n", reqinfo->mode );
|
||||
return SNMP_ERR_GENERR;
|
||||
snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid);
|
||||
netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
/* we should never get here, so this is a really bad error */
|
||||
snmp_log(LOG_ERR, "Unknown mode (%d) in handle_identity\n", reqinfo->mode );
|
||||
return SNMP_ERR_GENERR;
|
||||
}
|
||||
|
||||
return SNMP_ERR_NOERROR;
|
||||
|
@ -117,59 +92,53 @@ int handle_systemStats(netsnmp_mib_handler *handler, netsnmp_handler_registratio
|
|||
uint32_t int_val;
|
||||
|
||||
switch(reqinfo->mode) {
|
||||
case MODE_GET:
|
||||
for (request = requests; request; request = request->next) {
|
||||
subid = request->requestvb->name[OID_LENGTH(systemStats_oid)];
|
||||
case MODE_GET:
|
||||
subid = requests->requestvb->name[reginfo->rootoid_len - 2];
|
||||
|
||||
switch (subid) {
|
||||
case uptime_oid:
|
||||
uptime = switch_core_uptime() / 10000;
|
||||
snmp_set_var_typed_value(requests->requestvb, ASN_TIMETICKS, (u_char *) &uptime, sizeof(uptime));
|
||||
break;
|
||||
case sessionsSinceStartup_oid:
|
||||
int_val = switch_core_session_id() - 1;
|
||||
snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER, (u_char *) &int_val, sizeof(int_val));
|
||||
break;
|
||||
case currentSessions_oid:
|
||||
int_val = switch_core_session_count();
|
||||
snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
|
||||
break;
|
||||
case maxSessions_oid:
|
||||
switch_core_session_ctl(SCSC_MAX_SESSIONS, &int_val);;
|
||||
snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
|
||||
break;
|
||||
case currentCalls_oid:
|
||||
/*
|
||||
* This is zero for now, since there is no convenient way to get total call
|
||||
* count (not to be confused with session count), without touching the
|
||||
* database.
|
||||
*/
|
||||
int_val = 0;
|
||||
snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
|
||||
break;
|
||||
case sessionsPerSecond_oid:
|
||||
switch_core_session_ctl(SCSC_LAST_SPS, &int_val);
|
||||
snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
|
||||
break;
|
||||
case maxSessionsPerSecond_oid:
|
||||
switch_core_session_ctl(SCSC_SPS, &int_val);
|
||||
snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
|
||||
break;
|
||||
default:
|
||||
snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid);
|
||||
netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
|
||||
}
|
||||
}
|
||||
switch (subid) {
|
||||
case SS_UPTIME:
|
||||
uptime = switch_core_uptime() / 10000;
|
||||
snmp_set_var_typed_value(requests->requestvb, ASN_TIMETICKS, (u_char *) &uptime, sizeof(uptime));
|
||||
break;
|
||||
|
||||
case MODE_GETNEXT:
|
||||
snmp_log(LOG_ERR, "MODE_GETNEXT not supported (yet)\n");
|
||||
case SS_SESSIONS_SINCE_STARTUP:
|
||||
int_val = switch_core_session_id() - 1;
|
||||
snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER, (u_char *) &int_val, sizeof(int_val));
|
||||
break;
|
||||
case SS_CURRENT_SESSIONS:
|
||||
int_val = switch_core_session_count();
|
||||
snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
|
||||
break;
|
||||
case SS_MAX_SESSIONS:
|
||||
switch_core_session_ctl(SCSC_MAX_SESSIONS, &int_val);;
|
||||
snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
|
||||
break;
|
||||
case SS_CURRENT_CALLS:
|
||||
/*
|
||||
* This is zero for now, since there is no convenient way to get total call
|
||||
* count (not to be confused with session count), without touching the
|
||||
* database.
|
||||
*/
|
||||
int_val = 0;
|
||||
snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
|
||||
break;
|
||||
case SS_SESSIONS_PER_SECOND:
|
||||
switch_core_session_ctl(SCSC_LAST_SPS, &int_val);
|
||||
snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
|
||||
break;
|
||||
case SS_MAX_SESSIONS_PER_SECOND:
|
||||
switch_core_session_ctl(SCSC_SPS, &int_val);
|
||||
snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
|
||||
break;
|
||||
|
||||
default:
|
||||
/* we should never get here, so this is a really bad error */
|
||||
snmp_log(LOG_ERR, "Unknown mode (%d) in handle_systemStats\n", reqinfo->mode);
|
||||
return SNMP_ERR_GENERR;
|
||||
snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid);
|
||||
netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
/* we should never get here, so this is a really bad error */
|
||||
snmp_log(LOG_ERR, "Unknown mode (%d) in handle_systemStats\n", reqinfo->mode);
|
||||
return SNMP_ERR_GENERR;
|
||||
}
|
||||
|
||||
return SNMP_ERR_NOERROR;
|
||||
|
|
|
@ -1,6 +1,20 @@
|
|||
#ifndef subagent_H
|
||||
#define subagent_H
|
||||
|
||||
/* .1.3.6.1.4.1.27880.1.1 */
|
||||
#define ID_VERSION_STR 1
|
||||
#define ID_UUID 2
|
||||
|
||||
/* .1.3.6.1.4.1.27880.1.2 */
|
||||
#define SS_UPTIME 1
|
||||
#define SS_SESSIONS_SINCE_STARTUP 2
|
||||
#define SS_CURRENT_SESSIONS 3
|
||||
#define SS_MAX_SESSIONS 4
|
||||
#define SS_CURRENT_CALLS 5
|
||||
#define SS_SESSIONS_PER_SECOND 6
|
||||
#define SS_MAX_SESSIONS_PER_SECOND 7
|
||||
|
||||
|
||||
void init_subagent(void);
|
||||
Netsnmp_Node_Handler handle_identity;
|
||||
Netsnmp_Node_Handler handle_systemStats;
|
||||
|
|
|
@ -89,6 +89,7 @@ class Dbh {
|
|||
~Dbh();
|
||||
bool release();
|
||||
bool connected();
|
||||
bool test_reactive(char *test_sql, char *drop_sql = NULL, char *reactive_sql = NULL);
|
||||
bool query(char *sql, SWIGLUA_FN lua_fun);
|
||||
int affected_rows();
|
||||
};
|
||||
|
|
|
@ -312,15 +312,21 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp
|
|||
Dbh::Dbh(char *dsn, char *user, char *pass)
|
||||
{
|
||||
switch_cache_db_connection_options_t options = { {0} };
|
||||
const char *prefix = "core:";
|
||||
m_connected = false;
|
||||
|
||||
options.odbc_options.dsn = dsn;
|
||||
options.odbc_options.user = user;
|
||||
options.odbc_options.pass = pass;
|
||||
|
||||
if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_ODBC, &options) == SWITCH_STATUS_SUCCESS) {
|
||||
m_connected = true;
|
||||
if (strstr(dsn, prefix) == dsn) {
|
||||
options.core_db_options.db_path = &dsn[strlen(prefix)];
|
||||
if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_CORE_DB, &options) == SWITCH_STATUS_SUCCESS) {
|
||||
m_connected = true;
|
||||
}
|
||||
} else {
|
||||
m_connected = false;
|
||||
options.odbc_options.dsn = dsn;
|
||||
options.odbc_options.user = user;
|
||||
options.odbc_options.pass = pass;
|
||||
if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_ODBC, &options) == SWITCH_STATUS_SUCCESS) {
|
||||
m_connected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -344,6 +350,16 @@ bool Dbh::connected()
|
|||
return m_connected;
|
||||
}
|
||||
|
||||
bool Dbh::test_reactive(char *test_sql, char *drop_sql, char *reactive_sql)
|
||||
{
|
||||
if (m_connected) {
|
||||
if (switch_cache_db_test_reactive(dbh, test_sql, drop_sql, reactive_sql) == SWITCH_TRUE) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int Dbh::query_callback(void *pArg, int argc, char **argv, char **cargv)
|
||||
{
|
||||
SWIGLUA_FN *lua_fun = (SWIGLUA_FN *)pArg;
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace LUA {
|
|||
~Dbh();
|
||||
bool release();
|
||||
bool connected();
|
||||
bool test_reactive(char *test_sql, char *drop_sql = NULL, char *reactive_sql = NULL);
|
||||
bool query(char *sql, SWIGLUA_FN lua_fun);
|
||||
int affected_rows();
|
||||
};
|
||||
|
|
|
@ -7254,6 +7254,184 @@ fail:
|
|||
}
|
||||
|
||||
|
||||
static int _wrap_Dbh_test_reactive__SWIG_0(lua_State* L) {
|
||||
int SWIG_arg = -1;
|
||||
LUA::Dbh *arg1 = (LUA::Dbh *) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
char *arg3 = (char *) 0 ;
|
||||
char *arg4 = (char *) 0 ;
|
||||
bool result;
|
||||
|
||||
SWIG_check_num_args("test_reactive",4,4)
|
||||
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("test_reactive",1,"LUA::Dbh *");
|
||||
if(!lua_isstring(L,2)) SWIG_fail_arg("test_reactive",2,"char *");
|
||||
if(!lua_isstring(L,3)) SWIG_fail_arg("test_reactive",3,"char *");
|
||||
if(!lua_isstring(L,4)) SWIG_fail_arg("test_reactive",4,"char *");
|
||||
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Dbh,0))){
|
||||
SWIG_fail_ptr("Dbh_test_reactive",1,SWIGTYPE_p_LUA__Dbh);
|
||||
}
|
||||
|
||||
arg2 = (char *)lua_tostring(L, 2);
|
||||
arg3 = (char *)lua_tostring(L, 3);
|
||||
arg4 = (char *)lua_tostring(L, 4);
|
||||
result = (bool)(arg1)->test_reactive(arg2,arg3,arg4);
|
||||
SWIG_arg=0;
|
||||
lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
|
||||
return SWIG_arg;
|
||||
|
||||
if(0) SWIG_fail;
|
||||
|
||||
fail:
|
||||
lua_error(L);
|
||||
return SWIG_arg;
|
||||
}
|
||||
|
||||
|
||||
static int _wrap_Dbh_test_reactive__SWIG_1(lua_State* L) {
|
||||
int SWIG_arg = -1;
|
||||
LUA::Dbh *arg1 = (LUA::Dbh *) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
char *arg3 = (char *) 0 ;
|
||||
bool result;
|
||||
|
||||
SWIG_check_num_args("test_reactive",3,3)
|
||||
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("test_reactive",1,"LUA::Dbh *");
|
||||
if(!lua_isstring(L,2)) SWIG_fail_arg("test_reactive",2,"char *");
|
||||
if(!lua_isstring(L,3)) SWIG_fail_arg("test_reactive",3,"char *");
|
||||
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Dbh,0))){
|
||||
SWIG_fail_ptr("Dbh_test_reactive",1,SWIGTYPE_p_LUA__Dbh);
|
||||
}
|
||||
|
||||
arg2 = (char *)lua_tostring(L, 2);
|
||||
arg3 = (char *)lua_tostring(L, 3);
|
||||
result = (bool)(arg1)->test_reactive(arg2,arg3);
|
||||
SWIG_arg=0;
|
||||
lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
|
||||
return SWIG_arg;
|
||||
|
||||
if(0) SWIG_fail;
|
||||
|
||||
fail:
|
||||
lua_error(L);
|
||||
return SWIG_arg;
|
||||
}
|
||||
|
||||
|
||||
static int _wrap_Dbh_test_reactive__SWIG_2(lua_State* L) {
|
||||
int SWIG_arg = -1;
|
||||
LUA::Dbh *arg1 = (LUA::Dbh *) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
bool result;
|
||||
|
||||
SWIG_check_num_args("test_reactive",2,2)
|
||||
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("test_reactive",1,"LUA::Dbh *");
|
||||
if(!lua_isstring(L,2)) SWIG_fail_arg("test_reactive",2,"char *");
|
||||
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Dbh,0))){
|
||||
SWIG_fail_ptr("Dbh_test_reactive",1,SWIGTYPE_p_LUA__Dbh);
|
||||
}
|
||||
|
||||
arg2 = (char *)lua_tostring(L, 2);
|
||||
result = (bool)(arg1)->test_reactive(arg2);
|
||||
SWIG_arg=0;
|
||||
lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
|
||||
return SWIG_arg;
|
||||
|
||||
if(0) SWIG_fail;
|
||||
|
||||
fail:
|
||||
lua_error(L);
|
||||
return SWIG_arg;
|
||||
}
|
||||
|
||||
|
||||
static int _wrap_Dbh_test_reactive(lua_State* L) {
|
||||
int argc;
|
||||
int argv[5]={
|
||||
1,2,3,4,5
|
||||
};
|
||||
|
||||
argc = lua_gettop(L);
|
||||
if (argc == 2) {
|
||||
int _v;
|
||||
{
|
||||
void *ptr;
|
||||
if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Dbh, 0)) {
|
||||
_v = 0;
|
||||
} else {
|
||||
_v = 1;
|
||||
}
|
||||
}
|
||||
if (_v) {
|
||||
{
|
||||
_v = lua_isstring(L,argv[1]);
|
||||
}
|
||||
if (_v) {
|
||||
return _wrap_Dbh_test_reactive__SWIG_2(L);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (argc == 3) {
|
||||
int _v;
|
||||
{
|
||||
void *ptr;
|
||||
if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Dbh, 0)) {
|
||||
_v = 0;
|
||||
} else {
|
||||
_v = 1;
|
||||
}
|
||||
}
|
||||
if (_v) {
|
||||
{
|
||||
_v = lua_isstring(L,argv[1]);
|
||||
}
|
||||
if (_v) {
|
||||
{
|
||||
_v = lua_isstring(L,argv[2]);
|
||||
}
|
||||
if (_v) {
|
||||
return _wrap_Dbh_test_reactive__SWIG_1(L);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (argc == 4) {
|
||||
int _v;
|
||||
{
|
||||
void *ptr;
|
||||
if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Dbh, 0)) {
|
||||
_v = 0;
|
||||
} else {
|
||||
_v = 1;
|
||||
}
|
||||
}
|
||||
if (_v) {
|
||||
{
|
||||
_v = lua_isstring(L,argv[1]);
|
||||
}
|
||||
if (_v) {
|
||||
{
|
||||
_v = lua_isstring(L,argv[2]);
|
||||
}
|
||||
if (_v) {
|
||||
{
|
||||
_v = lua_isstring(L,argv[3]);
|
||||
}
|
||||
if (_v) {
|
||||
return _wrap_Dbh_test_reactive__SWIG_0(L);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lua_pushstring(L,"No matching function for overloaded 'Dbh_test_reactive'");
|
||||
lua_error(L);return 0;
|
||||
}
|
||||
|
||||
|
||||
static int _wrap_Dbh_query(lua_State* L) {
|
||||
int SWIG_arg = -1;
|
||||
LUA::Dbh *arg1 = (LUA::Dbh *) 0 ;
|
||||
|
@ -7328,6 +7506,7 @@ delete arg1;
|
|||
static swig_lua_method swig_LUA_Dbh_methods[] = {
|
||||
{"release", _wrap_Dbh_release},
|
||||
{"connected", _wrap_Dbh_connected},
|
||||
{"test_reactive", _wrap_Dbh_test_reactive},
|
||||
{"query", _wrap_Dbh_query},
|
||||
{"affected_rows", _wrap_Dbh_affected_rows},
|
||||
{0,0}
|
||||
|
|
|
@ -7413,6 +7413,20 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_dmachine(void * jar
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_codec_slin(void * jarg1, void * jarg2) {
|
||||
int jresult ;
|
||||
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
|
||||
switch_slin_data_t *arg2 = (switch_slin_data_t *) 0 ;
|
||||
switch_status_t result;
|
||||
|
||||
arg1 = (switch_core_session_t *)jarg1;
|
||||
arg2 = (switch_slin_data_t *)jarg2;
|
||||
result = (switch_status_t)switch_core_session_set_codec_slin(arg1,arg2);
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_get_uuid() {
|
||||
char * jresult ;
|
||||
char *result = 0 ;
|
||||
|
@ -22794,6 +22808,119 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_api_interface(void * jarg1) {
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT void SWIGSTDCALL CSharp_switch_slin_data_session_set(void * jarg1, void * jarg2) {
|
||||
switch_slin_data *arg1 = (switch_slin_data *) 0 ;
|
||||
switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
|
||||
|
||||
arg1 = (switch_slin_data *)jarg1;
|
||||
arg2 = (switch_core_session_t *)jarg2;
|
||||
if (arg1) (arg1)->session = arg2;
|
||||
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_slin_data_session_get(void * jarg1) {
|
||||
void * jresult ;
|
||||
switch_slin_data *arg1 = (switch_slin_data *) 0 ;
|
||||
switch_core_session_t *result = 0 ;
|
||||
|
||||
arg1 = (switch_slin_data *)jarg1;
|
||||
result = (switch_core_session_t *) ((arg1)->session);
|
||||
jresult = (void *)result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT void SWIGSTDCALL CSharp_switch_slin_data_write_frame_set(void * jarg1, void * jarg2) {
|
||||
switch_slin_data *arg1 = (switch_slin_data *) 0 ;
|
||||
switch_frame_t *arg2 = (switch_frame_t *) 0 ;
|
||||
|
||||
arg1 = (switch_slin_data *)jarg1;
|
||||
arg2 = (switch_frame_t *)jarg2;
|
||||
if (arg1) (arg1)->write_frame = *arg2;
|
||||
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_slin_data_write_frame_get(void * jarg1) {
|
||||
void * jresult ;
|
||||
switch_slin_data *arg1 = (switch_slin_data *) 0 ;
|
||||
switch_frame_t *result = 0 ;
|
||||
|
||||
arg1 = (switch_slin_data *)jarg1;
|
||||
result = (switch_frame_t *)& ((arg1)->write_frame);
|
||||
jresult = (void *)result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT void SWIGSTDCALL CSharp_switch_slin_data_codec_set(void * jarg1, void * jarg2) {
|
||||
switch_slin_data *arg1 = (switch_slin_data *) 0 ;
|
||||
switch_codec_t *arg2 = (switch_codec_t *) 0 ;
|
||||
|
||||
arg1 = (switch_slin_data *)jarg1;
|
||||
arg2 = (switch_codec_t *)jarg2;
|
||||
if (arg1) (arg1)->codec = *arg2;
|
||||
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_slin_data_codec_get(void * jarg1) {
|
||||
void * jresult ;
|
||||
switch_slin_data *arg1 = (switch_slin_data *) 0 ;
|
||||
switch_codec_t *result = 0 ;
|
||||
|
||||
arg1 = (switch_slin_data *)jarg1;
|
||||
result = (switch_codec_t *)& ((arg1)->codec);
|
||||
jresult = (void *)result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT void SWIGSTDCALL CSharp_switch_slin_data_frame_data_set(void * jarg1, char * jarg2) {
|
||||
switch_slin_data *arg1 = (switch_slin_data *) 0 ;
|
||||
char *arg2 ;
|
||||
|
||||
arg1 = (switch_slin_data *)jarg1;
|
||||
arg2 = (char *)jarg2;
|
||||
{
|
||||
if (arg2) strncpy((char *)arg1->frame_data, (const char *)arg2, 4096);
|
||||
else arg1->frame_data[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_slin_data_frame_data_get(void * jarg1) {
|
||||
char * jresult ;
|
||||
switch_slin_data *arg1 = (switch_slin_data *) 0 ;
|
||||
char *result = 0 ;
|
||||
|
||||
arg1 = (switch_slin_data *)jarg1;
|
||||
result = (char *)(char *) ((arg1)->frame_data);
|
||||
jresult = SWIG_csharp_string_callback((const char *)result);
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_slin_data() {
|
||||
void * jresult ;
|
||||
switch_slin_data *result = 0 ;
|
||||
|
||||
result = (switch_slin_data *)new switch_slin_data();
|
||||
jresult = (void *)result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_slin_data(void * jarg1) {
|
||||
switch_slin_data *arg1 = (switch_slin_data *) 0 ;
|
||||
|
||||
arg1 = (switch_slin_data *)jarg1;
|
||||
delete arg1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_profile_created_set(void * jarg1, void * jarg2) {
|
||||
switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
|
||||
switch_time_t arg2 ;
|
||||
|
|
|
@ -1357,6 +1357,11 @@ public class freeswitch {
|
|||
return ret;
|
||||
}
|
||||
|
||||
public static switch_status_t switch_core_session_set_codec_slin(SWIGTYPE_p_switch_core_session session, switch_slin_data data) {
|
||||
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_codec_slin(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_slin_data.getCPtr(data));
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static string switch_core_get_uuid() {
|
||||
string ret = freeswitchPINVOKE.switch_core_get_uuid();
|
||||
return ret;
|
||||
|
@ -7504,6 +7509,9 @@ class freeswitchPINVOKE {
|
|||
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_dmachine")]
|
||||
public static extern IntPtr switch_core_session_get_dmachine(HandleRef jarg1);
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_codec_slin")]
|
||||
public static extern int switch_core_session_set_codec_slin(HandleRef jarg1, HandleRef jarg2);
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_uuid")]
|
||||
public static extern string switch_core_get_uuid();
|
||||
|
||||
|
@ -11188,6 +11196,36 @@ class freeswitchPINVOKE {
|
|||
[DllImport("mod_managed", EntryPoint="CSharp_delete_switch_api_interface")]
|
||||
public static extern void delete_switch_api_interface(HandleRef jarg1);
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_switch_slin_data_session_set")]
|
||||
public static extern void switch_slin_data_session_set(HandleRef jarg1, HandleRef jarg2);
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_switch_slin_data_session_get")]
|
||||
public static extern IntPtr switch_slin_data_session_get(HandleRef jarg1);
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_switch_slin_data_write_frame_set")]
|
||||
public static extern void switch_slin_data_write_frame_set(HandleRef jarg1, HandleRef jarg2);
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_switch_slin_data_write_frame_get")]
|
||||
public static extern IntPtr switch_slin_data_write_frame_get(HandleRef jarg1);
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_switch_slin_data_codec_set")]
|
||||
public static extern void switch_slin_data_codec_set(HandleRef jarg1, HandleRef jarg2);
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_switch_slin_data_codec_get")]
|
||||
public static extern IntPtr switch_slin_data_codec_get(HandleRef jarg1);
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_switch_slin_data_frame_data_set")]
|
||||
public static extern void switch_slin_data_frame_data_set(HandleRef jarg1, string jarg2);
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_switch_slin_data_frame_data_get")]
|
||||
public static extern string switch_slin_data_frame_data_get(HandleRef jarg1);
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_new_switch_slin_data")]
|
||||
public static extern IntPtr new_switch_slin_data();
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_delete_switch_slin_data")]
|
||||
public static extern void delete_switch_slin_data(HandleRef jarg1);
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_profile_created_set")]
|
||||
public static extern void switch_channel_timetable_profile_created_set(HandleRef jarg1, HandleRef jarg2);
|
||||
|
||||
|
@ -28401,7 +28439,8 @@ public enum switch_rtp_bug_flag_t {
|
|||
RTP_BUG_IGNORE_MARK_BIT = (1 << 2),
|
||||
RTP_BUG_SEND_LINEAR_TIMESTAMPS = (1 << 3),
|
||||
RTP_BUG_START_SEQ_AT_ZERO = (1 << 4),
|
||||
RTP_BUG_NEVER_SEND_MARKER = (1 << 5)
|
||||
RTP_BUG_NEVER_SEND_MARKER = (1 << 5),
|
||||
RTP_BUG_IGNORE_DTMF_DURATION = (1 << 6)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29437,6 +29476,96 @@ public enum switch_signal_t {
|
|||
|
||||
namespace FreeSWITCH.Native {
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public class switch_slin_data : IDisposable {
|
||||
private HandleRef swigCPtr;
|
||||
protected bool swigCMemOwn;
|
||||
|
||||
internal switch_slin_data(IntPtr cPtr, bool cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = new HandleRef(this, cPtr);
|
||||
}
|
||||
|
||||
internal static HandleRef getCPtr(switch_slin_data obj) {
|
||||
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
|
||||
}
|
||||
|
||||
~switch_slin_data() {
|
||||
Dispose();
|
||||
}
|
||||
|
||||
public virtual void Dispose() {
|
||||
lock(this) {
|
||||
if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
freeswitchPINVOKE.delete_switch_slin_data(swigCPtr);
|
||||
}
|
||||
swigCPtr = new HandleRef(null, IntPtr.Zero);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
public SWIGTYPE_p_switch_core_session session {
|
||||
set {
|
||||
freeswitchPINVOKE.switch_slin_data_session_set(swigCPtr, SWIGTYPE_p_switch_core_session.getCPtr(value));
|
||||
}
|
||||
get {
|
||||
IntPtr cPtr = freeswitchPINVOKE.switch_slin_data_session_get(swigCPtr);
|
||||
SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public switch_frame write_frame {
|
||||
set {
|
||||
freeswitchPINVOKE.switch_slin_data_write_frame_set(swigCPtr, switch_frame.getCPtr(value));
|
||||
}
|
||||
get {
|
||||
IntPtr cPtr = freeswitchPINVOKE.switch_slin_data_write_frame_get(swigCPtr);
|
||||
switch_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_frame(cPtr, false);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public switch_codec codec {
|
||||
set {
|
||||
freeswitchPINVOKE.switch_slin_data_codec_set(swigCPtr, switch_codec.getCPtr(value));
|
||||
}
|
||||
get {
|
||||
IntPtr cPtr = freeswitchPINVOKE.switch_slin_data_codec_get(swigCPtr);
|
||||
switch_codec ret = (cPtr == IntPtr.Zero) ? null : new switch_codec(cPtr, false);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public string frame_data {
|
||||
set {
|
||||
freeswitchPINVOKE.switch_slin_data_frame_data_set(swigCPtr, value);
|
||||
}
|
||||
get {
|
||||
string ret = freeswitchPINVOKE.switch_slin_data_frame_data_get(swigCPtr);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public switch_slin_data() : this(freeswitchPINVOKE.new_switch_slin_data(), true) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||
* Version 1.3.35
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing--modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
namespace FreeSWITCH.Native {
|
||||
|
||||
[System.Flags] public enum switch_speech_flag_enum_t {
|
||||
SWITCH_SPEECH_FLAG_NONE = 0,
|
||||
SWITCH_SPEECH_FLAG_HASTEXT = (1 << 0),
|
||||
|
@ -30146,7 +30275,7 @@ public enum switch_status_t {
|
|||
SWITCH_STATUS_FALSE,
|
||||
SWITCH_STATUS_TIMEOUT,
|
||||
SWITCH_STATUS_RESTART,
|
||||
SWITCH_STATUS_TERM,
|
||||
SWITCH_STATUS_INTR,
|
||||
SWITCH_STATUS_NOTIMPL,
|
||||
SWITCH_STATUS_MEMERR,
|
||||
SWITCH_STATUS_NOOP,
|
||||
|
@ -30163,6 +30292,7 @@ public enum switch_status_t {
|
|||
SWITCH_STATUS_TOO_SMALL,
|
||||
SWITCH_STATUS_FOUND,
|
||||
SWITCH_STATUS_CONTINUE,
|
||||
SWITCH_STATUS_TERM,
|
||||
SWITCH_STATUS_NOT_INITALIZED
|
||||
}
|
||||
|
||||
|
|
|
@ -2564,8 +2564,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(swi
|
|||
char *app;
|
||||
switch_event_t *event;
|
||||
|
||||
if (!switch_channel_test_flag(channel, CF_RING_READY) && !switch_channel_test_flag(channel, CF_EARLY_MEDIA &&
|
||||
!switch_channel_test_flag(channel, CF_ANSWERED))) {
|
||||
if (!switch_channel_test_flag(channel, CF_RING_READY) &&
|
||||
!switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_ANSWERED)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_channel_get_uuid(channel), SWITCH_LOG_NOTICE, "Ring-Ready %s!\n", channel->name);
|
||||
switch_channel_set_flag_value(channel, CF_RING_READY, rv);
|
||||
if (channel->caller_profile && channel->caller_profile->times) {
|
||||
|
|
|
@ -3129,6 +3129,7 @@ static void *SWITCH_THREAD_FUNC speech_thread(switch_thread_t *thread, void *obj
|
|||
switch_event_t *dup;
|
||||
|
||||
if (switch_event_dup(&dup, event) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_event_set_data(channel, dup);
|
||||
switch_event_fire(&dup);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue