]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
added uuid_outgoing_answer to answer outgoing channels (ie portaudio endpoints)
authorMoises Silva <moises.silva@gmail.com>
Mon, 9 May 2011 05:25:24 +0000 (01:25 -0400)
committerMoises Silva <moises.silva@gmail.com>
Mon, 9 May 2011 05:25:24 +0000 (01:25 -0400)
src/mod/applications/mod_commands/mod_commands.c
src/mod/endpoints/mod_portaudio/mod_portaudio.c

index a6df087cb0cce0db3d29ba87e74551c8733335c0..4a3502b35b9dd2188458fe2ee5ca6f6134470d3c 100644 (file)
@@ -2047,6 +2047,34 @@ SWITCH_STANDARD_API(kill_function)
        return SWITCH_STATUS_SUCCESS;
 }
 
+#define OUTGOING_ANSWER_SYNTAX "<uuid>"
+SWITCH_STANDARD_API(outgoing_answer_function)
+{
+       switch_core_session_t *asession = NULL;
+       char *mycmd = NULL;
+
+       if (zstr(cmd) || !(mycmd = strdup(cmd))) {
+               stream->write_function(stream, "-USAGE: %s\n", OUTGOING_ANSWER_SYNTAX);
+               return SWITCH_STATUS_SUCCESS;
+       }
+
+       if (zstr(mycmd) || !(asession = switch_core_session_locate(mycmd))) {
+               stream->write_function(stream, "-ERR No Such Channel!\n");
+       } else {
+               switch_channel_t *channel = switch_core_session_get_channel(asession);
+               if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
+                       switch_channel_mark_answered(channel);
+                       stream->write_function(stream, "+OK\n");
+               } else {
+                       stream->write_function(stream, "-ERR Not an outbound channel!\n");
+               }
+               switch_core_session_rwunlock(session);
+       }
+
+       switch_safe_free(mycmd);
+       return SWITCH_STATUS_SUCCESS;
+}
+
 #define PREPROCESS_SYNTAX "<>"
 SWITCH_STANDARD_API(preprocess_function)
 {
@@ -5063,6 +5091,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
        SWITCH_ADD_API(commands_api_interface, "uuid_getvar", "uuid_getvar", uuid_getvar_function, GETVAR_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "uuid_hold", "hold", uuid_hold_function, HOLD_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "uuid_kill", "Kill Channel", kill_function, KILL_SYNTAX);
+       SWITCH_ADD_API(commands_api_interface, "uuid_outgoing_answer", "Answer Outgoing Channel", outgoing_answer_function, OUTGOING_ANSWER_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "uuid_limit_release", "Release limit resource", uuid_limit_release_function, LIMIT_RELEASE_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "uuid_loglevel", "set loglevel on session", uuid_loglevel, UUID_LOGLEVEL_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "uuid_media", "media", uuid_media_function, MEDIA_SYNTAX);
index 643daab44540496203037a5877fdae23e8221fea..079c5af8a265956b556e8a4a895dd30e767384c8 100644 (file)
@@ -319,8 +319,15 @@ static switch_status_t channel_on_routing(switch_core_session_t *session)
                }
 
                if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND) && !switch_test_flag(tech_pvt, TFLAG_AUTO_ANSWER)) {
+
                        add_pvt(tech_pvt, PA_SLAVE);
 
+                       /* endpoints do not ring (yet) */
+                       if (tech_pvt->audio_endpoint) {
+                               ring_file = NULL;
+                               goto endpoint_noring;
+                       }
+
                        ring_file = globals.ring_file;
                        if ((val = switch_channel_get_variable(channel, "pa_ring_file"))) {
                                ring_file = val;
@@ -349,6 +356,7 @@ static switch_status_t channel_on_routing(switch_core_session_t *session)
                                }
                        }
                }
+endpoint_noring:
 
                if (switch_test_flag(tech_pvt, TFLAG_AUTO_ANSWER)) {
                        switch_mutex_lock(globals.pvt_lock);