mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-30 09:49:26 +00:00
implements reporting of declined calls
This commit is contained in:
parent
7434d5250b
commit
740dbb9041
7 changed files with 85 additions and 39 deletions
|
|
@ -444,8 +444,10 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de
|
|||
}
|
||||
linphone_call_stop_media_streams (call);
|
||||
if (sr!=SalReasonDeclined) linphone_call_set_state(call,LinphoneCallError,msg);
|
||||
else linphone_call_set_state(call,LinphoneCallEnd,"Call declined.");
|
||||
|
||||
else{
|
||||
call->reason=LinphoneReasonDeclined;
|
||||
linphone_call_set_state(call,LinphoneCallEnd,"Call declined.");
|
||||
}
|
||||
}
|
||||
|
||||
static void auth_requested(SalOp *h, const char *realm, const char *username){
|
||||
|
|
@ -485,7 +487,7 @@ static void register_success(SalOp *op, bool_t registered){
|
|||
char *msg;
|
||||
|
||||
cfg->registered=registered;
|
||||
linphone_proxy_config_set_error(cfg,LinphoneErrorNone);
|
||||
linphone_proxy_config_set_error(cfg,LinphoneReasonNone);
|
||||
linphone_proxy_config_set_state(cfg, registered ? LinphoneRegistrationOk : LinphoneRegistrationCleared ,
|
||||
registered ? "Registration sucessful" : "Unregistration done");
|
||||
if (lc->vtable.display_status){
|
||||
|
|
@ -514,9 +516,9 @@ static void register_failure(SalOp *op, SalError error, SalReason reason, const
|
|||
ms_free(msg);
|
||||
}
|
||||
if (error== SalErrorFailure && reason == SalReasonForbidden) {
|
||||
linphone_proxy_config_set_error(cfg, LinphoneErrorBadCredentials);
|
||||
linphone_proxy_config_set_error(cfg, LinphoneReasonBadCredentials);
|
||||
} else if (error == SalErrorNoResponse) {
|
||||
linphone_proxy_config_set_error(cfg, LinphoneErrorNoResponse);
|
||||
linphone_proxy_config_set_error(cfg, LinphoneReasonNoResponse);
|
||||
}
|
||||
linphone_proxy_config_set_state(cfg,LinphoneRegistrationFailed,details);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,7 +216,10 @@ static void linphone_call_set_terminated(LinphoneCall *call){
|
|||
|
||||
linphone_core_update_allocated_audio_bandwidth(lc);
|
||||
if (call->state==LinphoneCallEnd){
|
||||
status=LinphoneCallSuccess;
|
||||
if (call->reason==LinphoneReasonDeclined){
|
||||
status=LinphoneCallDeclined;
|
||||
}
|
||||
else status=LinphoneCallSuccess;
|
||||
|
||||
}
|
||||
linphone_call_log_completed(call->log,call, status);
|
||||
|
|
@ -384,6 +387,13 @@ LinphoneCallState linphone_call_get_state(const LinphoneCall *call){
|
|||
return call->state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the reason for a call termination (either error or normal termination)
|
||||
**/
|
||||
LinphoneReason linphone_call_get_reason(const LinphoneCall *call){
|
||||
return call->reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user_pointer in the LinphoneCall
|
||||
*
|
||||
|
|
|
|||
|
|
@ -946,6 +946,14 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta
|
|||
linphone_core_assign_payload_type(&payload_type_ilbc,113,"mode=30");
|
||||
linphone_core_assign_payload_type(&payload_type_amr,114,"octet-align=1");
|
||||
|
||||
#if defined(ANDROID) || defined (__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||
/*shorten the DNS lookup time and send more retransmissions on mobiles:
|
||||
- to workaround potential packet losses
|
||||
- to avoid hanging for 30 seconds when the network doesn't work despite the phone thinks it does.
|
||||
*/
|
||||
_linphone_core_configure_resolver();
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NONSTANDARD_GSM
|
||||
{
|
||||
PayloadType *pt;
|
||||
|
|
@ -2332,7 +2340,9 @@ int linphone_core_terminate_call(LinphoneCore *lc, LinphoneCall *the_call)
|
|||
call = the_call;
|
||||
}
|
||||
sal_call_terminate(call->op);
|
||||
|
||||
if (call->state==LinphoneCallIncomingReceived){
|
||||
call->reason=LinphoneReasonDeclined;
|
||||
}
|
||||
/*stop ringing*/
|
||||
if (lc->ringstream!=NULL) {
|
||||
ring_stop(lc->ringstream);
|
||||
|
|
@ -4011,14 +4021,16 @@ LinphoneCallParams *linphone_core_create_default_call_parameters(LinphoneCore *l
|
|||
return p;
|
||||
}
|
||||
|
||||
const char *linphone_error_to_string(LinphoneError err){
|
||||
const char *linphone_error_to_string(LinphoneReason err){
|
||||
switch(err){
|
||||
case LinphoneErrorNone:
|
||||
case LinphoneReasonNone:
|
||||
return "No error";
|
||||
case LinphoneErrorNoResponse:
|
||||
case LinphoneReasonNoResponse:
|
||||
return "No response";
|
||||
case LinphoneErrorBadCredentials:
|
||||
case LinphoneReasonBadCredentials:
|
||||
return "Bad credentials";
|
||||
case LinphoneReasonDeclined:
|
||||
return "Call declined";
|
||||
}
|
||||
return "unknown error";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,7 +131,8 @@ typedef enum _LinphoneCallDir LinphoneCallDir;
|
|||
typedef enum _LinphoneCallStatus {
|
||||
LinphoneCallSuccess, /**< The call was sucessful*/
|
||||
LinphoneCallAborted, /**< The call was aborted */
|
||||
LinphoneCallMissed /**< The call was missed (unanswered)*/
|
||||
LinphoneCallMissed, /**< The call was missed (unanswered)*/
|
||||
LinphoneCallDeclined /**< The call was declined, either locally or by remote end*/
|
||||
} LinphoneCallStatus;
|
||||
|
||||
/**
|
||||
|
|
@ -182,15 +183,16 @@ void linphone_call_params_destroy(LinphoneCallParams *cp);
|
|||
/**
|
||||
* Enum describing failure reasons.
|
||||
**/
|
||||
enum _LinphoneError{
|
||||
LinphoneErrorNone,
|
||||
LinphoneErrorNoResponse, /**<No response received from remote*/
|
||||
LinphoneErrorBadCredentials /**<Authentication failed due to bad or missing credentials*/
|
||||
enum _LinphoneReason{
|
||||
LinphoneReasonNone,
|
||||
LinphoneReasonNoResponse, /**<No response received from remote*/
|
||||
LinphoneReasonBadCredentials, /**<Authentication failed due to bad or missing credentials*/
|
||||
LinphoneReasonDeclined, /**<The call has been declined*/
|
||||
};
|
||||
|
||||
typedef enum _LinphoneError LinphoneError;
|
||||
typedef enum _LinphoneReason LinphoneReason;
|
||||
|
||||
const char *linphone_error_to_string(LinphoneError err);
|
||||
const char *linphone_reason_to_string(LinphoneReason err);
|
||||
|
||||
/**
|
||||
* The LinphoneCall object represents a call issued or received by the LinphoneCore
|
||||
|
|
@ -200,21 +202,21 @@ typedef struct _LinphoneCall LinphoneCall;
|
|||
|
||||
typedef enum _LinphoneCallState{
|
||||
LinphoneCallIdle,
|
||||
LinphoneCallIncomingReceived,
|
||||
LinphoneCallOutgoingInit,
|
||||
LinphoneCallOutgoingProgress,
|
||||
LinphoneCallOutgoingRinging,
|
||||
LinphoneCallOutgoingEarlyMedia,
|
||||
LinphoneCallConnected,
|
||||
LinphoneCallStreamsRunning,
|
||||
LinphoneCallPausing,
|
||||
LinphoneCallPaused,
|
||||
LinphoneCallResuming,
|
||||
LinphoneCallRefered,
|
||||
LinphoneCallError,
|
||||
LinphoneCallEnd,
|
||||
LinphoneCallPausedByRemote,
|
||||
LinphoneCallUpdatedByRemote /**<used when video is asked by remote */
|
||||
LinphoneCallIncomingReceived, /**<This is a new incoming call */
|
||||
LinphoneCallOutgoingInit, /**<An outgoing call is started */
|
||||
LinphoneCallOutgoingProgress, /**<An outgoing call is in progress */
|
||||
LinphoneCallOutgoingRinging, /**<An outgoing call is ringing at remote end */
|
||||
LinphoneCallOutgoingEarlyMedia, /**<An outgoing call is proposed early media */
|
||||
LinphoneCallConnected, /**<Connected, the call is answered */
|
||||
LinphoneCallStreamsRunning, /**<The media streams are established and running*/
|
||||
LinphoneCallPausing, /**<The call is pausing at the initiative of local end */
|
||||
LinphoneCallPaused, /**< The call is paused, remote end has accepted the pause */
|
||||
LinphoneCallResuming, /**<The call is being resumed by local end*/
|
||||
LinphoneCallRefered, /**<The call is being transfered to another party, resulting in a new outgoing call to follow immediately*/
|
||||
LinphoneCallError, /**<The call encountered an error*/
|
||||
LinphoneCallEnd, /**<The call ended normally*/
|
||||
LinphoneCallPausedByRemote, /**<The call is paused by remote end*/
|
||||
LinphoneCallUpdatedByRemote /**<The call's parameters are updated, used for example when video is asked by remote */
|
||||
} LinphoneCallState;
|
||||
|
||||
const char *linphone_call_state_to_string(LinphoneCallState cs);
|
||||
|
|
@ -236,7 +238,7 @@ const LinphoneCallParams * linphone_call_get_current_params(const LinphoneCall *
|
|||
void linphone_call_enable_camera(LinphoneCall *lc, bool_t enabled);
|
||||
bool_t linphone_call_camera_enabled(const LinphoneCall *lc);
|
||||
int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file);
|
||||
LinphoneError linphone_call_get_error(const LinphoneCall *call);
|
||||
LinphoneReason linphone_call_get_reason(const LinphoneCall *call);
|
||||
const char *linphone_call_get_remote_user_agent(LinphoneCall *call);
|
||||
void *linphone_call_get_user_pointer(LinphoneCall *call);
|
||||
void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer);
|
||||
|
|
@ -315,7 +317,7 @@ struct _LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig
|
|||
bool_t linphone_proxy_config_get_dial_escape_plus(const LinphoneProxyConfig *cfg);
|
||||
const char * linphone_proxy_config_get_dial_prefix(const LinphoneProxyConfig *cfg);
|
||||
|
||||
LinphoneError linphone_proxy_config_get_error(const LinphoneProxyConfig *cfg);
|
||||
LinphoneReason linphone_proxy_config_get_error(const LinphoneProxyConfig *cfg);
|
||||
|
||||
/* destruction is called automatically when removing the proxy config */
|
||||
void linphone_proxy_config_destroy(LinphoneProxyConfig *cfg);
|
||||
|
|
|
|||
|
|
@ -775,3 +775,19 @@ int linphone_core_get_local_ip_for(int type, const char *dest, char *result){
|
|||
else dest="2a00:1450:8002::68";
|
||||
return get_local_ip_for_with_connect(type,dest,result);
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
#include <resolv.h>
|
||||
|
||||
void _linphone_core_configure_resolver(){
|
||||
res_init();
|
||||
_res.retrans=1; /*retransmit every second*/
|
||||
_res.retry=2; /*only two times per DNS server*/
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void _linphone_core_configure_resolver(){
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ struct _LinphoneCall
|
|||
time_t start_time; /*time at which the call was initiated*/
|
||||
time_t media_start_time; /*time at which it was accepted, media streams established*/
|
||||
LinphoneCallState state;
|
||||
LinphoneReason reason;
|
||||
int refcnt;
|
||||
void * user_pointer;
|
||||
int audio_port;
|
||||
|
|
@ -199,7 +200,7 @@ void linphone_core_stop_waiting(LinphoneCore *lc);
|
|||
int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy);
|
||||
void linphone_core_start_refered_call(LinphoneCore *lc, LinphoneCall *call);
|
||||
extern SalCallbacks linphone_sal_callbacks;
|
||||
void linphone_proxy_config_set_error(LinphoneProxyConfig *cfg,LinphoneError error);
|
||||
void linphone_proxy_config_set_error(LinphoneProxyConfig *cfg, LinphoneReason error);
|
||||
|
||||
struct _LinphoneProxyConfig
|
||||
{
|
||||
|
|
@ -224,7 +225,7 @@ struct _LinphoneProxyConfig
|
|||
bool_t dial_escape_plus;
|
||||
void* user_data;
|
||||
time_t deletion_date;
|
||||
LinphoneError error;
|
||||
LinphoneReason error;
|
||||
};
|
||||
|
||||
struct _LinphoneAuthInfo
|
||||
|
|
@ -439,6 +440,7 @@ SalMediaDescription *create_local_media_description(LinphoneCore *lc,
|
|||
LinphoneCall *call, bool_t with_video, bool_t only_one_codec);
|
||||
|
||||
#define linphone_core_ready(lc) ((lc)->state!=LinphoneGlobalStartup)
|
||||
void _linphone_core_configure_resolver();
|
||||
|
||||
#define HOLD_OFF (0)
|
||||
#define HOLD_ON (1)
|
||||
|
|
|
|||
|
|
@ -841,10 +841,12 @@ LinphoneRegistrationState linphone_proxy_config_get_state(const LinphoneProxyCon
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
LinphoneError linphone_proxy_config_get_error(const LinphoneProxyConfig *cfg) {
|
||||
|
||||
LinphoneReason linphone_proxy_config_get_error(const LinphoneProxyConfig *cfg) {
|
||||
return cfg->error;
|
||||
}
|
||||
void linphone_proxy_config_set_error(LinphoneProxyConfig *cfg,LinphoneError error) {
|
||||
|
||||
void linphone_proxy_config_set_error(LinphoneProxyConfig *cfg,LinphoneReason error) {
|
||||
cfg->error = error;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue