Commit bd6a9ed6 authored by Ghislain MARY's avatar Ghislain MARY

Clean Sal.

parent 881d8f3d
......@@ -278,7 +278,3 @@ bool_t sal_address_is_ipv6(const SalAddress *addr){
}
return FALSE;
}
void sal_address_destroy(SalAddress *addr){
sal_address_unref(addr);
}
......@@ -119,7 +119,7 @@ void sal_error_info_set(SalErrorInfo *ei, SalReason reason, const char *protocol
else{
ei->reason=reason;
if (code == 0) {
code = LinphonePrivate::to_sip_code(reason);
code = LinphonePrivate::toSipCode(reason);
}
}
ei->protocol_code=code;
......
......@@ -61,7 +61,7 @@ static void call_received(SalCallOp *h) {
LinphoneCore *lc = reinterpret_cast<LinphoneCore *>(h->getSal()->getUserPointer());
if (linphone_core_get_global_state(lc) != LinphoneGlobalOn) {
h->decline(SalReasonServiceUnavailable, nullptr);
h->decline(SalReasonServiceUnavailable);
h->release();
return;
}
......@@ -100,14 +100,14 @@ static void call_received(SalCallOp *h) {
if (oneToOneChatRoom) {
bool_t oneToOneChatRoomEnabled = linphone_config_get_bool(linphone_core_get_config(lc), "misc", "enable_one_to_one_chat_room", TRUE);
if (!oneToOneChatRoomEnabled) {
h->decline(SalReasonNotAcceptable, nullptr);
h->decline(SalReasonNotAcceptable);
h->release();
return;
}
IdentityAddress from(h->getFrom());
list<IdentityAddress> identAddresses = ServerGroupChatRoom::parseResourceLists(h->getRemoteBody());
if (identAddresses.size() != 1) {
h->decline(SalReasonNotAcceptable, nullptr);
h->decline(SalReasonNotAcceptable);
h->release();
return;
}
......@@ -133,7 +133,7 @@ static void call_received(SalCallOp *h) {
L_GET_PRIVATE(static_pointer_cast<ServerGroupChatRoom>(chatRoom))->confirmJoining(h);
} else {
//invite is for an unknown chatroom
h->decline(SalReasonNotFound, nullptr);
h->decline(SalReasonNotFound);
h->release();
}
} else {
......@@ -183,7 +183,7 @@ static void call_received(SalCallOp *h) {
}
if (!L_GET_PRIVATE_FROM_C_OBJECT(lc)->canWeAddCall()) { /* Busy */
h->decline(SalReasonBusy, nullptr);
h->decline(SalReasonBusy);
LinphoneErrorInfo *ei = linphone_error_info_new();
linphone_error_info_set(ei, nullptr, LinphoneReasonBusy, 486, "Busy - too many calls", nullptr);
linphone_core_report_early_failed_call(lc, LinphoneCallIncoming, fromAddr, toAddr, ei);
......@@ -202,7 +202,7 @@ static void call_received(SalCallOp *h) {
if (fromAddressToSearchIfMe && L_GET_PRIVATE_FROM_C_OBJECT(lc)->isAlreadyInCallWithAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(fromAddressToSearchIfMe))) {
char *addr = linphone_address_as_string(fromAddr);
ms_warning("Receiving a call while one with same address [%s] is initiated, refusing this one with busy message", addr);
h->decline(SalReasonBusy, nullptr);
h->decline(SalReasonBusy);
LinphoneErrorInfo *ei = linphone_error_info_new();
linphone_error_info_set(ei, nullptr, LinphoneReasonBusy, 486, "Busy - duplicated call", nullptr);
linphone_core_report_early_failed_call(lc, LinphoneCallIncoming, fromAddr, toAddr, ei);
......
......@@ -572,14 +572,12 @@ static LinphoneCardDavQuery* linphone_carddav_create_put_query(LinphoneCardDavCo
static char* generate_url_from_server_address_and_uid(const char *server_url) {
char *result = NULL;
if (server_url) {
char *uuid = reinterpret_cast<char *>(ms_malloc(64));
if (LinphonePrivate::Sal::generateUuid(uuid, 64) == 0) {
char *url = reinterpret_cast<char *>(ms_malloc(300));
snprintf(url, 300, "%s/linphone-%s.vcf", server_url, uuid);
ms_debug("Generated url is %s", url);
result = ms_strdup(url);
ms_free(url);
}
char *uuid = sal_generate_uuid();
char *url = (char *)(ms_malloc(300));
snprintf(url, 300, "%s/linphone-%s.vcf", server_url, uuid);
ms_debug("Generated url is %s", url);
result = ms_strdup(url);
ms_free(url);
ms_free(uuid);
}
return result;
......
......@@ -274,7 +274,7 @@ LinphoneStatus linphone_event_send_subscribe(LinphoneEvent *lev, const LinphoneC
body_handler = sal_body_handler_from_content(body);
auto subscribeOp = dynamic_cast<SalSubscribeOp *>(lev->op);
err=subscribeOp->subscribe(NULL,NULL,lev->name,lev->expires,body_handler);
err=subscribeOp->subscribe(lev->name,lev->expires,body_handler);
if (err==0){
if (lev->subscription_state==LinphoneSubscriptionNone)
linphone_event_set_state(lev,LinphoneSubscriptionOutgoingProgress);
......@@ -382,7 +382,7 @@ static int _linphone_event_send_publish(LinphoneEvent *lev, const LinphoneConten
} else lev->op->setSentCustomHeaders(NULL);
body_handler = sal_body_handler_from_content(body);
auto publishOp = dynamic_cast<SalPublishOp *>(lev->op);
err=publishOp->publish(NULL,NULL,lev->name,lev->expires,body_handler);
err=publishOp->publish(lev->name,lev->expires,body_handler);
if (err==0){
linphone_event_set_publish_state(lev,LinphonePublishProgress);
}else if (notify_err){
......
......@@ -199,7 +199,7 @@ void __linphone_friend_do_subscribe(LinphoneFriend *fr){
}
fr->outsub=new SalPresenceOp(lc->sal);
linphone_configure_op(lc,fr->outsub,addr,NULL,TRUE);
fr->outsub->subscribe(NULL,NULL,lp_config_get_int(lc->config,"sip","subscribe_expires",600));
fr->outsub->subscribe(lp_config_get_int(lc->config,"sip","subscribe_expires",600));
fr->subscribe_active=TRUE;
}
}
......
......@@ -2434,9 +2434,8 @@ void linphone_core_start (LinphoneCore *lc) {
//to give a chance to change uuid before starting
const char* uuid=lp_config_get_string(lc->config,"misc","uuid",NULL);
if (!uuid){
char tmp[64];
lc->sal->createUuid(tmp,sizeof(tmp));
lp_config_set_string(lc->config,"misc","uuid",tmp);
string uuid = lc->sal->createUuid();
lp_config_set_string(lc->config,"misc","uuid",uuid.c_str());
}else if (strcmp(uuid,"0")!=0) /*to allow to disable sip.instance*/
lc->sal->setUuid(uuid);
......@@ -3570,7 +3569,7 @@ static bctbx_list_t *make_routes_for_proxy(LinphoneProxyConfig *proxy, const Lin
SalAddress *proxy_addr=sal_address_new(linphone_proxy_config_get_addr(proxy));
if (strcmp(sal_address_get_domain(proxy_addr),linphone_address_get_domain(dest))==0){
ret=bctbx_list_append(ret,proxy_addr);
}else sal_address_destroy(proxy_addr);
}else sal_address_unref(proxy_addr);
}
return ret;
}
......@@ -3662,7 +3661,7 @@ static void linphone_transfer_routes_to_op(bctbx_list_t *routes, SalOp *op){
for(it=routes;it!=NULL;it=it->next){
SalAddress *addr=(SalAddress*)it->data;
op->addRouteAddress(addr);
sal_address_destroy(addr);
sal_address_unref(addr);
}
bctbx_list_free(routes);
}
......@@ -6419,7 +6418,8 @@ bool_t linphone_core_is_network_reachable(LinphoneCore* lc) {
}
ortp_socket_t linphone_core_get_sip_socket(LinphoneCore *lc){
return lc->sal->getSocket();
ms_warning("linphone_core_get_sip_socket is deprecated");
return -1;
}
void linphone_core_destroy(LinphoneCore *lc){
......
......@@ -371,7 +371,7 @@ LinphoneStatus linphone_proxy_config_set_route(LinphoneProxyConfig *cfg, const c
}else tmp=ms_strdup(route);
addr=sal_address_new(tmp);
if (addr!=NULL){
sal_address_destroy(addr);
sal_address_unref(addr);
cfg->reg_routes = bctbx_list_append(cfg->reg_routes, tmp);
return 0;
}else{
......@@ -402,7 +402,7 @@ LinphoneStatus linphone_proxy_config_set_routes(LinphoneProxyConfig *cfg, const
}
addr = sal_address_new(tmp);
if (addr != NULL) {
sal_address_destroy(addr);
sal_address_unref(addr);
cfg->reg_routes = bctbx_list_append(cfg->reg_routes, tmp);
} else {
ms_free(tmp);
......@@ -1459,7 +1459,7 @@ const char* linphone_proxy_config_get_transport(const LinphoneProxyConfig *cfg)
ret=sal_transport_to_string(sal_address_get_transport(route_addr));
if (destroy_route_addr)
sal_address_destroy((SalAddress *)route_addr);
sal_address_unref((SalAddress *)route_addr);
return ret;
}
......
......@@ -141,15 +141,15 @@ LINPHONE_PUBLIC void sal_default_set_sdp_handling(Sal* h, SalOpSDPHandling handl
LINPHONE_PUBLIC void sal_set_send_error(Sal *sal,int value);
LINPHONE_PUBLIC void sal_set_recv_error(Sal *sal,int value);
LINPHONE_PUBLIC int sal_enable_pending_trans_checking(Sal *sal, bool_t value);
LINPHONE_PUBLIC void sal_enable_unconditional_answer(Sal *sal,int value);
LINPHONE_PUBLIC void sal_enable_unconditional_answer(Sal *sal, bool_t value);
LINPHONE_PUBLIC void sal_set_dns_timeout(Sal* sal,int timeout);
LINPHONE_PUBLIC void sal_set_dns_user_hosts_file(Sal *sal, const char *hosts_file);
LINPHONE_PUBLIC void *sal_get_stack_impl(Sal *sal);
LINPHONE_PUBLIC void sal_set_refresher_retry_after(Sal *sal,int value);
LINPHONE_PUBLIC int sal_get_refresher_retry_after(const Sal *sal);
LINPHONE_PUBLIC void sal_set_transport_timeout(Sal* sal,int timeout);
LINPHONE_PUBLIC void sal_enable_test_features(Sal*ctx, bool_t enabled);
LINPHONE_PUBLIC int sal_transport_available(Sal *ctx, SalTransport t);
LINPHONE_PUBLIC void sal_enable_test_features(Sal*ctx, bool_t value);
LINPHONE_PUBLIC bool_t sal_transport_available(Sal *ctx, SalTransport t);
LINPHONE_PUBLIC const SalErrorInfo *sal_op_get_error_info(const SalOp *op);
LINPHONE_PUBLIC bool_t sal_call_dialog_request_pending(const SalOp *op);
......
......@@ -361,18 +361,13 @@ const char* linphone_vcard_get_organization(const LinphoneVcard *vCard) {
}
bool_t linphone_vcard_generate_unique_id(LinphoneVcard *vCard) {
char uuid[64];
if (vCard) {
if (linphone_vcard_get_uid(vCard)) {
return FALSE;
}
if (LinphonePrivate::Sal::generateUuid(uuid, sizeof(uuid)) == 0) {
char vcard_uuid[sizeof(uuid)+4];
snprintf(vcard_uuid, sizeof(vcard_uuid), "urn:%s", uuid);
linphone_vcard_set_uid(vCard, vcard_uuid);
return TRUE;
}
string uuid = "urn:" + LinphonePrivate::Sal::generateUuid();
linphone_vcard_set_uid(vCard, uuid.c_str());
return TRUE;
}
return FALSE;
}
......
......@@ -2659,12 +2659,12 @@ LINPHONE_PUBLIC bool_t linphone_core_sip_transport_supported(const LinphoneCore
LINPHONE_PUBLIC bool_t linphone_core_content_encoding_supported(const LinphoneCore *lc, const char *content_encoding);
/**
*
* Give access to the UDP sip socket. Can be useful to configure this socket as persistent I.E kCFStreamNetworkServiceType set to kCFStreamNetworkServiceTypeVoIP)
* @param lc #LinphoneCore
* @return socket file descriptor
* @deprecated Deprecated since 2018-08
*/
ortp_socket_t linphone_core_get_sip_socket(LinphoneCore *lc);
LINPHONE_DEPRECATED ortp_socket_t linphone_core_get_sip_socket(LinphoneCore *lc);
/**
* Set the incoming call timeout in seconds.
......
......@@ -124,14 +124,14 @@ Address::Address (const Address &other) : ClonableObject(*new AddressPrivate) {
Address::~Address () {
L_D();
if (d->internalAddress)
sal_address_destroy(d->internalAddress);
sal_address_unref(d->internalAddress);
}
Address &Address::operator= (const Address &other) {
L_D();
if (this != &other) {
if (d->internalAddress)
sal_address_destroy(d->internalAddress);
sal_address_unref(d->internalAddress);
SalAddress *salAddress = other.getPrivate()->internalAddress;
d->internalAddress = salAddress ? sal_address_clone(salAddress) : nullptr;
}
......
......@@ -496,262 +496,6 @@ int sal_media_description_equals(const SalMediaDescription *md1, const SalMediaD
return result;
}
#if 0
static void assign_address(SalAddress** address, const char *value){
if (*address){
sal_address_destroy(*address);
*address=NULL;
}
if (value)
*address=sal_address_new(value);
}
static void assign_string(char **str, const char *arg){
if (*str){
ms_free(*str);
*str=NULL;
}
if (arg)
*str=ms_strdup(arg);
}
void sal_op_set_contact_address(SalOp *op, const SalAddress *address){
if (((SalOpBase*)op)->contact_address) sal_address_destroy(((SalOpBase*)op)->contact_address);
((SalOpBase*)op)->contact_address=address?sal_address_clone(address):NULL;
}
const SalAddress* sal_op_get_contact_address(const SalOp *op) {
return ((SalOpBase*)op)->contact_address;
}
const SalAddress*sal_op_get_remote_contact_address(const SalOp* op)
{
return ((SalOpBase*)op)->remote_contact_address;
}
#define SET_PARAM(op,name) \
char* name##_string=NULL; \
assign_address(&((SalOpBase*)op)->name##_address,name); \
if (((SalOpBase*)op)->name##_address) { \
name##_string=sal_address_as_string(((SalOpBase*)op)->name##_address); \
}\
assign_string(&((SalOpBase*)op)->name,name##_string); \
if(name##_string) ms_free(name##_string);
void sal_op_set_route(SalOp *op, const char *route){
char* route_string=NULL;
SalOpBase* op_base = (SalOpBase*)op;
if (op_base->route_addresses) {
bctbx_list_for_each(op_base->route_addresses,(void (*)(void *))sal_address_destroy);
op_base->route_addresses=bctbx_list_free(op_base->route_addresses);
}
if (route) {
op_base->route_addresses=bctbx_list_append(NULL,NULL);
assign_address((SalAddress**)&(op_base->route_addresses->data),route);
route_string=sal_address_as_string((SalAddress*)op_base->route_addresses->data); \
}
assign_string(&op_base->route,route_string); \
if(route_string) ms_free(route_string);
}
const bctbx_list_t* sal_op_get_route_addresses(const SalOp *op) {
return ((SalOpBase*)op)->route_addresses;
}
void sal_op_set_route_address(SalOp *op, const SalAddress *address){
char* address_string=sal_address_as_string(address); /*can probably be optimized*/
sal_op_set_route(op,address_string);
ms_free(address_string);
}
void sal_op_add_route_address(SalOp *op, const SalAddress *address){
SalOpBase* op_base = (SalOpBase*)op;
if (op_base->route_addresses) {
op_base->route_addresses=bctbx_list_append(op_base->route_addresses,(void*)sal_address_clone(address));
} else {
sal_op_set_route_address(op,address);
}
}
void sal_op_set_realm(SalOp *op, const char *realm){
SalOpBase* op_base = (SalOpBase*)op;
if (op_base->realm != NULL){
ms_free(op_base->realm);
}
op_base->realm = ms_strdup(realm);
}
void sal_op_set_from(SalOp *op, const char *from){
SET_PARAM(op,from);
}
void sal_op_set_from_address(SalOp *op, const SalAddress *from){
char* address_string=sal_address_as_string(from); /*can probably be optimized*/
sal_op_set_from(op,address_string);
ms_free(address_string);
}
void sal_op_set_to(SalOp *op, const char *to){
SET_PARAM(op,to);
}
void sal_op_set_to_address(SalOp *op, const SalAddress *to){
char* address_string=sal_address_as_string(to); /*can probably be optimized*/
sal_op_set_to(op,address_string);
ms_free(address_string);
}
void sal_op_set_diversion_address(SalOp *op, const SalAddress *diversion){
if (((SalOpBase*)op)->diversion_address) sal_address_destroy(((SalOpBase*)op)->diversion_address);
((SalOpBase*)op)->diversion_address=diversion?sal_address_clone(diversion):NULL;
}
void sal_op_set_user_pointer(SalOp *op, void *up){
((SalOpBase*)op)->user_pointer=up;
}
Sal *sal_op_get_sal(const SalOp *op){
return ((SalOpBase*)op)->root;
}
const char *sal_op_get_from(const SalOp *op){
return ((SalOpBase*)op)->from;
}
const SalAddress *sal_op_get_from_address(const SalOp *op){
return ((SalOpBase*)op)->from_address;
}
const char *sal_op_get_to(const SalOp *op){
return ((SalOpBase*)op)->to;
}
const SalAddress *sal_op_get_to_address(const SalOp *op){
return ((SalOpBase*)op)->to_address;
}
const SalAddress *sal_op_get_diversion_address(const SalOp *op){
return ((SalOpBase*)op)->diversion_address;
}
const char *sal_op_get_remote_ua(const SalOp *op){
return ((SalOpBase*)op)->remote_ua;
}
void *sal_op_get_user_pointer(const SalOp *op){
return ((SalOpBase*)op)->user_pointer;
}
const char *sal_op_get_proxy(const SalOp *op){
return ((SalOpBase*)op)->route;
}
const char *sal_op_get_network_origin(const SalOp *op){
return ((SalOpBase*)op)->origin;
}
const char* sal_op_get_call_id(const SalOp *op) {
return ((SalOpBase*)op)->call_id;
}
void __sal_op_init(SalOp *b, Sal *sal){
memset(b,0,sizeof(SalOpBase));
((SalOpBase*)b)->root=sal;
}
void __sal_op_set_network_origin(SalOp *op, const char *origin){
SET_PARAM(op,origin);
}
void __sal_op_set_remote_contact(SalOp *op, const char* remote_contact){
assign_address(&((SalOpBase*)op)->remote_contact_address,remote_contact);\
/*to preserve header params*/
assign_string(&((SalOpBase*)op)->remote_contact,remote_contact); \
}
void __sal_op_set_network_origin_address(SalOp *op, SalAddress *origin){
char* address_string=sal_address_as_string(origin); /*can probably be optimized*/
__sal_op_set_network_origin(op,address_string);
ms_free(address_string);
}
void __sal_op_free(SalOp *op){
SalOpBase *b=(SalOpBase *)op;
if (b->from_address){
sal_address_destroy(b->from_address);
b->from_address=NULL;
}
if (b->to_address){
sal_address_destroy(b->to_address);
b->to_address=NULL;
}
if (b->service_route){
sal_address_destroy(b->service_route);
b->service_route=NULL;
}
if (b->origin_address){
sal_address_destroy(b->origin_address);
b->origin_address=NULL;
}
if (b->from) {
ms_free(b->from);
b->from=NULL;
}
if (b->to) {
ms_free(b->to);
b->to=NULL;
}
if (b->route) {
ms_free(b->route);
b->route=NULL;
}
if (b->realm) {
ms_free(b->realm);
b->realm=NULL;
}
if (b->contact_address) {
sal_address_destroy(b->contact_address);
}
if (b->origin){
ms_free(b->origin);
b->origin=NULL;
}
if (b->remote_ua){
ms_free(b->remote_ua);
b->remote_ua=NULL;
}
if (b->remote_contact){
ms_free(b->remote_contact);
b->remote_contact=NULL;
}
if (b->remote_contact_address){
sal_address_destroy(b->remote_contact_address);
}
if (b->local_media)
sal_media_description_unref(b->local_media);
if (b->remote_media)
sal_media_description_unref(b->remote_media);
if (b->custom_body) {
sal_custom_body_unref(b->custom_body);
}
if (b->call_id)
ms_free((void*)b->call_id);
if (b->service_route) {
sal_address_destroy(b->service_route);
}
if (b->route_addresses){
bctbx_list_for_each(b->route_addresses,(void (*)(void*)) sal_address_destroy);
b->route_addresses=bctbx_list_free(b->route_addresses);
}
if (b->recv_custom_headers)
sal_custom_header_free(b->recv_custom_headers);
if (b->sent_custom_headers)
sal_custom_header_free(b->sent_custom_headers);
if (b->entity_tag != NULL){
ms_free(b->entity_tag);
b->entity_tag = NULL;
}
ms_free(op);
}
#endif
SalAuthInfo* sal_auth_info_new() {
return ms_new0(SalAuthInfo,1);
}
......@@ -841,18 +585,6 @@ const char* sal_reason_to_string(const SalReason reason) {
default: return "Unkown reason";
}
}
#if 0
const SalAddress* sal_op_get_service_route(const SalOp *op) {
return ((SalOpBase*)op)->service_route;
}
void sal_op_set_service_route(SalOp *op,const SalAddress* service_route) {
if (((SalOpBase*)op)->service_route)
sal_address_destroy(((SalOpBase*)op)->service_route);
((SalOpBase*)op)->service_route=service_route?sal_address_clone(service_route):NULL;
}
#endif
const char* sal_presence_status_to_string(const SalPresenceStatus status) {
switch (status) {
......
......@@ -119,7 +119,6 @@ void sal_address_set_port(SalAddress *uri, int port);
void sal_address_clean(SalAddress *addr);
char *sal_address_as_string(const SalAddress *u);
char *sal_address_as_string_uri_only(const SalAddress *u);
void sal_address_destroy(SalAddress *u);
LINPHONE_PUBLIC void sal_address_set_param(SalAddress *u,const char* name,const char* value);
void sal_address_set_transport(SalAddress* addr,SalTransport transport);
void sal_address_set_transport_name(SalAddress* addr,const char* transport);
......@@ -660,6 +659,8 @@ int sal_lines_get_value(const char *data, const char *key, char *value, size_t v
unsigned long sal_begin_background_task(const char *name, void (*max_time_reached)(void *), void *data);
void sal_end_background_task(unsigned long id);
char *sal_generate_uuid (void);
/*Some old equipment may not only rely on attribute sendonly/recvonly/sendrecv/inative*/
#ifdef __cplusplus
......
......@@ -974,7 +974,7 @@ LinphoneStatus CallSession::decline (const LinphoneErrorInfo *ei) {
linphone_error_info_to_sal(ei, &sei);
d->op->declineWithErrorInfo(&sei , nullptr);
} else
d->op->decline(SalReasonDeclined, nullptr);
d->op->decline(SalReasonDeclined);
sal_error_info_reset(&sei);
sal_error_info_reset(&sub_sei);
d->terminate();
......@@ -1101,7 +1101,7 @@ int CallSession::startInvite (const Address *destination, const string &subject,
shared_ptr<CallSession> ref = getSharedFromThis();
if (content)
d->op->setLocalBody(*content);
int result = d->op->call(from, destinationStr.c_str(), subject.empty() ? nullptr : subject.c_str());
int result = d->op->call(from, destinationStr, subject);
ms_free(from);
if (result < 0) {
if ((d->state != CallSession::State::Error) && (d->state != CallSession::State::Released)) {
......
......@@ -4270,7 +4270,7 @@ void MediaSession::startIncomingNotification (bool notifyRinging) {
linphone_error_info_set(ei, nullptr, LinphoneReasonNotAcceptable, 488, "Not acceptable here", nullptr);
if (d->listener)
d->listener->onCallSessionEarlyFailed(getSharedFromThis(), ei);
d->op->decline(SalReasonNotAcceptable, nullptr);
d->op->decline(SalReasonNotAcceptable);
return;
}
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -27,8 +27,8 @@ LINPHONE_BEGIN_NAMESPACE
class SalCallOp : public SalOp, public SalMessageOpInterface {
public:
SalCallOp (Sal *sal) : SalOp(sal) {}
~SalCallOp () override;
SalCallOp (Sal *sal);
~SalCallOp ();
SalMediaDescription *getLocalMediaDescription () const { return mLocalMedia; }
int setLocalMediaDescription (SalMediaDescription *desc);
......@@ -39,14 +39,14 @@ public:
const Content &getRemoteBody () const { return mRemoteBody; }
SalMediaDescription *getFinalMediaDescription ();
int call (const char *from, const char *to, const char *subject);
int call (const std::string &from, const std::string &to, const std::string &subject);
int notifyRinging (bool earlyMedia);
int accept ();
int decline (SalReason reason, const char *redirection = nullptr);
int decline (SalReason reason, const std::string &redirectionUri = "");
int declineWithErrorInfo (const SalErrorInfo *info, const SalAddress *redirectionAddr = nullptr);
int update (const char *subject, bool noUserConsent);
int update (const std::string &subject, bool noUserConsent);
int cancelInvite (const SalErrorInfo *info = nullptr);
int refer (const char *referTo);
int refer (const std::string &referToUri);
int referWithReplaces (SalCallOp *otherCallOp);
int setReferrer (SalCallOp *referredCall);
SalCallOp *getReplaces () const;
......@@ -60,7 +60,7 @@ public:
bool dialogRequestPending () const { return (belle_sip_dialog_request_pending(mDialog) != 0); }
const char *getLocalTag () { return belle_sip_dialog_get_local_tag(mDialog); }
const char *getRemoteTag () { return belle_sip_dialog_get_remote_tag(mDialog); }
void setReplaces (const char *callId, const char *fromTag, const char *toTag);
void setReplaces (const std::string &callId, const std::string &fromTag, const std::string &toTag);
void setSdpHandling (SalOpSDPHandling handling);
// Implementation of SalMessageOpInterface
......@@ -68,7 +68,7 @@ public:
int reply (SalReason reason) override { return SalOp::replyMessage(reason); }
private:
virtual void fillCallbacks () override;
void fillCallbacks () override;
void setReleased ();
void setError (belle_sip_response_t *response, bool fatal);
......@@ -85,14 +85,14 @@ private:
void fillInvite (belle_sip_request_t *invite);
void cancellingInvite (const SalErrorInfo *info);
int referTo (belle_sip_header_refer_to_t *referToHeader, belle_sip_header_referred_by_t *referredByHeader);
int sendNotifyForRefer (int code, const char *reason);
int sendNotifyForRefer (int code, const std::string &reason);
void notifyLastResponse (SalCallOp *newCallOp);
void processRefer (const belle_sip_request_event_t *event, belle_sip_server_transaction_t *serverTransaction);
void processNotify (const belle_sip_request_event_t *event, belle_sip_server_transaction_t *serverTransaction);
static void setAddrTo0000 (char value[], size_t sz);
static int isMediaDescriptionAcceptable (SalMediaDescription *md);
static bool isAPendingIncomingInviteTransaction (belle_sip_transaction_t *tr);
static bool isMediaDescriptionAcceptable (SalMediaDescription *md);
static bool isAPendingIncomingInviteTransaction (belle_sip_transaction_t *transaction);
static void setCallAsReleased (SalCallOp *op);
static void unsupportedMethod (belle_sip_server_transaction_t *serverTransaction, belle_sip_request_t *request);
static belle_sip_header_reason_t *makeReasonHeader (const SalErrorInfo *info);
......
This diff is collapsed.
......@@ -31,9 +31,9 @@ public:
class SalSubscribeOp: public SalEventOp {
public:
SalSubscribeOp (Sal *sal): SalEventOp(sal) {}
SalSubscribeOp (Sal *sal);
int subscribe (const char *from, const char *to, const char *eventName, int expires, const SalBodyHandler *bodyHandler);
int subscribe (const std::string &eventName, int expires, const SalBodyHandler *bodyHandler);
int unsubscribe () { return SalOp::unsubscribe(); }
int accept ();
int decline (SalReason reason);
......@@ -42,7 +42,7 @@ public:
int closeNotify ();
private:
virtual void fillCallbacks () override;
void fillCallbacks () override;
void handleNotify (belle_sip_request_t *request, const char *eventName, SalBodyHandler *bodyHandler);
static void subscribeProcessIoErrorCb (void *userCtx, const belle_sip_io_error_event_t *event);
......@@ -57,13 +57,13 @@ private:
class SalPublishOp : public SalEventOp {
public:
SalPublishOp (Sal *sal) : SalEventOp(sal) {}
SalPublishOp (Sal *sal);
int publish (const char *from, const char *to, const char *eventName, int expires, const SalBodyHandler *bodyHandler);
int publish (const std::string &eventName, int expires, const SalBodyHandler *bodyHandler);
int unpublish ();
private:
virtual void fillCallbacks () override;
void fillCallbacks () override;
static void publishResponseEventCb (void *userCtx, const belle_sip_response_event_t *event);
static void publishRefresherListenerCb (belle_sip_refresher_t *refresher, void *userCtx, unsigned int statusCode, const char *reasonPhrase, int willRetry);
......
......@@ -23,68 +23,71 @@ using namespace std;
LINPHONE_BEGIN_NAMESPACE
void SalMessageOp::processError() {
if (mDir == Dir::Outgoing) {
void SalMessageOp::processError () {
if (mDir == Dir::Outgoing)
mRoot->mCallbacks.message_delivery_update(this, SalMessageDeliveryFailed);
} else {
ms_warning("unexpected io error for incoming message on op [%p]", this);
}
mState=State::Terminated;
else
lWarning() << "Unexpected error for incoming message on op [" << this << "]";
mState = State::Terminated;
}
void SalMessageOp::processIoErrorCb(void *user_ctx, const belle_sip_io_error_event_t *event) {
SalMessageOp * op = (SalMessageOp *)user_ctx;
sal_error_info_set(&op->mErrorInfo,SalReasonIOError, "SIP", 503,"IO Error",NULL);