Fixed early audio with chan_lcr (Asterisk)

If progress message is received, go into proceeding state.

Send audio, if proceeding/alerting state, so RTP stream is sent in both
directions. This is essential when using NAT.
This commit is contained in:
Andreas Eversberg 2012-12-04 15:41:23 +01:00
parent d2bcbfbaf0
commit 705f2dac84
3 changed files with 19 additions and 3 deletions

View File

@ -3012,6 +3012,15 @@ static int lcr_indicate(struct ast_channel *ast, int cond, const void *data, siz
break;
case AST_CONTROL_PROGRESS:
CDEBUG(call, ast, "Received indicate AST_CONTROL_PROGRESS from Asterisk.\n");
if (call->state == CHAN_LCR_STATE_IN_SETUP
|| call->state == CHAN_LCR_STATE_IN_DIALING) {
CDEBUG(call, ast, "Changing to proceeding state, because no more dialing possible.\n");
/* send message to lcr */
memset(&newparam, 0, sizeof(union parameter));
send_message(MESSAGE_PROCEEDING, call->ref, &newparam);
/* change state */
call->state = CHAN_LCR_STATE_IN_PROCEEDING;
}
/* request bchannel */
CDEBUG(call, ast, "Requesting audio path.\n");
memset(&newparam, 0, sizeof(union parameter));

View File

@ -24,6 +24,7 @@ Premote::Premote(int type, char *portname, struct port_settings *settings, struc
p_r_ref = new_remote++;
SCPY(p_r_remote_app, interface->remote_app);
p_r_tones = (interface->is_tones == IS_YES);
p_r_earlyb = (interface->is_earlyb == IS_YES);
/* send new ref to remote socket */
memset(&param, 0, sizeof(union parameter));
@ -233,9 +234,14 @@ int Premote::bridge_rx(unsigned char *data, int len)
union parameter newparam;
int l;
/* don't send tones, if not enabled or not connected */
if (!p_r_tones
&& p_state != PORT_STATE_CONNECT)
/* send tones, if connected, or if early audio is enabled in proceeding/alerting state */
if (p_state != PORT_STATE_CONNECT
&& !(p_r_earlyb
&& (p_state == PORT_STATE_OUT_PROCEEDING
|| p_state == PORT_STATE_OUT_ALERTING))
&& !(p_r_tones
&& (p_state == PORT_STATE_IN_PROCEEDING
|| p_state == PORT_STATE_IN_ALERTING)))
return 0;
if (p_tone_name[0])

View File

@ -11,6 +11,7 @@ class Premote : public Port
int p_r_remote_id; /* remote instance (socket) */
char p_r_remote_app[32];
int p_r_tones;
int p_r_earlyb;
int message_epoint(unsigned int epoint_id, int message_id, union parameter *param);
void message_remote(int message_type, union parameter *param);