mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
appnaping improvements
- take a background task during the ice gatethering for incoming call - add timestamps to gtk debug window, which was required to investigate the issue. Requires up to date belle-sip
This commit is contained in:
parent
b20e1de362
commit
589d3cd540
7 changed files with 45 additions and 19 deletions
|
|
@ -5,8 +5,7 @@
|
|||
* Xcode (download from apple or using appstore application)
|
||||
* [Java SE](http://www.oracle.com/technetwork/java/javase/downloads/index.html) or openJDK
|
||||
This is required to generate a C sourcefile from SIP grammar using [antlr3](http://www.antlr3.org/) generator.
|
||||
* [HomeBrew](http://brew.sh) or [Macports](http://www.macports.org/).
|
||||
* [XQuartz](https://xquartz.macosforge.org) for GTK version.
|
||||
* [HomeBrew](http://brew.sh) or [Macports](http://www.macports.org/).
|
||||
|
||||
### Dependencies
|
||||
|
||||
|
|
|
|||
|
|
@ -1135,6 +1135,16 @@ void sal_cancel_timer(Sal *sal, belle_sip_source_t *timer) {
|
|||
belle_sip_main_loop_t *ml = belle_sip_stack_get_main_loop(sal->stack);
|
||||
belle_sip_main_loop_remove_source(ml, timer);
|
||||
}
|
||||
|
||||
unsigned long sal_begin_background_task(const char *name, void (*max_time_reached)(void *), void *data){
|
||||
return belle_sip_begin_background_task(name, max_time_reached, data);
|
||||
}
|
||||
|
||||
void sal_end_background_task(unsigned long id){
|
||||
belle_sip_end_background_task(id);
|
||||
}
|
||||
|
||||
|
||||
void sal_enable_sip_update_method(Sal *ctx,bool_t value) {
|
||||
ctx->enable_sip_update=value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -336,6 +336,8 @@ static void call_received(SalOp *h){
|
|||
linphone_core_add_call(lc,call);
|
||||
linphone_call_ref(call); /*prevent the call from being destroyed while we are notifying, if the user declines within the state callback */
|
||||
|
||||
call->bg_task_id=sal_begin_background_task("liblinphone call notification", NULL, NULL);
|
||||
|
||||
if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (call->ice_session != NULL)) {
|
||||
/* Defer ringing until the end of the ICE candidates gathering process. */
|
||||
ms_message("Defer ringing to gather ICE candidates");
|
||||
|
|
|
|||
|
|
@ -3292,6 +3292,12 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){
|
|||
}
|
||||
|
||||
linphone_call_set_state(call,LinphoneCallIncomingReceived,"Incoming call");
|
||||
/*from now on, the application is aware of the call and supposed to take background task or already submitted notification to the user.
|
||||
We can then drop our background task.*/
|
||||
if (call->bg_task_id!=0) {
|
||||
sal_end_background_task(call->bg_task_id);
|
||||
call->bg_task_id=0;
|
||||
}
|
||||
|
||||
if (call->state==LinphoneCallIncomingReceived){
|
||||
/*try to be best-effort in giving real local or routable contact address for 100Rel case*/
|
||||
|
|
|
|||
|
|
@ -257,6 +257,7 @@ struct _LinphoneCall{
|
|||
LinphoneCall *transfer_target;/*if this call received a transfer request, then transfer_target points to the new call created to the refer target */
|
||||
int localdesc_changed;/*not a boolean, contains a mask representing changes*/
|
||||
LinphonePlayer *player;
|
||||
unsigned long bg_task_id; /*used to prevent device to suspend app while a call is received in background*/
|
||||
|
||||
char *dtmf_sequence; /*DTMF sequence needed to be sent using #dtmfs_timer*/
|
||||
belle_sip_source_t *dtmfs_timer; /*DTMF timer needed to send a DTMF sequence*/
|
||||
|
|
|
|||
|
|
@ -164,7 +164,6 @@ static FILE *linphone_gtk_log_init()
|
|||
|
||||
static void linphone_gtk_log_file(OrtpLogLevel lev, const char *msg)
|
||||
{
|
||||
time_t now;
|
||||
FILE *outlog;
|
||||
|
||||
outlog = linphone_gtk_log_init();
|
||||
|
|
@ -176,12 +175,11 @@ static void linphone_gtk_log_file(OrtpLogLevel lev, const char *msg)
|
|||
logfile_date_format in the GtkUi section of the config file,
|
||||
but it defaults to something compact, but yet readable. */
|
||||
const char *lname="undef";
|
||||
char date[256];
|
||||
|
||||
/* Convert level constant to text */
|
||||
switch(lev){
|
||||
case ORTP_DEBUG:
|
||||
lname="debug";
|
||||
lname="debug ";
|
||||
break;
|
||||
case ORTP_MESSAGE:
|
||||
lname="message";
|
||||
|
|
@ -190,23 +188,16 @@ static void linphone_gtk_log_file(OrtpLogLevel lev, const char *msg)
|
|||
lname="warning";
|
||||
break;
|
||||
case ORTP_ERROR:
|
||||
lname="error";
|
||||
lname="error ";
|
||||
break;
|
||||
case ORTP_FATAL:
|
||||
lname="fatal";
|
||||
lname="fatal ";
|
||||
break;
|
||||
default:
|
||||
lname="undef";
|
||||
lname="undef ";
|
||||
break;
|
||||
}
|
||||
/* Get current time and format it properly */
|
||||
now = time(NULL);
|
||||
strftime(date, sizeof(date), dateformat, localtime(&now));
|
||||
/* Now print out the message to the logfile. We don't flush,
|
||||
maybe we should do to ensure that we have all the messages in
|
||||
case of a crash (which is one of the main reasons we have a
|
||||
log facility in the first place). */
|
||||
fprintf(outlog, "[%s] [%s] %s\n", date, lname, msg);
|
||||
fprintf(outlog, "[%s] %s\n", lname, msg);
|
||||
fflush(outlog);
|
||||
}
|
||||
}
|
||||
|
|
@ -335,13 +326,24 @@ gboolean linphone_gtk_check_logs(){
|
|||
* Called from any linphone thread.
|
||||
*/
|
||||
void linphone_gtk_log_push(OrtpLogLevel lev, const char *fmt, va_list args){
|
||||
gchar *msg=g_strdup_vprintf(fmt,args);
|
||||
LinphoneGtkLog *lgl=g_new(LinphoneGtkLog,1);
|
||||
gchar *msg=g_strdup_vprintf(fmt,args);
|
||||
gchar *dated_msg;
|
||||
struct timeval tp;
|
||||
struct tm *lt;
|
||||
time_t tt;
|
||||
|
||||
ortp_gettimeofday(&tp, NULL);
|
||||
tt = (time_t)tp.tv_sec;
|
||||
lt = localtime((const time_t*)&tt);
|
||||
dated_msg=g_strdup_printf("%i-%.2i-%.2i %.2i:%.2i:%.2i:%.3i %s",
|
||||
1900 + lt->tm_year, lt->tm_mon + 1, lt->tm_mday, lt->tm_hour, lt->tm_min, lt->tm_sec, (int)(tp.tv_usec / 1000), msg);
|
||||
g_free(msg);
|
||||
lgl->lev=lev;
|
||||
lgl->msg=msg;
|
||||
lgl->msg=dated_msg;
|
||||
linphone_gtk_log_file(lev, dated_msg);
|
||||
g_static_mutex_lock(&log_mutex);
|
||||
log_queue=g_list_append(log_queue,lgl);
|
||||
linphone_gtk_log_file(lev, msg);
|
||||
g_static_mutex_unlock(&log_mutex);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -811,4 +811,10 @@ int sal_lines_get_value(const char *data, const char *key, char *value, size_t v
|
|||
|
||||
belle_sip_stack_t *sal_get_belle_sip_stack(Sal *sal);
|
||||
char* sal_op_get_public_uri(SalOp *sal);
|
||||
|
||||
unsigned long sal_begin_background_task(const char *name, void (*max_time_reached)(void *), void *data);
|
||||
void sal_end_background_task(unsigned long id);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue