Commit 61c2fbf9 authored by Simon Morlat's avatar Simon Morlat
Browse files

use internal linphone_core_send_presence() method to send on-the-phone...

use internal linphone_core_send_presence() method to send on-the-phone notification when a call is starting and restore to user's presence when last call is terminated.
This allows to use publish if relevant, while previous method could only send NOTIFY.
parent 7390fca8
...@@ -425,9 +425,12 @@ static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from, ...@@ -425,9 +425,12 @@ static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from,
call->media_start_time=0; call->media_start_time=0;
call->log=linphone_call_log_new(call, from, to); call->log=linphone_call_log_new(call, from, to);
call->owns_call_log=TRUE; call->owns_call_log=TRUE;
model = linphone_presence_model_new_with_activity(LinphonePresenceActivityOnThePhone, NULL); if (call->core->calls==NULL){
linphone_core_notify_all_friends(call->core,model); /*there were no call, and now there is a call, send an on-the-phone presence notification automatically*/
linphone_presence_model_unref(model); model = linphone_presence_model_new_with_activity(LinphonePresenceActivityOnThePhone, NULL);
linphone_core_send_presence(call->core,model);
linphone_presence_model_unref(model);
}
linphone_core_get_audio_port_range(call->core, &min_port, &max_port); linphone_core_get_audio_port_range(call->core, &min_port, &max_port);
if (min_port == max_port) { if (min_port == max_port) {
/* Used fixed RTP audio port. */ /* Used fixed RTP audio port. */
...@@ -635,7 +638,7 @@ static void linphone_call_set_terminated(LinphoneCall *call){ ...@@ -635,7 +638,7 @@ static void linphone_call_set_terminated(LinphoneCall *call){
} }
if (ms_list_size(lc->calls)==0) if (ms_list_size(lc->calls)==0)
linphone_core_notify_all_friends(lc,lc->presence_model); linphone_core_send_presence(lc,lc->presence_model);
linphone_core_conference_check_uninit(lc); linphone_core_conference_check_uninit(lc);
if (call->ringing_beep){ if (call->ringing_beep){
......
...@@ -3747,15 +3747,13 @@ void linphone_core_set_presence_info(LinphoneCore *lc, int minutes_away, const c ...@@ -3747,15 +3747,13 @@ void linphone_core_set_presence_info(LinphoneCore *lc, int minutes_away, const c
linphone_core_set_presence_model(lc, presence); linphone_core_set_presence_model(lc, presence);
} }
void linphone_core_set_presence_model(LinphoneCore *lc, LinphonePresenceModel *presence) { void linphone_core_send_presence(LinphoneCore *lc, LinphonePresenceModel *presence){
// TODO: Check that the presence timestamp is newer than the last sent presence.
linphone_core_notify_all_friends(lc,presence); linphone_core_notify_all_friends(lc,presence);
/*
Improve the use of all LINPHONE_STATUS available.
!TODO Do not mix "presence status" with "answer status code"..
Use correct parameter to follow sip_if_match/sip_etag.
*/
linphone_core_send_publish(lc,presence); linphone_core_send_publish(lc,presence);
}
void linphone_core_set_presence_model(LinphoneCore *lc, LinphonePresenceModel *presence) {
linphone_core_send_presence(lc,presence);
if ((lc->presence_model != NULL) && (lc->presence_model != presence)) { if ((lc->presence_model != NULL) && (lc->presence_model != presence)) {
linphone_presence_model_unref(lc->presence_model); linphone_presence_model_unref(lc->presence_model);
......
...@@ -296,6 +296,7 @@ static inline void set_string(char **dest, const char *src){ ...@@ -296,6 +296,7 @@ static inline void set_string(char **dest, const char *src){
void linphone_process_authentication(LinphoneCore* lc, SalOp *op); void linphone_process_authentication(LinphoneCore* lc, SalOp *op);
void linphone_authentication_ok(LinphoneCore *lc, SalOp *op); void linphone_authentication_ok(LinphoneCore *lc, SalOp *op);
void linphone_subscription_new(LinphoneCore *lc, SalOp *op, const char *from); void linphone_subscription_new(LinphoneCore *lc, SalOp *op, const char *from);
void linphone_core_send_presence(LinphoneCore *lc, LinphonePresenceModel *presence);
void linphone_notify_parse_presence(SalOp *op, const char *content_type, const char *content_subtype, const char *body, SalPresenceModel **result); void linphone_notify_parse_presence(SalOp *op, const char *content_type, const char *content_subtype, const char *body, SalPresenceModel **result);
void linphone_notify_convert_presence_to_xml(SalOp *op, SalPresenceModel *presence, const char *contact, char **content); void linphone_notify_convert_presence_to_xml(SalOp *op, SalPresenceModel *presence, const char *contact, char **content);
void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeStatus ss, SalPresenceModel *model); void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeStatus ss, SalPresenceModel *model);
......
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