/** Create factory of MRCPv2 connection agents */ static mrcp_ca_factory_t* unimrcp_client_ca_factory_create(unimrcp_client_loader_t *loader, const apr_xml_elem *elem) { mrcp_ca_factory_t *ca_factory = NULL; mrcp_connection_agent_t *agent; char *name; char *state; char *list_str = apr_pstrdup(loader->pool,cdata_text_get(elem)); do { name = apr_strtok(list_str, ",", &state); if(name) { agent = mrcp_client_connection_agent_get(loader->client,name); if(agent) { if(!ca_factory) ca_factory = mrcp_ca_factory_create(loader->pool); mrcp_ca_factory_agent_add(ca_factory,agent); } else { apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown MRCPv2-UAC Name <%s>",name); } } list_str = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */ } while(name); return ca_factory; }
/** Create MRCP profile */ MRCP_DECLARE(mrcp_profile_t*) mrcp_client_profile_create( mrcp_resource_factory_t *resource_factory, mrcp_sig_agent_t *signaling_agent, mrcp_connection_agent_t *connection_agent, mpf_engine_t *media_engine, mpf_termination_factory_t *rtp_factory, mpf_rtp_settings_t *rtp_settings, mrcp_sig_settings_t *signaling_settings, apr_pool_t *pool) { mrcp_sa_factory_t *sa_factory = NULL; mrcp_ca_factory_t *ca_factory = NULL; mpf_engine_factory_t *mpf_factory = NULL; mrcp_version_e mrcp_version = MRCP_VERSION_2; if(!connection_agent) mrcp_version = MRCP_VERSION_1; if(signaling_agent) { sa_factory = mrcp_sa_factory_create(pool); mrcp_sa_factory_agent_add(sa_factory,signaling_agent); } if(connection_agent) { ca_factory = mrcp_ca_factory_create(pool); mrcp_ca_factory_agent_add(ca_factory,connection_agent); } if(media_engine) { mpf_factory = mpf_engine_factory_create(pool); mpf_engine_factory_engine_add(mpf_factory,media_engine); } return mrcp_client_profile_create_ex( mrcp_version, resource_factory, sa_factory, ca_factory, mpf_factory, rtp_factory, rtp_settings, signaling_settings, pool); }