}
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){
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){
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);
}
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);
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
*
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;
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);
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";
}
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;
/**
/**
* 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
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);
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);
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);
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
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;
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
{
bool_t dial_escape_plus;
void* user_data;
time_t deletion_date;
- LinphoneError error;
+ LinphoneReason error;
};
struct _LinphoneAuthInfo
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)
}
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;
}