From e597db563c905bf9f019f6f02a6129807aee9682 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 6 Feb 2013 12:44:05 +0100 Subject: [PATCH] add sal keep alive implementation --- coreapi/bellesip_sal/sal_impl.c | 10 +++++++--- coreapi/bellesip_sal/sal_impl.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/coreapi/bellesip_sal/sal_impl.c b/coreapi/bellesip_sal/sal_impl.c index a0f5fe947..4aa6f5bf8 100644 --- a/coreapi/bellesip_sal/sal_impl.c +++ b/coreapi/bellesip_sal/sal_impl.c @@ -472,6 +472,7 @@ int sal_add_listen_port(Sal *ctx, SalAddress* addr){ ,sal_address_get_port_int(addr) ,sal_transport_to_string(sal_address_get_transport(addr))); if (lp) { + belle_sip_listening_point_set_keep_alive(lp,ctx->keep_alive); result = belle_sip_provider_add_listening_point(ctx->prov,lp); } else { return -1; @@ -511,7 +512,11 @@ void sal_set_user_agent(Sal *ctx, const char *user_agent){ } /*keepalive period in ms*/ void sal_set_keepalive_period(Sal *ctx,unsigned int value){ - ms_error("sal_set_keepalive_period not implemented yet"); + const belle_sip_list_t* iterator; + ctx->keep_alive=value; + for (iterator=belle_sip_provider_get_listening_points(ctx->prov);iterator!=NULL;iterator=iterator->next) { + belle_sip_listening_point_set_keep_alive((belle_sip_listening_point_t*)iterator->data,ctx->keep_alive); + } return ; } /** @@ -519,8 +524,7 @@ void sal_set_keepalive_period(Sal *ctx,unsigned int value){ * 0 desactiaved * */ unsigned int sal_get_keepalive_period(Sal *ctx){ - ms_fatal("sal_get_keepalive_period not implemented yet"); - return -1; + return ctx->keep_alive; } void sal_use_session_timers(Sal *ctx, int expires){ ctx->session_expires=expires; diff --git a/coreapi/bellesip_sal/sal_impl.h b/coreapi/bellesip_sal/sal_impl.h index 8a206be24..f29fabd7c 100644 --- a/coreapi/bellesip_sal/sal_impl.h +++ b/coreapi/bellesip_sal/sal_impl.h @@ -33,6 +33,7 @@ struct Sal{ void *up; /*user pointer*/ int session_expires; bool_t one_matching_codec; + unsigned int keep_alive; }; typedef enum SalOpSate {