]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add sip_force_audio_fmtp
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 1 Jun 2010 19:04:55 +0000 (14:04 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 1 Jun 2010 19:04:55 +0000 (14:04 -0500)
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c

index 8315b6116bbc20ca76fde7e819e724296cd5387f..29fbbd8fdff580e42aeea2ce63b9882be5f4635f 100644 (file)
@@ -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++;
 
index 2209daec0cf8ba635e5eb0650ec6243a8fc54cbf..eaae144078ec9042d01ce55b527b871864045eb1 100644 (file)
@@ -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;