uint8_t ring_ready;
uint8_t early_media;
uint8_t answered;
+ uint8_t tagged;
uint32_t per_channel_timelimit_sec;
uint32_t per_channel_progress_timelimit_sec;
uint32_t per_channel_delay_start;
for (i = 0; i < len; i++) {
switch_channel_state_t state;
+
+ if (originate_status[i].tagged && originate_status[i].peer_session) {
+ switch_channel_t *channel = switch_core_session_get_channel(originate_status[i].peer_session);
+ int j;
+
+ if (switch_channel_down(channel)) {
+ switch_call_cause_t cause = switch_channel_get_cause(channel);
+
+ for (j = 0; j < len; j++) {
+ channel = switch_core_session_get_channel(originate_status[j].peer_session);
+ switch_channel_hangup(channel, cause);
+ }
+ oglobals->hups = len;
+ rval = 0;
+ goto end;
+ }
+ }
+
if (!(originate_status[i].peer_channel && originate_status[i].peer_session)) {
oglobals->hups++;
continue;
int32_t sample;
switch_core_session_t *session;
switch_codec_t *read_codec, read_codecs[MAX_PEERS] = { { 0 } };
- int i,x;
+ int i, x, ready = 0, answered = 0;
int16_t *data;
uint32_t datalen = 0;
switch_status_t status;
originate_status[i].peer_session = session;
switch_core_session_read_lock(session);
}
-
+
while (state->ready) {
datalen = 0;
memset(mux_data, 0, sizeof(mux_data));
-
+ ready = 0;
+ answered = 0;
+
for(i = 0; i < MAX_PEERS && (session = originate_status[i].peer_session); i++) {
switch_channel_t *channel = switch_core_session_get_channel(session);
if (switch_channel_media_ready(channel)) {
+ ready++;
+
+ if (switch_channel_test_flag(channel, CF_ANSWERED)) {
+ answered++;
+ }
+
if (!switch_core_codec_ready((&read_codecs[i]))) {
read_codec = switch_core_session_get_read_codec(session);
switch_buffer_write(state->buffer, mux_data, datalen);
switch_mutex_unlock(state->mutex);
}
+
+ if (!ready || answered) {
+ break;
+ }
}
switch_core_session_rwunlock(session);
}
+ state->oglobals->early_ok = 1;
+
return NULL;
}
if (originate_status[i].peer_channel) {
const char *vvar;
-
+
+ if (switch_true(switch_channel_get_variable(originate_status[i].peer_channel, "leg_required"))) {
+ originate_status[i].tagged = 1;
+ }
+
if ((vvar = switch_channel_get_variable(originate_status[i].peer_channel, "origination_callee_id_name"))) {
switch_channel_set_profile_var(originate_status[i].peer_channel, "callee_id_name", vvar);
}