diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index b0d21eee65..06d9a2e2bb 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -41,6 +41,7 @@ #define HAVE_APR #include +#include #ifdef SWITCH_HAVE_ODBC #include #endif @@ -64,7 +65,7 @@ typedef struct private_object private_object_t; #define MY_EVENT_EXPIRE "sofia::expire" #define MULTICAST_EVENT "multicast::event" #define SOFIA_REPLACES_HEADER "_sofia_replaces_" -#define SOFIA_USER_AGENT "FreeSWITCH(mod_sofia)" +#define SOFIA_USER_AGENT "FreeSWITCH-" SWITCH_VERSION_FULL "-mod_sofia" #define SOFIA_CHAT_PROTO "sip" #define SOFIA_SIP_HEADER_PREFIX "sip_h_" #define SOFIA_SIP_HEADER_PREFIX_T "~sip_h_" diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 35d0331f27..e8f0f9bff6 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1199,10 +1199,9 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, goto done; } else { switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOSDP"); - switch_set_flag(tech_pvt, TFLAG_LATE_NEGOTIATION); sofia_glue_tech_choose_port(tech_pvt); sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0); - + switch_channel_set_state(channel, CS_HIBERNATE); nua_respond(tech_pvt->nh, SIP_200_OK, SIPTAG_CONTACT_STR(tech_pvt->profile->url), SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END()); @@ -1332,6 +1331,10 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "RTP Error!\n"); switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); } + if (switch_channel_get_state(channel) == CS_HIBERNATE) { + switch_set_flag_locked(tech_pvt, TFLAG_READY); + switch_channel_set_state(channel, CS_INIT); + } goto done; } } diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 801ab1f6e7..c202a4b44f 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1016,11 +1016,14 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt) switch_status_t sofia_glue_tech_media(private_object_t *tech_pvt, char *r_sdp) { - sdp_parser_t *parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0); + sdp_parser_t *parser = NULL; sdp_session_t *sdp; uint8_t match = 0; assert(tech_pvt != NULL); + assert(r_sdp != NULL); + + parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0); if (switch_strlen_zero(r_sdp)) { return SWITCH_STATUS_FALSE;