]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
cover up sofia bug parsing contact strings that do not have <> in them
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 30 Sep 2009 21:06:01 +0000 (21:06 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 30 Sep 2009 21:06:01 +0000 (21:06 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15026 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.c

index 594bc33fb35a3491f17f5323215b23cf46163a26..f66249064de10126acdf6535607bd47271cd0725 100644 (file)
@@ -1304,8 +1304,15 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
        case SWITCH_MESSAGE_INDICATE_REDIRECT:
                if (!switch_strlen_zero(msg->string_arg)) {
                        if (!switch_channel_test_flag(channel, CF_ANSWERED) && !sofia_test_flag(tech_pvt, TFLAG_BYE)) {
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Redirecting to %s\n", msg->string_arg);
-                               nua_respond(tech_pvt->nh, SIP_302_MOVED_TEMPORARILY, SIPTAG_CONTACT_STR(msg->string_arg), TAG_END());
+                               char *dest = (char *) msg->string_arg;
+
+                               if (!strchr(msg->string_arg, '<') && !strchr(msg->string_arg, '>')) {
+                                       dest = switch_core_session_sprintf(session, "\"unknown\" <%s>", msg->string_arg);
+                               }
+                               
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Redirecting to %s\n", dest);
+
+                               nua_respond(tech_pvt->nh, SIP_302_MOVED_TEMPORARILY, SIPTAG_CONTACT_STR(dest), TAG_END());
                                sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
                        } else {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Too late for redirecting to %s, already answered\n", msg->string_arg);