]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add some clarification
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 11 Aug 2008 16:12:55 +0000 (16:12 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 11 Aug 2008 16:12:55 +0000 (16:12 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9238 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_types.h
src/mod/endpoints/mod_sofia/mod_sofia.c
src/switch_channel.c
src/switch_ivr_originate.c

index b23fa2d662538e40a7f8af7d9d56a9c3c9335a7e..1afa59939591f12e8075a2453e040b89efdf247f 100644 (file)
@@ -1186,7 +1186,8 @@ typedef enum {
        SWITCH_CAUSE_ALLOTTED_TIMEOUT = 602,
        SWITCH_CAUSE_USER_CHALLENGE = 603,
        SWITCH_CAUSE_MEDIA_TIMEOUT = 604,
-       SWITCH_CAUSE_PICKED_OFF = 605
+       SWITCH_CAUSE_PICKED_OFF = 605,
+       SWITCH_CAUSE_USER_NOT_REGISTERED = 606
 } switch_call_cause_t;
 
 typedef enum {
index 5cf980c050981661a3820cd4edf545a793a108b1..81752ca22849ed49853d00f96636f71b5e1d0d09 100644 (file)
@@ -1616,8 +1616,8 @@ SWITCH_STANDARD_API(sofia_contact_function)
        char *p;
        sofia_profile_t *profile = NULL;
        const char *exclude_contact = NULL;
-       char *reply = "";
-
+       char *reply = "error/facility_not_subscribed";
+       
        if (!cmd) {
                stream->write_function(stream, "%s", "");
                return SWITCH_STATUS_SUCCESS;
@@ -1696,8 +1696,14 @@ SWITCH_STANDARD_API(sofia_contact_function)
                        if (!switch_strlen_zero(reply) && end_of(reply) == ',') {
                                end_of(reply) = '\0';
                        }
+
+                       if (switch_strlen_zero(reply)) {
+                               reply = "error/user_not_registered";
+                       }
+
                        stream->write_function(stream, "%s", reply);
                        reply = NULL;
+                       
                        switch_safe_free(mystream.data);
                }
        }
@@ -1960,7 +1966,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
                                tech_pvt->local_url = switch_core_session_sprintf(nsession, "%s@%s", dest, host);
                        } else {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot locate registered user %s@%s\n", dest, host);
-                               cause = SWITCH_CAUSE_NO_ROUTE_DESTINATION;
+                               cause = SWITCH_CAUSE_USER_NOT_REGISTERED;
                                goto error;
                        }
                } else if (!(host = strchr(dest, '@'))) {
@@ -1972,7 +1978,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
                                host = profile_name;
                        } else {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot locate registered user %s@%s\n", dest, profile_name);
-                               cause = SWITCH_CAUSE_NO_ROUTE_DESTINATION;
+                               cause = SWITCH_CAUSE_USER_NOT_REGISTERED;
                                goto error;
                        }
                } else {
index 9123526c95b7d88ca45f0dc11f444ce3af92088e..084657a8d1742dcbd57a24ca9c6191c02a2debec 100644 (file)
@@ -101,6 +101,7 @@ static struct switch_cause_table CAUSE_CHART[] = {
        {"USER_CHALLENGE", SWITCH_CAUSE_USER_CHALLENGE},
        {"MEDIA_TIMEOUT", SWITCH_CAUSE_MEDIA_TIMEOUT},
        {"PICKED_OFF", SWITCH_CAUSE_PICKED_OFF},
+       {"USER_NOT_REGISTERED", SWITCH_CAUSE_USER_NOT_REGISTERED},
        {NULL, 0}
 };
 
index 70d739e9a7aa7e98d5d07d44a87b84f409cf5139..6cc355f5c40de9c246541f06946b3710dbabbb64 100644 (file)
@@ -536,10 +536,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
        char *loop_data = NULL;
        uint32_t progress_timelimit_sec = 0;
 
+       *bleg = NULL;
+
+       if (!strncasecmp(bridgeto, "error/", 6)) {
+               *cause = switch_channel_str2cause(bridgeto + 6);
+               return SWITCH_STATUS_SUCCESS;
+       }
+
        switch_zmalloc(write_frame.data, SWITCH_RECOMMENDED_BUFFER_SIZE);
        write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
 
-       *bleg = NULL;
        odata = strdup(bridgeto);
 
        if (!odata) {