forked from mirrors/linphone-iphone
- fix text_received() callback so that it can work without date header.
- add api to add custom header (work in progress) - add accessors to call logs and hide the structure into private.h
This commit is contained in:
parent
d157b76a91
commit
990cbb596d
15 changed files with 2925 additions and 2708 deletions
|
|
@ -1965,7 +1965,7 @@ static int lpc_cmd_duration(LinphoneCore *lc, char *args){
|
|||
for(;elem!=NULL;elem=elem->next){
|
||||
if (elem->next==NULL){
|
||||
cl=(LinphoneCallLog*)elem->data;
|
||||
linphonec_out("%i seconds\n",cl->duration);
|
||||
linphonec_out("%i seconds\n",linphone_call_log_get_duration(cl));
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -842,8 +842,8 @@ static bool_t is_duplicate_msg(LinphoneCore *lc, const char *msg_id){
|
|||
}
|
||||
|
||||
|
||||
static void text_received(Sal *sal, const SalMessage *msg){
|
||||
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal);
|
||||
static void text_received(SalOp *op, const SalMessage *msg){
|
||||
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
|
||||
if (is_duplicate_msg(lc,msg->message_id)==FALSE){
|
||||
linphone_core_message_received(lc,msg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,13 +160,6 @@ LinphoneChatMessage* linphone_chat_room_create_message(const LinphoneChatRoom *c
|
|||
return msg;
|
||||
}
|
||||
|
||||
void linphone_chat_message_destroy(LinphoneChatMessage* msg) {
|
||||
if (msg->message) ms_free(msg->message);
|
||||
if (msg->external_body_url) ms_free(msg->external_body_url);
|
||||
if (msg->from) linphone_address_destroy(msg->from);
|
||||
ms_free(msg);
|
||||
}
|
||||
|
||||
void linphone_chat_room_send_message2(LinphoneChatRoom *cr, LinphoneChatMessage* msg,LinphoneChatMessageStateChangeCb status_cb,void* ud) {
|
||||
msg->cb=status_cb;
|
||||
msg->cb_ud=ud;
|
||||
|
|
@ -231,6 +224,15 @@ time_t linphone_chat_message_get_time(const LinphoneChatMessage* message) {
|
|||
const char * linphone_chat_message_get_text(const LinphoneChatMessage* message) {
|
||||
return message->message;
|
||||
}
|
||||
|
||||
void linphone_chat_message_add_custom_header(LinphoneChatMessage* message, const char *header_name, const char *header_value){
|
||||
message->custom_headers=sal_custom_header_append(message->custom_headers,header_name,header_value);
|
||||
}
|
||||
|
||||
const char * linphone_chat_message_get_custom_header(LinphoneChatMessage* message, const char *header_name){
|
||||
return sal_custom_header_find(message->custom_headers,header_name);
|
||||
}
|
||||
|
||||
LinphoneChatMessage* linphone_chat_message_clone(const LinphoneChatMessage* msg) {
|
||||
/*struct _LinphoneChatMessage {
|
||||
char* message;
|
||||
|
|
@ -250,3 +252,13 @@ LinphoneChatMessage* linphone_chat_message_clone(const LinphoneChatMessage* msg)
|
|||
if (msg->from) new_message->from=linphone_address_clone(msg->from);
|
||||
return new_message;
|
||||
}
|
||||
|
||||
void linphone_chat_message_destroy(LinphoneChatMessage* msg) {
|
||||
if (msg->message) ms_free(msg->message);
|
||||
if (msg->external_body_url) ms_free(msg->external_body_url);
|
||||
if (msg->from) linphone_address_destroy(msg->from);
|
||||
if (msg->custom_headers) sal_custom_header_free(msg->custom_headers);
|
||||
ms_free(msg);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -472,6 +472,8 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr
|
|||
linphone_core_get_local_ip(lc,linphone_address_get_domain(to),call->localip);
|
||||
linphone_call_init_common(call,from,to);
|
||||
_linphone_call_params_copy(&call->params,params);
|
||||
sal_op_set_custom_header(call->op,call->params.custom_headers);
|
||||
|
||||
if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) {
|
||||
call->ice_session = ice_session_new();
|
||||
ice_session_set_role(call->ice_session, IR_Controlling);
|
||||
|
|
@ -733,9 +735,7 @@ static void linphone_call_destroy(LinphoneCall *obj)
|
|||
if (obj->auth_token) {
|
||||
ms_free(obj->auth_token);
|
||||
}
|
||||
if (obj->params.record_file)
|
||||
ms_free(obj->params.record_file);
|
||||
|
||||
linphone_call_params_uninit(&obj->params);
|
||||
ms_free(obj);
|
||||
}
|
||||
|
||||
|
|
@ -810,6 +810,7 @@ const LinphoneCallParams * linphone_call_get_remote_params(LinphoneCall *call){
|
|||
cp->low_bandwidth=TRUE;
|
||||
}
|
||||
}
|
||||
cp->custom_headers=(SalCustomHeader*)sal_op_get_custom_header(call->op);
|
||||
return cp;
|
||||
}
|
||||
}
|
||||
|
|
@ -963,6 +964,18 @@ void linphone_call_enable_camera (LinphoneCall *call, bool_t enable){
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef VIDEO_ENABLED
|
||||
/**
|
||||
* Request remote side to send us a Video Fast Update.
|
||||
**/
|
||||
void linphone_call_send_vfu_request(LinphoneCall *call)
|
||||
{
|
||||
if (LinphoneCallStreamsRunning == linphone_call_get_state(call))
|
||||
sal_call_send_vfu_request(call->op);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Take a photo of currently received video and write it into a jpeg file.
|
||||
**/
|
||||
|
|
@ -1038,10 +1051,16 @@ bool_t linphone_call_params_video_enabled(const LinphoneCallParams *cp){
|
|||
return cp->has_video;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns kind of media encryption selected for the call.
|
||||
**/
|
||||
enum LinphoneMediaEncryption linphone_call_params_get_media_encryption(const LinphoneCallParams *cp) {
|
||||
return cp->media_encryption;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set requested media encryption for a call.
|
||||
**/
|
||||
void linphone_call_params_set_media_encryption(LinphoneCallParams *cp, enum LinphoneMediaEncryption e) {
|
||||
cp->media_encryption = e;
|
||||
}
|
||||
|
|
@ -1054,6 +1073,9 @@ void linphone_call_params_enable_early_media_sending(LinphoneCallParams *cp, boo
|
|||
cp->real_early_media=enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether sending of early media was enabled.
|
||||
**/
|
||||
bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams *cp){
|
||||
return cp->real_early_media;
|
||||
}
|
||||
|
|
@ -1073,25 +1095,25 @@ void linphone_call_params_set_audio_bandwidth_limit(LinphoneCallParams *cp, int
|
|||
cp->audio_bw=bandwidth;
|
||||
}
|
||||
|
||||
#ifdef VIDEO_ENABLED
|
||||
/**
|
||||
* Request remote side to send us a Video Fast Update.
|
||||
**/
|
||||
void linphone_call_send_vfu_request(LinphoneCall *call)
|
||||
{
|
||||
if (LinphoneCallStreamsRunning == linphone_call_get_state(call))
|
||||
sal_call_send_vfu_request(call->op);
|
||||
void linphone_call_params_add_custom_header(LinphoneCallParams *params, const char *header_name, const char *header_value){
|
||||
params->custom_headers=sal_custom_header_append(params->custom_headers,header_name,header_value);
|
||||
}
|
||||
#endif
|
||||
|
||||
const char *linphone_call_params_get_custom_header(LinphoneCallParams *params, const char *header_name){
|
||||
return sal_custom_header_find(params->custom_headers,header_name);
|
||||
}
|
||||
|
||||
void _linphone_call_params_copy(LinphoneCallParams *ncp, const LinphoneCallParams *cp){
|
||||
memcpy(ncp,cp,sizeof(LinphoneCallParams));
|
||||
if (cp->record_file) ncp->record_file=ms_strdup(cp->record_file);
|
||||
/*
|
||||
* The management of the custom headers is not optimal. We copy everything while ref counting would be more efficient.
|
||||
*/
|
||||
if (cp->custom_headers) ncp->custom_headers=sal_custom_header_clone(cp->custom_headers);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Copy existing LinphoneCallParams to a new LinphoneCallParams object.
|
||||
**/
|
||||
LinphoneCallParams * linphone_call_params_copy(const LinphoneCallParams *cp){
|
||||
LinphoneCallParams *ncp=ms_new0(LinphoneCallParams,1);
|
||||
|
|
@ -1099,14 +1121,20 @@ LinphoneCallParams * linphone_call_params_copy(const LinphoneCallParams *cp){
|
|||
return ncp;
|
||||
}
|
||||
|
||||
void linphone_call_params_uninit(LinphoneCallParams *p){
|
||||
if (p->record_file) ms_free(p->record_file);
|
||||
if (p->custom_headers) sal_custom_header_free(p->custom_headers);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Destroy LinphoneCallParams.
|
||||
**/
|
||||
void linphone_call_params_destroy(LinphoneCallParams *p){
|
||||
if (p->record_file) ms_free(p->record_file);
|
||||
linphone_call_params_uninit(p);
|
||||
ms_free(p);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -203,8 +203,8 @@ static void call_logs_read_from_config_file(LinphoneCore *lc){
|
|||
if (tmp) cl->refkey=ms_strdup(tmp);
|
||||
cl->quality=lp_config_get_float(cfg,logsection,"quality",-1);
|
||||
cl->video_enabled=lp_config_get_int(cfg,logsection,"video_enabled",0);
|
||||
cl->call_id=lp_config_get_string(cfg,logsection,"call_id",NULL);
|
||||
if(cl->call_id) cl->call_id=ms_strdup(cl->call_id);
|
||||
tmp=lp_config_get_string(cfg,logsection,"call_id",NULL);
|
||||
if (tmp) cl->call_id=ms_strdup(tmp);
|
||||
lc->call_logs=ms_list_append(lc->call_logs,cl);
|
||||
}else break;
|
||||
}
|
||||
|
|
@ -270,10 +270,16 @@ const rtp_stats_t *linphone_call_log_get_remote_stats(const LinphoneCallLog *cl)
|
|||
return &cl->remote_stats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign a user pointer to the call log.
|
||||
**/
|
||||
void linphone_call_log_set_user_pointer(LinphoneCallLog *cl, void *up){
|
||||
cl->user_pointer=up;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the user pointer associated with the call log.
|
||||
**/
|
||||
void *linphone_call_log_get_user_pointer(const LinphoneCallLog *cl){
|
||||
return cl->user_pointer;
|
||||
}
|
||||
|
|
@ -306,13 +312,62 @@ const char *linphone_call_log_get_ref_key(const LinphoneCallLog *cl){
|
|||
return cl->refkey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns origin (ie from) address of the call.
|
||||
**/
|
||||
LinphoneAddress *linphone_call_log_get_from(LinphoneCallLog *cl){
|
||||
return cl->from;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns destination address (ie to) of the call.
|
||||
**/
|
||||
LinphoneAddress *linphone_call_log_get_to(LinphoneCallLog *cl){
|
||||
return cl->to;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the direction of the call.
|
||||
**/
|
||||
LinphoneCallDir linphone_call_log_get_dir(LinphoneCallLog *cl){
|
||||
return cl->dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the status of the call.
|
||||
**/
|
||||
LinphoneCallStatus linphone_call_log_get_status(LinphoneCallLog *cl){
|
||||
return cl->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the start date of the call, expressed as a POSIX time_t.
|
||||
**/
|
||||
time_t linphone_call_log_get_start_date(LinphoneCallLog *cl){
|
||||
return cl->start_date_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns duration of the call.
|
||||
**/
|
||||
int linphone_call_log_get_duration(LinphoneCallLog *cl){
|
||||
return cl->duration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns overall quality indication of the call.
|
||||
**/
|
||||
float linphone_call_log_get_quality(LinphoneCallLog *cl){
|
||||
return cl->quality;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
void linphone_call_log_destroy(LinphoneCallLog *cl){
|
||||
if (cl->from!=NULL) linphone_address_destroy(cl->from);
|
||||
if (cl->to!=NULL) linphone_address_destroy(cl->to);
|
||||
if (cl->refkey!=NULL) ms_free(cl->refkey);
|
||||
if (cl->call_id) ms_free((void*)cl->call_id);
|
||||
if (cl->call_id) ms_free(cl->call_id);
|
||||
ms_free(cl);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -141,24 +141,7 @@ typedef enum _LinphoneCallStatus {
|
|||
* @ingroup call_logs
|
||||
*
|
||||
**/
|
||||
typedef struct _LinphoneCallLog{
|
||||
LinphoneCallDir dir; /**< The direction of the call*/
|
||||
LinphoneCallStatus status; /**< The status of the call*/
|
||||
LinphoneAddress *from; /**<Originator of the call as a LinphoneAddress object*/
|
||||
LinphoneAddress *to; /**<Destination of the call as a LinphoneAddress object*/
|
||||
char start_date[128]; /**<Human readable string containing the start date*/
|
||||
int duration; /**<Duration of the call in seconds*/
|
||||
char *refkey;
|
||||
void *user_pointer;
|
||||
rtp_stats_t local_stats;
|
||||
rtp_stats_t remote_stats;
|
||||
float quality;
|
||||
int video_enabled;
|
||||
struct _LinphoneCore *lc;
|
||||
time_t start_date_time; /**Start date of the call in seconds as expressed in a time_t */
|
||||
const char* call_id; /**unique id of a call*/
|
||||
} LinphoneCallLog;
|
||||
|
||||
typedef struct _LinphoneCallLog LinphoneCallLog;
|
||||
|
||||
/**
|
||||
* Enum describing type of media encryption types.
|
||||
|
|
@ -175,6 +158,13 @@ enum LinphoneMediaEncryption {
|
|||
typedef enum LinphoneMediaEncryption LinphoneMediaEncryption;
|
||||
|
||||
/*public: */
|
||||
LinphoneAddress *linphone_call_log_get_from(LinphoneCallLog *cl);
|
||||
LinphoneAddress *linphone_call_log_get_to(LinphoneCallLog *cl);
|
||||
LinphoneCallDir linphone_call_log_get_dir(LinphoneCallLog *cl);
|
||||
LinphoneCallStatus linphone_call_log_get_status(LinphoneCallLog *cl);
|
||||
time_t linphone_call_log_get_start_date(LinphoneCallLog *cl);
|
||||
int linphone_call_log_get_duration(LinphoneCallLog *cl);
|
||||
float linphone_call_log_get_quality(LinphoneCallLog *cl);
|
||||
void linphone_call_log_set_user_pointer(LinphoneCallLog *cl, void *up);
|
||||
void *linphone_call_log_get_user_pointer(const LinphoneCallLog *cl);
|
||||
void linphone_call_log_set_ref_key(LinphoneCallLog *cl, const char *refkey);
|
||||
|
|
@ -208,6 +198,8 @@ bool_t linphone_call_params_low_bandwidth_enabled(const LinphoneCallParams *cp);
|
|||
void linphone_call_params_enable_low_bandwidth(LinphoneCallParams *cp, bool_t enabled);
|
||||
void linphone_call_params_set_record_file(LinphoneCallParams *cp, const char *path);
|
||||
const char *linphone_call_params_get_record_file(const LinphoneCallParams *cp);
|
||||
void linphone_call_params_add_custom_header(LinphoneCallParams *params, const char *header_name, const char *header_value);
|
||||
const char *linphone_call_params_get_custom_header(LinphoneCallParams *params, const char *header_name);
|
||||
/**
|
||||
* Enum describing failure reasons.
|
||||
* @ingroup initializing
|
||||
|
|
|
|||
|
|
@ -81,17 +81,36 @@ struct _LinphoneCallParams{
|
|||
int down_ptime;
|
||||
int up_ptime;
|
||||
char *record_file;
|
||||
SalCustomHeader *custom_headers;
|
||||
bool_t has_video;
|
||||
bool_t real_early_media; /*send real media even during early media (for outgoing calls)*/
|
||||
bool_t in_conference; /*in conference mode */
|
||||
bool_t pad;
|
||||
bool_t low_bandwidth;
|
||||
};
|
||||
|
||||
|
||||
struct _LinphoneCallLog{
|
||||
struct _LinphoneCore *lc;
|
||||
LinphoneCallDir dir; /**< The direction of the call*/
|
||||
LinphoneCallStatus status; /**< The status of the call*/
|
||||
LinphoneAddress *from; /**<Originator of the call as a LinphoneAddress object*/
|
||||
LinphoneAddress *to; /**<Destination of the call as a LinphoneAddress object*/
|
||||
char start_date[128]; /**<Human readable string containing the start date*/
|
||||
int duration; /**<Duration of the call in seconds*/
|
||||
char *refkey;
|
||||
void *user_pointer;
|
||||
rtp_stats_t local_stats;
|
||||
rtp_stats_t remote_stats;
|
||||
float quality;
|
||||
time_t start_date_time; /**Start date of the call in seconds as expressed in a time_t */
|
||||
char* call_id; /**unique id of a call*/
|
||||
bool_t video_enabled;
|
||||
};
|
||||
|
||||
typedef struct _CallCallbackObj
|
||||
{
|
||||
LinphoneCallCbFunc _func;
|
||||
void * _user_data;
|
||||
LinphoneCallCbFunc _func;
|
||||
void * _user_data;
|
||||
}CallCallbackObj;
|
||||
|
||||
static const int linphone_call_magic=0x3343;
|
||||
|
|
@ -105,6 +124,7 @@ struct _LinphoneChatMessage {
|
|||
char* external_body_url;
|
||||
LinphoneAddress* from;
|
||||
time_t time;
|
||||
SalCustomHeader *custom_headers;
|
||||
};
|
||||
|
||||
typedef struct StunCandidate{
|
||||
|
|
@ -664,6 +684,7 @@ void call_logs_write_to_config_file(LinphoneCore *lc);
|
|||
int linphone_core_get_edge_bw(LinphoneCore *lc);
|
||||
int linphone_core_get_edge_ptime(LinphoneCore *lc);
|
||||
void _linphone_call_params_copy(LinphoneCallParams *params, const LinphoneCallParams *refparams);
|
||||
void linphone_call_params_uninit(LinphoneCallParams *params);
|
||||
|
||||
int linphone_upnp_init(LinphoneCore *lc);
|
||||
void linphone_upnp_destroy(LinphoneCore *lc);
|
||||
|
|
|
|||
|
|
@ -348,6 +348,8 @@ void __sal_op_free(SalOp *op){
|
|||
sal_media_description_unref(b->remote_media);
|
||||
if (b->call_id)
|
||||
ms_free(b->call_id);
|
||||
if (b->custom_headers)
|
||||
sal_custom_header_free(b->custom_headers);
|
||||
ms_free(op);
|
||||
}
|
||||
|
||||
|
|
@ -372,3 +374,60 @@ void sal_auth_info_delete(const SalAuthInfo* auth_info) {
|
|||
ms_free((void*)auth_info);
|
||||
}
|
||||
|
||||
SalCustomHeader *sal_custom_header_append(SalCustomHeader *ch, const char *name, const char *value){
|
||||
SalCustomHeader *h=ms_new0(SalCustomHeader,1);
|
||||
h->header_name=ms_strdup(name);
|
||||
h->header_value=ms_strdup(value);
|
||||
h->node.data=h;
|
||||
return (SalCustomHeader*)ms_list_append_link((MSList*)ch,(MSList*)h);
|
||||
}
|
||||
|
||||
const char *sal_custom_header_find(const SalCustomHeader *ch, const char *name){
|
||||
const MSList *it;
|
||||
for (it=(const MSList*)ch;it!=NULL;it=it->next){
|
||||
const SalCustomHeader *itch=(const SalCustomHeader *)it;
|
||||
if (strcasecmp(itch->header_name,name)==0)
|
||||
return itch->header_value;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void sal_custom_header_uninit(SalCustomHeader *ch){
|
||||
ms_free(ch->header_name);
|
||||
ms_free(ch->header_value);
|
||||
}
|
||||
|
||||
void sal_custom_header_free(SalCustomHeader *ch){
|
||||
ms_list_for_each((MSList*)ch,(void (*)(void*))sal_custom_header_uninit);
|
||||
ms_list_free((MSList *)ch);
|
||||
}
|
||||
|
||||
SalCustomHeader *sal_custom_header_clone(SalCustomHeader *ch){
|
||||
const MSList *it;
|
||||
SalCustomHeader *ret=NULL;
|
||||
for (it=(const MSList*)ch;it!=NULL;it=it->next){
|
||||
const SalCustomHeader *itch=(const SalCustomHeader *)it;
|
||||
ret=sal_custom_header_append(ret,itch->header_name,itch->header_value);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
const SalCustomHeader *sal_op_get_custom_header(SalOp *op){
|
||||
SalOpBase *b=(SalOpBase *)op;
|
||||
return b->custom_headers;
|
||||
}
|
||||
|
||||
/*
|
||||
* Warning: this function takes owneship of the custom headers
|
||||
*/
|
||||
void sal_op_set_custom_header(SalOp *op, SalCustomHeader* ch){
|
||||
SalOpBase *b=(SalOpBase *)op;
|
||||
if (b->custom_headers){
|
||||
sal_custom_header_free(b->custom_headers);
|
||||
b->custom_headers=NULL;
|
||||
}
|
||||
b->custom_headers=ch;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,10 @@ struct SalAddress;
|
|||
|
||||
typedef struct SalAddress SalAddress;
|
||||
|
||||
struct SalCustomHeader;
|
||||
|
||||
typedef struct SalCustomHeader SalCustomHeader;
|
||||
|
||||
typedef enum {
|
||||
SalTransportUDP, /*UDP*/
|
||||
SalTransportTCP, /*TCP*/
|
||||
|
|
@ -224,6 +228,7 @@ typedef struct SalOpBase{
|
|||
void *user_pointer;
|
||||
char* call_id;
|
||||
char *remote_contact;
|
||||
SalCustomHeader *custom_headers;
|
||||
} SalOpBase;
|
||||
|
||||
|
||||
|
|
@ -291,7 +296,7 @@ typedef void (*SalOnRegisterFailure)(SalOp *op, SalError error, SalReason reason
|
|||
typedef void (*SalOnVfuRequest)(SalOp *op);
|
||||
typedef void (*SalOnDtmfReceived)(SalOp *op, char dtmf);
|
||||
typedef void (*SalOnRefer)(Sal *sal, SalOp *op, const char *referto);
|
||||
typedef void (*SalOnTextReceived)(Sal *sal, const SalMessage *msg);
|
||||
typedef void (*SalOnTextReceived)(SalOp *op, const SalMessage *msg);
|
||||
typedef void (*SalOnTextDeliveryUpdate)(SalOp *op, SalTextDeliveryStatus status);
|
||||
typedef void (*SalOnNotify)(SalOp *op, const char *from, const char *event);
|
||||
typedef void (*SalOnNotifyRefer)(SalOp *op, SalReferStatus state);
|
||||
|
|
@ -451,6 +456,19 @@ int sal_ping(SalOp *op, const char *from, const char *to);
|
|||
/*misc*/
|
||||
void sal_get_default_local_ip(Sal *sal, int address_family, char *ip, size_t iplen);
|
||||
|
||||
struct SalCustomHeader{
|
||||
MSList node;
|
||||
char *header_name;
|
||||
char *header_value;
|
||||
};
|
||||
|
||||
SalCustomHeader *sal_custom_header_append(SalCustomHeader *ch, const char *name, const char *value);
|
||||
const char *sal_custom_header_find(const SalCustomHeader *ch, const char *name);
|
||||
void sal_custom_header_free(SalCustomHeader *ch);
|
||||
SalCustomHeader *sal_custom_header_clone(SalCustomHeader *ch);
|
||||
const SalCustomHeader *sal_op_get_custom_header(SalOp *op);
|
||||
void sal_op_set_custom_header(SalOp *op, SalCustomHeader* ch);
|
||||
|
||||
|
||||
/*internal API */
|
||||
void __sal_op_init(SalOp *b, Sal *sal);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -94,6 +94,8 @@ void sal_exosip_in_subscription_closed(Sal *sal, eXosip_event_t *ev);
|
|||
SalOp * sal_find_out_subscribe(Sal *sal, int sid);
|
||||
SalOp * sal_find_in_subscribe(Sal *sal, int nid);
|
||||
void sal_exosip_fix_route(SalOp *op);
|
||||
void sal_exosip_add_custom_headers(osip_message_t *msg, SalCustomHeader *ch);
|
||||
SalCustomHeader * sal_exosip_get_custom_headers(osip_message_t *msg);
|
||||
|
||||
void _osip_list_set_empty(osip_list_t *l, void (*freefunc)(void*));
|
||||
|
||||
|
|
|
|||
|
|
@ -94,8 +94,7 @@ static inline char *my_ctime_r(const time_t *t, char *buf){
|
|||
|
||||
int sal_message_send(SalOp *op, const char *from, const char *to, const char* content_type, const char *msg){
|
||||
osip_message_t *sip=NULL;
|
||||
time_t t;
|
||||
time(&t);
|
||||
time_t t=time(NULL);
|
||||
char buf[26];
|
||||
|
||||
if(op->cid == -1)
|
||||
|
|
@ -111,6 +110,7 @@ int sal_message_send(SalOp *op, const char *from, const char *to, const char* co
|
|||
eXosip_message_build_request(&sip,"MESSAGE",sal_op_get_to(op),
|
||||
sal_op_get_from(op),sal_op_get_route(op));
|
||||
if (sip!=NULL){
|
||||
sal_exosip_add_custom_headers(sip,op->base.custom_headers);
|
||||
osip_message_set_date(sip,my_ctime_r(&t,buf));
|
||||
osip_message_set_content_type(sip,content_type);
|
||||
if (msg) osip_message_set_body(sip,msg,strlen(msg));
|
||||
|
|
|
|||
|
|
@ -51,17 +51,19 @@ void linphone_gtk_call_log_update(GtkWidget *w){
|
|||
for (logs=linphone_core_get_call_logs(linphone_gtk_get_core());logs!=NULL;logs=logs->next){
|
||||
LinphoneCallLog *cl=(LinphoneCallLog*)logs->data;
|
||||
GtkTreeIter iter;
|
||||
LinphoneAddress *la=cl->dir==LinphoneCallIncoming ? cl->from : cl->to;
|
||||
LinphoneAddress *la=linphone_call_log_get_dir(cl)==LinphoneCallIncoming ? linphone_call_log_get_from(cl) : linphone_call_log_get_to(cl);
|
||||
char *addr= linphone_address_as_string_uri_only (la);
|
||||
const char *display;
|
||||
gchar *logtxt, *minutes, *seconds;
|
||||
gchar quality[20];
|
||||
const char *status=NULL;
|
||||
gchar *start_date=NULL;
|
||||
time_t start_date_time=linphone_call_log_get_start_date(cl);
|
||||
int duration=linphone_call_log_get_duration(cl);
|
||||
|
||||
#if GLIB_CHECK_VERSION(2,26,0)
|
||||
if (cl->start_date_time){
|
||||
GDateTime *dt=g_date_time_new_from_unix_local(cl->start_date_time);
|
||||
if (start_date_time){
|
||||
GDateTime *dt=g_date_time_new_from_unix_local(start_date_time);
|
||||
start_date=g_date_time_format(dt,"%c");
|
||||
g_date_time_unref(dt);
|
||||
}
|
||||
|
|
@ -73,10 +75,10 @@ void linphone_gtk_call_log_update(GtkWidget *w){
|
|||
if (display==NULL)
|
||||
display=linphone_address_get_domain (la);
|
||||
}
|
||||
if (cl->quality!=-1){
|
||||
snprintf(quality,sizeof(quality),"%.1f",cl->quality);
|
||||
}
|
||||
switch(cl->status){
|
||||
if (linphone_call_log_get_quality(cl)!=-1){
|
||||
snprintf(quality,sizeof(quality),"%.1f",linphone_call_log_get_quality(cl));
|
||||
}else snprintf(quality,sizeof(quality)-1,"%s",_("n/a"));
|
||||
switch(linphone_call_log_get_status(cl)){
|
||||
case LinphoneCallAborted:
|
||||
status=_("Aborted");
|
||||
break;
|
||||
|
|
@ -90,21 +92,21 @@ void linphone_gtk_call_log_update(GtkWidget *w){
|
|||
break;
|
||||
}
|
||||
minutes=g_markup_printf_escaped(
|
||||
ngettext("%i minute", "%i minutes", cl->duration/60),
|
||||
cl->duration/60);
|
||||
ngettext("%i minute", "%i minutes", duration/60),
|
||||
duration/60);
|
||||
seconds=g_markup_printf_escaped(
|
||||
ngettext("%i second", "%i seconds", cl->duration%60),
|
||||
cl->duration%60);
|
||||
ngettext("%i second", "%i seconds", duration%60),
|
||||
duration%60);
|
||||
if (status==NULL) logtxt=g_markup_printf_escaped(
|
||||
_("<big><b>%s</b></big>\t<small><i>%s</i>\t"
|
||||
"<i>Quality: %s</i></small>\n%s\t%s %s\t"),
|
||||
display, addr, cl->quality!=-1 ? quality : _("n/a"),
|
||||
start_date ? start_date : cl->start_date, minutes, seconds);
|
||||
display, addr, quality ,
|
||||
start_date ? start_date : "", minutes, seconds);
|
||||
else logtxt=g_markup_printf_escaped(
|
||||
_("<big><b>%s</b></big>\t<small><i>%s</i></small>\t"
|
||||
"\n%s\t%s"),
|
||||
display, addr,
|
||||
start_date ? start_date : cl->start_date, status);
|
||||
start_date ? start_date : "", status);
|
||||
g_free(minutes);
|
||||
g_free(seconds);
|
||||
if (start_date) g_free(start_date);
|
||||
|
|
@ -113,7 +115,7 @@ void linphone_gtk_call_log_update(GtkWidget *w){
|
|||
GdkPixbuf *incoming = create_pixbuf("call_status_incoming.png");
|
||||
GdkPixbuf *outgoing = create_pixbuf("call_status_outgoing.png");
|
||||
gtk_list_store_set (store,&iter,
|
||||
0, cl->dir==LinphoneCallOutgoing ? outgoing : incoming,
|
||||
0, linphone_call_log_get_dir(cl)==LinphoneCallOutgoing ? outgoing : incoming,
|
||||
1, logtxt,2,la,-1);
|
||||
ms_free(addr);
|
||||
g_free(logtxt);
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ static void linphone_gtk_in_call_set_animation_image(GtkWidget *callview, const
|
|||
GList *elem=gtk_container_get_children(GTK_CONTAINER(container));
|
||||
GtkWidget *image;
|
||||
|
||||
if (!is_stock){
|
||||
if (!is_stock){
|
||||
if (image_name==NULL){
|
||||
gtk_widget_hide(container);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit fd8f21d7087ed2d5af18e4cd3a7db9bdf0008ed3
|
||||
Subproject commit 6251dea54272cf048c580e03a80c67d672367f2a
|
||||
Loading…
Add table
Reference in a new issue