[Freeswitch-svn] [commit] r3992 - freeswitch/trunk/src/mod/endpoints/mod_iax
Freeswitch SVN
anthm at freeswitch.org
Thu Jan 18 20:36:20 EST 2007
Author: anthm
Date: Thu Jan 18 20:36:20 2007
New Revision: 3992
Modified:
freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
Log:
a few twiax for early media (part 1)
Modified: freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c Thu Jan 18 20:36:20 2007
@@ -1033,8 +1033,12 @@
case IAX_EVENT_TIMEOUT:
break;
case IAX_EVENT_ACCEPT:
- if (tech_pvt) {
- tech_media(tech_pvt, iaxevent);
+ if (channel && !switch_channel_test_flag(channel, CF_ANSWERED)) {
+ if (tech_media(tech_pvt, iaxevent) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_set_flag(channel, CF_EARLY_MEDIA);
+ } else {
+ switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+ }
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Call accepted.\n");
break;
@@ -1047,17 +1051,18 @@
case IAX_EVENT_ANSWER:
// the other side answered our call
if (channel) {
- tech_media(tech_pvt, iaxevent);
-
- if (switch_channel_test_flag(channel, CF_ANSWERED)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "WTF Mutiple Answer %s?\n", switch_channel_get_name(channel));
+ if (tech_media(tech_pvt, iaxevent) == SWITCH_STATUS_SUCCESS) {
+ if (switch_channel_test_flag(channel, CF_ANSWERED)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "WTF Mutiple Answer %s?\n", switch_channel_get_name(channel));
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Answer %s\n", switch_channel_get_name(channel));
+ switch_channel_mark_answered(channel);
+ }
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Answer %s\n", switch_channel_get_name(channel));
- switch_channel_mark_answered(channel);
+ switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
}
-
- }
+ }
break;
case IAX_EVENT_CONNECT:
// incoming call detected
More information about the Freeswitch-svn
mailing list