cleanup
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@265 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
c1dfe0c0ae
commit
058739eed9
|
@ -555,16 +555,24 @@ static switch_status_t channel_receive_message_b(switch_core_session_t *session,
|
|||
|
||||
switch (msg->message_id) {
|
||||
case SWITCH_MESSAGE_INDICATE_RINGING:
|
||||
if (!switch_channel_test_flag(channel, CF_OUTBOUND)) {
|
||||
zap_set_state_locked(tech_pvt->zchan, ZAP_CHANNEL_STATE_PROGRESS);
|
||||
{
|
||||
if (!switch_channel_test_flag(channel, CF_OUTBOUND)) {
|
||||
zap_set_state_locked(tech_pvt->zchan, ZAP_CHANNEL_STATE_PROGRESS);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SWITCH_MESSAGE_INDICATE_PROGRESS:
|
||||
if (!switch_channel_test_flag(channel, CF_OUTBOUND)) {
|
||||
zap_set_state_locked(tech_pvt->zchan, ZAP_CHANNEL_STATE_EARLY_MEDIA);
|
||||
{
|
||||
if (!switch_channel_test_flag(channel, CF_OUTBOUND)) {
|
||||
zap_set_state_locked(tech_pvt->zchan, ZAP_CHANNEL_STATE_PROGRESS_MEDIA);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SWITCH_MESSAGE_INDICATE_ANSWER:
|
||||
if (!switch_channel_test_flag(channel, CF_OUTBOUND)) {
|
||||
zap_set_state_locked(tech_pvt->zchan, ZAP_CHANNEL_STATE_UP);
|
||||
{
|
||||
if (!switch_channel_test_flag(channel, CF_OUTBOUND)) {
|
||||
zap_set_state_locked(tech_pvt->zchan, ZAP_CHANNEL_STATE_UP);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -877,7 +885,7 @@ static ZIO_SIGNAL_CB_FUNCTION(on_fxo_signal)
|
|||
switch_channel_t *channel = NULL;
|
||||
zap_status_t status;
|
||||
|
||||
zap_log(ZAP_LOG_DEBUG, "got fxo sig [%s]\n", zap_signal_event2str(sigmsg->event_id));
|
||||
zap_log(ZAP_LOG_DEBUG, "got FXO sig [%s]\n", zap_signal_event2str(sigmsg->event_id));
|
||||
|
||||
switch(sigmsg->event_id) {
|
||||
case ZAP_SIGEVENT_UP:
|
||||
|
@ -909,7 +917,7 @@ static ZIO_SIGNAL_CB_FUNCTION(on_fxs_signal)
|
|||
private_t *tech_pvt = NULL;
|
||||
zap_status_t status = ZAP_SUCCESS;
|
||||
|
||||
zap_log(ZAP_LOG_DEBUG, "got fxs sig [%s]\n", zap_signal_event2str(sigmsg->event_id));
|
||||
zap_log(ZAP_LOG_DEBUG, "got FXS sig [%s]\n", zap_signal_event2str(sigmsg->event_id));
|
||||
|
||||
switch(sigmsg->event_id) {
|
||||
case ZAP_SIGEVENT_UP:
|
||||
|
|
|
@ -263,13 +263,13 @@ typedef enum {
|
|||
ZAP_CHANNEL_STATE_CALLWAITING,
|
||||
ZAP_CHANNEL_STATE_TERMINATING,
|
||||
ZAP_CHANNEL_STATE_RESTART,
|
||||
ZAP_CHANNEL_STATE_EARLY_MEDIA,
|
||||
ZAP_CHANNEL_STATE_PROGRESS_MEDIA,
|
||||
ZAP_CHANNEL_STATE_PROGRESS,
|
||||
ZAP_CHANNEL_STATE_INVALID
|
||||
} zap_channel_state_t;
|
||||
#define CHANNEL_STATE_STRINGS "DOWN", "UP", "HANGUP", "HOLD", "DIALTONE", "COLLECT", \
|
||||
"RING", "BUSY", "ATTN", "IDLE", "GENRING", "DIALING", "GET_CALLERID", "CALLWAITING", \
|
||||
"TERMINATING", "RESTART", "EARLY_MEDIA", "PROGRESS", "INVALID"
|
||||
"TERMINATING", "RESTART", "PROGRESS_MEDIA", "PROGRESS", "INVALID"
|
||||
ZAP_STR2ENUM_P(zap_str2zap_channel_state, zap_channel_state2str, zap_channel_state_t)
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -516,6 +516,18 @@ zap_status_t zap_channel_set_state(zap_channel_t *zchan, zap_channel_state_t sta
|
|||
}
|
||||
|
||||
switch(zchan->state) {
|
||||
case ZAP_CHANNEL_STATE_UP:
|
||||
{
|
||||
switch(state) {
|
||||
case ZAP_CHANNEL_STATE_PROGRESS:
|
||||
case ZAP_CHANNEL_STATE_PROGRESS_MEDIA:
|
||||
ok = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ZAP_CHANNEL_STATE_DOWN:
|
||||
{
|
||||
switch(state) {
|
||||
|
@ -528,6 +540,7 @@ zap_status_t zap_channel_set_state(zap_channel_t *zchan, zap_channel_state_t sta
|
|||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ZAP_CHANNEL_STATE_BUSY:
|
||||
{
|
||||
switch(state) {
|
||||
|
@ -538,6 +551,7 @@ zap_status_t zap_channel_set_state(zap_channel_t *zchan, zap_channel_state_t sta
|
|||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -771,8 +785,10 @@ zap_status_t zap_channel_done(zap_channel_t *zchan)
|
|||
assert(zchan != NULL);
|
||||
|
||||
memset(&zchan->caller_data, 0, sizeof(zchan->caller_data));
|
||||
|
||||
zap_clear_flag_locked(zchan, ZAP_CHANNEL_INUSE);
|
||||
zap_clear_flag_locked(zchan, ZAP_CHANNEL_OUTBOUND);
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (zchan->fds[i] > -1) {
|
||||
close(zchan->fds[i]);
|
||||
|
|
|
@ -110,7 +110,7 @@ static L3INT zap_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen)
|
|||
break;
|
||||
case Q931mes_ALERTING:
|
||||
{
|
||||
zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_EARLY_MEDIA);
|
||||
zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_PROGRESS_MEDIA);
|
||||
}
|
||||
break;
|
||||
case Q931mes_PROGRESS:
|
||||
|
@ -248,7 +248,7 @@ static __inline__ void state_advance(zap_channel_t *zchan)
|
|||
zap_channel_close(&zchan);
|
||||
}
|
||||
break;
|
||||
case ZAP_CHANNEL_STATE_EARLY_MEDIA:
|
||||
case ZAP_CHANNEL_STATE_PROGRESS_MEDIA:
|
||||
{
|
||||
if (zap_test_flag(zchan, ZAP_CHANNEL_OUTBOUND)) {
|
||||
sig.event_id = ZAP_SIGEVENT_PROGRESS_MEDIA;
|
||||
|
|
Loading…
Reference in New Issue