Commit 19f236fa authored by jehan's avatar jehan

implement useragent

parent 885d4a07
......@@ -56,7 +56,7 @@
<folderInfo id="0.2131511368.593515799." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1930099439" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform binaryParser="org.eclipse.cdt.core.MachO64" id="org.eclipse.cdt.build.core.prefbase.toolchain.1930099439.714963030" name=""/>
<builder arguments="CFLAGS=&quot;-g -Wall -Werror&quot;" command="make" id="org.eclipse.cdt.build.core.settings.default.builder.896899734" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<builder arguments="CFLAGS=&quot;-g -Wall -Werror&quot; V=1" command="make" id="org.eclipse.cdt.build.core.settings.default.builder.896899734" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.1682581923" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.730520342" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.552841386" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
......
......@@ -23,7 +23,7 @@
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value>CFLAGS=&quot;-g -Wall -Werror&quot;</value>
<value>CFLAGS=&quot;-g -Wall -Werror&quot; V=1</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
......
......@@ -17,7 +17,9 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "sal_impl.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
void sal_enable_logs(){
belle_sip_set_log_level(BELLE_SIP_LOG_MESSAGE);
}
......@@ -66,8 +68,8 @@ static void process_io_error(void *user_ctx, const belle_sip_io_error_event_t *e
ms_error("process_io_error not implemented yet");
}
static void process_request_event(void *user_ctx, const belle_sip_request_event_t *event) {
belle_sip_server_transaction_t* server_transaction = belle_sip_request_event_get_server_transaction(event);
SalOp* op = (SalOp*)belle_sip_transaction_get_application_data(BELLE_SIP_TRANSACTION(server_transaction));
/*belle_sip_server_transaction_t* server_transaction = belle_sip_request_event_get_server_transaction(event);
SalOp* op = (SalOp*)belle_sip_transaction_get_application_data(BELLE_SIP_TRANSACTION(server_transaction));*/
ms_error("sal process_request_event not implemented yet");
}
......@@ -168,7 +170,13 @@ static void process_transaction_terminated(void *user_ctx, const belle_sip_trans
}
Sal * sal_init(){
char stack_string[64];
Sal * sal=ms_new0(Sal,1);
snprintf(stack_string,sizeof(stack_string)-1,"(belle-sip/%s)",belle_sip_version_to_string());
sal->user_agent=belle_sip_header_user_agent_new();
belle_sip_header_user_agent_add_product(sal->user_agent, PACKAGE_NAME "/" LINPHONE_VERSION);
belle_sip_header_user_agent_add_product(sal->user_agent,stack_string);
belle_sip_object_ref(sal->user_agent);
sal->stack = belle_sip_stack_new(NULL);
sal->prov = belle_sip_stack_create_provider(sal->stack,NULL);
sal->listener_callbacks.process_dialog_terminated=process_dialog_terminated;
......@@ -235,6 +243,7 @@ void sal_set_callbacks(Sal *ctx, const SalCallbacks *cbs){
void sal_uninit(Sal* sal){
belle_sip_object_unref(sal->user_agent);
belle_sip_object_unref(sal->prov);
belle_sip_object_unref(sal->stack);
ms_free(sal);
......@@ -269,7 +278,8 @@ ortp_socket_t sal_get_socket(Sal *ctx){
return -1;
}
void sal_set_user_agent(Sal *ctx, const char *user_agent){
ms_error("sal_set_user_agent not implemented yet");
belle_sip_header_user_agent_set_products(ctx->user_agent,NULL);
belle_sip_header_user_agent_add_product(ctx->user_agent,user_agent);
return ;
}
/*keepalive period in ms*/
......
......@@ -29,6 +29,7 @@ struct Sal{
belle_sip_listener_callbacks_t listener_callbacks;
belle_sip_stack_t* stack;
belle_sip_provider_t *prov;
belle_sip_header_user_agent_t* user_agent;
void *up; /*user pointer*/
int session_expires;
};
......
......@@ -120,6 +120,7 @@ belle_sip_request_t* sal_op_build_request(SalOp *op,const char* method) {
belle_sip_header_via_new(),
70);
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(contact_header));
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(op->base.root->user_agent));
return req;
}
......
......@@ -1470,15 +1470,17 @@ extern const char *eXosip_get_version();
#endif
static void apply_user_agent(LinphoneCore *lc){
#if !USE_BELLESIP /*default user agent is handled at sal level*/
char ua_string[256];
snprintf(ua_string,sizeof(ua_string)-1,"%s/%s (eXosip2/%s)",_ua_name,_ua_version,
#if HAVE_EXOSIP_GET_VERSION && !USE_BELLESIP
#if HAVE_EXOSIP_GET_VERSION
eXosip_get_version()
#else
"unknown"
#endif
);
if (lc->sal) sal_set_user_agent(lc->sal,ua_string);
#endif
}
/**
......@@ -1537,7 +1539,9 @@ static int apply_transports(LinphoneCore *lc){
transport_error(lc,"tls",tr->tls_port);
}
}
apply_user_agent(lc);
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment