Author: gmaruzz Date: Thu Feb 19 19:26:20 2009 New Revision: 12174 Log: skypiax: ringback is ok now, early media in early stage (eg: not yet early media :-) ) Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/chan_skypiax.c freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/skypiax.h freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/chan_skypiax.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/chan_skypiax.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/chan_skypiax.c Thu Feb 19 19:26:20 2009 @@ -1880,40 +1880,31 @@ #endif return 0; } - -int outbound_channel_answered(private_t * p) +int remote_party_is_ringing(private_t * p) { -#ifdef NOTDEF - switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; - - if (strlen(tech_pvt->session_uuid_str)) { - session = switch_core_session_locate(tech_pvt->session_uuid_str); - } else { - ERRORA("No session???\n", SKYPIAX_P_LOG); - } - if (session) { - channel = switch_core_session_get_channel(session); - } else { - ERRORA("No session???\n", SKYPIAX_P_LOG); + if (p->owner) { + ast_queue_control(p->owner, AST_CONTROL_RINGING); } - if (channel) { - switch_channel_mark_answered(channel); - //DEBUGA_SKYPE("skype_call: %s, answered\n", SKYPIAX_P_LOG, id); - } else { - ERRORA("No channel???\n", SKYPIAX_P_LOG); + + return 0; +} +int remote_party_is_early_media(private_t * p) +{ + if (p->owner) { + ast_queue_control(p->owner, AST_CONTROL_RINGING); } - switch_core_session_rwunlock(session); + return 0; +} + -#endif +int outbound_channel_answered(private_t * p) +{ if (p->owner) { ast_queue_control(p->owner, AST_CONTROL_ANSWER); } - NOTICA("HERE!\n", SKYPIAX_P_LOG); - return 0; } void *skypiax_do_tcp_srv_thread(void *obj) Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/skypiax.h ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/skypiax.h (original) +++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/skypiax.h Thu Feb 19 19:26:20 2009 @@ -414,6 +414,8 @@ #endif /* WIN32 */ int skypiax_close_socket(unsigned int fd); private_t *find_available_skypiax_interface(void); +int remote_party_is_ringing(private_t * tech_pvt); +int remote_party_is_early_media(private_t * tech_pvt); #define SKYPIAX_STATE_DOWN AST_STATE_DOWN #define SKYPIAX_STATE_RING AST_STATE_RING #define SKYPIAX_STATE_DIALING AST_STATE_DIALING Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c Thu Feb 19 19:26:20 2009 @@ -1169,6 +1169,62 @@ return 0; } +int remote_party_is_ringing(private_t * tech_pvt) +{ + switch_core_session_t *session = NULL; + switch_channel_t *channel = NULL; + + if (strlen(tech_pvt->session_uuid_str)) { + session = switch_core_session_locate(tech_pvt->session_uuid_str); + } else { + ERRORA("No session???\n", SKYPIAX_P_LOG); + } + if (session) { + channel = switch_core_session_get_channel(session); + } else { + ERRORA("No session???\n", SKYPIAX_P_LOG); + } + if (channel) { + switch_channel_mark_ring_ready(channel); + DEBUGA_SKYPE("skype_call: REMOTE PARTY RINGING\n", SKYPIAX_P_LOG); + } else { + ERRORA("No channel???\n", SKYPIAX_P_LOG); + } + + switch_core_session_rwunlock(session); + + return 0; +} + + +int remote_party_is_early_media(private_t * tech_pvt) +{ + switch_core_session_t *session = NULL; + switch_channel_t *channel = NULL; + + if (strlen(tech_pvt->session_uuid_str)) { + session = switch_core_session_locate(tech_pvt->session_uuid_str); + } else { + ERRORA("No session???\n", SKYPIAX_P_LOG); + } + if (session) { + channel = switch_core_session_get_channel(session); + switch_core_session_add_stream(session, NULL); + } else { + ERRORA("No session???\n", SKYPIAX_P_LOG); + } + if (channel) { + //switch_channel_mark_pre_answered(channel); + NOTICA("skype_call: REMOTE PARTY EARLY MEDIA, we will pass you the audio, just the code is not yet written :-)\n", SKYPIAX_P_LOG); + } else { + ERRORA("No channel???\n", SKYPIAX_P_LOG); + } + + switch_core_session_rwunlock(session); + + return 0; +} + int outbound_channel_answered(private_t * tech_pvt) { switch_core_session_t *session = NULL; Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h (original) +++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h Thu Feb 19 19:26:20 2009 @@ -268,3 +268,5 @@ #endif /* WIN32 */ int skypiax_close_socket(unsigned int fd); private_t *find_available_skypiax_interface(void); +int remote_party_is_ringing(private_t * tech_pvt); +int remote_party_is_early_media(private_t * tech_pvt); Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c Thu Feb 19 19:26:20 2009 @@ -267,12 +267,14 @@ strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1); DEBUGA_SKYPE("Our remote party in skype_call %s is RINGING\n", SKYPIAX_P_LOG, id); + remote_party_is_ringing(tech_pvt); } } else if (!strcasecmp(value, "EARLYMEDIA")) { tech_pvt->skype_callflow = CALLFLOW_STATUS_EARLYMEDIA; tech_pvt->interface_state = SKYPIAX_STATE_DIALING; - DEBUGA_SKYPE("Our remote party in skype_call %s is EARLYMEDIA\n", + NOTICA("Our remote party in skype_call %s is EARLYMEDIA\n", SKYPIAX_P_LOG, id); + remote_party_is_early_media(tech_pvt); } else if (!strcasecmp(value, "MISSED")) { DEBUGA_SKYPE("We missed skype_call %s\n", SKYPIAX_P_LOG, id); } else if (!strcasecmp(value, "FINISHED")) {