add direction col to sql db, add direction param to session_create, log dtmf digits to digits_dialed variable for cdr
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12244 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
26caa46c97
commit
9886f369c3
|
@ -139,7 +139,7 @@ SWITCH_DECLARE(switch_channel_timetable_t *) switch_channel_get_timetable(_In_ s
|
|||
\param pool memory_pool to use for allocation
|
||||
\return SWITCH_STATUS_SUCCESS if successful
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_alloc(_In_ switch_channel_t **channel, _In_ switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_alloc(_In_ switch_channel_t **channel, _In_ switch_call_direction_t direction, _In_ switch_memory_pool_t *pool);
|
||||
|
||||
/*!
|
||||
\brief Connect a newly allocated channel to a session object and setup it's initial state
|
||||
|
|
|
@ -529,9 +529,10 @@ SWITCH_DECLARE(switch_memory_pool_t *) switch_core_session_get_pool(_In_ switch_
|
|||
\param pool the pool to use for the allocation (a new one will be used if NULL)
|
||||
\return the newly created session
|
||||
*/
|
||||
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(_In_ switch_endpoint_interface_t *endpoint_interface,
|
||||
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(_In_ switch_endpoint_interface_t *endpoint_interface,
|
||||
_In_ switch_call_direction_t direction,
|
||||
_Inout_opt_ switch_memory_pool_t **pool, _In_opt_z_ const char *use_uuid);
|
||||
#define switch_core_session_request(_ep, _p) switch_core_session_request_uuid(_ep, _p, NULL)
|
||||
#define switch_core_session_request(_ep, _d, _p) switch_core_session_request_uuid(_ep, _d, _p, NULL)
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_set_uuid(switch_core_session_t *session, const char *use_uuid);
|
||||
|
||||
|
@ -565,7 +566,9 @@ SWITCH_DECLARE(switch_size_t) switch_core_session_id(void);
|
|||
\param pool the pool to use
|
||||
\return the newly created session
|
||||
*/
|
||||
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(_In_z_ const char *endpoint_name, _Inout_ switch_memory_pool_t **pool);
|
||||
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(_In_z_ const char *endpoint_name,
|
||||
_In_ switch_call_direction_t direction,
|
||||
_Inout_ switch_memory_pool_t **pool);
|
||||
|
||||
/*!
|
||||
\brief Launch the session thread (state machine) on a given session
|
||||
|
|
|
@ -168,6 +168,7 @@ SWITCH_BEGIN_EXTERN_C
|
|||
#define SWITCH_UUID_BRIDGE "uuid_bridge"
|
||||
#define SWITCH_BITS_PER_BYTE 8
|
||||
#define SWITCH_DEFAULT_FILE_BUFFER_LEN 65536
|
||||
#define SWITCH_DTMF_LOG_LEN 1000
|
||||
|
||||
typedef uint8_t switch_byte_t;
|
||||
|
||||
|
@ -176,6 +177,11 @@ typedef struct {
|
|||
uint32_t duration;
|
||||
} switch_dtmf_t;
|
||||
|
||||
typedef enum {
|
||||
SWITCH_CALL_DIRECTION_INBOUND,
|
||||
SWITCH_CALL_DIRECTION_OUTBOUND
|
||||
} switch_call_direction_t;
|
||||
|
||||
typedef enum {
|
||||
SBF_DIAL_ALEG = (1 << 0),
|
||||
SBF_EXEC_ALEG = (1 << 1),
|
||||
|
|
|
@ -604,7 +604,7 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe
|
|||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "unique-id", conference->name);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-state", "CS_ROUTING");
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", conference->count == 1 ? "early" : "confirmed");
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-direction", conference->count == 1 ? "outbound" : "inbound");
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction", conference->count == 1 ? "outbound" : "inbound");
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
|
||||
|
|
|
@ -617,7 +617,7 @@ static void send_presence(fifo_node_t *node)
|
|||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-state", wait_count > 0 ? "CS_ROUTING" : "CS_HANGUP");
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "unique-id", node->name);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", wait_count > 0 ? "early" : "terminated");
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-direction", "inbound");
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction", "inbound");
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -757,7 +757,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
|||
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
|
||||
{
|
||||
|
||||
if ((*new_session = switch_core_session_request(&channel_endpoint_interface, pool)) != 0) {
|
||||
if ((*new_session = switch_core_session_request(&channel_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
|
||||
private_t *tech_pvt;
|
||||
switch_channel_t *channel;
|
||||
switch_caller_profile_t *caller_profile;
|
||||
|
@ -1412,7 +1412,7 @@ static switch_status_t place_call(char **argv, int argc, switch_stream_handle_t
|
|||
}
|
||||
dest = argv[0];
|
||||
|
||||
if ((session = switch_core_session_request(&channel_endpoint_interface, NULL)) != 0) {
|
||||
if ((session = switch_core_session_request(&channel_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
|
||||
private_t *tech_pvt;
|
||||
switch_channel_t *channel;
|
||||
char *dialplan = globals.dialplan;
|
||||
|
|
|
@ -1569,7 +1569,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
|||
switch_caller_profile_t *outbound_profile,
|
||||
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
|
||||
{
|
||||
if ((*new_session = switch_core_session_request(dingaling_endpoint_interface, pool)) != 0) {
|
||||
if ((*new_session = switch_core_session_request(dingaling_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
|
||||
struct private_object *tech_pvt;
|
||||
switch_channel_t *channel;
|
||||
switch_caller_profile_t *caller_profile = NULL;
|
||||
|
@ -2547,7 +2547,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
|||
status = LDL_STATUS_FALSE;
|
||||
goto done;
|
||||
}
|
||||
if ((session = switch_core_session_request(dingaling_endpoint_interface, NULL)) != 0) {
|
||||
if ((session = switch_core_session_request(dingaling_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
|
||||
switch_core_session_add_stream(session, NULL);
|
||||
|
||||
if ((tech_pvt = (struct private_object *) switch_core_session_alloc(session, sizeof(struct private_object))) != 0) {
|
||||
|
|
|
@ -702,7 +702,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
|||
switch_caller_profile_t *outbound_profile,
|
||||
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
|
||||
{
|
||||
if ((*new_session = switch_core_session_request(iax_endpoint_interface, pool)) != 0) {
|
||||
if ((*new_session = switch_core_session_request(iax_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
|
||||
private_t *tech_pvt;
|
||||
switch_channel_t *channel;
|
||||
switch_caller_profile_t *caller_profile;
|
||||
|
@ -1008,7 +1008,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_iax_runtime)
|
|||
switch_core_session_t *session;
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "New Inbound Channel %s!\n", iaxevent->ies.calling_name);
|
||||
if ((session = switch_core_session_request(iax_endpoint_interface, NULL)) != 0) {
|
||||
if ((session = switch_core_session_request(iax_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
|
||||
switch_core_session_add_stream(session, NULL);
|
||||
if ((tech_pvt = (private_t *) switch_core_session_alloc(session, sizeof(private_t))) != 0) {
|
||||
channel = switch_core_session_get_channel(session);
|
||||
|
|
|
@ -214,7 +214,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
|
|||
|
||||
if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND) && !switch_test_flag(tech_pvt, TFLAG_BLEG)) {
|
||||
|
||||
if (!(b_session = switch_core_session_request(loopback_endpoint_interface, NULL))) {
|
||||
if (!(b_session = switch_core_session_request(loopback_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failure.\n");
|
||||
goto end;
|
||||
}
|
||||
|
@ -648,7 +648,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
|||
switch_channel_pre_answer(channel);
|
||||
}
|
||||
|
||||
if ((*new_session = switch_core_session_request(loopback_endpoint_interface, pool)) != 0) {
|
||||
if ((*new_session = switch_core_session_request(loopback_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
|
||||
private_t *tech_pvt;
|
||||
switch_channel_t *channel;
|
||||
switch_caller_profile_t *caller_profile;
|
||||
|
|
|
@ -483,7 +483,8 @@ FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint, switch_caller
|
|||
{
|
||||
opal_private_t *tech_pvt;
|
||||
FSManager & mgr = (FSManager &) endpoint.GetManager();
|
||||
m_fsSession = switch_core_session_request(mgr.GetSwitchInterface(), NULL);
|
||||
m_fsSession = switch_core_session_request(mgr.GetSwitchInterface(),
|
||||
outbound_profile ? SWITCH_CALL_DIRECTION_OUTBOUND : SWITCH_CALL_DIRECTION_INBOUND, NULL);
|
||||
m_fsChannel = switch_core_session_get_channel(m_fsSession);
|
||||
|
||||
tech_pvt = (opal_private_t *) switch_core_session_alloc(m_fsSession, sizeof(*tech_pvt));
|
||||
|
|
|
@ -708,7 +708,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
|||
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
|
||||
{
|
||||
|
||||
if ((*new_session = switch_core_session_request(portaudio_endpoint_interface, pool)) != 0) {
|
||||
if ((*new_session = switch_core_session_request(portaudio_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
|
||||
private_t *tech_pvt;
|
||||
switch_channel_t *channel;
|
||||
switch_caller_profile_t *caller_profile;
|
||||
|
@ -1668,7 +1668,7 @@ static switch_status_t place_call(char **argv, int argc, switch_stream_handle_t
|
|||
}
|
||||
dest = argv[0];
|
||||
|
||||
if ((session = switch_core_session_request(portaudio_endpoint_interface, NULL)) != 0) {
|
||||
if ((session = switch_core_session_request(portaudio_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
|
||||
private_t *tech_pvt;
|
||||
switch_channel_t *channel;
|
||||
char *dialplan = globals.dialplan;
|
||||
|
|
|
@ -399,7 +399,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
|||
switch_caller_profile_t *outbound_profile,
|
||||
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
|
||||
{
|
||||
if ((*new_session = switch_core_session_request(reference_endpoint_interface, pool)) != 0) {
|
||||
if ((*new_session = switch_core_session_request(reference_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
|
||||
private_t *tech_pvt;
|
||||
switch_channel_t *channel;
|
||||
switch_caller_profile_t *caller_profile;
|
||||
|
|
|
@ -1852,7 +1852,7 @@ int new_inbound_channel(private_t * p)
|
|||
switch_core_session_t *session = NULL;
|
||||
switch_channel_t *channel = NULL;
|
||||
|
||||
if ((session = switch_core_session_request(skypiax_endpoint_interface, NULL)) != 0) {
|
||||
if ((session = switch_core_session_request(skypiax_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
|
||||
switch_core_session_add_stream(session, NULL);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
skypiax_tech_init(tech_pvt, session);
|
||||
|
|
|
@ -506,7 +506,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t * sess
|
|||
switch_memory_pool_t ** pool,
|
||||
switch_originate_flag_t flags)
|
||||
{
|
||||
if ((*new_session = switch_core_session_request(skypiax_endpoint_interface, pool)) != 0) {
|
||||
if ((*new_session = switch_core_session_request(skypiax_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
|
||||
private_t *tech_pvt;
|
||||
switch_channel_t *channel;
|
||||
switch_caller_profile_t *caller_profile;
|
||||
|
@ -1139,7 +1139,7 @@ int new_inbound_channel(private_t * tech_pvt)
|
|||
switch_core_session_t *session = NULL;
|
||||
switch_channel_t *channel = NULL;
|
||||
|
||||
if ((session = switch_core_session_request(skypiax_endpoint_interface, NULL)) != 0) {
|
||||
if ((session = switch_core_session_request(skypiax_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
|
||||
switch_core_session_add_stream(session, NULL);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
skypiax_tech_init(tech_pvt, session);
|
||||
|
|
|
@ -2335,7 +2335,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
|
|||
|
||||
*new_session = NULL;
|
||||
|
||||
if (!(nsession = switch_core_session_request(sofia_endpoint_interface, pool))) {
|
||||
if (!(nsession = switch_core_session_request(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Creating Session\n");
|
||||
goto error;
|
||||
}
|
||||
|
|
|
@ -4016,9 +4016,9 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
|||
|
||||
if (sofia_endpoint_interface) {
|
||||
if (sofia_test_pflag(profile, PFLAG_CALLID_AS_UUID)) {
|
||||
session = switch_core_session_request_uuid(sofia_endpoint_interface, NULL, sip->sip_call_id->i_id);
|
||||
session = switch_core_session_request_uuid(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL, sip->sip_call_id->i_id);
|
||||
} else {
|
||||
session = switch_core_session_request(sofia_endpoint_interface, NULL);
|
||||
session = switch_core_session_request(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -830,7 +830,7 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char
|
|||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "unique-id", uuid);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", state);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "astate", state);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-direction", direction);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction", direction);
|
||||
}
|
||||
|
||||
switch_event_fire(&event);
|
||||
|
@ -1030,7 +1030,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
|||
|
||||
if (helper->event) {
|
||||
switch_stream_handle_t stream = { 0 };
|
||||
const char *direction = switch_str_nil(switch_event_get_header(helper->event, "call-direction"));
|
||||
const char *direction = switch_str_nil(switch_event_get_header(helper->event, "presence-call-direction"));
|
||||
const char *uuid = switch_str_nil(switch_event_get_header(helper->event, "unique-id"));
|
||||
const char *state = switch_str_nil(switch_event_get_header(helper->event, "channel-state"));
|
||||
const char *event_status = switch_str_nil(switch_event_get_header(helper->event, "status"));
|
||||
|
|
|
@ -202,7 +202,7 @@ static switch_call_cause_t unicall_incoming_channel(zap_sigmsg_t *sigmsg, switch
|
|||
|
||||
*sp = NULL;
|
||||
|
||||
if (!(session = switch_core_session_request(openzap_endpoint_interface, NULL)))
|
||||
if (!(session = switch_core_session_request(openzap_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)))
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Initialization Error!\n");
|
||||
return ZAP_FAIL;
|
||||
|
@ -1540,7 +1540,7 @@ static switch_call_cause_t unicall_outgoing_channel(switch_core_session_t *sessi
|
|||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_outgoing_channel(%p)\n", (void *) session);
|
||||
|
||||
if ((*new_session = switch_core_session_request(unicall_endpoint_interface, pool)) == NULL)
|
||||
if ((*new_session = switch_core_session_request(unicall_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) == NULL)
|
||||
{
|
||||
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
|
||||
}
|
||||
|
|
|
@ -109,7 +109,9 @@ static struct switch_cause_table CAUSE_CHART[] = {
|
|||
|
||||
struct switch_channel {
|
||||
char *name;
|
||||
switch_call_direction_t direction;
|
||||
switch_queue_t *dtmf_queue;
|
||||
switch_queue_t *dtmf_log_queue;
|
||||
switch_mutex_t *dtmf_mutex;
|
||||
switch_mutex_t *flag_mutex;
|
||||
switch_mutex_t *state_mutex;
|
||||
|
@ -210,7 +212,7 @@ SWITCH_DECLARE(switch_channel_timetable_t *) switch_channel_get_timetable(switch
|
|||
return times;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_alloc(switch_channel_t **channel, switch_memory_pool_t *pool)
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_alloc(switch_channel_t **channel, switch_call_direction_t direction, switch_memory_pool_t *pool)
|
||||
{
|
||||
switch_assert(pool != NULL);
|
||||
|
||||
|
@ -221,7 +223,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_alloc(switch_channel_t **channel,
|
|||
switch_event_create(&(*channel)->variables, SWITCH_EVENT_GENERAL);
|
||||
|
||||
switch_core_hash_init(&(*channel)->private_hash, pool);
|
||||
switch_queue_create(&(*channel)->dtmf_queue, 128, pool);
|
||||
switch_queue_create(&(*channel)->dtmf_queue, SWITCH_DTMF_LOG_LEN, pool);
|
||||
switch_queue_create(&(*channel)->dtmf_log_queue, SWITCH_DTMF_LOG_LEN, pool);
|
||||
|
||||
switch_mutex_init(&(*channel)->dtmf_mutex, SWITCH_MUTEX_NESTED, pool);
|
||||
switch_mutex_init(&(*channel)->flag_mutex, SWITCH_MUTEX_NESTED, pool);
|
||||
|
@ -229,6 +232,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_alloc(switch_channel_t **channel,
|
|||
switch_mutex_init(&(*channel)->profile_mutex, SWITCH_MUTEX_NESTED, pool);
|
||||
(*channel)->hangup_cause = SWITCH_CAUSE_NONE;
|
||||
(*channel)->name = "";
|
||||
(*channel)->direction = direction;
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -355,7 +359,12 @@ SWITCH_DECLARE(switch_status_t) switch_channel_dequeue_dtmf(switch_channel_t *ch
|
|||
if (switch_queue_trypop(channel->dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) {
|
||||
dt = (switch_dtmf_t *) pop;
|
||||
*dtmf = *dt;
|
||||
free(dt);
|
||||
|
||||
if (switch_queue_trypush(channel->dtmf_log_queue, dt) != SWITCH_STATUS_SUCCESS) {
|
||||
free(dt);
|
||||
}
|
||||
|
||||
dt = NULL;
|
||||
|
||||
if (dtmf->duration > switch_core_max_dtmf_duration(0)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s EXCESSIVE DTMF DIGIT [%c] LEN [%d]\n",
|
||||
|
@ -404,14 +413,21 @@ SWITCH_DECLARE(void) switch_channel_flush_dtmf(switch_channel_t *channel)
|
|||
|
||||
switch_mutex_lock(channel->dtmf_mutex);
|
||||
while (switch_queue_trypop(channel->dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_safe_free(pop);
|
||||
switch_dtmf_t *dt = (switch_dtmf_t *) pop;
|
||||
if (channel->state >= CS_HANGUP || switch_queue_trypush(channel->dtmf_log_queue, dt) != SWITCH_STATUS_SUCCESS) {
|
||||
free(dt);
|
||||
}
|
||||
}
|
||||
switch_mutex_unlock(channel->dtmf_mutex);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(void) switch_channel_uninit(switch_channel_t *channel)
|
||||
{
|
||||
void *pop;
|
||||
switch_channel_flush_dtmf(channel);
|
||||
while (switch_queue_trypop(channel->dtmf_log_queue, &pop) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_safe_free(pop);
|
||||
}
|
||||
switch_core_hash_destroy(&channel->private_hash);
|
||||
switch_mutex_lock(channel->profile_mutex);
|
||||
switch_event_destroy(&channel->variables);
|
||||
|
@ -2234,6 +2250,9 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *
|
|||
switch_time_t uduration = 0, legbillusec = 0, billusec = 0, progresssec = 0, progressusec = 0, progress_mediasec = 0, progress_mediausec = 0;
|
||||
time_t tt_created = 0, tt_answered = 0, tt_progress = 0, tt_progress_media = 0, tt_hungup = 0, mtt_created = 0, mtt_answered = 0, mtt_hungup =
|
||||
0, tt_prof_created, mtt_prof_created, mtt_progress = 0, mtt_progress_media = 0;
|
||||
void *pop;
|
||||
char dtstr[SWITCH_DTMF_LOG_LEN+1] = "";
|
||||
int x = 0;
|
||||
|
||||
if (!(caller_profile = switch_channel_get_caller_profile(channel)) || !channel->variables) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
|
@ -2256,6 +2275,22 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *
|
|||
cid_buf = caller_profile->caller_id_number;
|
||||
}
|
||||
|
||||
while (x < SWITCH_DTMF_LOG_LEN && switch_queue_trypop(channel->dtmf_log_queue, &pop) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_dtmf_t *dt = (switch_dtmf_t *) pop;
|
||||
|
||||
if (dt) {
|
||||
dtstr[x++] = dt->digit;
|
||||
free(dt);
|
||||
dt = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (x) {
|
||||
switch_channel_set_variable(channel, "digits_dialed", dtstr);
|
||||
} else {
|
||||
switch_channel_set_variable(channel, "digits_dialed", "none");
|
||||
}
|
||||
|
||||
if (caller_profile->times) {
|
||||
switch_time_exp_t tm;
|
||||
switch_size_t retsize;
|
||||
|
|
|
@ -269,6 +269,8 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_
|
|||
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
switch_channel_set_flag(channel, CF_OUTBOUND);
|
||||
|
||||
forwardvar = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE);
|
||||
if (!switch_strlen_zero(forwardvar)) {
|
||||
forwardval = atoi(forwardvar) - 1;
|
||||
|
@ -1043,7 +1045,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_uuid(switch_core_session
|
|||
}
|
||||
|
||||
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_endpoint_interface_t
|
||||
*endpoint_interface, switch_memory_pool_t **pool, const char *use_uuid)
|
||||
*endpoint_interface,
|
||||
switch_call_direction_t direction,
|
||||
switch_memory_pool_t **pool,
|
||||
const char *use_uuid)
|
||||
{
|
||||
switch_memory_pool_t *usepool;
|
||||
switch_core_session_t *session;
|
||||
|
@ -1091,10 +1096,14 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_
|
|||
session = switch_core_alloc(usepool, sizeof(*session));
|
||||
session->pool = usepool;
|
||||
|
||||
if (switch_channel_alloc(&session->channel, session->pool) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_channel_alloc(&session->channel, direction, session->pool) != SWITCH_STATUS_SUCCESS) {
|
||||
abort();
|
||||
}
|
||||
|
||||
if (direction == SWITCH_CALL_DIRECTION_OUTBOUND) {
|
||||
switch_channel_set_flag(session->channel, CF_OUTBOUND);
|
||||
}
|
||||
|
||||
switch_channel_init(session->channel, session, CS_NEW, 0);
|
||||
|
||||
/* The session *IS* the pool you may not alter it because you have no idea how
|
||||
|
@ -1154,7 +1163,9 @@ SWITCH_DECLARE(switch_size_t) switch_core_session_id(void)
|
|||
}
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(const char *endpoint_name, switch_memory_pool_t **pool)
|
||||
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(const char *endpoint_name,
|
||||
switch_call_direction_t direction,
|
||||
switch_memory_pool_t **pool)
|
||||
{
|
||||
switch_endpoint_interface_t *endpoint_interface;
|
||||
switch_core_session_t *session;
|
||||
|
@ -1164,7 +1175,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(cons
|
|||
return NULL;
|
||||
}
|
||||
|
||||
session = switch_core_session_request(endpoint_interface, pool);
|
||||
session = switch_core_session_request(endpoint_interface, direction, pool);
|
||||
|
||||
UNPROTECT_INTERFACE(endpoint_interface);
|
||||
|
||||
|
|
|
@ -275,8 +275,10 @@ static void core_event_handler(switch_event_t *event)
|
|||
break;
|
||||
}
|
||||
case SWITCH_EVENT_CHANNEL_CREATE:
|
||||
sql = switch_mprintf("insert into channels (uuid,created,created_epoch, name,state,dialplan,context) values('%q','%q','%ld','%q','%q','%q','%q')",
|
||||
sql = switch_mprintf("insert into channels (uuid,direction,created,created_epoch, name,state,dialplan,context) "
|
||||
"values('%q','%q','%q','%ld','%q','%q','%q','%q')",
|
||||
switch_event_get_header_nil(event, "unique-id"),
|
||||
switch_event_get_header_nil(event, "call-direction"),
|
||||
switch_event_get_header_nil(event, "event-date-local"),
|
||||
(long)switch_epoch_time_now(NULL),
|
||||
switch_event_get_header_nil(event, "channel-name"),
|
||||
|
@ -434,6 +436,7 @@ void switch_core_sqldb_start(switch_memory_pool_t *pool)
|
|||
char create_channels_sql[] =
|
||||
"CREATE TABLE channels (\n"
|
||||
" uuid VARCHAR(255),\n"
|
||||
" direction VARCHAR(255),\n"
|
||||
" created VARCHAR(255),\n"
|
||||
" created_epoch INTEGER,\n"
|
||||
" name VARCHAR(255),\n"
|
||||
|
|
|
@ -1277,7 +1277,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_create_pres_in_detailed(char *file,
|
|||
switch_event_add_header_string(pres_event, SWITCH_STACK_TOP, "unique-id", alt_event_type);
|
||||
switch_event_add_header_string(pres_event, SWITCH_STACK_TOP, "channel-state", channel_state);
|
||||
switch_event_add_header_string(pres_event, SWITCH_STACK_TOP, "answer-state", answer_state);
|
||||
switch_event_add_header_string(pres_event, SWITCH_STACK_TOP, "call-direction", call_direction);
|
||||
switch_event_add_header_string(pres_event, SWITCH_STACK_TOP, "presence-call-direction", call_direction);
|
||||
switch_event_fire_detailed(file, func, line, &pres_event, NULL);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue