1 /* 2 * Copyright 2008-2014 Arsen Chaloyan 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 * $Id: mrcp_sig_agent.h 2253 2014-11-21 02:57:19Z achaloyan@gmail.com $ 17 */ 18 19 #ifndef MRCP_SIG_AGENT_H 20 #define MRCP_SIG_AGENT_H 21 22 /** 23 * @file mrcp_sig_agent.h 24 * @brief Abstract MRCP Signaling Agent 25 */ 26 27 #include <apr_network_io.h> 28 #include <apr_tables.h> 29 #include "mrcp_sig_types.h" 30 #include "apt_task.h" 31 32 APT_BEGIN_EXTERN_C 33 34 /** Signaling settings */ 35 struct mrcp_sig_settings_t { 36 /** Server IP address */ 37 char *server_ip; 38 /** Server port */ 39 apr_port_t server_port; 40 /** Server SIP user name (v2 only) */ 41 char *user_name; 42 /** Resource location (v1 only) */ 43 char *resource_location; 44 /** Map of the MRCP resource names (v1 only) */ 45 apr_table_t *resource_map; 46 /** Force destination IP address. Should be used only in case 47 SDP contains incorrect connection address (local IP address behind NAT) */ 48 apt_bool_t force_destination; 49 /** Optional feature tags */ 50 char *feature_tags; 51 }; 52 53 /** MRCP signaling agent */ 54 struct mrcp_sig_agent_t { 55 /** Agent identifier */ 56 const char *id; 57 /** Memory pool to allocate memory from */ 58 apr_pool_t *pool; 59 /** External object associated with agent */ 60 void *obj; 61 /** Parent object (client/server) */ 62 void *parent; 63 /** MRCP resource factory */ 64 mrcp_resource_factory_t *resource_factory; 65 /** Task interface */ 66 apt_task_t *task; 67 /** Task message pool used to allocate signaling agent messages */ 68 apt_task_msg_pool_t *msg_pool; 69 70 /** Virtual create_server_session */ 71 mrcp_session_t* (*create_server_session)(mrcp_sig_agent_t *signaling_agent); 72 /** Virtual create_client_session */ 73 apt_bool_t (*create_client_session)(mrcp_session_t *session, const mrcp_sig_settings_t *settings); 74 }; 75 76 /** Create signaling agent. */ 77 MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_signaling_agent_create(const char *id, void *obj, apr_pool_t *pool); 78 79 /** Create factory of signaling agents. */ 80 MRCP_DECLARE(mrcp_sa_factory_t*) mrcp_sa_factory_create(apr_pool_t *pool); 81 82 /** Add signaling agent to factory. */ 83 MRCP_DECLARE(apt_bool_t) mrcp_sa_factory_agent_add(mrcp_sa_factory_t *sa_factory, mrcp_sig_agent_t *sig_agent); 84 85 /** Determine whether factory is empty. */ 86 MRCP_DECLARE(apt_bool_t) mrcp_sa_factory_is_empty(const mrcp_sa_factory_t *sa_factory); 87 88 /** Select next available signaling agent. */ 89 MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_sa_factory_agent_select(mrcp_sa_factory_t *sa_factory); 90 91 /** Allocate MRCP signaling settings. */ 92 MRCP_DECLARE(mrcp_sig_settings_t*) mrcp_signaling_settings_alloc(apr_pool_t *pool); 93 94 95 APT_END_EXTERN_C 96 97 #endif /* MRCP_SIG_AGENT_H */ 98