mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-27 13:44:16 +00:00
code analysis, clean up asserts related to switch_core_session_get_channel.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7402 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
c8dd27cdd1
commit
482badffca
44 files changed
+506
-1661
No files matched your search
@@ -906,7 +906,6 @@ static int activate_rtp(struct private_object *tech_pvt)
|
||||
static int do_candidates(struct private_object *tech_pvt, int force)
|
||||
{
|
||||
switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
if (switch_test_flag(tech_pvt, TFLAG_DO_CAND)) {
|
||||
return 1;
|
||||
@@ -1052,7 +1051,7 @@ static int do_describe(struct private_object *tech_pvt, int force)
|
||||
static switch_status_t negotiate_media(switch_core_session_t *session)
|
||||
{
|
||||
switch_status_t ret = SWITCH_STATUS_FALSE;
|
||||
switch_channel_t *channel;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
struct private_object *tech_pvt = NULL;
|
||||
switch_time_t started;
|
||||
switch_time_t now;
|
||||
@@ -1061,9 +1060,6 @@ static switch_status_t negotiate_media(switch_core_session_t *session)
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_IO);
|
||||
|
||||
started = switch_timestamp_now();
|
||||
@@ -1148,15 +1144,12 @@ static switch_status_t negotiate_media(switch_core_session_t *session)
|
||||
*/
|
||||
static switch_status_t channel_on_init(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
struct private_object *tech_pvt = NULL;
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt->read_frame.buflen = SWITCH_RTP_MAX_BUF_LEN;
|
||||
|
||||
switch_set_flag(tech_pvt, TFLAG_READY);
|
||||
@@ -1171,12 +1164,9 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
|
||||
|
||||
static switch_status_t channel_on_ring(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
struct private_object *tech_pvt = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
@@ -1205,12 +1195,9 @@ static switch_status_t channel_on_execute(switch_core_session_t *session)
|
||||
|
||||
static switch_status_t channel_on_hangup(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
struct private_object *tech_pvt = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
@@ -1258,18 +1245,13 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
|
||||
|
||||
static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
struct private_object *tech_pvt = NULL;
|
||||
|
||||
if (!(channel = switch_core_session_get_channel(session))) {
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (!(tech_pvt = switch_core_session_get_private(session))) {
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
switch (sig) {
|
||||
case SWITCH_SIG_KILL:
|
||||
switch_clear_flag_locked(tech_pvt, TFLAG_IO);
|
||||
@@ -1351,12 +1333,9 @@ static switch_status_t channel_send_dtmf(switch_core_session_t *session, const s
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
struct private_object *tech_pvt = NULL;
|
||||
switch_channel_t *channel = NULL;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
int payload = 0;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = (struct private_object *) switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
@@ -1452,13 +1431,10 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
struct private_object *tech_pvt;
|
||||
switch_channel_t *channel = NULL;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
int bytes = 0, samples = 0, frames = 0;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = (struct private_object *) switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
@@ -1506,10 +1482,6 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
|
||||
static switch_status_t channel_answer_channel(switch_core_session_t *session)
|
||||
{
|
||||
struct private_object *tech_pvt;
|
||||
switch_channel_t *channel = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
@@ -1524,12 +1496,8 @@ static switch_status_t channel_answer_channel(switch_core_session_t *session)
|
||||
|
||||
static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
struct private_object *tech_pvt;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
@@ -1564,13 +1532,9 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
||||
|
||||
static switch_status_t channel_receive_event(switch_core_session_t *session, switch_event_t *event)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
struct private_object *tech_pvt;
|
||||
char *subject, *body;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
@@ -2572,7 +2536,6 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "using Existing session for %s\n", ldl_session_get_id(dlsession));
|
||||
|
||||
|
||||
@@ -339,8 +339,6 @@ static switch_status_t iax_set_codec(private_t * tech_pvt, struct iax_session *i
|
||||
}
|
||||
|
||||
channel = switch_core_session_get_channel(tech_pvt->session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
|
||||
if (tech_pvt->samprate || *samprate) {
|
||||
unsigned short samples = iax_build_codec_rates();
|
||||
@@ -456,26 +454,15 @@ static void tech_init(private_t * tech_pvt, switch_core_session_t *session)
|
||||
*/
|
||||
static switch_status_t channel_on_init(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
private_t *tech_pvt = NULL;
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
private_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
|
||||
iax_set_private(tech_pvt->iax_session, tech_pvt);
|
||||
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_IO);
|
||||
|
||||
|
||||
//switch_thread_cond_create(&tech_pvt->cond, switch_core_session_get_pool(session));
|
||||
//switch_mutex_lock(tech_pvt->mutex);
|
||||
|
||||
/* Move Channel's State Machine to RING */
|
||||
switch_channel_set_state(channel, CS_RING);
|
||||
switch_channel_set_state(switch_core_session_get_channel(session), CS_RING);
|
||||
switch_mutex_lock(globals.mutex);
|
||||
globals.calls++;
|
||||
switch_mutex_unlock(globals.mutex);
|
||||
@@ -485,52 +472,24 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
|
||||
|
||||
static switch_status_t channel_on_ring(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL RING\n", switch_channel_get_name(channel));
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL RING\n", switch_channel_get_name(switch_core_session_get_channel(session)));
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_on_execute(switch_core_session_t *session)
|
||||
{
|
||||
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_on_hangup(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
private_t *tech_pvt = switch_core_session_get_private(session);
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch_clear_flag_locked(tech_pvt, TFLAG_IO);
|
||||
switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
|
||||
//switch_thread_cond_signal(tech_pvt->cond);
|
||||
|
||||
if (tech_pvt->read_codec.implementation) {
|
||||
switch_core_codec_destroy(&tech_pvt->read_codec);
|
||||
@@ -548,7 +507,7 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
|
||||
iax_session_destroy(&tech_pvt->iax_session);
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(switch_core_session_get_channel(session)));
|
||||
switch_mutex_lock(globals.mutex);
|
||||
globals.calls--;
|
||||
if (globals.calls < 0) {
|
||||
@@ -561,21 +520,14 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
|
||||
|
||||
static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
private_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch (sig) {
|
||||
case SWITCH_SIG_KILL:
|
||||
switch_clear_flag_locked(tech_pvt, TFLAG_IO);
|
||||
switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
|
||||
//switch_thread_cond_signal(tech_pvt->cond);
|
||||
switch_channel_hangup(switch_core_session_get_channel(session), SWITCH_CAUSE_NORMAL_CLEARING);
|
||||
break;
|
||||
case SWITCH_SIG_BREAK:
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_BREAK);
|
||||
@@ -601,9 +553,7 @@ static switch_status_t channel_on_transmit(switch_core_session_t *session)
|
||||
|
||||
static switch_status_t channel_waitfor_read(switch_core_session_t *session, int ms, int stream_id)
|
||||
{
|
||||
private_t *tech_pvt = NULL;
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
private_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -611,20 +561,15 @@ static switch_status_t channel_waitfor_read(switch_core_session_t *session, int
|
||||
|
||||
static switch_status_t channel_waitfor_write(switch_core_session_t *session, int ms, int stream_id)
|
||||
{
|
||||
private_t *tech_pvt = NULL;
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
private_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
|
||||
{
|
||||
private_t *tech_pvt = NULL;
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
private_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
if (tech_pvt->iax_session) {
|
||||
iax_send_dtmf(tech_pvt->iax_session, dtmf->digit);
|
||||
@@ -635,16 +580,11 @@ static switch_status_t channel_send_dtmf(switch_core_session_t *session, const s
|
||||
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
private_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_time_t started = switch_timestamp_now();
|
||||
unsigned int elapsed;
|
||||
switch_byte_t *data;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
tech_pvt->read_frame.flags = SFF_NONE;
|
||||
*frame = NULL;
|
||||
@@ -655,7 +595,6 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
switch_yield(1000);
|
||||
continue;
|
||||
}
|
||||
//switch_thread_cond_wait(tech_pvt->cond, tech_pvt->mutex);
|
||||
if (switch_test_flag(tech_pvt, TFLAG_BREAK)) {
|
||||
switch_clear_flag(tech_pvt, TFLAG_BREAK);
|
||||
goto cng;
|
||||
@@ -685,12 +624,9 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch_yield(1000);
|
||||
}
|
||||
|
||||
|
||||
return SWITCH_STATUS_FALSE;
|
||||
|
||||
cng:
|
||||
@@ -701,19 +637,11 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
tech_pvt->read_frame.flags = SFF_CNG;
|
||||
*frame = &tech_pvt->read_frame;
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
//switch_frame_t *pframe;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
private_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
|
||||
@@ -732,13 +660,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
|
||||
|
||||
static switch_status_t channel_answer_channel(switch_core_session_t *session)
|
||||
{
|
||||
private_t *tech_pvt;
|
||||
switch_channel_t *channel = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
private_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
|
||||
@@ -750,13 +672,7 @@ static switch_status_t channel_answer_channel(switch_core_session_t *session)
|
||||
|
||||
static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
private_t *tech_pvt;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = (private_t *) switch_core_session_get_private(session);
|
||||
private_t *tech_pvt = (private_t *) switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch (msg->message_id) {
|
||||
@@ -824,7 +740,6 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
|
||||
}
|
||||
|
||||
|
||||
if (iax_set_codec(tech_pvt, tech_pvt->iax_session, &req, &cap, &samprate, IAX_QUERY) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_CAUSE_BEARERCAPABILITY_NOTIMPL;
|
||||
@@ -844,23 +759,16 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
}
|
||||
|
||||
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
|
||||
|
||||
}
|
||||
|
||||
static switch_status_t channel_receive_event(switch_core_session_t *session, switch_event_t *event)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
struct private_object *tech_pvt;
|
||||
char *body;
|
||||
struct private_object *tech_pvt = switch_core_session_get_private(session);
|
||||
char *body = switch_event_get_body(event);
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
|
||||
if (!(body = switch_event_get_body(event))) {
|
||||
if (!body) {
|
||||
body = "";
|
||||
}
|
||||
|
||||
@@ -893,7 +801,6 @@ switch_io_routines_t iax_io_routines = {
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_iax_load)
|
||||
{
|
||||
|
||||
module_pool = pool;
|
||||
|
||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||
@@ -980,7 +887,6 @@ static switch_status_t tech_media(private_t * tech_pvt, struct iax_event *iaxeve
|
||||
|
||||
SWITCH_MODULE_RUNTIME_FUNCTION(mod_iax_runtime)
|
||||
{
|
||||
//int refresh;
|
||||
struct iax_event *iaxevent = NULL;
|
||||
switch_event_t *s_event;
|
||||
if (load_config() != SWITCH_STATUS_SUCCESS) {
|
||||
@@ -1111,7 +1017,6 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_iax_runtime)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
|
||||
iaxevent->ies.username,
|
||||
globals.dialplan,
|
||||
@@ -1128,7 +1033,6 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_iax_runtime)
|
||||
switch_snprintf(name, sizeof(name), "IAX/%s-%04x", tech_pvt->caller_profile->destination_number, rand() & 0xffff);
|
||||
switch_channel_set_name(channel, name);
|
||||
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
|
||||
|
||||
}
|
||||
|
||||
if (iax_set_codec(tech_pvt, iaxevent->session,
|
||||
@@ -1163,7 +1067,6 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_iax_runtime)
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hangup %s\n", switch_channel_get_name(channel));
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_HANGUP);
|
||||
switch_channel_hangup(channel, iaxevent->etype == IAX_EVENT_HANGUP ? SWITCH_CAUSE_NORMAL_CLEARING : SWITCH_CAUSE_FACILITY_REJECTED);
|
||||
//switch_thread_cond_signal(tech_pvt->cond);
|
||||
iaxevent->session = NULL;
|
||||
}
|
||||
break;
|
||||
@@ -1177,7 +1080,6 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_iax_runtime)
|
||||
int bytes, frames;
|
||||
|
||||
if (!switch_test_flag(tech_pvt, TFLAG_CODEC)) {
|
||||
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "audio with no codec yet!\n");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1192,13 +1094,11 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_iax_runtime)
|
||||
memcpy(tech_pvt->read_frame.data, iaxevent->data, iaxevent->datalen);
|
||||
/* wake up the i/o thread */
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_VOICE);
|
||||
//switch_thread_cond_signal(tech_pvt->cond);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IAX_EVENT_TRANSFER:
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Call transfer occurred.\n");
|
||||
//session[0] = iaxevent->session;
|
||||
break;
|
||||
case IAX_EVENT_DTMF:
|
||||
if (channel) {
|
||||
@@ -1206,7 +1106,6 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_iax_runtime)
|
||||
if (globals.debug) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%c DTMF %s\n", dtmf.digit, switch_channel_get_name(channel));
|
||||
}
|
||||
|
||||
switch_channel_queue_dtmf(channel, &dtmf);
|
||||
}
|
||||
|
||||
@@ -1215,10 +1114,8 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_iax_runtime)
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Don't know what to do with IAX event %d.\n", iaxevent->etype);
|
||||
break;
|
||||
}
|
||||
|
||||
iax_event_free(iaxevent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
running = 0;
|
||||
|
||||
@@ -165,25 +165,18 @@ static switch_status_t pa_cmd(const char *dest, switch_core_session_t *session,
|
||||
*/
|
||||
static switch_status_t channel_on_init(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
private_t *tech_pvt = NULL;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
private_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_time_t last;
|
||||
int waitsec = globals.ring_interval * 1000000;
|
||||
switch_file_handle_t fh = { 0 };
|
||||
const char *val, *ring_file = NULL, *hold_file = NULL;
|
||||
int16_t abuf[2048];
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
|
||||
last = switch_timestamp_now() - waitsec;
|
||||
|
||||
|
||||
|
||||
if ((val = switch_channel_get_variable(channel, "pa_hold_file"))) {
|
||||
hold_file = val;
|
||||
} else {
|
||||
@@ -196,12 +189,9 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
|
||||
|
||||
if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL INIT %d %d\n",
|
||||
switch_channel_get_name(channel), switch_channel_get_state(channel), switch_test_flag(tech_pvt, TFLAG_ANSWER));
|
||||
|
||||
|
||||
|
||||
if (engage_device(tech_pvt->sample_rate, tech_pvt->codec_ms) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
@@ -297,40 +287,17 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
|
||||
switch_channel_set_state(channel, CS_RING);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
static switch_status_t channel_on_ring(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL RING\n", switch_channel_get_name(channel));
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL RING\n", switch_channel_get_name(switch_core_session_get_channel(session)));
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_on_execute(switch_core_session_t *session)
|
||||
{
|
||||
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -429,13 +396,7 @@ static void remove_pvt(private_t * tech_pvt)
|
||||
|
||||
static switch_status_t channel_on_hangup(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
private_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
remove_pvt(tech_pvt);
|
||||
@@ -450,20 +411,15 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
|
||||
switch_core_file_close(&tech_pvt->fh);
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(switch_core_session_get_channel(session)));
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
private_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch (sig) {
|
||||
@@ -476,7 +432,6 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int
|
||||
}
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -488,47 +443,24 @@ static switch_status_t channel_on_transmit(switch_core_session_t *session)
|
||||
|
||||
static switch_status_t channel_on_loopback(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL LOOPBACK\n");
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static switch_status_t channel_waitfor_read(switch_core_session_t *session, int ms, int stream_id)
|
||||
{
|
||||
private_t *tech_pvt = NULL;
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_waitfor_write(switch_core_session_t *session, int ms, int stream_id)
|
||||
{
|
||||
private_t *tech_pvt = NULL;
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
|
||||
{
|
||||
private_t *tech_pvt = NULL;
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
private_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF ON CALL %s [%c]\n", tech_pvt->call_id, dtmf->digit);
|
||||
@@ -538,15 +470,9 @@ static switch_status_t channel_send_dtmf(switch_core_session_t *session, const s
|
||||
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
private_t *tech_pvt = switch_core_session_get_private(session);
|
||||
int samples = 0;
|
||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
if (!globals.audio_stream) {
|
||||
@@ -590,7 +516,6 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
hold:
|
||||
|
||||
{
|
||||
switch_size_t olen = globals.read_codec.implementation->samples_per_frame;
|
||||
if (switch_core_timer_next(&globals.timer) != SWITCH_STATUS_SUCCESS) {
|
||||
@@ -605,7 +530,6 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
goto cng;
|
||||
}
|
||||
|
||||
|
||||
tech_pvt->hold_frame.datalen = (uint32_t) (olen * sizeof(int16_t));
|
||||
tech_pvt->hold_frame.samples = (uint32_t) olen;
|
||||
*frame = &tech_pvt->hold_frame;
|
||||
@@ -642,13 +566,8 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
private_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
if (!globals.audio_stream) {
|
||||
@@ -672,35 +591,18 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
|
||||
}
|
||||
|
||||
return status;
|
||||
|
||||
}
|
||||
|
||||
static switch_status_t channel_answer_channel(switch_core_session_t *session)
|
||||
{
|
||||
private_t *tech_pvt;
|
||||
switch_channel_t *channel = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
private_t *tech_pvt;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
private_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
|
||||
switch (msg->message_id) {
|
||||
case SWITCH_MESSAGE_INDICATE_ANSWER:
|
||||
channel_answer_channel(session);
|
||||
@@ -743,7 +645,6 @@ 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(portaudio_endpoint_interface, pool)) != 0) {
|
||||
private_t *tech_pvt;
|
||||
switch_channel_t *channel;
|
||||
@@ -790,7 +691,6 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
}
|
||||
|
||||
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -817,14 +717,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_portaudio_load)
|
||||
"Input Device: %d, Output Device: %d, Ring Device: %d Sample Rate: %d MS: %d\n", globals.indev,
|
||||
globals.outdev, globals.ringdev, globals.sample_rate, globals.codec_ms);
|
||||
|
||||
|
||||
switch_core_hash_init(&globals.call_hash, module_pool);
|
||||
switch_mutex_init(&globals.device_lock, SWITCH_MUTEX_NESTED, module_pool);
|
||||
switch_mutex_init(&globals.pvt_lock, SWITCH_MUTEX_NESTED, module_pool);
|
||||
switch_mutex_init(&globals.flag_mutex, SWITCH_MUTEX_NESTED, module_pool);
|
||||
|
||||
|
||||
|
||||
if (switch_event_reserve_subclass(MY_EVENT_RINGING) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass!\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
@@ -1043,8 +940,7 @@ static void PrintSupportedStandardSampleRates(const PaStreamParameters * inputPa
|
||||
int i, printCount, cr = 7;
|
||||
PaError err;
|
||||
static double standardSampleRates[] = { 8000.0, 9600.0, 11025.0, 12000.0, 16000.0, 22050.0, 24000.0, 32000.0,
|
||||
44100.0, 48000.0, 88200.0, 96000.0, 192000.0, -1
|
||||
};
|
||||
44100.0, 48000.0, 88200.0, 96000.0, 192000.0, -1};
|
||||
|
||||
printCount = cr;
|
||||
for (i = 0; standardSampleRates[i] > 0; i++) {
|
||||
@@ -1093,8 +989,6 @@ static int dump_info(void)
|
||||
PaError err;
|
||||
const char *line = "--------------------------------------------------------------------------------\n";
|
||||
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO,
|
||||
"PortAudio version number = %d\nPortAudio version text = '%s'\n", Pa_GetVersion(), Pa_GetVersionText());
|
||||
if (globals.audio_stream) {
|
||||
@@ -1194,8 +1088,6 @@ static int dump_info(void)
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static switch_status_t engage_device(int sample_rate, int codec_ms)
|
||||
{
|
||||
PaStreamParameters inputParameters, outputParameters;
|
||||
@@ -1236,13 +1128,9 @@ static switch_status_t engage_device(int sample_rate, int codec_ms)
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
globals.read_frame.rate = sample_rate;
|
||||
globals.read_frame.codec = &globals.read_codec;
|
||||
|
||||
|
||||
|
||||
switch_mutex_lock(globals.device_lock);
|
||||
/* LOCKED ************************************************************************************************** */
|
||||
inputParameters.device = globals.indev;
|
||||
@@ -1261,7 +1149,6 @@ static switch_status_t engage_device(int sample_rate, int codec_ms)
|
||||
/* UNLOCKED ************************************************************************************************* */
|
||||
switch_mutex_unlock(globals.device_lock);
|
||||
|
||||
|
||||
if (err != paNoError) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open audio device!\n");
|
||||
switch_core_codec_destroy(&globals.read_codec);
|
||||
@@ -1271,14 +1158,9 @@ static switch_status_t engage_device(int sample_rate, int codec_ms)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
static switch_status_t engage_ring_device(int sample_rate, int channels)
|
||||
{
|
||||
PaStreamParameters outputParameters;
|
||||
@@ -1301,7 +1183,6 @@ static switch_status_t engage_ring_device(int sample_rate, int channels)
|
||||
/* UNLOCKED ************************************************************************************************* */
|
||||
switch_mutex_unlock(globals.device_lock);
|
||||
|
||||
|
||||
if (err != paNoError) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open ring device!\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
@@ -1312,8 +1193,6 @@ static switch_status_t engage_ring_device(int sample_rate, int channels)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static switch_status_t dtmf_call(char **argv, int argc, switch_stream_handle_t *stream)
|
||||
{
|
||||
char *dtmf_str = argv[0];
|
||||
@@ -1382,7 +1261,6 @@ static switch_status_t switch_call(char **argv, int argc, switch_stream_handle_t
|
||||
switch_mutex_unlock(globals.pvt_lock);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
static switch_status_t hangup_call(char **argv, int argc, switch_stream_handle_t *stream)
|
||||
@@ -1406,7 +1284,6 @@ static switch_status_t hangup_call(char **argv, int argc, switch_stream_handle_t
|
||||
switch_mutex_unlock(globals.pvt_lock);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
static switch_status_t answer_call(char **argv, int argc, switch_stream_handle_t *stream)
|
||||
@@ -1446,12 +1323,9 @@ static switch_status_t answer_call(char **argv, int argc, switch_stream_handle_t
|
||||
}
|
||||
done:
|
||||
switch_mutex_unlock(globals.pvt_lock);
|
||||
|
||||
stream->write_function(stream, "Answered %d channels.\n", x);
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
static switch_status_t do_flags(char **argv, int argc, switch_stream_handle_t *stream)
|
||||
@@ -1676,19 +1550,9 @@ SWITCH_STANDARD_API(pa_cmd)
|
||||
http = switch_event_get_header(stream->event, "http-host");
|
||||
}
|
||||
|
||||
|
||||
if (http) {
|
||||
stream->write_function(stream, "Content-type: text/html\n\n");
|
||||
|
||||
#if 0
|
||||
switch_event_header_t *hp;
|
||||
stream->write_function(stream, "<pre>");
|
||||
for (hp = stream->event->headers; hp; hp = hp->next) {
|
||||
stream->write_function(stream, "[%s]=[%s]\n", hp->name, hp->value);
|
||||
}
|
||||
stream->write_function(stream, "</pre>");
|
||||
#endif
|
||||
|
||||
wcmd = switch_str_nil(switch_event_get_header(stream->event, "wcmd"));
|
||||
action = switch_event_get_header(stream->event, "action");
|
||||
|
||||
@@ -1815,13 +1679,10 @@ SWITCH_STANDARD_API(pa_cmd)
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
if (http) {
|
||||
|
||||
stream->write_function(stream,
|
||||
"<br><br><table align=center><tr><td><center><form method=post>\n"
|
||||
"<input type=text name=wcmd size=40><br><br>\n"
|
||||
|
||||
"<input name=action type=submit value=\"call\"> "
|
||||
"<input name=action type=submit value=\"hangup\"> "
|
||||
"<input name=action type=submit value=\"list\"> "
|
||||
@@ -1856,7 +1717,6 @@ SWITCH_STANDARD_API(pa_cmd)
|
||||
}
|
||||
|
||||
switch_safe_free(mycmd);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,13 +73,8 @@ static switch_status_t sofia_kill_channel(switch_core_session_t *session, int si
|
||||
*/
|
||||
static switch_status_t sofia_on_init(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_object_t *tech_pvt;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
tech_pvt->read_frame.buflen = SWITCH_RTP_MAX_BUF_LEN;
|
||||
@@ -116,18 +111,12 @@ static switch_status_t sofia_on_init(switch_core_session_t *session)
|
||||
|
||||
static switch_status_t sofia_on_ring(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_object_t *tech_pvt = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA RING\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA RING\n", switch_channel_get_name(switch_core_session_get_channel(session)));
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -135,18 +124,12 @@ static switch_status_t sofia_on_ring(switch_core_session_t *session)
|
||||
|
||||
static switch_status_t sofia_on_reset(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_object_t *tech_pvt = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA RESET\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA RESET\n", switch_channel_get_name(switch_core_session_get_channel(session)));
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -154,35 +137,23 @@ static switch_status_t sofia_on_reset(switch_core_session_t *session)
|
||||
|
||||
static switch_status_t sofia_on_hibernate(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_object_t *tech_pvt = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
private_object_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA HIBERNATE\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA HIBERNATE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t sofia_on_execute(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_object_t *tech_pvt = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA EXECUTE\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA EXECUTE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -247,16 +218,10 @@ static int hangup_cause_to_sip(switch_call_cause_t cause)
|
||||
switch_status_t sofia_on_hangup(switch_core_session_t *session)
|
||||
{
|
||||
switch_core_session_t *a_session;
|
||||
private_object_t *tech_pvt;
|
||||
switch_channel_t *channel = NULL;
|
||||
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
switch_call_cause_t cause;
|
||||
int sip_cause;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
if (tech_pvt->profile->rtpip && tech_pvt->local_sdp_audio_port) {
|
||||
switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_audio_port);
|
||||
@@ -364,19 +329,12 @@ static switch_status_t sofia_on_transmit(switch_core_session_t *session)
|
||||
|
||||
static switch_status_t sofia_answer_channel(switch_core_session_t *session)
|
||||
{
|
||||
private_object_t *tech_pvt;
|
||||
switch_channel_t *channel = NULL;
|
||||
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
switch_status_t status;
|
||||
uint32_t session_timeout = 0;
|
||||
const char *val;
|
||||
|
||||
switch_assert(session != NULL);
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
|
||||
if (switch_test_flag(tech_pvt, TFLAG_ANS) || switch_channel_test_flag(channel, CF_OUTBOUND)) {
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -445,14 +403,10 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
|
||||
|
||||
static switch_status_t sofia_read_video_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
private_object_t *tech_pvt = NULL;
|
||||
switch_channel_t *channel = NULL;
|
||||
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
int payload = 0;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
if (switch_test_flag(tech_pvt, TFLAG_HUP)) {
|
||||
@@ -467,10 +421,8 @@ static switch_status_t sofia_read_video_frame(switch_core_session_t *session, sw
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tech_pvt->video_read_frame.datalen = 0;
|
||||
|
||||
|
||||
if (switch_test_flag(tech_pvt, TFLAG_IO)) {
|
||||
switch_status_t status;
|
||||
|
||||
@@ -512,14 +464,10 @@ static switch_status_t sofia_read_video_frame(switch_core_session_t *session, sw
|
||||
|
||||
static switch_status_t sofia_write_video_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
private_object_t *tech_pvt;
|
||||
switch_channel_t *channel = NULL;
|
||||
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
while (!(tech_pvt->video_read_codec.implementation && switch_rtp_ready(tech_pvt->video_rtp_session))) {
|
||||
@@ -552,14 +500,10 @@ static switch_status_t sofia_write_video_frame(switch_core_session_t *session, s
|
||||
|
||||
static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
private_object_t *tech_pvt = NULL;
|
||||
switch_channel_t *channel = NULL;
|
||||
private_object_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
int payload = 0;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
if (!(tech_pvt->profile->pflags & PFLAG_RUNNING)) {
|
||||
@@ -642,15 +586,11 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
|
||||
|
||||
static switch_status_t sofia_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
private_object_t *tech_pvt;
|
||||
switch_channel_t *channel = NULL;
|
||||
private_object_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
int bytes = 0, samples = 0, frames = 0;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
while (!(tech_pvt->read_codec.implementation && switch_rtp_ready(tech_pvt->rtp_session))) {
|
||||
@@ -700,16 +640,10 @@ static switch_status_t sofia_write_frame(switch_core_session_t *session, switch_
|
||||
|
||||
static switch_status_t sofia_kill_channel(switch_core_session_t *session, int sig)
|
||||
{
|
||||
private_object_t *tech_pvt;
|
||||
switch_channel_t *channel = NULL;
|
||||
private_object_t *tech_pvt = switch_core_session_get_private(session);
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
|
||||
switch (sig) {
|
||||
case SWITCH_SIG_BREAK:
|
||||
if (switch_rtp_ready(tech_pvt->rtp_session)) {
|
||||
@@ -737,29 +671,11 @@ static switch_status_t sofia_kill_channel(switch_core_session_t *session, int si
|
||||
|
||||
static switch_status_t sofia_waitfor_read(switch_core_session_t *session, int ms, int stream_id)
|
||||
{
|
||||
private_object_t *tech_pvt;
|
||||
switch_channel_t *channel = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t sofia_waitfor_write(switch_core_session_t *session, int ms, int stream_id)
|
||||
{
|
||||
private_object_t *tech_pvt;
|
||||
switch_channel_t *channel = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -792,14 +708,10 @@ static switch_status_t sofia_send_dtmf(switch_core_session_t *session, const swi
|
||||
|
||||
static switch_status_t sofia_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
private_object_t *tech_pvt;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
private_object_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_status_t status;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
if (msg->message_id == SWITCH_MESSAGE_INDICATE_ANSWER || msg->message_id == SWITCH_MESSAGE_INDICATE_PROGRESS) {
|
||||
@@ -1109,15 +1021,10 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
|
||||
static switch_status_t sofia_receive_event(switch_core_session_t *session, switch_event_t *event)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
struct private_object *tech_pvt;
|
||||
struct private_object *tech_pvt = switch_core_session_get_private(session);
|
||||
char *body;
|
||||
nua_handle_t *msg_nh;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
if (!(body = switch_event_get_body(event))) {
|
||||
|
||||
@@ -119,12 +119,9 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status,
|
||||
sip_t const *sip,
|
||||
tagi_t tags[])
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
|
||||
if (session) {
|
||||
const char *tmp;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
if (sip->sip_user_agent && !switch_strlen_zero(sip->sip_user_agent->g_string)){
|
||||
switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);
|
||||
}
|
||||
@@ -1302,8 +1299,6 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
|
||||
char const *phrase,
|
||||
nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
|
||||
{
|
||||
|
||||
|
||||
if (sip && session) {
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
const char *uuid;
|
||||
@@ -1437,8 +1432,6 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
|
||||
if (session) {
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
switch_assert(tech_pvt->nh != NULL);
|
||||
@@ -1821,22 +1814,19 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
||||
sip_from_t const *from;
|
||||
sip_to_t const *to;
|
||||
sip_refer_to_t const *refer_to;
|
||||
private_object_t *tech_pvt = NULL;
|
||||
private_object_t *tech_pvt = switch_core_session_get_private(session);
|
||||
char *etmp = NULL, *exten = NULL;
|
||||
switch_channel_t *channel_a = NULL, *channel_b = NULL;
|
||||
switch_channel_t *channel_a = switch_core_session_get_channel(session);
|
||||
switch_channel_t *channel_b = NULL;
|
||||
su_home_t *home = NULL;
|
||||
char *full_ref_by = NULL;
|
||||
char *full_ref_to = NULL;
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
channel_a = switch_core_session_get_channel(session);
|
||||
|
||||
if (!sip->sip_cseq || !(etmp = switch_mprintf("refer;id=%u", sip->sip_cseq->cs_seq))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
if (switch_channel_test_flag(channel_a, CF_BYPASS_MEDIA)) {
|
||||
nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
|
||||
NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp), TAG_END());
|
||||
@@ -2115,8 +2105,6 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
||||
|
||||
void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[])
|
||||
{
|
||||
struct private_object *tech_pvt = NULL;
|
||||
switch_channel_t *channel = NULL;
|
||||
/* placeholder for string searching */
|
||||
const char *signal_ptr;
|
||||
const char *rec_header;
|
||||
@@ -2125,14 +2113,10 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
||||
|
||||
if (session) {
|
||||
/* Get the channel */
|
||||
channel = switch_core_session_get_channel(session);
|
||||
|
||||
/* Barf if we didn't get it */
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
/* make sure we have our privates */
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
|
||||
struct private_object *tech_pvt = switch_core_session_get_private(session);
|
||||
|
||||
/* Barf if we didn't get it */
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
@@ -2219,18 +2203,13 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
|
||||
fail:
|
||||
|
||||
nua_respond(nh, 488, "Unsupported Request", NUTAG_WITH_THIS(nua), TAG_END());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -385,10 +385,8 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *
|
||||
tech_pvt->te = profile->te;
|
||||
}
|
||||
|
||||
|
||||
tech_pvt->dtmf_type = profile->dtmf_type;
|
||||
|
||||
|
||||
if (tech_pvt->bcng_pt) {
|
||||
tech_pvt->cng_pt = tech_pvt->bcng_pt;
|
||||
} else if (!tech_pvt->cng_pt) {
|
||||
@@ -399,7 +397,6 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *
|
||||
tech_pvt->channel = switch_core_session_get_channel(session);
|
||||
switch_core_session_set_private(session, tech_pvt);
|
||||
|
||||
|
||||
switch_snprintf(name, sizeof(name), "sofia/%s/%s", profile->name, channame);
|
||||
switch_channel_set_name(tech_pvt->channel, name);
|
||||
}
|
||||
@@ -651,8 +648,8 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
||||
char *alert_info = NULL;
|
||||
const char *max_forwards = NULL;
|
||||
const char *alertbuf;
|
||||
private_object_t *tech_pvt;
|
||||
switch_channel_t *channel = NULL;
|
||||
private_object_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
switch_caller_profile_t *caller_profile;
|
||||
const char *cid_name, *cid_num;
|
||||
char *e_dest = NULL;
|
||||
@@ -665,12 +662,8 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
||||
const char *val;
|
||||
const char *rep;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
rep = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER);
|
||||
|
||||
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch_clear_flag_locked(tech_pvt, TFLAG_SDP);
|
||||
@@ -897,14 +890,10 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
||||
|
||||
void sofia_glue_do_xfer_invite(switch_core_session_t *session)
|
||||
{
|
||||
private_object_t *tech_pvt;
|
||||
switch_channel_t *channel = NULL;
|
||||
private_object_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
switch_caller_profile_t *caller_profile;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
caller_profile = switch_channel_get_caller_profile(channel);
|
||||
@@ -1497,24 +1486,20 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
|
||||
{
|
||||
uint8_t match = 0;
|
||||
switch_payload_t te = 0, cng_pt = 0;
|
||||
private_object_t *tech_pvt;
|
||||
private_object_t *tech_pvt = switch_core_session_get_private(session);
|
||||
sdp_media_t *m;
|
||||
sdp_attribute_t *attr;
|
||||
int first = 0, last = 0;
|
||||
int ptime = 0, dptime = 0;
|
||||
int sendonly = 0;
|
||||
int greedy = 0, x = 0, skip = 0, mine = 0;
|
||||
switch_channel_t *channel = NULL;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
const char *val;
|
||||
const char *crypto = NULL;
|
||||
int got_crypto = 0;
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
greedy = !!(tech_pvt->profile->pflags & PFLAG_GREEDY);
|
||||
|
||||
if (!greedy) {
|
||||
@@ -1962,7 +1947,6 @@ void sofia_glue_pass_sdp(private_object_t *tech_pvt, char *sdp)
|
||||
if ((val = switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE))
|
||||
&& (other_session = switch_core_session_locate(val))) {
|
||||
other_channel = switch_core_session_get_channel(other_session);
|
||||
switch_assert(other_channel != NULL);
|
||||
switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, sdp);
|
||||
|
||||
if (!switch_test_flag(tech_pvt, TFLAG_CHANGE_MEDIA) && (switch_channel_test_flag(other_channel, CF_OUTBOUND) &&
|
||||
|
||||
@@ -750,8 +750,7 @@ void sofia_reg_handle_sip_r_challenge(int status,
|
||||
cancel:
|
||||
|
||||
if (session) {
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_MANDATORY_IE_MISSING);
|
||||
switch_channel_hangup(switch_core_session_get_channel(session), SWITCH_CAUSE_MANDATORY_IE_MISSING);
|
||||
} else {
|
||||
nua_cancel(nh, TAG_END());
|
||||
}
|
||||
|
||||
@@ -200,16 +200,12 @@ static int tech_activate(private_object * tech_pvt);
|
||||
*/
|
||||
static switch_status_t woomera_on_init(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
struct private_object *tech_pvt = NULL;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
struct private_object *tech_pvt = switch_core_session_get_private(session);
|
||||
int rate = 8000;
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt->frame.data = tech_pvt->databuf;
|
||||
|
||||
if (switch_core_codec_init
|
||||
@@ -244,53 +240,25 @@ static switch_status_t woomera_on_init(switch_core_session_t *session)
|
||||
|
||||
static switch_status_t woomera_on_ring(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
struct private_object *tech_pvt = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERA RING\n", switch_channel_get_name(channel));
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERA RING\n", switch_channel_get_name(switch_core_session_get_channel(session)));
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t woomera_on_execute(switch_core_session_t *session)
|
||||
{
|
||||
|
||||
switch_channel_t *channel = NULL;
|
||||
struct private_object *tech_pvt = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERA EXECUTE\n", switch_channel_get_name(channel));
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERA EXECUTE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t woomera_on_hangup(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
struct private_object *tech_pvt = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
struct private_object *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch_core_codec_destroy(&tech_pvt->read_codec);
|
||||
switch_core_codec_destroy(&tech_pvt->write_codec);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERA HANGUP\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERA HANGUP\n", switch_channel_get_name(switch_core_session_get_channel(session)));
|
||||
tech_destroy(tech_pvt);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -316,13 +284,7 @@ static void udp_socket_close(struct private_object *tech_pvt)
|
||||
|
||||
static switch_status_t woomera_kill_channel(switch_core_session_t *session, int sig)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
struct private_object *tech_pvt = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
struct private_object *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
if (!tech_pvt->udp_socket) {
|
||||
@@ -332,7 +294,7 @@ static switch_status_t woomera_kill_channel(switch_core_session_t *session, int
|
||||
switch (sig) {
|
||||
case SWITCH_SIG_KILL:
|
||||
udp_socket_close(tech_pvt);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERA KILL\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERA KILL\n", switch_channel_get_name(switch_core_session_get_channel(session)));
|
||||
break;
|
||||
case SWITCH_SIG_BREAK:
|
||||
{
|
||||
@@ -345,7 +307,6 @@ static switch_status_t woomera_kill_channel(switch_core_session_t *session, int
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -384,15 +345,10 @@ static switch_status_t woomera_waitfor_write(switch_core_session_t *session, int
|
||||
|
||||
static switch_status_t woomera_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
struct private_object *tech_pvt = NULL;
|
||||
struct private_object *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_frame_t *pframe;
|
||||
switch_size_t len;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
for(;;) {
|
||||
@@ -406,15 +362,10 @@ static switch_status_t woomera_read_frame(switch_core_session_t *session, switch
|
||||
switch_yield(1000);
|
||||
}
|
||||
|
||||
|
||||
if (!tech_pvt->udp_socket) {
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
/*
|
||||
if ((status = woomera_waitfor_read(session, -1)) != SWITCH_STATUS_SUCCESS) {
|
||||
return status;
|
||||
}1<
|
||||
*/
|
||||
|
||||
pframe = &tech_pvt->frame;
|
||||
*frame = pframe;
|
||||
|
||||
@@ -430,15 +381,9 @@ static switch_status_t woomera_read_frame(switch_core_session_t *session, switch
|
||||
|
||||
static switch_status_t woomera_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
struct private_object *tech_pvt = NULL;
|
||||
struct private_object *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_size_t len;
|
||||
//switch_frame_t *pframe;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
if (switch_test_flag(tech_pvt, TFLAG_ABORT) || !tech_pvt->udp_socket) {
|
||||
@@ -449,7 +394,6 @@ static switch_status_t woomera_write_frame(switch_core_session_t *session, switc
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
//pframe = &tech_pvt->frame;
|
||||
len = frame->datalen;
|
||||
if (switch_socket_sendto(tech_pvt->udp_socket, tech_pvt->udpwrite, 0, frame->data, &len) == SWITCH_STATUS_SUCCESS) {
|
||||
frame->datalen = (uint32_t) len;
|
||||
@@ -953,24 +897,17 @@ static int tech_activate(private_object * tech_pvt)
|
||||
static void *woomera_channel_thread_run(switch_thread_t * thread, void *obj)
|
||||
{
|
||||
switch_core_session_t *session = obj;
|
||||
switch_channel_t *channel = NULL;
|
||||
struct private_object *tech_pvt = NULL;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
struct private_object *tech_pvt = switch_core_session_get_private(session);
|
||||
woomera_message wmsg;
|
||||
int res = 0;
|
||||
|
||||
switch_assert(session != NULL);
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
if (!tech_pvt->udp_socket) {
|
||||
tech_create_read_socket(tech_pvt);
|
||||
}
|
||||
|
||||
|
||||
for (;;) {
|
||||
if (globals.panic) {
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_ABORT);
|
||||
@@ -1014,18 +951,6 @@ static void *woomera_channel_thread_run(switch_thread_t * thread, void *obj)
|
||||
memset(tech_pvt->dtmfbuf, 0, sizeof(tech_pvt->dtmfbuf));
|
||||
switch_mutex_unlock(tech_pvt->iolock);
|
||||
}
|
||||
#if 1==0 /*convert to use switch_time_now */
|
||||
if (tech_pvt->timeout) {
|
||||
struct timeval now;
|
||||
int elapsed;
|
||||
gettimeofday(&now, NULL);
|
||||
elapsed = (((now.tv_sec * 1000) + now.tv_usec / 1000) - ((tech_pvt->started.tv_sec * 1000) + tech_pvt->started.tv_usec / 1000));
|
||||
if (elapsed > tech_pvt->timeout) {
|
||||
/* call timed out! */
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_ABORT);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!tech_pvt->command_channel) {
|
||||
break;
|
||||
@@ -1038,17 +963,6 @@ static void *woomera_channel_thread_run(switch_thread_t * thread, void *obj)
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_ABORT);
|
||||
continue;
|
||||
} else if (!strcasecmp(wmsg.command, "DTMF")) {
|
||||
/*
|
||||
struct ast_frame dtmf_frame = {AST_FRAME_DTMF};
|
||||
int x = 0;
|
||||
for (x = 0; x < strlen(wmsg.command_args); x++) {
|
||||
dtmf_frame.subclass = wmsg.command_args[x];
|
||||
ast_queue_frame(tech_pvt->owner, ast_frdup(&dtmf_frame));
|
||||
if (globals.debug > 1) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, WOOMERA_DEBUG_PREFIX "SEND DTMF [%c] to %s\n", dtmf_frame.subclass, tech_pvt->owner->name);
|
||||
}
|
||||
}
|
||||
*/
|
||||
} else if (!strcasecmp(wmsg.command, "PROCEED")) {
|
||||
/* This packet has lots of info so well keep it */
|
||||
tech_pvt->call_info = wmsg;
|
||||
@@ -1154,12 +1068,8 @@ static void *woomera_channel_thread_run(switch_thread_t * thread, void *obj)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void *woomera_thread_run(void *obj)
|
||||
{
|
||||
|
||||
int res = 0;
|
||||
woomera_message wmsg;
|
||||
woomera_profile *profile;
|
||||
@@ -1209,28 +1119,8 @@ static void *woomera_thread_run(void *obj)
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ALERT, "{%s} HELP! I lost my connection to woomera!\n", profile->name);
|
||||
woomera_socket_close(&profile->woomera_socket);
|
||||
|
||||
//global_set_flag(TFLAG_ABORT);
|
||||
globals.panic = 1;
|
||||
continue;
|
||||
|
||||
/* Can't get to the following code --Commented out for now. */
|
||||
/* if (profile->woomera_socket)
|
||||
if (switch_test_flag(profile, PFLAG_INBOUND)) {
|
||||
woomera_printf(profile, profile->woomera_socket, "LISTEN%s", WOOMERA_RECORD_SEPERATOR);
|
||||
if (woomera_message_parse(profile->woomera_socket,
|
||||
&wmsg, WOOMERA_HARD_TIMEOUT, profile, &profile->event_queue) < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "{%s} HELP! Woomera is broken!\n",
|
||||
profile->name);
|
||||
globals.panic = 1;
|
||||
woomera_socket_close(&profile->woomera_socket);
|
||||
}
|
||||
}
|
||||
if (profile->woomera_socket) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Woomera Thread Up {%s} %s/%d\n", profile->name,
|
||||
profile->woomera_host, profile->woomera_port);
|
||||
}
|
||||
}*/
|
||||
//continue;
|
||||
}
|
||||
|
||||
if (!strcasecmp(wmsg.command, "INCOMING")) {
|
||||
@@ -1277,7 +1167,6 @@ static void *woomera_thread_run(void *obj)
|
||||
switch_yield(100);
|
||||
}
|
||||
|
||||
|
||||
if (profile->woomera_socket) {
|
||||
woomera_printf(profile, profile->woomera_socket, "BYE%s", WOOMERA_RECORD_SEPERATOR);
|
||||
woomera_socket_close(&profile->woomera_socket);
|
||||
@@ -1290,7 +1179,6 @@ static void *woomera_thread_run(void *obj)
|
||||
|
||||
SWITCH_MODULE_RUNTIME_FUNCTION(mod_woomera_runtime)
|
||||
{
|
||||
|
||||
woomera_thread_run(&default_profile);
|
||||
|
||||
return SWITCH_STATUS_TERM;
|
||||
|
||||
Reference in new issue
Block a user