From 6360264fb255db3d9122abe0eade3034371e6dae Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 1 Jun 2010 14:04:55 -0500 Subject: [PATCH] add sip_force_audio_fmtp --- src/mod/endpoints/mod_sofia/sofia.c | 42 +++++++++++++++++++++--- src/mod/endpoints/mod_sofia/sofia_glue.c | 10 ++++-- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 8315b6116b..29fbbd8fdf 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1341,8 +1341,40 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void profile->nua = nua_create(profile->s_root, /* Event loop */ sofia_event_callback, /* Callback for processing events */ profile, /* Additional data to pass to callback */ - NUTAG_URL(profile->bindurl), NTATAG_USER_VIA(1), TAG_IF(!strchr(profile->sipip, ':'), SOATAG_AF(SOA_AF_IP4_ONLY)), TAG_IF(strchr(profile->sipip, ':'), SOATAG_AF(SOA_AF_IP6_ONLY)), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_SIPS_URL(profile->tls_bindurl)), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_CERTIFICATE_DIR(profile->tls_cert_dir)), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_TLS_VERIFY_POLICY(0)), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_TLS_VERSION(profile->tls_version)), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_KEEPALIVE(20000)), TAG_IF(!strchr(profile->sipip, ':'), NTATAG_UDP_MTU(65535)), TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_SRV), NTATAG_USE_SRV(0)), TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_NAPTR), NTATAG_USE_NAPTR(0)), NTATAG_DEFAULT_PROXY(profile->outbound_proxy), NTATAG_SERVER_RPORT(profile->rport_level), TPTAG_LOG(sofia_test_flag(profile, TFLAG_TPORT_LOG)), TAG_IF(sofia_test_pflag(profile, PFLAG_SIPCOMPACT), NTATAG_SIPFLAGS(MSG_DO_COMPACT)), TAG_IF(profile->timer_t1, NTATAG_SIP_T1(profile->timer_t1)), TAG_IF(profile->timer_t1x64, NTATAG_SIP_T1X64(profile->timer_t1x64)), TAG_IF(profile->timer_t2, NTATAG_SIP_T2(profile->timer_t2)), TAG_IF(profile->timer_t4, NTATAG_SIP_T4(profile->timer_t4)), TAG_END()); /* Last tag should always finish the sequence */ - + NUTAG_URL(profile->bindurl), + NTATAG_USER_VIA(1), + TAG_IF(!strchr(profile->sipip, ':'), + SOATAG_AF(SOA_AF_IP4_ONLY)), + TAG_IF(strchr(profile->sipip, ':'), + SOATAG_AF(SOA_AF_IP6_ONLY)), + TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), + NUTAG_SIPS_URL(profile->tls_bindurl)), + TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), + NUTAG_CERTIFICATE_DIR(profile->tls_cert_dir)), + TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), + TPTAG_TLS_VERIFY_POLICY(0)), + TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), + TPTAG_TLS_VERSION(profile->tls_version)), + TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), + TPTAG_KEEPALIVE(20000)), + TAG_IF(!strchr(profile->sipip, ':'), + NTATAG_UDP_MTU(65535)), + TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_SRV), + NTATAG_USE_SRV(0)), + TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_NAPTR), + NTATAG_USE_NAPTR(0)), + NTATAG_DEFAULT_PROXY(profile->outbound_proxy), + NTATAG_SERVER_RPORT(profile->rport_level), + TPTAG_LOG(sofia_test_flag(profile, TFLAG_TPORT_LOG)), + TAG_IF(sofia_test_pflag(profile, PFLAG_SIPCOMPACT), + NTATAG_SIPFLAGS(MSG_DO_COMPACT)), + TAG_IF(profile->timer_t1, NTATAG_SIP_T1(profile->timer_t1)), + TAG_IF(profile->timer_t1x64, NTATAG_SIP_T1X64(profile->timer_t1x64)), + TAG_IF(profile->timer_t2, NTATAG_SIP_T2(profile->timer_t2)), + TAG_IF(profile->timer_t4, NTATAG_SIP_T4(profile->timer_t4)), + SIPTAG_ACCEPT_STR("application/sdp, multipart/mixed"), + TAG_END()); /* Last tag should always finish the sequence */ + if (!profile->nua) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Creating SIP UA for profile: %s\n", profile->name); sofia_profile_start_failure(profile, profile->name); @@ -1351,7 +1383,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created agent for %s\n", profile->name); - + nua_set_params(profile->nua, SIPTAG_ALLOW_STR("INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO"), NUTAG_APPL_METHOD("OPTIONS"), @@ -5773,7 +5805,9 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ char sip_acl_authed_by[512] = ""; char sip_acl_token[512] = ""; - + if (sip->sip_multipart) { + printf("W0000000t\n"); + } profile->ib_calls++; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 2209daec0c..eaae144078 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -153,6 +153,12 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 char srbuf[128] = ""; const char *var_val; const char *username = tech_pvt->profile->username; + const char *fmtp_out = tech_pvt->fmtp_out; + const char *fmtp_out_var = switch_channel_get_variable(tech_pvt->channel, "sip_force_audio_fmtp"); + + if (fmtp_out_var) { + fmtp_out = fmtp_out_var; + } if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) || ((val = switch_channel_get_variable(tech_pvt->channel, "supress_cng")) && switch_true(val)) || @@ -265,8 +271,8 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 if (tech_pvt->rm_encoding) { rate = tech_pvt->rm_rate; switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", tech_pvt->agreed_pt, tech_pvt->rm_encoding, rate); - if (tech_pvt->fmtp_out) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->agreed_pt, tech_pvt->fmtp_out); + if (fmtp_out) { + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->agreed_pt, fmtp_out); } if (tech_pvt->read_codec.implementation && !ptime) { ptime = tech_pvt->read_codec.implementation->microseconds_per_packet / 1000;