mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 12:38:09 +00:00
Merge branch 'master' of git://git.linphone.org/linphone
This commit is contained in:
commit
9df45abebd
36 changed files with 1935 additions and 463 deletions
|
|
@ -63,6 +63,7 @@ cd /c/sources
|
|||
|
||||
Building belle-sip
|
||||
******************
|
||||
* make sure that java version 1.6 is available in the PATH. java-1.7 will not work with antlr generator.
|
||||
* download the sources with msys-git shell using the following command:
|
||||
$ git clone git://git.linphone.org/belle-sip.git
|
||||
* compile and install
|
||||
|
|
|
|||
|
|
@ -378,6 +378,8 @@ void linphone_core_remove_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *in
|
|||
|
||||
/**
|
||||
* Returns an unmodifiable list of currently entered LinphoneAuthInfo.
|
||||
* @param[in] lc The LinphoneCore object
|
||||
* @return \mslist{LinphoneAuthInfo}
|
||||
**/
|
||||
const MSList *linphone_core_get_auth_info_list(const LinphoneCore *lc){
|
||||
return lc->auth_info;
|
||||
|
|
|
|||
|
|
@ -843,8 +843,8 @@ static void register_success(SalOp *op, bool_t registered){
|
|||
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)sal_op_get_user_pointer(op);
|
||||
char *msg;
|
||||
|
||||
if (!cfg || cfg->deletion_date!=0){
|
||||
ms_message("Registration success for removed proxy config, ignored");
|
||||
if (!cfg){
|
||||
ms_message("Registration success for deleted proxy config, ignored");
|
||||
return;
|
||||
}
|
||||
linphone_proxy_config_set_state(cfg, registered ? LinphoneRegistrationOk : LinphoneRegistrationCleared ,
|
||||
|
|
@ -868,10 +868,6 @@ static void register_failure(SalOp *op){
|
|||
ms_warning("Registration failed for unknown proxy config.");
|
||||
return ;
|
||||
}
|
||||
if (cfg->deletion_date!=0){
|
||||
ms_message("Registration failed for removed proxy config, ignored");
|
||||
return;
|
||||
}
|
||||
if (details==NULL)
|
||||
details=_("no response timeout");
|
||||
|
||||
|
|
|
|||
|
|
@ -246,8 +246,8 @@ bool_t linphone_core_chat_enabled(const LinphoneCore *lc){
|
|||
|
||||
/**
|
||||
* Returns an list of chat rooms
|
||||
* @param lc #LinphoneCore object
|
||||
* @return A list of #LinphoneChatRoom
|
||||
* @param[in] lc #LinphoneCore object
|
||||
* @return \mslist{LinphoneChatRoom}
|
||||
**/
|
||||
MSList* linphone_core_get_chat_rooms(LinphoneCore *lc) {
|
||||
return lc->chatrooms;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ DETAILS_AT_TOP = NO
|
|||
INHERIT_DOCS = YES
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
ALIASES = mslist{1}="A list of \ref \1 objects. \xmlonly <mslist>\1</mslist> \endxmlonly"
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
SUBGROUPING = YES
|
||||
|
|
|
|||
|
|
@ -236,6 +236,14 @@ static MSList *make_codec_list(LinphoneCore *lc, const MSList *codecs, int bandw
|
|||
for(it=codecs;it!=NULL;it=it->next){
|
||||
PayloadType *pt=(PayloadType*)it->data;
|
||||
if (pt->flags & PAYLOAD_TYPE_ENABLED){
|
||||
int sample_rate = payload_type_get_rate(pt);
|
||||
|
||||
if( strcasecmp("G722",pt->mime_type) == 0 ){
|
||||
/* G722 spec says 8000 but the codec actually requires 16000 */
|
||||
ms_debug("Correcting sample rate for G722");
|
||||
sample_rate = 16000;
|
||||
}
|
||||
|
||||
if (bandwidth_limit>0 && !linphone_core_is_payload_type_usable_for_bandwidth(lc,pt,bandwidth_limit)){
|
||||
ms_message("Codec %s/%i eliminated because of audio bandwidth constraint of %i kbit/s",
|
||||
pt->mime_type,pt->clock_rate,bandwidth_limit);
|
||||
|
|
@ -244,7 +252,7 @@ static MSList *make_codec_list(LinphoneCore *lc, const MSList *codecs, int bandw
|
|||
if (linphone_core_check_payload_type_usability(lc,pt)){
|
||||
l=ms_list_append(l,payload_type_clone(pt));
|
||||
nb++;
|
||||
if (max_sample_rate && payload_type_get_rate(pt)>*max_sample_rate) *max_sample_rate=payload_type_get_rate(pt);
|
||||
if (max_sample_rate && sample_rate>*max_sample_rate) *max_sample_rate=sample_rate;
|
||||
}
|
||||
}
|
||||
if ((nb_codecs_limit > 0) && (nb >= nb_codecs_limit)) break;
|
||||
|
|
@ -305,7 +313,7 @@ static void setup_encryption_keys(LinphoneCall *call, SalMediaDescription *md){
|
|||
for(i=0; i<md->nb_streams; i++) {
|
||||
if (!sal_stream_description_active(&md->streams[i])) continue;
|
||||
if (sal_stream_description_has_srtp(&md->streams[i]) == TRUE) {
|
||||
if (keep_srtp_keys && old_md && sal_stream_description_has_srtp(&old_md->streams[i]) == TRUE){
|
||||
if (keep_srtp_keys && old_md && (sal_stream_description_active(&old_md->streams[i]) == TRUE) && (sal_stream_description_has_srtp(&old_md->streams[i]) == TRUE)) {
|
||||
int j;
|
||||
ms_message("Keeping same crypto keys.");
|
||||
for(j=0;j<SAL_CRYPTO_ALGO_MAX;++j){
|
||||
|
|
@ -562,8 +570,6 @@ static void port_config_set(LinphoneCall *call, int stream_index, int min_port,
|
|||
static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from, LinphoneAddress *to){
|
||||
int min_port, max_port;
|
||||
ms_message("New LinphoneCall [%p] initialized (LinphoneCore version: %s)",call,linphone_core_get_version());
|
||||
call->magic=linphone_call_magic;
|
||||
call->refcnt=1;
|
||||
call->state=LinphoneCallIdle;
|
||||
call->transfer_state = LinphoneCallIdle;
|
||||
call->media_start_time=0;
|
||||
|
|
@ -639,13 +645,79 @@ static void linphone_call_outgoing_select_ip_version(LinphoneCall *call, Linphon
|
|||
}else call->af=AF_INET;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill the local ip that routes to the internet according to the destination, or guess it by other special means (upnp).
|
||||
*/
|
||||
static void linphone_call_get_local_ip(LinphoneCall *call, const LinphoneAddress *remote_addr){
|
||||
const char *ip;
|
||||
int af = call->af;
|
||||
const char *dest = NULL;
|
||||
if (call->dest_proxy == NULL) {
|
||||
struct addrinfo hints;
|
||||
struct addrinfo *res = NULL;
|
||||
int err;
|
||||
const char *domain = linphone_address_get_domain(remote_addr);
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
err = getaddrinfo(domain, NULL, &hints, &res);
|
||||
if (err == 0) {
|
||||
dest = domain;
|
||||
}
|
||||
}
|
||||
if (linphone_core_get_firewall_policy(call->core)==LinphonePolicyUseNatAddress
|
||||
&& (ip=linphone_core_get_nat_address_resolved(call->core))!=NULL){
|
||||
strncpy(call->localip,ip,LINPHONE_IPADDR_SIZE);
|
||||
return;
|
||||
}
|
||||
#ifdef BUILD_UPNP
|
||||
else if (call->core->upnp != NULL && linphone_core_get_firewall_policy(call->core)==LinphonePolicyUseUpnp &&
|
||||
linphone_upnp_context_get_state(call->core->upnp) == LinphoneUpnpStateOk) {
|
||||
ip = linphone_upnp_context_get_external_ipaddress(call->core->upnp);
|
||||
strncpy(call->localip,ip,LINPHONE_IPADDR_SIZE);
|
||||
return;
|
||||
}
|
||||
#endif //BUILD_UPNP
|
||||
if (af==AF_UNSPEC){
|
||||
if (linphone_core_ipv6_enabled(call->core)){
|
||||
bool_t has_ipv6;
|
||||
has_ipv6=linphone_core_get_local_ip_for(AF_INET6,dest,call->localip)==0;
|
||||
if (strcmp(call->localip,"::1")!=0)
|
||||
return; /*this machine has real ipv6 connectivity*/
|
||||
if (linphone_core_get_local_ip_for(AF_INET,dest,call->localip)==0 && strcmp(call->localip,"127.0.0.1")!=0)
|
||||
return; /*this machine has only ipv4 connectivity*/
|
||||
if (has_ipv6){
|
||||
/*this machine has only local loopback for both ipv4 and ipv6, so prefer ipv6*/
|
||||
strncpy(call->localip,"::1",LINPHONE_IPADDR_SIZE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/*in all other cases use IPv4*/
|
||||
af=AF_INET;
|
||||
}
|
||||
if (linphone_core_get_local_ip_for(af,dest,call->localip)==0)
|
||||
return;
|
||||
}
|
||||
|
||||
static void linphone_call_destroy(LinphoneCall *obj);
|
||||
|
||||
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneCall);
|
||||
|
||||
BELLE_SIP_INSTANCIATE_VPTR(LinphoneCall, belle_sip_object_t,
|
||||
(belle_sip_object_destroy_t)linphone_call_destroy,
|
||||
NULL, // clone
|
||||
NULL, // marshal
|
||||
FALSE
|
||||
);
|
||||
|
||||
LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, const LinphoneCallParams *params, LinphoneProxyConfig *cfg){
|
||||
LinphoneCall *call=ms_new0(LinphoneCall,1);
|
||||
LinphoneCall *call = belle_sip_object_new(LinphoneCall);
|
||||
|
||||
call->dir=LinphoneCallOutgoing;
|
||||
call->core=lc;
|
||||
linphone_call_outgoing_select_ip_version(call,to,cfg);
|
||||
linphone_core_get_local_ip(lc,call->af,call->localip);
|
||||
linphone_call_get_local_ip(call, to);
|
||||
linphone_call_init_common(call,from,to);
|
||||
_linphone_call_params_copy(&call->params,params);
|
||||
|
||||
|
|
@ -700,7 +772,7 @@ void linphone_call_set_compatible_incoming_call_parameters(LinphoneCall *call, c
|
|||
}
|
||||
|
||||
LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op){
|
||||
LinphoneCall *call=ms_new0(LinphoneCall,1);
|
||||
LinphoneCall *call = belle_sip_object_new(LinphoneCall);
|
||||
const SalMediaDescription *md;
|
||||
LinphoneFirewallPolicy fpol;
|
||||
|
||||
|
|
@ -731,7 +803,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
|
|||
}
|
||||
|
||||
linphone_address_clean(from);
|
||||
linphone_core_get_local_ip(lc,call->af,call->localip);
|
||||
linphone_call_get_local_ip(call, from);
|
||||
linphone_call_init_common(call, from, to);
|
||||
call->log->call_id=ms_strdup(sal_op_get_call_id(op)); /*must be known at that time*/
|
||||
call->dest_proxy = linphone_core_lookup_known_proxy(call->core, to);
|
||||
|
|
@ -991,7 +1063,6 @@ static void linphone_call_destroy(LinphoneCall *obj)
|
|||
linphone_call_params_uninit(&obj->params);
|
||||
linphone_call_params_uninit(&obj->current_params);
|
||||
sal_error_info_reset(&obj->non_op_error);
|
||||
ms_free(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -999,27 +1070,13 @@ static void linphone_call_destroy(LinphoneCall *obj)
|
|||
* @{
|
||||
**/
|
||||
|
||||
/**
|
||||
* Increments the call 's reference count.
|
||||
* An application that wishes to retain a pointer to call object
|
||||
* must use this function to unsure the pointer remains
|
||||
* valid. Once the application no more needs this pointer,
|
||||
* it must call linphone_call_unref().
|
||||
**/
|
||||
LinphoneCall * linphone_call_ref(LinphoneCall *obj){
|
||||
obj->refcnt++;
|
||||
belle_sip_object_ref(obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrements the call object reference count.
|
||||
* See linphone_call_ref().
|
||||
**/
|
||||
void linphone_call_unref(LinphoneCall *obj){
|
||||
obj->refcnt--;
|
||||
if (obj->refcnt==0){
|
||||
linphone_call_destroy(obj);
|
||||
}
|
||||
belle_sip_object_unref(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1146,7 +1203,7 @@ const LinphoneErrorInfo *linphone_call_get_error_info(const LinphoneCall *call){
|
|||
*
|
||||
* return user_pointer an opaque user pointer that can be retrieved at any time
|
||||
**/
|
||||
void *linphone_call_get_user_pointer(LinphoneCall *call)
|
||||
void *linphone_call_get_user_data(const LinphoneCall *call)
|
||||
{
|
||||
return call->user_pointer;
|
||||
}
|
||||
|
|
@ -1158,7 +1215,7 @@ void *linphone_call_get_user_pointer(LinphoneCall *call)
|
|||
*
|
||||
* the user_pointer is an opaque user pointer that can be retrieved at any time in the LinphoneCall
|
||||
**/
|
||||
void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer)
|
||||
void linphone_call_set_user_data(LinphoneCall *call, void *user_pointer)
|
||||
{
|
||||
call->user_pointer = user_pointer;
|
||||
}
|
||||
|
|
@ -1342,17 +1399,17 @@ void linphone_call_params_enable_video(LinphoneCallParams *cp, bool_t enabled){
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the audio codec used in the call, described as a PayloadType structure.
|
||||
* Returns the audio codec used in the call, described as a LinphonePayloadType structure.
|
||||
**/
|
||||
const PayloadType* linphone_call_params_get_used_audio_codec(const LinphoneCallParams *cp) {
|
||||
const LinphonePayloadType* linphone_call_params_get_used_audio_codec(const LinphoneCallParams *cp) {
|
||||
return cp->audio_codec;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the video codec used in the call, described as a PayloadType structure.
|
||||
* Returns the video codec used in the call, described as a LinphonePayloadType structure.
|
||||
**/
|
||||
const PayloadType* linphone_call_params_get_used_video_codec(const LinphoneCallParams *cp) {
|
||||
const LinphonePayloadType* linphone_call_params_get_used_video_codec(const LinphoneCallParams *cp) {
|
||||
return cp->video_codec;
|
||||
}
|
||||
|
||||
|
|
@ -1679,6 +1736,7 @@ int linphone_call_prepare_ice(LinphoneCall *call, bool_t incoming_offer){
|
|||
void linphone_call_init_audio_stream(LinphoneCall *call){
|
||||
LinphoneCore *lc=call->core;
|
||||
AudioStream *audiostream;
|
||||
const char *location;
|
||||
int dscp;
|
||||
|
||||
if (call->audiostream != NULL) return;
|
||||
|
|
@ -1702,6 +1760,13 @@ void linphone_call_init_audio_stream(LinphoneCall *call){
|
|||
else if (strcasecmp(type,"full")==0)
|
||||
audio_stream_enable_echo_limiter(audiostream,ELControlFull);
|
||||
}
|
||||
|
||||
/* equalizer location in the graph: 'mic' = in input graph, otherwise in output graph.
|
||||
Any other value than mic will default to output graph for compatibility */
|
||||
location = lp_config_get_string(lc->config,"sound","eq_location","hp");
|
||||
audiostream->eq_loc = (strcasecmp(location,"mic") == 0) ? MSEqualizerMic : MSEqualizerHP;
|
||||
ms_error("Equalizer location: %s", location);
|
||||
|
||||
audio_stream_enable_gain_control(audiostream,TRUE);
|
||||
if (linphone_core_echo_cancellation_enabled(lc)){
|
||||
int len,delay,framesize;
|
||||
|
|
@ -2257,7 +2322,7 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna
|
|||
}
|
||||
}else ms_warning("No video stream accepted.");
|
||||
}else{
|
||||
ms_warning("No valid video stream defined.");
|
||||
ms_message("No valid video stream defined.");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -288,14 +288,14 @@ const char *linphone_call_log_get_call_id(const LinphoneCallLog *cl){
|
|||
/**
|
||||
* Assign a user pointer to the call log.
|
||||
**/
|
||||
void linphone_call_log_set_user_pointer(LinphoneCallLog *cl, void *up){
|
||||
void linphone_call_log_set_user_data(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){
|
||||
void *linphone_call_log_get_user_data(const LinphoneCallLog *cl){
|
||||
return cl->user_pointer;
|
||||
}
|
||||
|
||||
|
|
@ -1466,6 +1466,8 @@ LinphoneCore *linphone_core_new_with_config(const LinphoneCoreVTable *vtable, st
|
|||
|
||||
/**
|
||||
* Returns the list of available audio codecs.
|
||||
* @param[in] lc The LinphoneCore object
|
||||
* @return \mslist{PayloadType}
|
||||
*
|
||||
* This list is unmodifiable. The ->data field of the MSList points a PayloadType
|
||||
* structure holding the codec information.
|
||||
|
|
@ -1480,6 +1482,8 @@ const MSList *linphone_core_get_audio_codecs(const LinphoneCore *lc)
|
|||
|
||||
/**
|
||||
* Returns the list of available video codecs.
|
||||
* @param[in] lc The LinphoneCore object
|
||||
* @return \mslist{PayloadType}
|
||||
*
|
||||
* This list is unmodifiable. The ->data field of the MSList points a PayloadType
|
||||
* structure holding the codec information.
|
||||
|
|
@ -1518,44 +1522,6 @@ int linphone_core_set_primary_contact(LinphoneCore *lc, const char *contact)
|
|||
}
|
||||
|
||||
|
||||
/*Returns the local ip that routes to the internet, or guessed by other special means (upnp)*/
|
||||
/*result must be an array of chars at least LINPHONE_IPADDR_SIZE */
|
||||
void linphone_core_get_local_ip(LinphoneCore *lc, int af, char *result){
|
||||
const char *ip;
|
||||
if (linphone_core_get_firewall_policy(lc)==LinphonePolicyUseNatAddress
|
||||
&& (ip=linphone_core_get_nat_address_resolved(lc))!=NULL){
|
||||
strncpy(result,ip,LINPHONE_IPADDR_SIZE);
|
||||
return;
|
||||
}
|
||||
#ifdef BUILD_UPNP
|
||||
else if (lc->upnp != NULL && linphone_core_get_firewall_policy(lc)==LinphonePolicyUseUpnp &&
|
||||
linphone_upnp_context_get_state(lc->upnp) == LinphoneUpnpStateOk) {
|
||||
ip = linphone_upnp_context_get_external_ipaddress(lc->upnp);
|
||||
strncpy(result,ip,LINPHONE_IPADDR_SIZE);
|
||||
return;
|
||||
}
|
||||
#endif //BUILD_UPNP
|
||||
if (af==AF_UNSPEC){
|
||||
if (linphone_core_ipv6_enabled(lc)){
|
||||
bool_t has_ipv6;
|
||||
has_ipv6=linphone_core_get_local_ip_for(AF_INET6,NULL,result)==0;
|
||||
if (strcmp(result,"::1")!=0)
|
||||
return; /*this machine has real ipv6 connectivity*/
|
||||
if (linphone_core_get_local_ip_for(AF_INET,NULL,result)==0 && strcmp(result,"127.0.0.1")!=0)
|
||||
return; /*this machine has only ipv4 connectivity*/
|
||||
if (has_ipv6){
|
||||
/*this machine has only local loopback for both ipv4 and ipv6, so prefer ipv6*/
|
||||
strncpy(result,"::1",LINPHONE_IPADDR_SIZE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/*in all other cases use IPv4*/
|
||||
af=AF_INET;
|
||||
}
|
||||
if (linphone_core_get_local_ip_for(af,NULL,result)==0)
|
||||
return;
|
||||
}
|
||||
|
||||
static void update_primary_contact(LinphoneCore *lc){
|
||||
char *guessed=NULL;
|
||||
char tmp[LINPHONE_IPADDR_SIZE];
|
||||
|
|
@ -1570,7 +1536,7 @@ static void update_primary_contact(LinphoneCore *lc){
|
|||
ms_error("Could not parse identity contact !");
|
||||
url=linphone_address_new("sip:unknown@unkwownhost");
|
||||
}
|
||||
linphone_core_get_local_ip(lc, AF_UNSPEC, tmp);
|
||||
linphone_core_get_local_ip_for(AF_UNSPEC, NULL, tmp);
|
||||
if (strcmp(tmp,"127.0.0.1")==0 || strcmp(tmp,"::1")==0 ){
|
||||
ms_warning("Local loopback network only !");
|
||||
lc->sip_conf.loopback_only=TRUE;
|
||||
|
|
@ -1631,6 +1597,9 @@ LinphoneAddress *linphone_core_get_primary_contact_parsed(LinphoneCore *lc){
|
|||
|
||||
/**
|
||||
* Sets the list of audio codecs.
|
||||
* @param[in] lc The LinphoneCore object
|
||||
* @param[in] codecs \mslist{PayloadType}
|
||||
* @return 0
|
||||
*
|
||||
* @ingroup media_parameters
|
||||
* The list is taken by the LinphoneCore thus the application should not free it.
|
||||
|
|
@ -1646,6 +1615,9 @@ int linphone_core_set_audio_codecs(LinphoneCore *lc, MSList *codecs)
|
|||
|
||||
/**
|
||||
* Sets the list of video codecs.
|
||||
* @param[in] lc The LinphoneCore object
|
||||
* @param[in] codecs \mslist{PayloadType}
|
||||
* @return 0
|
||||
*
|
||||
* @ingroup media_parameters
|
||||
* The list is taken by the LinphoneCore thus the application should not free it.
|
||||
|
|
@ -2160,7 +2132,7 @@ static void monitor_network_state(LinphoneCore *lc, time_t curtime){
|
|||
|
||||
/* only do the network up checking every five seconds */
|
||||
if (lc->network_last_check==0 || (curtime-lc->network_last_check)>=5){
|
||||
linphone_core_get_local_ip(lc,AF_UNSPEC,newip);
|
||||
linphone_core_get_local_ip_for(AF_UNSPEC,NULL,newip);
|
||||
if (strcmp(newip,"::1")!=0 && strcmp(newip,"127.0.0.1")!=0){
|
||||
new_status=TRUE;
|
||||
}else new_status=FALSE; /*no network*/
|
||||
|
|
@ -2190,9 +2162,10 @@ static void proxy_update(LinphoneCore *lc){
|
|||
for(elem=lc->sip_conf.deleted_proxies;elem!=NULL;elem=next){
|
||||
LinphoneProxyConfig* cfg = (LinphoneProxyConfig*)elem->data;
|
||||
next=elem->next;
|
||||
if (ms_time(NULL) - cfg->deletion_date > 5) {
|
||||
if (ms_time(NULL) - cfg->deletion_date > 32) {
|
||||
lc->sip_conf.deleted_proxies =ms_list_remove_link(lc->sip_conf.deleted_proxies,elem);
|
||||
ms_message("clearing proxy config for [%s]",linphone_proxy_config_get_addr(cfg));
|
||||
ms_message("Proxy config for [%s] is definitely removed from core.",linphone_proxy_config_get_addr(cfg));
|
||||
_linphone_proxy_config_release_ops(cfg);
|
||||
linphone_proxy_config_destroy(cfg);
|
||||
}
|
||||
}
|
||||
|
|
@ -3279,6 +3252,7 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho
|
|||
#ifdef VIDEO_ENABLED
|
||||
if ((call->videostream != NULL) && (call->state == LinphoneCallStreamsRunning)) {
|
||||
video_stream_set_sent_video_size(call->videostream,linphone_core_get_preferred_video_size(lc));
|
||||
video_stream_set_fps(call->videostream, linphone_core_get_preferred_framerate(lc));
|
||||
if (call->camera_enabled && call->videostream->cam!=lc->video_conf.device){
|
||||
video_stream_change_camera(call->videostream,lc->video_conf.device);
|
||||
}else video_stream_update_video_params(call->videostream);
|
||||
|
|
@ -3671,6 +3645,8 @@ int linphone_core_terminate_all_calls(LinphoneCore *lc){
|
|||
|
||||
/**
|
||||
* Returns the current list of calls.
|
||||
* @param[in] lc The LinphoneCore object
|
||||
* @return \mslist{LinphoneCall}
|
||||
*
|
||||
* Note that this list is read-only and might be changed by the core after a function call to linphone_core_iterate().
|
||||
* Similarly the LinphoneCall objects inside it might be destroyed without prior notice.
|
||||
|
|
@ -4813,6 +4789,8 @@ LinphoneFirewallPolicy linphone_core_get_firewall_policy(const LinphoneCore *lc)
|
|||
|
||||
/**
|
||||
* Get the list of call logs (past calls).
|
||||
* @param[in] lc The LinphoneCore object
|
||||
* @return \mslist{LinphoneCallLog}
|
||||
*
|
||||
* @ingroup call_logs
|
||||
**/
|
||||
|
|
@ -6260,8 +6238,8 @@ static PayloadType* find_payload_type_from_list(const char* type, int rate, int
|
|||
}
|
||||
|
||||
|
||||
PayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type, int rate, int channels) {
|
||||
PayloadType* result = find_payload_type_from_list(type, rate, channels, linphone_core_get_audio_codecs(lc));
|
||||
LinphonePayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type, int rate, int channels) {
|
||||
LinphonePayloadType* result = find_payload_type_from_list(type, rate, channels, linphone_core_get_audio_codecs(lc));
|
||||
if (result) {
|
||||
return result;
|
||||
} else {
|
||||
|
|
@ -6304,6 +6282,19 @@ LinphoneCallParams *linphone_core_create_default_call_parameters(LinphoneCore *l
|
|||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a LinphoneCallParams suitable for linphone_core_invite_with_params(), linphone_core_accept_call_with_params(), linphone_core_accept_early_media_with_params(),
|
||||
* linphone_core_accept_call_update().
|
||||
* The parameters are initialized according to the current LinphoneCore configuration and the current state of the LinphoneCall.
|
||||
* @param lc the LinphoneCore
|
||||
* @param call the call for which the parameters are to be build, or NULL in the case where the parameters are to be used for a new outgoing call.
|
||||
* @return a new LinphoneCallParams
|
||||
*/
|
||||
LinphoneCallParams *linphone_core_create_call_params(LinphoneCore *lc, LinphoneCall *call){
|
||||
if (!call) return linphone_core_create_default_call_parameters(lc);
|
||||
return linphone_call_params_copy(&call->params);
|
||||
}
|
||||
|
||||
const char *linphone_reason_to_string(LinphoneReason err){
|
||||
switch(err){
|
||||
case LinphoneReasonNone:
|
||||
|
|
@ -6714,3 +6705,20 @@ bool_t linphone_core_sdp_200_ack_enabled(const LinphoneCore *lc) {
|
|||
void linphone_core_set_file_transfer_server(LinphoneCore *core, const char * server_url) {
|
||||
core->file_transfer_server=ms_strdup(server_url);
|
||||
}
|
||||
|
||||
|
||||
int linphone_payload_type_get_type(const LinphonePayloadType *pt) {
|
||||
return pt->type;
|
||||
}
|
||||
|
||||
int linphone_payload_type_get_normal_bitrate(const LinphonePayloadType *pt) {
|
||||
return pt->normal_bitrate;
|
||||
}
|
||||
|
||||
char * linphone_payload_type_get_mime_type(const LinphonePayloadType *pt) {
|
||||
return pt->mime_type;
|
||||
}
|
||||
|
||||
int linphone_payload_type_get_channels(const LinphonePayloadType *pt) {
|
||||
return pt->channels;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -247,6 +247,48 @@ LinphoneDictionary* lp_config_section_to_dict( const LpConfig* lpconfig, const c
|
|||
void lp_config_load_dict_to_section( LpConfig* lpconfig, const char* section, const LinphoneDictionary* dict);
|
||||
|
||||
|
||||
/**
|
||||
* @addtogroup media_parameters
|
||||
* @{
|
||||
**/
|
||||
|
||||
/**
|
||||
* Object representing an RTP payload type.
|
||||
*/
|
||||
typedef PayloadType LinphonePayloadType;
|
||||
|
||||
/**
|
||||
* Get the type of payload.
|
||||
* @param[in] pt LinphonePayloadType object
|
||||
* @return The type of payload.
|
||||
*/
|
||||
LINPHONE_PUBLIC int linphone_payload_type_get_type(const LinphonePayloadType *pt);
|
||||
|
||||
/**
|
||||
* Get the normal bitrate in bits/s.
|
||||
* @param[in] pt LinphonePayloadType object
|
||||
* @return The normal bitrate in bits/s.
|
||||
*/
|
||||
LINPHONE_PUBLIC int linphone_payload_type_get_normal_bitrate(const LinphonePayloadType *pt);
|
||||
|
||||
/**
|
||||
* Get the mime type.
|
||||
* @param[in] pt LinphonePayloadType object
|
||||
* @return The mime type.
|
||||
*/
|
||||
LINPHONE_PUBLIC char * linphone_payload_type_get_mime_type(const LinphonePayloadType *pt);
|
||||
|
||||
/**
|
||||
* Get the number of channels.
|
||||
* @param[in] pt LinphonePayloadType object
|
||||
* @return The number of channels.
|
||||
*/
|
||||
LINPHONE_PUBLIC int linphone_payload_type_get_channels(const LinphonePayloadType *pt);
|
||||
|
||||
/**
|
||||
* @}
|
||||
**/
|
||||
|
||||
#ifdef IN_LINPHONE
|
||||
#include "linphonefriend.h"
|
||||
#include "event.h"
|
||||
|
|
@ -356,8 +398,12 @@ LINPHONE_PUBLIC bool_t linphone_call_log_video_enabled(LinphoneCallLog *cl);
|
|||
LINPHONE_PUBLIC time_t linphone_call_log_get_start_date(LinphoneCallLog *cl);
|
||||
LINPHONE_PUBLIC int linphone_call_log_get_duration(LinphoneCallLog *cl);
|
||||
LINPHONE_PUBLIC float linphone_call_log_get_quality(LinphoneCallLog *cl);
|
||||
LINPHONE_PUBLIC void linphone_call_log_set_user_pointer(LinphoneCallLog *cl, void *up);
|
||||
LINPHONE_PUBLIC void *linphone_call_log_get_user_pointer(const LinphoneCallLog *cl);
|
||||
/** @deprecated Use linphone_call_log_set_user_data() instead. */
|
||||
#define linphone_call_log_set_user_pointer(cl, ud) linphone_call_log_set_user_data(cl, ud)
|
||||
LINPHONE_PUBLIC void linphone_call_log_set_user_data(LinphoneCallLog *cl, void *up);
|
||||
/** @deprecated Use linphone_call_log_get_user_data() instead. */
|
||||
#define linphone_call_log_get_user_pointer(cl) linphone_call_log_get_user_data(cl)
|
||||
LINPHONE_PUBLIC void *linphone_call_log_get_user_data(const LinphoneCallLog *cl);
|
||||
void linphone_call_log_set_ref_key(LinphoneCallLog *cl, const char *refkey);
|
||||
const char *linphone_call_log_get_ref_key(const LinphoneCallLog *cl);
|
||||
LINPHONE_PUBLIC const rtp_stats_t *linphone_call_log_get_local_stats(const LinphoneCallLog *cl);
|
||||
|
|
@ -379,8 +425,8 @@ struct _LinphoneCallParams;
|
|||
**/
|
||||
typedef struct _LinphoneCallParams LinphoneCallParams;
|
||||
|
||||
LINPHONE_PUBLIC const PayloadType* linphone_call_params_get_used_audio_codec(const LinphoneCallParams *cp);
|
||||
LINPHONE_PUBLIC const PayloadType* linphone_call_params_get_used_video_codec(const LinphoneCallParams *cp);
|
||||
LINPHONE_PUBLIC const LinphonePayloadType* linphone_call_params_get_used_audio_codec(const LinphoneCallParams *cp);
|
||||
LINPHONE_PUBLIC const LinphonePayloadType* linphone_call_params_get_used_video_codec(const LinphoneCallParams *cp);
|
||||
LINPHONE_PUBLIC LinphoneCallParams * linphone_call_params_copy(const LinphoneCallParams *cp);
|
||||
LINPHONE_PUBLIC void linphone_call_params_enable_video(LinphoneCallParams *cp, bool_t enabled);
|
||||
LINPHONE_PUBLIC bool_t linphone_call_params_video_enabled(const LinphoneCallParams *cp);
|
||||
|
|
@ -683,6 +729,41 @@ typedef enum _LinphoneCallState{
|
|||
|
||||
LINPHONE_PUBLIC const char *linphone_call_state_to_string(LinphoneCallState cs);
|
||||
|
||||
/**
|
||||
* Acquire a reference to the call.
|
||||
* An application that wishes to retain a pointer to call object
|
||||
* must use this function to unsure the pointer remains
|
||||
* valid. Once the application no more needs this pointer,
|
||||
* it must call linphone_call_unref().
|
||||
* @param[in] call The call.
|
||||
* @return The same call.
|
||||
* @ingroup call_control
|
||||
**/
|
||||
LINPHONE_PUBLIC LinphoneCall *linphone_call_ref(LinphoneCall *call);
|
||||
|
||||
/**
|
||||
* Release reference to the call.
|
||||
* @param[in] call The call.
|
||||
* @ingroup call_control
|
||||
**/
|
||||
LINPHONE_PUBLIC void linphone_call_unref(LinphoneCall *call);
|
||||
|
||||
/**
|
||||
* Retrieve the user pointer associated with the call.
|
||||
* @param[in] call The call.
|
||||
* @return The user pointer associated with the call.
|
||||
* @ingroup call_control
|
||||
**/
|
||||
LINPHONE_PUBLIC void *linphone_call_get_user_data(const LinphoneCall *call);
|
||||
|
||||
/**
|
||||
* Assign a user pointer to the call.
|
||||
* @param[in] cfg The call.
|
||||
* @param[in] ud The user pointer to associate with the call.
|
||||
* @ingroup call_control
|
||||
**/
|
||||
LINPHONE_PUBLIC void linphone_call_set_user_data(LinphoneCall *call, void *ud);
|
||||
|
||||
LINPHONE_PUBLIC LinphoneCore *linphone_call_get_core(const LinphoneCall *call);
|
||||
LINPHONE_PUBLIC LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
|
||||
LINPHONE_PUBLIC bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
|
||||
|
|
@ -690,8 +771,6 @@ LINPHONE_PUBLIC const LinphoneAddress * linphone_core_get_current_call_remote_ad
|
|||
LINPHONE_PUBLIC const LinphoneAddress * linphone_call_get_remote_address(const LinphoneCall *call);
|
||||
LINPHONE_PUBLIC char *linphone_call_get_remote_address_as_string(const LinphoneCall *call);
|
||||
LINPHONE_PUBLIC LinphoneCallDir linphone_call_get_dir(const LinphoneCall *call);
|
||||
LINPHONE_PUBLIC LinphoneCall * linphone_call_ref(LinphoneCall *call);
|
||||
LINPHONE_PUBLIC void linphone_call_unref(LinphoneCall *call);
|
||||
LINPHONE_PUBLIC LinphoneCallLog *linphone_call_get_call_log(const LinphoneCall *call);
|
||||
LINPHONE_PUBLIC const char *linphone_call_get_refer_to(const LinphoneCall *call);
|
||||
LINPHONE_PUBLIC bool_t linphone_call_has_transfer_pending(const LinphoneCall *call);
|
||||
|
|
@ -717,8 +796,10 @@ LINPHONE_PUBLIC const char* linphone_call_get_authentication_token(LinphoneCall
|
|||
LINPHONE_PUBLIC bool_t linphone_call_get_authentication_token_verified(LinphoneCall *call);
|
||||
LINPHONE_PUBLIC void linphone_call_set_authentication_token_verified(LinphoneCall *call, bool_t verified);
|
||||
LINPHONE_PUBLIC void linphone_call_send_vfu_request(LinphoneCall *call);
|
||||
LINPHONE_PUBLIC void *linphone_call_get_user_pointer(LinphoneCall *call);
|
||||
LINPHONE_PUBLIC void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer);
|
||||
/** @deprecated Use linphone_call_get_user_data() instead. */
|
||||
#define linphone_call_get_user_pointer(call) linphone_call_get_user_data(call)
|
||||
/** @deprecated Use linphone_call_set_user_data() instead. */
|
||||
#define linphone_call_set_user_pointer(call, ud) linphone_call_set_user_data(call, ud)
|
||||
LINPHONE_PUBLIC void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void* user_data);
|
||||
LINPHONE_PUBLIC LinphoneCallState linphone_call_get_transfer_state(LinphoneCall *call);
|
||||
LINPHONE_PUBLIC void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy);
|
||||
|
|
@ -810,6 +891,34 @@ typedef enum _LinphoneRegistrationState{
|
|||
*/
|
||||
LINPHONE_PUBLIC const char *linphone_registration_state_to_string(LinphoneRegistrationState cs);
|
||||
LINPHONE_PUBLIC LinphoneProxyConfig *linphone_proxy_config_new(void);
|
||||
|
||||
/**
|
||||
* Acquire a reference to the proxy config.
|
||||
* @param[in] cfg The proxy config.
|
||||
* @return The same proxy config.
|
||||
**/
|
||||
LINPHONE_PUBLIC LinphoneProxyConfig *linphone_proxy_config_ref(LinphoneProxyConfig *cfg);
|
||||
|
||||
/**
|
||||
* Release reference to the proxy config.
|
||||
* @param[in] cfg The proxy config.
|
||||
**/
|
||||
LINPHONE_PUBLIC void linphone_proxy_config_unref(LinphoneProxyConfig *cfg);
|
||||
|
||||
/**
|
||||
* Retrieve the user pointer associated with the proxy config.
|
||||
* @param[in] cfg The proxy config.
|
||||
* @return The user pointer associated with the proxy config.
|
||||
**/
|
||||
LINPHONE_PUBLIC void *linphone_proxy_config_get_user_data(const LinphoneProxyConfig *cfg);
|
||||
|
||||
/**
|
||||
* Assign a user pointer to the proxy config.
|
||||
* @param[in] cfg The proxy config.
|
||||
* @param[in] ud The user pointer to associate with the proxy config.
|
||||
**/
|
||||
LINPHONE_PUBLIC void linphone_proxy_config_set_user_data(LinphoneProxyConfig *cfg, void *ud);
|
||||
|
||||
LINPHONE_PUBLIC int linphone_proxy_config_set_server_addr(LinphoneProxyConfig *obj, const char *server_addr);
|
||||
LINPHONE_PUBLIC int linphone_proxy_config_set_identity(LinphoneProxyConfig *obj, const char *identity);
|
||||
LINPHONE_PUBLIC int linphone_proxy_config_set_route(LinphoneProxyConfig *obj, const char *route);
|
||||
|
|
@ -986,14 +1095,6 @@ LINPHONE_PUBLIC SipSetup *linphone_proxy_config_get_sip_setup(LinphoneProxyConfi
|
|||
* normalize a human readable phone number into a basic string. 888-444-222 becomes 888444222
|
||||
*/
|
||||
LINPHONE_PUBLIC int linphone_proxy_config_normalize_number(LinphoneProxyConfig *proxy, const char *username, char *result, size_t result_len);
|
||||
/*
|
||||
* attached a user data to a proxy config
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_proxy_config_set_user_data(LinphoneProxyConfig *cr, void * ud);
|
||||
/*
|
||||
* get user data to a proxy config. return null if any
|
||||
*/
|
||||
LINPHONE_PUBLIC void * linphone_proxy_config_get_user_data(LinphoneProxyConfig *cr);
|
||||
|
||||
/**
|
||||
* Set default privacy policy for all calls routed through this proxy.
|
||||
|
|
@ -1297,9 +1398,24 @@ LINPHONE_PUBLIC MSList *linphone_chat_room_get_history(LinphoneChatRoom *cr,int
|
|||
LINPHONE_PUBLIC void linphone_chat_room_mark_as_read(LinphoneChatRoom *cr);
|
||||
LINPHONE_PUBLIC void linphone_chat_room_delete_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg);
|
||||
LINPHONE_PUBLIC void linphone_chat_room_delete_history(LinphoneChatRoom *cr);
|
||||
/**
|
||||
* Gets the number of messages in a chat room.
|
||||
* @param[in] cr The #LinphoneChatRoom object corresponding to the conversation for which size has to be computed
|
||||
* @return the number of messages.
|
||||
*/
|
||||
LINPHONE_PUBLIC int linphone_chat_room_get_history_size(LinphoneChatRoom *cr);
|
||||
|
||||
/**
|
||||
* Notify the destination of the chat message being composed that the user is typing a new message.
|
||||
* Gets the partial list of messages in the given range, sorted from oldest to most recent.
|
||||
* @param[in] cr The #LinphoneChatRoom object corresponding to the conversation for which messages should be retrieved
|
||||
* @param[in] begin The first message of the range to be retrieved. History most recent message has index 0.
|
||||
* @param[in] end The last message of the range to be retrieved. History oldest message has index of history size - 1 (use #linphone_chat_room_get_history_size to retrieve history size)
|
||||
* @return \mslist{LinphoneChatMessage}
|
||||
*/
|
||||
LINPHONE_PUBLIC MSList *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int begin, int end);
|
||||
|
||||
/**
|
||||
* Notifies the destination of the chat message being composed that the user is typing a new message.
|
||||
* @param[in] cr The #LinphoneChatRoom object corresponding to the conversation for which a new message is being typed.
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_chat_room_compose(LinphoneChatRoom *cr);
|
||||
|
|
@ -1797,9 +1913,12 @@ LINPHONE_PUBLIC int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneC
|
|||
* Get default call parameters reflecting current linphone core configuration
|
||||
* @param lc LinphoneCore object
|
||||
* @return LinphoneCallParams
|
||||
* @deprecated use linphone_core_create_call_params()
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneCallParams *linphone_core_create_default_call_parameters(LinphoneCore *lc);
|
||||
|
||||
LINPHONE_PUBLIC LinphoneCallParams *linphone_core_create_call_params(LinphoneCore *lc, LinphoneCall *call);
|
||||
|
||||
LINPHONE_PUBLIC LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneCore *lc, const char *remote_address);
|
||||
|
||||
LINPHONE_PUBLIC void linphone_core_send_dtmf(LinphoneCore *lc,char dtmf);
|
||||
|
|
@ -1879,48 +1998,48 @@ LINPHONE_PUBLIC int linphone_core_set_video_codecs(LinphoneCore *lc, MSList *cod
|
|||
/**
|
||||
* Tells whether the specified payload type is enabled.
|
||||
* @param[in] lc #LinphoneCore object.
|
||||
* @param[in] pt The #PayloadType we want to know is enabled or not.
|
||||
* @param[in] pt The #LinphonePayloadType we want to know is enabled or not.
|
||||
* @returns TRUE if the payload type is enabled, FALSE if disabled.
|
||||
* @ingroup media_parameters
|
||||
*/
|
||||
LINPHONE_PUBLIC bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, const PayloadType *pt);
|
||||
LINPHONE_PUBLIC bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, const LinphonePayloadType *pt);
|
||||
|
||||
/**
|
||||
* Tells whether the specified payload type represents a variable bitrate codec.
|
||||
* @param[in] lc #LinphoneCore object.
|
||||
* @param[in] pt The #PayloadType we want to know
|
||||
* @param[in] pt The #LinphonePayloadType we want to know
|
||||
* @returns TRUE if the payload type represents a VBR codec, FALSE if disabled.
|
||||
* @ingroup media_parameters
|
||||
*/
|
||||
LINPHONE_PUBLIC bool_t linphone_core_payload_type_is_vbr(LinphoneCore *lc, const PayloadType *pt);
|
||||
LINPHONE_PUBLIC bool_t linphone_core_payload_type_is_vbr(LinphoneCore *lc, const LinphonePayloadType *pt);
|
||||
|
||||
/**
|
||||
* Set an explicit bitrate (IP bitrate, not codec bitrate) for a given codec, in kbit/s.
|
||||
* @param[in] lc the #LinphoneCore object
|
||||
* @param[in] pt the #PayloadType to modify.
|
||||
* @param[in] pt the #LinphonePayloadType to modify.
|
||||
* @param[in] bitrate the IP bitrate in kbit/s.
|
||||
* @ingroup media_parameters
|
||||
**/
|
||||
LINPHONE_PUBLIC void linphone_core_set_payload_type_bitrate(LinphoneCore *lc, PayloadType *pt, int bitrate);
|
||||
LINPHONE_PUBLIC void linphone_core_set_payload_type_bitrate(LinphoneCore *lc, LinphonePayloadType *pt, int bitrate);
|
||||
|
||||
/**
|
||||
* Get the bitrate explicitely set with linphone_core_set_payload_type_bitrate().
|
||||
* @param[in] lc the #LinphoneCore object
|
||||
* @param[in] pt the #PayloadType to modify.
|
||||
* @param[in] pt the #LinphonePayloadType to modify.
|
||||
* @return bitrate the IP bitrate in kbit/s, or -1 if an error occured.
|
||||
* @ingroup media_parameters
|
||||
**/
|
||||
LINPHONE_PUBLIC int linphone_core_get_payload_type_bitrate(LinphoneCore *lc, const PayloadType *pt);
|
||||
LINPHONE_PUBLIC int linphone_core_get_payload_type_bitrate(LinphoneCore *lc, const LinphonePayloadType *pt);
|
||||
|
||||
/**
|
||||
* Enable or disable the use of the specified payload type.
|
||||
* @param[in] lc #LinphoneCore object.
|
||||
* @param[in] pt The #PayloadType to enable or disable. It can be retrieved using #linphone_core_find_payload_type
|
||||
* @param[in] pt The #LinphonePayloadType to enable or disable. It can be retrieved using #linphone_core_find_payload_type
|
||||
* @param[in] enable TRUE to enable the payload type, FALSE to disable it.
|
||||
* @return 0 if successful, any other value otherwise.
|
||||
* @ingroup media_parameters
|
||||
*/
|
||||
LINPHONE_PUBLIC int linphone_core_enable_payload_type(LinphoneCore *lc, PayloadType *pt, bool_t enable);
|
||||
LINPHONE_PUBLIC int linphone_core_enable_payload_type(LinphoneCore *lc, LinphonePayloadType *pt, bool_t enable);
|
||||
|
||||
/**
|
||||
* Wildcard value used by #linphone_core_find_payload_type to ignore rate in search algorithm
|
||||
|
|
@ -1942,7 +2061,7 @@ LINPHONE_PUBLIC int linphone_core_enable_payload_type(LinphoneCore *lc, PayloadT
|
|||
* @param channels number of channels, can be #LINPHONE_FIND_PAYLOAD_IGNORE_CHANNELS
|
||||
* @return Returns NULL if not found.
|
||||
*/
|
||||
LINPHONE_PUBLIC PayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type, int rate, int channels) ;
|
||||
LINPHONE_PUBLIC LinphonePayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type, int rate, int channels) ;
|
||||
|
||||
LINPHONE_PUBLIC int linphone_core_get_payload_type_number(LinphoneCore *lc, const PayloadType *pt);
|
||||
|
||||
|
|
|
|||
|
|
@ -2425,12 +2425,11 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getFriendByAddress(JNIE
|
|||
env->ReleaseStringUTFChars(jaddress, address);
|
||||
return (jlong) lf;
|
||||
}
|
||||
//LinphoneChatRoom
|
||||
extern "C" jlongArray Java_org_linphone_core_LinphoneChatRoomImpl_getHistory(JNIEnv* env
|
||||
|
||||
extern "C" jlongArray _LinphoneChatRoomImpl_getHistory(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr
|
||||
,jint limit) {
|
||||
MSList* history = linphone_chat_room_get_history((LinphoneChatRoom*)ptr, limit);
|
||||
,MSList* history) {
|
||||
int historySize = ms_list_size(history);
|
||||
jlongArray jHistory = env->NewLongArray(historySize);
|
||||
jlong *jInternalArray = env->GetLongArrayElements(jHistory, NULL);
|
||||
|
|
@ -2446,6 +2445,21 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneChatRoomImpl_getHistory(JNI
|
|||
|
||||
return jHistory;
|
||||
}
|
||||
extern "C" jlongArray Java_org_linphone_core_LinphoneChatRoomImpl_getHistoryRange(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr
|
||||
,jint start
|
||||
,jint end) {
|
||||
MSList* history = linphone_chat_room_get_history_range((LinphoneChatRoom*)ptr, start, end);
|
||||
return _LinphoneChatRoomImpl_getHistory(env, thiz, ptr, history);
|
||||
}
|
||||
extern "C" jlongArray Java_org_linphone_core_LinphoneChatRoomImpl_getHistory(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr
|
||||
,jint limit) {
|
||||
MSList* history = linphone_chat_room_get_history((LinphoneChatRoom*)ptr, limit);
|
||||
return _LinphoneChatRoomImpl_getHistory(env, thiz, ptr, history);
|
||||
}
|
||||
extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_getPeerAddress(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
|
|
@ -2484,6 +2498,11 @@ extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_createLinphoneChatM
|
|||
|
||||
return (jlong) chatMessage;
|
||||
}
|
||||
extern "C" jint Java_org_linphone_core_LinphoneChatRoomImpl_getHistorySize (JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
return (jint) linphone_chat_room_get_history_size((LinphoneChatRoom*)ptr);
|
||||
}
|
||||
extern "C" jint Java_org_linphone_core_LinphoneChatRoomImpl_getUnreadMessagesCount(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
|
|
|
|||
|
|
@ -356,7 +356,8 @@ LINPHONE_PUBLIC void linphone_core_reject_subscriber(LinphoneCore *lc, LinphoneF
|
|||
|
||||
/**
|
||||
* Get Buddy list of LinphoneFriend
|
||||
* @param lc #LinphoneCore object
|
||||
* @param[in] lc #LinphoneCore object
|
||||
* @return \mslist{LinphoneFriend}
|
||||
*/
|
||||
LINPHONE_PUBLIC const MSList * linphone_core_get_friend_list(const LinphoneCore *lc);
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ static inline LinphoneChatMessage* get_transient_message(LinphoneChatRoom* cr, u
|
|||
static void create_chat_message(char **argv, void *data){
|
||||
LinphoneChatRoom *cr = (LinphoneChatRoom *)data;
|
||||
LinphoneAddress *from;
|
||||
LinphoneAddress *to;
|
||||
|
||||
unsigned int storage_id = atoi(argv[0]);
|
||||
|
||||
|
|
@ -65,12 +66,18 @@ static void create_chat_message(char **argv, void *data){
|
|||
if(atoi(argv[3])==LinphoneChatMessageIncoming){
|
||||
new_message->dir=LinphoneChatMessageIncoming;
|
||||
from=linphone_address_new(argv[2]);
|
||||
to=linphone_address_new(argv[1]);
|
||||
} else {
|
||||
new_message->dir=LinphoneChatMessageOutgoing;
|
||||
from=linphone_address_new(argv[1]);
|
||||
to=linphone_address_new(argv[2]);
|
||||
}
|
||||
linphone_chat_message_set_from(new_message,from);
|
||||
linphone_address_destroy(from);
|
||||
if (to){
|
||||
linphone_chat_message_set_to(new_message,to);
|
||||
linphone_address_destroy(to);
|
||||
}
|
||||
|
||||
if( argv[9] != NULL ){
|
||||
new_message->time = (time_t)atol(argv[9]);
|
||||
|
|
@ -105,7 +112,7 @@ void linphone_sql_request_message(sqlite3 *db,const char *stmt,LinphoneChatRoom
|
|||
int ret;
|
||||
ret=sqlite3_exec(db,stmt,callback,cr,&errmsg);
|
||||
if(ret != SQLITE_OK) {
|
||||
ms_error("Error in creation: %s.\n", errmsg);
|
||||
ms_error("Error in creation: %s.", errmsg);
|
||||
sqlite3_free(errmsg);
|
||||
}
|
||||
}
|
||||
|
|
@ -115,7 +122,7 @@ int linphone_sql_request(sqlite3* db,const char *stmt){
|
|||
int ret;
|
||||
ret=sqlite3_exec(db,stmt,NULL,NULL,&errmsg);
|
||||
if(ret != SQLITE_OK) {
|
||||
ms_error("linphone_sql_request: error sqlite3_exec(): %s.\n", errmsg);
|
||||
ms_error("linphone_sql_request: statement %s -> error sqlite3_exec(): %s.", stmt, errmsg);
|
||||
sqlite3_free(errmsg);
|
||||
}
|
||||
return ret;
|
||||
|
|
@ -127,7 +134,7 @@ void linphone_sql_request_all(sqlite3* db,const char *stmt, LinphoneCore* lc){
|
|||
int ret;
|
||||
ret=sqlite3_exec(db,stmt,callback_all,lc,&errmsg);
|
||||
if(ret != SQLITE_OK) {
|
||||
ms_error("linphone_sql_request_all: error sqlite3_exec(): %s.\n", errmsg);
|
||||
ms_error("linphone_sql_request_all: error sqlite3_exec(): %s.", errmsg);
|
||||
sqlite3_free(errmsg);
|
||||
}
|
||||
}
|
||||
|
|
@ -210,14 +217,14 @@ void linphone_chat_room_update_url(LinphoneChatRoom *cr, LinphoneChatMessage *ms
|
|||
sqlite3_free(buf);
|
||||
}
|
||||
|
||||
int linphone_chat_room_get_unread_messages_count(LinphoneChatRoom *cr){
|
||||
static int linphone_chat_room_get_messages_count(LinphoneChatRoom *cr, bool_t unread_only){
|
||||
LinphoneCore *lc=linphone_chat_room_get_lc(cr);
|
||||
int numrows=0;
|
||||
|
||||
if (lc->db==NULL) return 0;
|
||||
|
||||
char *peer=linphone_address_as_string_uri_only(linphone_chat_room_get_peer_address(cr));
|
||||
char *buf=sqlite3_mprintf("SELECT count(*) FROM history WHERE remoteContact = %Q AND read = 0;",peer);
|
||||
char *buf=sqlite3_mprintf("SELECT count(*) FROM history WHERE remoteContact = %Q %s;",peer,unread_only?"AND read = 0":"");
|
||||
sqlite3_stmt *selectStatement;
|
||||
int returnValue = sqlite3_prepare_v2(lc->db,buf,-1,&selectStatement,NULL);
|
||||
if (returnValue == SQLITE_OK){
|
||||
|
|
@ -231,6 +238,14 @@ int linphone_chat_room_get_unread_messages_count(LinphoneChatRoom *cr){
|
|||
return numrows;
|
||||
}
|
||||
|
||||
int linphone_chat_room_get_unread_messages_count(LinphoneChatRoom *cr){
|
||||
return linphone_chat_room_get_messages_count(cr, TRUE);
|
||||
}
|
||||
|
||||
int linphone_chat_room_get_history_size(LinphoneChatRoom *cr){
|
||||
return linphone_chat_room_get_messages_count(cr, FALSE);
|
||||
}
|
||||
|
||||
void linphone_chat_room_delete_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg) {
|
||||
LinphoneCore *lc=cr->lc;
|
||||
|
||||
|
|
@ -253,31 +268,52 @@ void linphone_chat_room_delete_history(LinphoneChatRoom *cr){
|
|||
ms_free(peer);
|
||||
}
|
||||
|
||||
MSList *linphone_chat_room_get_history(LinphoneChatRoom *cr,int nb_message){
|
||||
MSList *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int startm, int endm){
|
||||
LinphoneCore *lc=linphone_chat_room_get_lc(cr);
|
||||
MSList *ret;
|
||||
char *buf;
|
||||
char *peer;
|
||||
uint64_t begin,end;
|
||||
int buf_max_size = 512;
|
||||
|
||||
if (lc->db==NULL) return NULL;
|
||||
peer=linphone_address_as_string_uri_only(linphone_chat_room_get_peer_address(cr));
|
||||
peer = linphone_address_as_string_uri_only(linphone_chat_room_get_peer_address(cr));
|
||||
|
||||
cr->messages_hist = NULL;
|
||||
if (nb_message > 0)
|
||||
buf=sqlite3_mprintf("SELECT * FROM history WHERE remoteContact = %Q ORDER BY id DESC LIMIT %i ;",peer,nb_message);
|
||||
else
|
||||
buf=sqlite3_mprintf("SELECT * FROM history WHERE remoteContact = %Q ORDER BY id DESC;",peer);
|
||||
|
||||
/*since we want to append query parameters depending on arguments given, we use malloc instead of sqlite3_mprintf*/
|
||||
buf=ms_malloc(buf_max_size);
|
||||
buf=sqlite3_snprintf(buf_max_size-1,buf,"SELECT * FROM history WHERE remoteContact = %Q ORDER BY id DESC",peer);
|
||||
|
||||
if (startm<0) startm=0;
|
||||
|
||||
if (endm>0&&endm>=startm){
|
||||
buf=sqlite3_snprintf(buf_max_size-1,buf,"%s LIMIT %i ",buf,endm+1-startm);
|
||||
}else if(startm>0){
|
||||
ms_message("%s(): end is lower than start (%d < %d). No end assumed.",__FUNCTION__,endm,startm);
|
||||
buf=sqlite3_snprintf(buf_max_size-1,buf,"%s LIMIT -1",buf);
|
||||
}
|
||||
|
||||
if (startm>0){
|
||||
buf=sqlite3_snprintf(buf_max_size-1,buf,"%s OFFSET %i ",buf,startm);
|
||||
}
|
||||
|
||||
begin=ortp_get_cur_time_ms();
|
||||
linphone_sql_request_message(lc->db,buf,cr);
|
||||
end=ortp_get_cur_time_ms();
|
||||
ms_message("linphone_chat_room_get_history(): completed in %i ms",(int)(end-begin));
|
||||
sqlite3_free(buf);
|
||||
ms_message("%s(): completed in %i ms",__FUNCTION__, (int)(end-begin));
|
||||
ms_free(buf);
|
||||
ret=cr->messages_hist;
|
||||
cr->messages_hist=NULL;
|
||||
ms_free(peer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
MSList *linphone_chat_room_get_history(LinphoneChatRoom *cr,int nb_message){
|
||||
return linphone_chat_room_get_history_range(cr, 0, nb_message);
|
||||
}
|
||||
|
||||
|
||||
void linphone_close_storage(sqlite3* db){
|
||||
sqlite3_close(db);
|
||||
}
|
||||
|
|
@ -477,6 +513,10 @@ MSList *linphone_chat_room_get_history(LinphoneChatRoom *cr,int nb_message){
|
|||
return NULL;
|
||||
}
|
||||
|
||||
LINPHONE_PUBLIC MSList *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int begin, int end){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void linphone_chat_room_delete_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg) {
|
||||
}
|
||||
|
||||
|
|
@ -499,4 +539,8 @@ int linphone_chat_room_get_unread_messages_count(LinphoneChatRoom *cr){
|
|||
return 0;
|
||||
}
|
||||
|
||||
int linphone_chat_room_get_history_size(LinphoneChatRoom *cr){
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ static bool_t payload_type_enabled(const PayloadType *pt) {
|
|||
return (((pt)->flags & PAYLOAD_TYPE_ENABLED)!=0);
|
||||
}
|
||||
|
||||
bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, const PayloadType *pt){
|
||||
bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, const LinphonePayloadType *pt){
|
||||
if (ms_list_find(lc->codecs_conf.audio_codecs, (PayloadType*) pt) || ms_list_find(lc->codecs_conf.video_codecs, (PayloadType*)pt)){
|
||||
return payload_type_enabled(pt);
|
||||
}
|
||||
|
|
@ -77,12 +77,12 @@ bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, const PayloadType *p
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
bool_t linphone_core_payload_type_is_vbr(LinphoneCore *lc, const PayloadType *pt){
|
||||
bool_t linphone_core_payload_type_is_vbr(LinphoneCore *lc, const LinphonePayloadType *pt){
|
||||
if (pt->type==PAYLOAD_VIDEO) return TRUE;
|
||||
return !!(pt->flags & PAYLOAD_TYPE_IS_VBR);
|
||||
}
|
||||
|
||||
int linphone_core_enable_payload_type(LinphoneCore *lc, PayloadType *pt, bool_t enabled){
|
||||
int linphone_core_enable_payload_type(LinphoneCore *lc, LinphonePayloadType *pt, bool_t enabled){
|
||||
if (ms_list_find(lc->codecs_conf.audio_codecs,pt) || ms_list_find(lc->codecs_conf.video_codecs,pt)){
|
||||
payload_type_set_enable(pt,enabled);
|
||||
_linphone_core_codec_config_write(lc);
|
||||
|
|
@ -108,7 +108,7 @@ const char *linphone_core_get_payload_type_description(LinphoneCore *lc, Payload
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void linphone_core_set_payload_type_bitrate(LinphoneCore *lc, PayloadType *pt, int bitrate){
|
||||
void linphone_core_set_payload_type_bitrate(LinphoneCore *lc, LinphonePayloadType *pt, int bitrate){
|
||||
if (ms_list_find(lc->codecs_conf.audio_codecs, (PayloadType*) pt) || ms_list_find(lc->codecs_conf.video_codecs, (PayloadType*)pt)){
|
||||
if (pt->type==PAYLOAD_VIDEO || pt->flags & PAYLOAD_TYPE_IS_VBR){
|
||||
pt->normal_bitrate=bitrate*1000;
|
||||
|
|
@ -181,7 +181,7 @@ static int get_audio_payload_bandwidth(LinphoneCore *lc, const PayloadType *pt,
|
|||
}else return (int)ceil(get_audio_payload_bandwidth_from_codec_bitrate(pt)/1000.0);/*rounding codec bandwidth should be avoid, specially for AMR*/
|
||||
}
|
||||
|
||||
int linphone_core_get_payload_type_bitrate(LinphoneCore *lc, const PayloadType *pt){
|
||||
int linphone_core_get_payload_type_bitrate(LinphoneCore *lc, const LinphonePayloadType *pt){
|
||||
int maxbw=get_min_bandwidth(linphone_core_get_download_bandwidth(lc),
|
||||
linphone_core_get_upload_bandwidth(lc));
|
||||
if (pt->type==PAYLOAD_AUDIO_CONTINUOUS || pt->type==PAYLOAD_AUDIO_PACKETIZED){
|
||||
|
|
@ -946,18 +946,6 @@ bool_t linphone_core_media_description_contains_video_stream(const SalMediaDescr
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
LinphoneCall * is_a_linphone_call(void *user_pointer){
|
||||
LinphoneCall *call=(LinphoneCall*)user_pointer;
|
||||
if (call==NULL) return NULL;
|
||||
return call->magic==linphone_call_magic ? call : NULL;
|
||||
}
|
||||
|
||||
LinphoneProxyConfig * is_a_linphone_proxy_config(void *user_pointer){
|
||||
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)user_pointer;
|
||||
if (cfg==NULL) return NULL;
|
||||
return cfg->magic==linphone_proxy_config_magic ? cfg : NULL;
|
||||
}
|
||||
|
||||
unsigned int linphone_core_get_audio_features(LinphoneCore *lc){
|
||||
unsigned int ret=0;
|
||||
const char *features=lp_config_get_string(lc->config,"sound","features",NULL);
|
||||
|
|
|
|||
|
|
@ -138,8 +138,6 @@ typedef struct _CallCallbackObj
|
|||
void * _user_data;
|
||||
}CallCallbackObj;
|
||||
|
||||
static const int linphone_call_magic=0x3343;
|
||||
|
||||
typedef enum _LinphoneChatMessageDir{
|
||||
LinphoneChatMessageIncoming,
|
||||
LinphoneChatMessageOutgoing
|
||||
|
|
@ -183,7 +181,8 @@ typedef struct _PortConfig{
|
|||
|
||||
struct _LinphoneCall
|
||||
{
|
||||
int magic; /*used to distinguish from proxy config*/
|
||||
belle_sip_object_t base;
|
||||
void *user_data;
|
||||
struct _LinphoneCore *core;
|
||||
SalErrorInfo non_op_error;
|
||||
int af; /*the address family to prefer for RTP path, guessed from signaling path*/
|
||||
|
|
@ -202,7 +201,6 @@ struct _LinphoneCall
|
|||
LinphoneCallState prevstate;
|
||||
LinphoneCallState transfer_state; /*idle if no transfer*/
|
||||
LinphoneProxyConfig *dest_proxy;
|
||||
int refcnt;
|
||||
void * user_pointer;
|
||||
PortConfig media_ports[2];
|
||||
MSMediaStreamSessions sessions[2]; /*the rtp, srtp, zrtp contexts for each stream*/
|
||||
|
|
@ -252,6 +250,8 @@ struct _LinphoneCall
|
|||
bool_t paused_by_app;
|
||||
};
|
||||
|
||||
BELLE_SIP_DECLARE_VPTR(LinphoneCall);
|
||||
|
||||
|
||||
LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, const LinphoneCallParams *params, LinphoneProxyConfig *cfg);
|
||||
LinphoneCall * linphone_call_new_incoming(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op);
|
||||
|
|
@ -292,7 +292,6 @@ void linphone_core_update_friends_subscriptions(LinphoneCore *lc, LinphoneProxyC
|
|||
|
||||
int parse_hostname_to_addr(const char *server, struct sockaddr_storage *ss, socklen_t *socklen, int default_port);
|
||||
|
||||
void linphone_core_get_local_ip(LinphoneCore *lc, int af, char *result);
|
||||
bool_t host_has_ipv6_network();
|
||||
bool_t lp_spawn_command_line_sync(const char *command, char **result,int *command_ret);
|
||||
|
||||
|
|
@ -402,15 +401,12 @@ extern SalCallbacks linphone_sal_callbacks;
|
|||
bool_t linphone_core_rtcp_enabled(const LinphoneCore *lc);
|
||||
bool_t linphone_core_symmetric_rtp_enabled(LinphoneCore*lc);
|
||||
|
||||
LinphoneCall * is_a_linphone_call(void *user_pointer);
|
||||
LinphoneProxyConfig * is_a_linphone_proxy_config(void *user_pointer);
|
||||
|
||||
void linphone_core_queue_task(LinphoneCore *lc, belle_sip_source_func_t task_fun, void *data, const char *task_description);
|
||||
|
||||
static const int linphone_proxy_config_magic=0x7979;
|
||||
LINPHONE_PUBLIC bool_t linphone_proxy_config_address_equal(const LinphoneAddress *a, const LinphoneAddress *b);
|
||||
LINPHONE_PUBLIC bool_t linphone_proxy_config_is_server_config_changed(const LinphoneProxyConfig* obj);
|
||||
void _linphone_proxy_config_unregister(LinphoneProxyConfig *obj);
|
||||
void _linphone_proxy_config_release_ops(LinphoneProxyConfig *obj);
|
||||
|
||||
/*chat*/
|
||||
void linphone_chat_message_destroy(LinphoneChatMessage* msg);
|
||||
|
|
@ -418,7 +414,8 @@ void linphone_chat_message_destroy(LinphoneChatMessage* msg);
|
|||
|
||||
struct _LinphoneProxyConfig
|
||||
{
|
||||
int magic;
|
||||
belle_sip_object_t base;
|
||||
void *user_data;
|
||||
struct _LinphoneCore *lc;
|
||||
char *reg_proxy;
|
||||
char *reg_identity;
|
||||
|
|
@ -447,7 +444,6 @@ struct _LinphoneProxyConfig
|
|||
bool_t pad;
|
||||
uint8_t avpf_rr_interval;
|
||||
uint8_t quality_reporting_interval;
|
||||
void* user_data;
|
||||
time_t deletion_date;
|
||||
LinphonePrivacyMask privacy;
|
||||
/*use to check if server config has changed between edit() and done()*/
|
||||
|
|
@ -457,6 +453,8 @@ struct _LinphoneProxyConfig
|
|||
|
||||
};
|
||||
|
||||
BELLE_SIP_DECLARE_VPTR(LinphoneProxyConfig);
|
||||
|
||||
struct _LinphoneAuthInfo
|
||||
{
|
||||
char *username;
|
||||
|
|
@ -925,7 +923,9 @@ BELLE_SIP_TYPE_ID(LinphoneContactSearch),
|
|||
BELLE_SIP_TYPE_ID(LinphoneContactProvider),
|
||||
BELLE_SIP_TYPE_ID(LinphoneLDAPContactProvider),
|
||||
BELLE_SIP_TYPE_ID(LinphoneLDAPContactSearch),
|
||||
BELLE_SIP_TYPE_ID(LinphoneChatMessage)
|
||||
BELLE_SIP_TYPE_ID(LinphoneChatMessage),
|
||||
BELLE_SIP_TYPE_ID(LinphoneProxyConfig),
|
||||
BELLE_SIP_TYPE_ID(LinphoneCall)
|
||||
BELLE_SIP_DECLARE_TYPES_END
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -99,8 +99,6 @@ static void linphone_proxy_config_init(LinphoneCore* lc, LinphoneProxyConfig *ob
|
|||
const char *contact_params = lc ? lp_config_get_default_string(lc->config, "proxy", "contact_parameters", NULL) : NULL;
|
||||
const char *contact_uri_params = lc ? lp_config_get_default_string(lc->config, "proxy", "contact_uri_parameters", NULL) : NULL;
|
||||
|
||||
memset(obj, 0, sizeof(LinphoneProxyConfig));
|
||||
obj->magic = linphone_proxy_config_magic;
|
||||
obj->expires = lc ? lp_config_get_default_int(lc->config, "proxy", "reg_expires", 3600) : 3600;
|
||||
obj->reg_sendregister = lc ? lp_config_get_default_int(lc->config, "proxy", "reg_sendregister", 0) : 0;
|
||||
obj->dial_prefix = dial_prefix ? ms_strdup(dial_prefix) : NULL;
|
||||
|
|
@ -109,6 +107,7 @@ static void linphone_proxy_config_init(LinphoneCore* lc, LinphoneProxyConfig *ob
|
|||
obj->reg_identity = identity ? ms_strdup(identity) : NULL;
|
||||
obj->reg_proxy = proxy ? ms_strdup(proxy) : NULL;
|
||||
obj->reg_route = route ? ms_strdup(route) : NULL;
|
||||
obj->domain = NULL;
|
||||
obj->realm = realm ? ms_strdup(realm) : NULL;
|
||||
obj->quality_reporting_enabled = lc ? lp_config_get_default_int(lc->config, "proxy", "quality_reporting_enabled", 0) : 0;
|
||||
obj->quality_reporting_collector = quality_reporting_collector ? ms_strdup(quality_reporting_collector) : NULL;
|
||||
|
|
@ -133,20 +132,35 @@ LinphoneProxyConfig *linphone_proxy_config_new() {
|
|||
return linphone_core_create_proxy_config(NULL);
|
||||
}
|
||||
|
||||
static void _linphone_proxy_config_destroy(LinphoneProxyConfig *obj);
|
||||
|
||||
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneProxyConfig);
|
||||
|
||||
BELLE_SIP_INSTANCIATE_VPTR(LinphoneProxyConfig, belle_sip_object_t,
|
||||
(belle_sip_object_destroy_t)_linphone_proxy_config_destroy,
|
||||
NULL, // clone
|
||||
NULL, // marshal
|
||||
FALSE
|
||||
);
|
||||
|
||||
LinphoneProxyConfig * linphone_core_create_proxy_config(LinphoneCore *lc) {
|
||||
LinphoneProxyConfig *obj=NULL;
|
||||
obj=ms_new(LinphoneProxyConfig,1);
|
||||
LinphoneProxyConfig *obj = belle_sip_object_new(LinphoneProxyConfig);
|
||||
linphone_proxy_config_init(lc,obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys a proxy config.
|
||||
*
|
||||
* @note: LinphoneProxyConfig that have been removed from LinphoneCore with
|
||||
* linphone_core_remove_proxy_config() must not be freed.
|
||||
**/
|
||||
void linphone_proxy_config_destroy(LinphoneProxyConfig *obj){
|
||||
void _linphone_proxy_config_release_ops(LinphoneProxyConfig *obj){
|
||||
if (obj->op) {
|
||||
sal_op_release(obj->op);
|
||||
obj->op=NULL;
|
||||
}
|
||||
if (obj->publish_op){
|
||||
sal_op_release(obj->publish_op);
|
||||
obj->publish_op=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void _linphone_proxy_config_destroy(LinphoneProxyConfig *obj){
|
||||
if (obj->reg_proxy!=NULL) ms_free(obj->reg_proxy);
|
||||
if (obj->reg_identity!=NULL) ms_free(obj->reg_identity);
|
||||
if (obj->reg_route!=NULL) ms_free(obj->reg_route);
|
||||
|
|
@ -156,13 +170,31 @@ void linphone_proxy_config_destroy(LinphoneProxyConfig *obj){
|
|||
if (obj->realm!=NULL) ms_free(obj->realm);
|
||||
if (obj->type!=NULL) ms_free(obj->type);
|
||||
if (obj->dial_prefix!=NULL) ms_free(obj->dial_prefix);
|
||||
if (obj->op) sal_op_release(obj->op);
|
||||
if (obj->publish_op) sal_op_release(obj->publish_op);
|
||||
if (obj->contact_params) ms_free(obj->contact_params);
|
||||
if (obj->contact_uri_params) ms_free(obj->contact_uri_params);
|
||||
if (obj->saved_proxy!=NULL) linphone_address_destroy(obj->saved_proxy);
|
||||
if (obj->saved_identity!=NULL) linphone_address_destroy(obj->saved_identity);
|
||||
ms_free(obj);
|
||||
_linphone_proxy_config_release_ops(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys a proxy config.
|
||||
* @deprecated
|
||||
*
|
||||
* @note: LinphoneProxyConfig that have been removed from LinphoneCore with
|
||||
* linphone_core_remove_proxy_config() must not be freed.
|
||||
**/
|
||||
void linphone_proxy_config_destroy(LinphoneProxyConfig *cfg) {
|
||||
belle_sip_object_unref(cfg);
|
||||
}
|
||||
|
||||
LinphoneProxyConfig *linphone_proxy_config_ref(LinphoneProxyConfig *cfg) {
|
||||
belle_sip_object_ref(cfg);
|
||||
return cfg;
|
||||
}
|
||||
|
||||
void linphone_proxy_config_unref(LinphoneProxyConfig *cfg) {
|
||||
belle_sip_object_unref(cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -445,9 +477,6 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *obj){
|
|||
linphone_proxy_config_set_state(obj,LinphoneRegistrationCleared,"Registration cleared");
|
||||
}
|
||||
_linphone_proxy_config_unregister(obj);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1134,10 +1163,7 @@ void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *cf
|
|||
linphone_proxy_config_edit(cfg);
|
||||
linphone_proxy_config_enable_register(cfg,FALSE);
|
||||
linphone_proxy_config_done(cfg);
|
||||
linphone_proxy_config_update(cfg); /*so that it has an effect*/
|
||||
|
||||
/*as cfg no longer in proxies, unregister will never be issued*/
|
||||
_linphone_proxy_config_unregister(cfg);
|
||||
linphone_proxy_config_update(cfg);
|
||||
}
|
||||
if (lc->default_proxy==cfg){
|
||||
lc->default_proxy=NULL;
|
||||
|
|
@ -1198,6 +1224,8 @@ int linphone_core_get_default_proxy(LinphoneCore *lc, LinphoneProxyConfig **conf
|
|||
|
||||
/**
|
||||
* Returns an unmodifiable list of entered proxy configurations.
|
||||
* @param[in] lc The LinphoneCore object
|
||||
* @return \mslist{LinphoneProxyConfig}
|
||||
**/
|
||||
const MSList *linphone_core_get_proxy_config_list(const LinphoneCore *lc){
|
||||
return lc->sip_conf.proxies;
|
||||
|
|
@ -1496,12 +1524,12 @@ void linphone_account_creator_destroy(LinphoneAccountCreator *obj){
|
|||
}
|
||||
}
|
||||
|
||||
void linphone_proxy_config_set_user_data(LinphoneProxyConfig *cr, void * ud) {
|
||||
cr->user_data=ud;
|
||||
void linphone_proxy_config_set_user_data(LinphoneProxyConfig *cfg, void *ud) {
|
||||
cfg->user_data = ud;
|
||||
}
|
||||
|
||||
void * linphone_proxy_config_get_user_data(LinphoneProxyConfig *cr) {
|
||||
return cr->user_data;
|
||||
void * linphone_proxy_config_get_user_data(const LinphoneProxyConfig *cfg) {
|
||||
return cfg->user_data;
|
||||
}
|
||||
|
||||
void linphone_proxy_config_set_state(LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const char *message){
|
||||
|
|
|
|||
|
|
@ -1540,7 +1540,7 @@ static void update_registration_status(LinphoneProxyConfig *cfg, LinphoneRegistr
|
|||
}while(gtk_tree_model_iter_next(model,&iter));
|
||||
}
|
||||
if (!found) {
|
||||
g_warning("Could not find proxy config in combo box of identities.");
|
||||
/*ignored, this is a notification for a removed proxy config.*/
|
||||
return;
|
||||
}
|
||||
switch (rs){
|
||||
|
|
|
|||
|
|
@ -429,16 +429,19 @@ static void linphone_gtk_assistant_prepare(GtkWidget *assistant, GtkWidget *page
|
|||
linphone_core_add_auth_info(linphone_gtk_get_core(),info);
|
||||
linphone_address_destroy(identity);
|
||||
|
||||
// If account created on sip.linphone.org, we configure linphone to use TLS by default
|
||||
if (strcmp(creator->domain, "sip:sip.linphone.org") == 0 && linphone_core_sip_transport_supported(linphone_gtk_get_core(),LinphoneTransportTls)) {
|
||||
LinphoneAddress *addr=linphone_address_new(creator->domain);
|
||||
char *tmp;
|
||||
linphone_address_set_transport(addr, LinphoneTransportTls);
|
||||
tmp=linphone_address_as_string(addr);
|
||||
linphone_proxy_config_set_server_addr(cfg,tmp);
|
||||
linphone_proxy_config_set_route(cfg,tmp);
|
||||
ms_free(tmp);
|
||||
linphone_address_destroy(addr);
|
||||
if (strcmp(creator->domain, "sip:sip.linphone.org") == 0 ){
|
||||
linphone_proxy_config_enable_avpf(cfg,TRUE);
|
||||
// If account created on sip.linphone.org, we configure linphone to use TLS by default
|
||||
if (linphone_core_sip_transport_supported(linphone_gtk_get_core(),LinphoneTransportTls)) {
|
||||
LinphoneAddress *addr=linphone_address_new(creator->domain);
|
||||
char *tmp;
|
||||
linphone_address_set_transport(addr, LinphoneTransportTls);
|
||||
tmp=linphone_address_as_string(addr);
|
||||
linphone_proxy_config_set_server_addr(cfg,tmp);
|
||||
linphone_proxy_config_set_route(cfg,tmp);
|
||||
ms_free(tmp);
|
||||
linphone_address_destroy(addr);
|
||||
}
|
||||
}
|
||||
|
||||
if (linphone_core_add_proxy_config(linphone_gtk_get_core(),cfg)==-1)
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ package org.linphone.core;
|
|||
import org.linphone.core.LinphoneChatMessage.State;
|
||||
|
||||
/**
|
||||
*
|
||||
* A chat room is the place where text messages are exchanged.
|
||||
*
|
||||
* A chat room is the place where text messages are exchanged.
|
||||
Can be created by linphone_core_create_chat_room().
|
||||
*
|
||||
*/
|
||||
|
|
@ -43,7 +43,7 @@ public interface LinphoneChatRoom {
|
|||
* @param chat message
|
||||
*/
|
||||
void sendMessage(LinphoneChatMessage message, LinphoneChatMessage.StateListener listener);
|
||||
|
||||
|
||||
/**
|
||||
* Create a LinphoneChatMessage
|
||||
* @param chatRoom chat room associated to the message
|
||||
|
|
@ -51,31 +51,45 @@ public interface LinphoneChatRoom {
|
|||
* @return LinphoneChatMessage object
|
||||
*/
|
||||
LinphoneChatMessage createLinphoneChatMessage(String message);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the chat history associated with the peer address associated with this chat room
|
||||
* @return an array of LinphoneChatMessage
|
||||
*/
|
||||
LinphoneChatMessage[] getHistory();
|
||||
|
||||
|
||||
/**
|
||||
* Returns the chat history associated with the peer address associated with this chat room
|
||||
* @param limit the maximum number of messages to fetch
|
||||
* @return an array of LinphoneChatMessage
|
||||
*/
|
||||
LinphoneChatMessage[] getHistory(int limit);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the chat history associated with the peer address associated with this chat room for the given range, sorted from oldest to most recent
|
||||
* @param begin the first (most recent) message to retrieve. Newest message has index 0. If negative, use value 0 instead.
|
||||
* @param end the last (oldest) message to retrieve. Oldest message has value "history size" - 1 (equivalent to -1). If negative or lower than begin value, value is given, use -1.
|
||||
* @return an array of LinphoneChatMessage, empty if nothing has been found
|
||||
*/
|
||||
LinphoneChatMessage[] getHistoryRange(int begin, int end);
|
||||
|
||||
/**
|
||||
* Destroys a LinphoneChatRoom.
|
||||
*/
|
||||
void destroy();
|
||||
|
||||
|
||||
/**
|
||||
* Returns the amount of unread messages associated with the peer of this chatRoom.
|
||||
* @return the amount of unread messages
|
||||
*/
|
||||
int getUnreadMessagesCount();
|
||||
|
||||
|
||||
/**
|
||||
* Returns the amount of messages associated with the peer of this chatRoom.
|
||||
* @return the amount of messages in the conversation
|
||||
*/
|
||||
int getHistorySize();
|
||||
|
||||
/**
|
||||
* Deletes all the messages associated with the peer of this chat room
|
||||
*/
|
||||
|
|
@ -91,24 +105,24 @@ public interface LinphoneChatRoom {
|
|||
* @return true if the remote is currently composing a message, false otherwise.
|
||||
*/
|
||||
boolean isRemoteComposing();
|
||||
|
||||
|
||||
/**
|
||||
* Marks all the messages in this conversation as read
|
||||
*/
|
||||
void markAsRead();
|
||||
|
||||
|
||||
/**
|
||||
* Deletes a message
|
||||
* @param message the message to delete
|
||||
*/
|
||||
void deleteMessage(LinphoneChatMessage message);
|
||||
|
||||
|
||||
/**
|
||||
* Update the value stored in the database for the external_body_url field
|
||||
* @param message to update
|
||||
*/
|
||||
void updateUrl(LinphoneChatMessage message);
|
||||
|
||||
|
||||
/**
|
||||
* Create a LinphoneChatMessage
|
||||
* @return LinphoneChatMessage object
|
||||
|
|
|
|||
|
|
@ -27,9 +27,11 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom {
|
|||
private native long getPeerAddress(long ptr);
|
||||
private native void sendMessage(long ptr, String message);
|
||||
private native void sendMessage2(long ptr, Object msg, long messagePtr, StateListener listener);
|
||||
private native long[] getHistoryRange(long ptr, int begin, int end);
|
||||
private native long[] getHistory(long ptr, int limit);
|
||||
private native void destroy(long ptr);
|
||||
private native int getUnreadMessagesCount(long ptr);
|
||||
private native int getHistorySize(long ptr);
|
||||
private native void deleteHistory(long ptr);
|
||||
private native void compose(long ptr);
|
||||
private native boolean isRemoteComposing(long ptr);
|
||||
|
|
@ -53,7 +55,7 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom {
|
|||
sendMessage(nativePtr,message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendMessage(LinphoneChatMessage message, StateListener listener) {
|
||||
synchronized(getCore()){
|
||||
|
|
@ -67,37 +69,43 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom {
|
|||
return new LinphoneChatMessageImpl(createLinphoneChatMessage(nativePtr, message));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public LinphoneChatMessage[] getHistory() {
|
||||
synchronized(getCore()){
|
||||
return getHistory(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public LinphoneChatMessage[] getHistoryRange(int begin, int end) {
|
||||
synchronized(getCore()){
|
||||
long[] typesPtr = getHistoryRange(nativePtr, begin, end);
|
||||
return getHistoryPrivate(typesPtr);
|
||||
}
|
||||
}
|
||||
|
||||
public LinphoneChatMessage[] getHistory(int limit) {
|
||||
synchronized(getCore()){
|
||||
long[] typesPtr = getHistory(nativePtr, limit);
|
||||
if (typesPtr == null) return null;
|
||||
|
||||
LinphoneChatMessage[] messages = new LinphoneChatMessage[typesPtr.length];
|
||||
for (int i=0; i < messages.length; i++) {
|
||||
messages[i] = new LinphoneChatMessageImpl(typesPtr[i]);
|
||||
}
|
||||
|
||||
return messages;
|
||||
return getHistoryPrivate(typesPtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void destroy() {
|
||||
destroy(nativePtr);
|
||||
}
|
||||
|
||||
|
||||
public int getUnreadMessagesCount() {
|
||||
synchronized(getCore()){
|
||||
return getUnreadMessagesCount(nativePtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getHistorySize() {
|
||||
synchronized(getCore()){
|
||||
return getHistorySize(nativePtr);
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteHistory() {
|
||||
synchronized(getCore()){
|
||||
deleteHistory(nativePtr);
|
||||
|
|
@ -115,27 +123,27 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom {
|
|||
return isRemoteComposing(nativePtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void markAsRead() {
|
||||
synchronized(getCore()){
|
||||
markAsRead(nativePtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void deleteMessage(LinphoneChatMessage message) {
|
||||
synchronized(getCore()){
|
||||
if (message != null)
|
||||
deleteMessage(nativePtr, ((LinphoneChatMessageImpl)message).getNativePtr());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void updateUrl(LinphoneChatMessage message) {
|
||||
synchronized(getCore()){
|
||||
if (message != null)
|
||||
updateUrl(nativePtr, ((LinphoneChatMessageImpl)message).getNativePtr());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public LinphoneChatMessage createLinphoneChatMessage(String message,
|
||||
String url, State state, long timestamp, boolean isRead,
|
||||
|
|
@ -150,4 +158,14 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom {
|
|||
public synchronized LinphoneCore getCore() {
|
||||
return (LinphoneCore)getCore(nativePtr);
|
||||
}
|
||||
private LinphoneChatMessage[] getHistoryPrivate(long[] typesPtr) {
|
||||
if (typesPtr == null) return null;
|
||||
|
||||
LinphoneChatMessage[] messages = new LinphoneChatMessage[typesPtr.length];
|
||||
for (int i=0; i < messages.length; i++) {
|
||||
messages[i] = new LinphoneChatMessageImpl(typesPtr[i]);
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 11afbd58bc873a83f6c5efbf0794da11b782e225
|
||||
Subproject commit 33cce2e74956d37c98d120b2c1d19c1d19d2f9a0
|
||||
2
oRTP
2
oRTP
|
|
@ -1 +1 @@
|
|||
Subproject commit 9d158c2daf289bd826b855903e913786f90d5bad
|
||||
Subproject commit 49fc68957126d1126be1eb0fcaaa6153480e93e4
|
||||
|
|
@ -26,6 +26,7 @@
|
|||
#include "private.h"
|
||||
#include "liblinphone_tester.h"
|
||||
|
||||
static void srtp_call(void);
|
||||
static void call_base(LinphoneMediaEncryption mode, bool_t enable_video,bool_t enable_relay,LinphoneFirewallPolicy policy);
|
||||
static void disable_all_audio_codecs_except_one(LinphoneCore *lc, const char *mime);
|
||||
|
||||
|
|
@ -124,8 +125,8 @@ static void linphone_call_cb(LinphoneCall *call,void * user_data) {
|
|||
|
||||
void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreManager* callee) {
|
||||
LinphoneCall *c1,*c2;
|
||||
int i;
|
||||
int dummy=0;
|
||||
MSTimeSpec ts;
|
||||
|
||||
c1=linphone_core_get_current_call(caller->lc);
|
||||
c2=linphone_core_get_current_call(callee->lc);
|
||||
|
|
@ -136,7 +137,9 @@ void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreMana
|
|||
if (!c1 || !c2) return;
|
||||
linphone_call_ref(c1);
|
||||
linphone_call_ref(c2);
|
||||
for (i=0; i<24 /*=12s need at least one exchange of SR to maybe 10s*/; i++) {
|
||||
|
||||
liblinphone_tester_clock_start(&ts);
|
||||
do {
|
||||
if (linphone_call_get_audio_stats(c1)->round_trip_delay >0.0
|
||||
&& linphone_call_get_audio_stats(c2)->round_trip_delay >0.0
|
||||
&& (!linphone_call_log_video_enabled(linphone_call_get_call_log(c1)) || linphone_call_get_video_stats(c1)->round_trip_delay>0.0)
|
||||
|
|
@ -145,8 +148,7 @@ void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreMana
|
|||
|
||||
}
|
||||
wait_for_until(caller->lc,callee->lc,&dummy,1,500); /*just to sleep while iterating*/
|
||||
|
||||
}
|
||||
}while (!liblinphone_tester_clock_elapsed(&ts,12000));
|
||||
CU_ASSERT_TRUE(linphone_call_get_audio_stats(c1)->round_trip_delay>0.0);
|
||||
CU_ASSERT_TRUE(linphone_call_get_audio_stats(c2)->round_trip_delay>0.0);
|
||||
if (linphone_call_log_video_enabled(linphone_call_get_call_log(c1))) {
|
||||
|
|
@ -159,10 +161,10 @@ void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreMana
|
|||
linphone_call_unref(c2);
|
||||
}
|
||||
|
||||
bool_t call_with_params(LinphoneCoreManager* caller_mgr
|
||||
bool_t call_with_params2(LinphoneCoreManager* caller_mgr
|
||||
,LinphoneCoreManager* callee_mgr
|
||||
, const LinphoneCallParams *caller_params
|
||||
, const LinphoneCallParams *callee_params) {
|
||||
, const LinphoneCallParams *callee_params, bool_t build_callee_params) {
|
||||
int retry=0;
|
||||
stats initial_caller=caller_mgr->stat;
|
||||
stats initial_callee=callee_mgr->stat;
|
||||
|
|
@ -214,10 +216,16 @@ bool_t call_with_params(LinphoneCoreManager* caller_mgr
|
|||
}
|
||||
linphone_address_destroy(callee_from);
|
||||
}
|
||||
if (callee_params)
|
||||
if (callee_params){
|
||||
linphone_core_accept_call_with_params(callee_mgr->lc,linphone_core_get_current_call(callee_mgr->lc),callee_params);
|
||||
else
|
||||
}else if (build_callee_params){
|
||||
LinphoneCallParams *default_params=linphone_core_create_call_params(callee_mgr->lc,linphone_core_get_current_call(callee_mgr->lc));
|
||||
ms_error("Created default call params with video=%i", linphone_call_params_video_enabled(default_params));
|
||||
linphone_core_accept_call_with_params(callee_mgr->lc,linphone_core_get_current_call(callee_mgr->lc),default_params);
|
||||
linphone_call_params_destroy(default_params);
|
||||
}else{
|
||||
linphone_core_accept_call(callee_mgr->lc,linphone_core_get_current_call(callee_mgr->lc));
|
||||
}
|
||||
|
||||
CU_ASSERT_TRUE(wait_for(callee_mgr->lc,caller_mgr->lc,&callee_mgr->stat.number_of_LinphoneCallConnected,initial_callee.number_of_LinphoneCallConnected+1));
|
||||
CU_ASSERT_TRUE(wait_for(callee_mgr->lc,caller_mgr->lc,&caller_mgr->stat.number_of_LinphoneCallConnected,initial_callee.number_of_LinphoneCallConnected+1));
|
||||
|
|
@ -242,6 +250,14 @@ bool_t call_with_params(LinphoneCoreManager* caller_mgr
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool_t call_with_params(LinphoneCoreManager* caller_mgr
|
||||
,LinphoneCoreManager* callee_mgr
|
||||
, const LinphoneCallParams *caller_params
|
||||
, const LinphoneCallParams *callee_params){
|
||||
return call_with_params2(caller_mgr,callee_mgr,caller_params,callee_params,FALSE);
|
||||
}
|
||||
|
||||
bool_t call_with_caller_params(LinphoneCoreManager* caller_mgr,LinphoneCoreManager* callee_mgr, const LinphoneCallParams *params) {
|
||||
return call_with_params(caller_mgr,callee_mgr,params,NULL);
|
||||
}
|
||||
|
|
@ -1142,7 +1158,42 @@ static bool_t add_video(LinphoneCoreManager* caller,LinphoneCoreManager* callee)
|
|||
/*send vfu*/
|
||||
linphone_call_send_vfu_request(call_obj);
|
||||
return wait_for(caller->lc,callee->lc,&callee->stat.number_of_IframeDecoded,initial_callee_stat.number_of_IframeDecoded+1);
|
||||
} else return 0;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool_t remove_video(LinphoneCoreManager *caller, LinphoneCoreManager *callee) {
|
||||
LinphoneCallParams *callee_params;
|
||||
LinphoneCall *call_obj;
|
||||
stats initial_caller_stat = caller->stat;
|
||||
stats initial_callee_stat = callee->stat;
|
||||
|
||||
if (!linphone_core_get_current_call(callee->lc)
|
||||
|| (linphone_call_get_state(linphone_core_get_current_call(callee->lc)) != LinphoneCallStreamsRunning)
|
||||
|| !linphone_core_get_current_call(caller->lc)
|
||||
|| (linphone_call_get_state(linphone_core_get_current_call(caller->lc)) != LinphoneCallStreamsRunning)) {
|
||||
ms_warning("bad state for removing video");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((call_obj = linphone_core_get_current_call(callee->lc))) {
|
||||
callee_params = linphone_call_params_copy(linphone_call_get_current_params(call_obj));
|
||||
|
||||
/* Remove video. */
|
||||
linphone_call_params_enable_video(callee_params, FALSE);
|
||||
linphone_core_update_call(callee->lc, call_obj, callee_params);
|
||||
|
||||
CU_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallUpdatedByRemote, initial_caller_stat.number_of_LinphoneCallUpdatedByRemote + 1));
|
||||
CU_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &callee->stat.number_of_LinphoneCallUpdating, initial_callee_stat.number_of_LinphoneCallUpdating + 1));
|
||||
CU_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &callee->stat.number_of_LinphoneCallStreamsRunning, initial_callee_stat.number_of_LinphoneCallStreamsRunning + 1));
|
||||
CU_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallStreamsRunning, initial_caller_stat.number_of_LinphoneCallStreamsRunning + 1));
|
||||
|
||||
CU_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc))));
|
||||
CU_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(caller->lc))));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void call_with_video_added(void) {
|
||||
|
|
@ -1181,10 +1232,60 @@ static void call_with_video_added_random_ports(void) {
|
|||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
||||
static void call_with_several_video_switches(void) {
|
||||
int dummy = 0;
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
|
||||
CU_ASSERT_TRUE(call(pauline,marie));
|
||||
|
||||
CU_ASSERT_TRUE(add_video(pauline,marie));
|
||||
wait_for_until(pauline->lc,marie->lc,&dummy,1,1000); /* Wait for VFU request exchanges to be finished. */
|
||||
CU_ASSERT_TRUE(remove_video(pauline,marie));
|
||||
CU_ASSERT_TRUE(add_video(pauline,marie));
|
||||
wait_for_until(pauline->lc,marie->lc,&dummy,1,1000); /* Wait for VFU request exchanges to be finished. */
|
||||
CU_ASSERT_TRUE(remove_video(pauline,marie));
|
||||
/*just to sleep*/
|
||||
linphone_core_terminate_all_calls(pauline->lc);
|
||||
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1));
|
||||
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1));
|
||||
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
||||
static void srtp_call_with_several_video_switches(void) {
|
||||
int dummy = 0;
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
|
||||
|
||||
if (linphone_core_media_encryption_supported(marie->lc, LinphoneMediaEncryptionSRTP)) {
|
||||
linphone_core_set_media_encryption(marie->lc, LinphoneMediaEncryptionSRTP);
|
||||
linphone_core_set_media_encryption(pauline->lc, LinphoneMediaEncryptionSRTP);
|
||||
|
||||
CU_ASSERT_TRUE(call(pauline,marie));
|
||||
|
||||
CU_ASSERT_TRUE(add_video(pauline,marie));
|
||||
wait_for_until(pauline->lc,marie->lc,&dummy,1,1000); /* Wait for VFU request exchanges to be finished. */
|
||||
CU_ASSERT_TRUE(remove_video(pauline,marie));
|
||||
CU_ASSERT_TRUE(add_video(pauline,marie));
|
||||
wait_for_until(pauline->lc,marie->lc,&dummy,1,1000); /* Wait for VFU request exchanges to be finished. */
|
||||
CU_ASSERT_TRUE(remove_video(pauline,marie));
|
||||
/*just to sleep*/
|
||||
linphone_core_terminate_all_calls(pauline->lc);
|
||||
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1));
|
||||
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1));
|
||||
} else {
|
||||
ms_warning("Not tested because SRTP is not available.");
|
||||
}
|
||||
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
||||
static void call_with_declined_video_base(bool_t using_policy) {
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
|
||||
LinphoneCallParams* callee_params;
|
||||
LinphoneCallParams* callee_params=NULL;
|
||||
LinphoneCallParams* caller_params;
|
||||
LinphoneCall* marie_call;
|
||||
LinphoneCall* pauline_call;
|
||||
|
|
@ -1207,11 +1308,16 @@ static void call_with_declined_video_base(bool_t using_policy) {
|
|||
caller_params=linphone_core_create_default_call_parameters(pauline->lc);
|
||||
if (!using_policy)
|
||||
linphone_call_params_enable_video(caller_params,TRUE);
|
||||
callee_params=linphone_core_create_default_call_parameters(marie->lc);
|
||||
if (!using_policy)
|
||||
|
||||
if (!using_policy){
|
||||
callee_params=linphone_core_create_default_call_parameters(marie->lc);
|
||||
linphone_call_params_enable_video(callee_params,FALSE);
|
||||
}
|
||||
|
||||
CU_ASSERT_TRUE(call_with_params(pauline,marie,caller_params,callee_params));
|
||||
CU_ASSERT_TRUE(call_with_params2(pauline,marie,caller_params,callee_params,using_policy));
|
||||
|
||||
linphone_call_params_destroy(caller_params);
|
||||
if (callee_params) linphone_call_params_destroy(callee_params);
|
||||
marie_call=linphone_core_get_current_call(marie->lc);
|
||||
pauline_call=linphone_core_get_current_call(pauline->lc);
|
||||
|
||||
|
|
@ -1234,7 +1340,7 @@ static void call_with_declined_video_using_policy(void) {
|
|||
}
|
||||
|
||||
static void video_call_base(LinphoneCoreManager* pauline,LinphoneCoreManager* marie, bool_t using_policy) {
|
||||
LinphoneCallParams* callee_params;
|
||||
LinphoneCallParams* callee_params=NULL;
|
||||
LinphoneCallParams* caller_params;
|
||||
LinphoneCall* marie_call;
|
||||
LinphoneCall* pauline_call;
|
||||
|
|
@ -1257,16 +1363,18 @@ static void video_call_base(LinphoneCoreManager* pauline,LinphoneCoreManager* ma
|
|||
caller_params=linphone_core_create_default_call_parameters(pauline->lc);
|
||||
if (!using_policy)
|
||||
linphone_call_params_enable_video(caller_params,TRUE);
|
||||
callee_params=linphone_core_create_default_call_parameters(marie->lc);
|
||||
if (!using_policy)
|
||||
|
||||
if (!using_policy){
|
||||
callee_params=linphone_core_create_default_call_parameters(marie->lc);
|
||||
linphone_call_params_enable_video(callee_params,TRUE);
|
||||
}
|
||||
|
||||
CU_ASSERT_TRUE(call_with_params(pauline,marie,caller_params,callee_params));
|
||||
CU_ASSERT_TRUE(call_with_params2(pauline,marie,caller_params,callee_params,using_policy));
|
||||
marie_call=linphone_core_get_current_call(marie->lc);
|
||||
pauline_call=linphone_core_get_current_call(pauline->lc);
|
||||
|
||||
linphone_call_params_destroy(caller_params);
|
||||
linphone_call_params_destroy(callee_params);
|
||||
if (callee_params) linphone_call_params_destroy(callee_params);
|
||||
|
||||
if (marie_call && pauline_call ) {
|
||||
CU_ASSERT_TRUE(linphone_call_log_video_enabled(linphone_call_get_call_log(marie_call)));
|
||||
|
|
@ -2670,14 +2778,25 @@ static void savpf_to_savpf_call(void) {
|
|||
profile_call(TRUE, TRUE, TRUE, TRUE, "RTP/SAVPF");
|
||||
}
|
||||
|
||||
static void call_recording() {
|
||||
static char *create_filepath(const char *dir, const char *filename, const char *ext) {
|
||||
char *filepath = ms_new0(char, strlen(dir) + strlen(filename) + strlen(ext) + 3);
|
||||
strcpy(filepath, dir);
|
||||
strcat(filepath, "/");
|
||||
strcat(filepath, filename);
|
||||
strcat(filepath, ".");
|
||||
strcat(filepath, ext);
|
||||
return filepath;
|
||||
}
|
||||
|
||||
static void record_call(const char *filename, bool_t enableVideo) {
|
||||
LinphoneCoreManager *marie = NULL;
|
||||
LinphoneCoreManager *pauline = NULL;
|
||||
LinphoneCallParams *marieParams = NULL;
|
||||
LinphoneCallParams *paulineParams = NULL;
|
||||
LinphoneCall *callInst = NULL;
|
||||
int dummy=0;
|
||||
char *filepath = NULL;
|
||||
const char **formats, *format;
|
||||
char *filepath;
|
||||
int dummy=0, i;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef HAVE_OPENH264
|
||||
|
|
@ -2690,61 +2809,49 @@ static void call_recording() {
|
|||
marieParams = linphone_core_create_default_call_parameters(marie->lc);
|
||||
paulineParams = linphone_core_create_default_call_parameters(pauline->lc);
|
||||
|
||||
#ifdef ANDROID
|
||||
const char dirname[] = "/sdcard/Movies/liblinphone_tester";
|
||||
#else
|
||||
const char dirname[] = ".test";
|
||||
#endif
|
||||
|
||||
#ifdef VIDEO_ENABLED
|
||||
const char filename[] = "recording.mkv";
|
||||
#else
|
||||
const char filename[] = "recording.wav";
|
||||
#endif
|
||||
|
||||
filepath = ms_new0(char, strlen(dirname) + strlen(filename) + 2);
|
||||
strcpy(filepath, dirname);
|
||||
strcat(filepath, "/");
|
||||
strcat(filepath, filename);
|
||||
if(access(dirname, F_OK) != 0) {
|
||||
#ifdef WIN32
|
||||
CU_ASSERT_EQUAL(mkdir(dirname),0);
|
||||
#else
|
||||
CU_ASSERT_EQUAL(mkdir(dirname, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH), 0);
|
||||
#endif
|
||||
}
|
||||
CU_ASSERT_EQUAL(access(dirname, W_OK), 0);
|
||||
if(access(filepath, F_OK) == 0) {
|
||||
CU_ASSERT_EQUAL(remove(filepath), 0);
|
||||
}
|
||||
|
||||
linphone_call_params_set_record_file(marieParams, filepath);
|
||||
|
||||
#ifdef VIDEO_ENABLED
|
||||
if((linphone_core_find_payload_type(marie->lc, "H264", -1, -1) != NULL) && (linphone_core_find_payload_type(pauline->lc, "H264", -1, -1) != NULL)) {
|
||||
linphone_call_params_enable_video(marieParams, TRUE);
|
||||
linphone_call_params_enable_video(paulineParams, TRUE);
|
||||
disable_all_video_codecs_except_one(marie->lc, "H264");
|
||||
disable_all_video_codecs_except_one(pauline->lc, "H264");
|
||||
} else {
|
||||
ms_warning("call_recording(): the H264 payload has not been found. Only sound will be recorded");
|
||||
if(enableVideo) {
|
||||
if((linphone_core_find_payload_type(marie->lc, "H264", -1, -1) != NULL)
|
||||
&& (linphone_core_find_payload_type(pauline->lc, "H264", -1, -1) != NULL)) {
|
||||
linphone_call_params_enable_video(marieParams, TRUE);
|
||||
linphone_call_params_enable_video(paulineParams, TRUE);
|
||||
disable_all_video_codecs_except_one(marie->lc, "H264");
|
||||
disable_all_video_codecs_except_one(pauline->lc, "H264");
|
||||
} else {
|
||||
ms_warning("call_recording(): the H264 payload has not been found. Only sound will be recorded");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
CU_ASSERT_TRUE(call_with_params(marie, pauline, marieParams, paulineParams));
|
||||
CU_ASSERT_PTR_NOT_NULL(callInst = linphone_core_get_current_call(marie->lc));
|
||||
formats = linphone_core_get_supported_file_formats(marie->lc);
|
||||
|
||||
ms_message("call_recording(): the call will be recorded into %s", filepath);
|
||||
linphone_call_start_recording(callInst);
|
||||
wait_for_until(marie->lc,pauline->lc,&dummy,1,10000);
|
||||
linphone_call_stop_recording(callInst);
|
||||
|
||||
CU_ASSERT_EQUAL(access(filepath, F_OK), 0);
|
||||
end_call(marie, pauline);
|
||||
for(i=0, format = formats[0]; format != NULL; i++, format = formats[i]) {
|
||||
filepath = create_filepath(liblinphone_tester_writable_dir_prefix, filename, format);
|
||||
remove(filepath);
|
||||
linphone_call_params_set_record_file(marieParams, filepath);
|
||||
if((CU_ASSERT_TRUE(call_with_params(marie, pauline, marieParams, paulineParams)))
|
||||
&& (CU_ASSERT_PTR_NOT_NULL(callInst = linphone_core_get_current_call(marie->lc)))) {
|
||||
|
||||
ms_message("call_recording(): start recording into %s", filepath);
|
||||
linphone_call_start_recording(callInst);
|
||||
wait_for_until(marie->lc,pauline->lc,&dummy,1,5000);
|
||||
linphone_call_stop_recording(callInst);
|
||||
end_call(marie, pauline);
|
||||
CU_ASSERT_EQUAL(access(filepath, F_OK), 0);
|
||||
remove(filepath);
|
||||
}
|
||||
ms_free(filepath);
|
||||
}
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
ms_free(filepath);
|
||||
}
|
||||
|
||||
static void audio_call_recording_test(void) {
|
||||
record_call("recording", FALSE);
|
||||
}
|
||||
|
||||
static void video_call_recording_test(void) {
|
||||
record_call("recording", TRUE);
|
||||
}
|
||||
|
||||
test_t call_tests[] = {
|
||||
|
|
@ -2757,6 +2864,7 @@ test_t call_tests[] = {
|
|||
{ "Call failed because of codecs", call_failed_because_of_codecs },
|
||||
{ "Simple call", simple_call },
|
||||
{ "Outbound call with multiple proxy possible", call_outbound_with_multiple_proxy },
|
||||
{ "Audio call recording", audio_call_recording_test },
|
||||
#if 0 /* not yet activated because not implemented */
|
||||
{ "Multiple answers to a call", multiple_answers_call },
|
||||
#endif
|
||||
|
|
@ -2785,12 +2893,15 @@ test_t call_tests[] = {
|
|||
{ "ZRTP ice video call", zrtp_video_ice_call },
|
||||
{ "Call with video added", call_with_video_added },
|
||||
{ "Call with video added (random ports)", call_with_video_added_random_ports },
|
||||
{ "Call with several video switches", call_with_several_video_switches },
|
||||
{ "SRTP call with several video switches", srtp_call_with_several_video_switches },
|
||||
{ "Call with video declined", call_with_declined_video},
|
||||
{ "Call with video declined using policy", call_with_declined_video_using_policy},
|
||||
{ "Call with multiple early media", multiple_early_media },
|
||||
{ "Call with ICE from video to non-video", call_with_ice_video_to_novideo},
|
||||
{ "Call with ICE and video added", call_with_ice_video_added },
|
||||
{ "Video call with ICE no matching audio codecs", video_call_with_ice_no_matching_audio_codecs },
|
||||
{ "Video call recording", video_call_recording_test },
|
||||
#endif
|
||||
{ "SRTP ice call", srtp_ice_call },
|
||||
{ "ZRTP ice call", zrtp_ice_call },
|
||||
|
|
@ -2836,7 +2947,6 @@ test_t call_tests[] = {
|
|||
{ "SAVPF to AVPF call", savpf_to_avpf_call },
|
||||
{ "SAVPF to SAVP call", savpf_to_savp_call },
|
||||
{ "SAVPF to SAVPF call", savpf_to_savpf_call },
|
||||
{ "Call recording", call_recording }
|
||||
};
|
||||
|
||||
test_suite_t call_test_suite = {
|
||||
|
|
|
|||
|
|
@ -754,12 +754,11 @@ static void is_composing_notification(void) {
|
|||
/*
|
||||
* Copy file "from" to file "to".
|
||||
* Destination file is truncated if existing.
|
||||
* Return 1 on success, 0 on error (printing an error).
|
||||
* Return 0 on success, positive value on error.
|
||||
*/
|
||||
static int
|
||||
message_tester_copy_file(const char *from, const char *to)
|
||||
{
|
||||
char message[256];
|
||||
FILE *in, *out;
|
||||
char buf[256];
|
||||
size_t n;
|
||||
|
|
@ -768,21 +767,17 @@ message_tester_copy_file(const char *from, const char *to)
|
|||
in=fopen(from, "r");
|
||||
if ( in == NULL )
|
||||
{
|
||||
snprintf(message, 255, "Can't open %s for reading: %s\n",
|
||||
from, strerror(errno));
|
||||
fprintf(stderr, "%s", message);
|
||||
return 0;
|
||||
ms_error("Can't open %s for reading: %s\n",from,strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Open "to" file for writing (will truncate existing files) */
|
||||
out=fopen(to, "w");
|
||||
if ( out == NULL )
|
||||
{
|
||||
snprintf(message, 255, "Can't open %s for writing: %s\n",
|
||||
to, strerror(errno));
|
||||
fprintf(stderr, "%s", message);
|
||||
ms_error("Can't open %s for writing: %s\n",to,strerror(errno));
|
||||
fclose(in);
|
||||
return 0;
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Copy data from "in" to "out" */
|
||||
|
|
@ -790,16 +785,17 @@ message_tester_copy_file(const char *from, const char *to)
|
|||
{
|
||||
if ( ! fwrite(buf, 1, n, out) )
|
||||
{
|
||||
ms_error("Could not write in %s: %s\n",to,strerror(errno));
|
||||
fclose(in);
|
||||
fclose(out);
|
||||
return 0;
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(in);
|
||||
fclose(out);
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int check_no_strange_time(void* data,int argc, char** argv,char** cNames) {
|
||||
|
|
@ -814,7 +810,7 @@ static void message_storage_migration() {
|
|||
snprintf(src_db,sizeof(src_db), "%s/messages.db", liblinphone_tester_file_prefix);
|
||||
snprintf(tmp_db,sizeof(tmp_db), "%s/tmp.db", liblinphone_tester_writable_dir_prefix);
|
||||
|
||||
CU_ASSERT_EQUAL_FATAL(message_tester_copy_file(src_db, tmp_db), 1);
|
||||
CU_ASSERT_EQUAL_FATAL(message_tester_copy_file(src_db, tmp_db), 0);
|
||||
|
||||
// enable to test the performances of the migration step
|
||||
//linphone_core_message_storage_set_debug(marie->lc, TRUE);
|
||||
|
|
@ -828,8 +824,54 @@ static void message_storage_migration() {
|
|||
|
||||
// check that all messages have been migrated to the UTC time storage
|
||||
CU_ASSERT(sqlite3_exec(marie->lc->db, "SELECT * FROM history WHERE time != '-1';", check_no_strange_time, NULL, NULL) == SQLITE_OK );
|
||||
|
||||
linphone_core_manager_destroy(marie);
|
||||
remove(tmp_db);
|
||||
}
|
||||
|
||||
static void history_messages_count() {
|
||||
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneAddress *jehan_addr = linphone_address_new("<sip:Jehan@sip.linphone.org>");
|
||||
LinphoneChatRoom *chatroom;
|
||||
MSList *messages;
|
||||
char src_db[256];
|
||||
char tmp_db[256];
|
||||
snprintf(src_db,sizeof(src_db), "%s/messages.db", liblinphone_tester_file_prefix);
|
||||
snprintf(tmp_db,sizeof(tmp_db), "%s/tmp.db", liblinphone_tester_writable_dir_prefix);
|
||||
|
||||
CU_ASSERT_EQUAL_FATAL(message_tester_copy_file(src_db, tmp_db), 0);
|
||||
|
||||
linphone_core_set_chat_database_path(marie->lc, tmp_db);
|
||||
|
||||
chatroom = linphone_core_get_chat_room(marie->lc, jehan_addr);
|
||||
CU_ASSERT_PTR_NOT_NULL(chatroom);
|
||||
if (chatroom){
|
||||
MSList *history=linphone_chat_room_get_history(chatroom,0);
|
||||
CU_ASSERT_EQUAL(linphone_chat_room_get_history_size(chatroom), 1270);
|
||||
CU_ASSERT_EQUAL(ms_list_size(history), linphone_chat_room_get_history_size(chatroom));
|
||||
/*check the second most recent message*/
|
||||
CU_ASSERT_STRING_EQUAL(linphone_chat_message_get_text((LinphoneChatMessage *)history->next->data), "Fore and aft follow each other.");
|
||||
|
||||
/*test offset+limit: retrieve the 42th latest message only and check its content*/
|
||||
messages=linphone_chat_room_get_history_range(chatroom, 42, 42);
|
||||
CU_ASSERT_EQUAL(ms_list_size(messages), 1);
|
||||
CU_ASSERT_STRING_EQUAL(linphone_chat_message_get_text((LinphoneChatMessage *)messages->data), "If you open yourself to the Tao is intangible and evasive, yet prefers to keep us at the mercy of the kingdom, then all of the streams of hundreds of valleys because of its limitless possibilities.");
|
||||
|
||||
/*test offset without limit*/
|
||||
CU_ASSERT_EQUAL(ms_list_size(linphone_chat_room_get_history_range(chatroom, 1265, -1)), 1270-1265);
|
||||
|
||||
/*test limit without offset*/
|
||||
CU_ASSERT_EQUAL(ms_list_size(linphone_chat_room_get_history_range(chatroom, 0, 5)), 6);
|
||||
|
||||
/*test invalid start*/
|
||||
CU_ASSERT_EQUAL(ms_list_size(linphone_chat_room_get_history_range(chatroom, 1265, 1260)), 1270-1265);
|
||||
}
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_address_destroy(jehan_addr);
|
||||
remove(tmp_db);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
test_t message_tests[] = {
|
||||
|
|
@ -852,6 +894,7 @@ test_t message_tests[] = {
|
|||
{ "IsComposing notification", is_composing_notification }
|
||||
#ifdef MSG_STORAGE_ENABLED
|
||||
,{ "Database migration", message_storage_migration }
|
||||
,{ "History count", history_messages_count }
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -50,7 +50,11 @@ const char *liblinphone_tester_file_prefix=".";
|
|||
#endif
|
||||
|
||||
/* TODO: have the same "static" for QNX and windows as above? */
|
||||
#ifdef ANDROID
|
||||
const char *liblinphone_tester_writable_dir_prefix = "/data/data/org.linphone.tester/cache";
|
||||
#else
|
||||
const char *liblinphone_tester_writable_dir_prefix = ".";
|
||||
#endif
|
||||
|
||||
const char *userhostsfile = "tester_hosts";
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ class CArgument(CObject):
|
|||
def __init__(self, t, name = '', enums = [], structs = []):
|
||||
CObject.__init__(self, name)
|
||||
self.description = None
|
||||
self.containedType = None
|
||||
keywords = [ 'const', 'struct', 'enum', 'signed', 'unsigned', 'short', 'long', '*' ]
|
||||
fullySplittedType = []
|
||||
splittedType = t.strip().split(' ')
|
||||
|
|
@ -302,6 +303,8 @@ class Project:
|
|||
para.remove(n)
|
||||
for n in para.findall('.//ref'):
|
||||
n.attrib = {}
|
||||
for n in para.findall(".//mslist"):
|
||||
para.remove(n)
|
||||
if descriptionNode.tag == 'parameterdescription':
|
||||
descriptionNode.tag = 'description'
|
||||
if descriptionNode.tag == 'simplesect':
|
||||
|
|
@ -335,6 +338,11 @@ class Project:
|
|||
if st.associatedTypedef == td:
|
||||
self.add(CClass(st))
|
||||
break
|
||||
elif ('Linphone' + td.definition) == td.name:
|
||||
st = CStruct(td.name)
|
||||
st.associatedTypedef = td
|
||||
self.add(st)
|
||||
self.add(CClass(st))
|
||||
# Sort classes by length of name (longest first), so that methods are put in the right class
|
||||
self.classes.sort(key = lambda c: len(c.name), reverse = True)
|
||||
for e in self.__events:
|
||||
|
|
@ -480,6 +488,10 @@ class Project:
|
|||
returnarg = CArgument(t, enums = self.enums, structs = self.__structs)
|
||||
returndesc = node.find("./detaileddescription/para/simplesect[@kind='return']")
|
||||
if returndesc is not None:
|
||||
if returnarg.ctype == 'MSList':
|
||||
n = returndesc.find('.//mslist')
|
||||
if n is not None:
|
||||
returnarg.containedType = n.text
|
||||
returnarg.description = self.__cleanDescription(returndesc)
|
||||
elif returnarg.completeType != 'void':
|
||||
missingDocWarning += "\tReturn value is not documented\n"
|
||||
|
|
@ -499,6 +511,10 @@ class Project:
|
|||
for arg in argslist.arguments:
|
||||
for paramdesc in paramdescs:
|
||||
if arg.name == paramdesc.find('./parameternamelist').find('./parametername').text:
|
||||
if arg.ctype == 'MSList':
|
||||
n = paramdesc.find('.//mslist')
|
||||
if n is not None:
|
||||
arg.containedType = n.text
|
||||
arg.description = self.__cleanDescription(paramdesc.find('./parameterdescription'))
|
||||
missingDocWarning = ''
|
||||
for arg in argslist.arguments:
|
||||
|
|
@ -589,12 +605,16 @@ class Generator:
|
|||
functionAttributes['location'] = f.location
|
||||
functionNode = ET.SubElement(parentNode, nodeName, functionAttributes)
|
||||
returnValueAttributes = { 'type' : f.returnArgument.ctype, 'completetype' : f.returnArgument.completeType }
|
||||
if f.returnArgument.containedType is not None:
|
||||
returnValueAttributes['containedtype'] = f.returnArgument.containedType
|
||||
returnValueNode = ET.SubElement(functionNode, 'return', returnValueAttributes)
|
||||
if f.returnArgument.description is not None:
|
||||
returnValueNode.append(f.returnArgument.description)
|
||||
argumentsNode = ET.SubElement(functionNode, 'arguments')
|
||||
for arg in f.arguments:
|
||||
argumentNodeAttributes = { 'name' : arg.name, 'type' : arg.ctype, 'completetype' : arg.completeType }
|
||||
if arg.containedType is not None:
|
||||
argumentNodeAttributes['containedtype'] = arg.containedType
|
||||
argumentNode = ET.SubElement(argumentsNode, 'argument', argumentNodeAttributes)
|
||||
if arg.description is not None:
|
||||
argumentNode.append(arg.description)
|
||||
|
|
|
|||
|
|
@ -38,50 +38,28 @@ blacklisted_events = [
|
|||
'LinphoneCoreFileTransferSendCb' # missing LinphoneContent
|
||||
]
|
||||
blacklisted_functions = [
|
||||
'linphone_call_get_user_pointer', # rename to linphone_call_get_user_data
|
||||
'linphone_call_set_user_pointer', # rename to linphone_call_set_user_data
|
||||
'linphone_call_log_get_local_stats', # missing rtp_stats_t
|
||||
'linphone_call_log_get_remote_stats', # missing rtp_stats_t
|
||||
'linphone_call_log_get_start_date', # missing time_t
|
||||
'linphone_call_log_get_user_pointer', # rename to linphone_call_log_get_user_data
|
||||
'linphone_call_log_set_user_pointer', # rename to linphone_call_log_set_user_data
|
||||
'linphone_call_params_get_privacy', # missing LinphonePrivacyMask
|
||||
'linphone_call_params_get_used_audio_codec', # missing PayloadType
|
||||
'linphone_call_params_get_used_video_codec', # missing PayloadType
|
||||
'linphone_call_params_set_privacy', # missing LinphonePrivacyMask
|
||||
'linphone_chat_message_get_file_transfer_information', # missing LinphoneContent
|
||||
'linphone_chat_message_get_time', # missing time_t
|
||||
'linphone_chat_message_start_file_download', # to be handwritten because of callback
|
||||
'linphone_chat_message_state_to_string', # There is no use to wrap this function
|
||||
'linphone_chat_room_create_file_transfer_message', # missing LinphoneContent
|
||||
'linphone_chat_room_create_message_2', # missing time_t
|
||||
'linphone_core_can_we_add_call', # private function
|
||||
'linphone_core_enable_payload_type', # missing PayloadType
|
||||
'linphone_core_find_payload_type', # missing PayloadType
|
||||
'linphone_core_get_audio_codecs', # missing PayloadType and MSList
|
||||
'linphone_core_get_auth_info_list', # missing MSList
|
||||
'linphone_core_get_call_logs', # missing MSList
|
||||
'linphone_core_get_calls', # missing MSList
|
||||
'linphone_core_get_chat_rooms', # missing MSList
|
||||
'linphone_core_get_audio_port_range', # to be handwritten because of result via arguments
|
||||
'linphone_core_get_default_proxy', # to be handwritten because of double pointer indirection
|
||||
'linphone_core_get_payload_type_bitrate', # missing PayloadType
|
||||
'linphone_core_get_friend_list', # missing MSList
|
||||
'linphone_core_get_proxy_config_list', # missing MSList
|
||||
'linphone_core_get_sip_transports', # missing LCSipTransports
|
||||
'linphone_core_get_sip_transports_used', # missing LCSipTransports
|
||||
'linphone_core_get_supported_video_sizes', # missing MSVideoSizeDef
|
||||
'linphone_core_get_video_codecs', # missing PayloadType and MSList
|
||||
'linphone_core_get_video_policy', # missing LinphoneVideoPolicy
|
||||
'linphone_core_payload_type_enabled', # missing PayloadType
|
||||
'linphone_core_payload_type_is_vbr', # missing PayloadType
|
||||
'linphone_core_get_video_port_range', # to be handwritten because of result via arguments
|
||||
'linphone_core_publish', # missing LinphoneContent
|
||||
'linphone_core_serialize_logs', # There is no use to wrap this function
|
||||
'linphone_core_set_log_file', # There is no use to wrap this function
|
||||
'linphone_core_set_log_handler', # Hand-written but put directly in the linphone module
|
||||
'linphone_core_set_log_level', # There is no use to wrap this function
|
||||
'linphone_core_set_payload_type_bitrate', # missing PayloadType
|
||||
'linphone_core_set_video_policy', # missing LinphoneVideoPolicy
|
||||
'linphone_core_set_audio_codecs', # missing PayloadType and MSList
|
||||
'linphone_core_set_sip_transports', # missing LCSipTransports
|
||||
'linphone_core_subscribe', # missing LinphoneContent
|
||||
'linphone_event_notify', # missing LinphoneContent
|
||||
|
|
@ -89,7 +67,6 @@ blacklisted_functions = [
|
|||
'linphone_event_send_subscribe', # missing LinphoneContent
|
||||
'linphone_event_update_publish', # missing LinphoneContent
|
||||
'linphone_event_update_subscribe', # missing LinphoneContent
|
||||
'linphone_presence_model_get_timestamp', # missing time_t
|
||||
'linphone_proxy_config_get_privacy', # missing LinphonePrivacyMask
|
||||
'linphone_proxy_config_normalize_number', # to be handwritten because of result via arguments
|
||||
'linphone_proxy_config_set_file_transfer_server', # defined but not implemented in linphone core
|
||||
|
|
@ -103,6 +80,8 @@ blacklisted_functions = [
|
|||
]
|
||||
hand_written_functions = [
|
||||
'linphone_chat_room_send_message2',
|
||||
'linphone_core_get_sound_devices',
|
||||
'linphone_core_get_video_devices',
|
||||
'linphone_core_new',
|
||||
'linphone_core_new_with_config'
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
static PyObject * pylinphone_Core_get_sound_devices(PyObject *self, void *closure);
|
||||
static PyObject * pylinphone_Core_get_video_devices(PyObject *self, void *closure);
|
||||
|
||||
static PyTypeObject pylinphone_VideoSizeType;
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -8,3 +11,5 @@ typedef struct {
|
|||
int PyLinphoneVideoSize_Check(PyObject *p);
|
||||
MSVideoSize PyLinphoneVideoSize_AsMSVideoSize(PyObject *obj);
|
||||
PyObject * PyLinphoneVideoSize_FromMSVideoSize(MSVideoSize vs);
|
||||
time_t PyDateTime_As_time_t(PyObject *obj);
|
||||
PyObject * PyDateTime_From_time_t(time_t t);
|
||||
|
|
|
|||
|
|
@ -114,6 +114,57 @@ static PyObject * pylinphone_module_method_set_log_handler(PyObject *self, PyObj
|
|||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
static PyObject * pylinphone_Core_get_sound_devices(PyObject *self, void *closure) {
|
||||
PyObject *_list;
|
||||
const char **_devices;
|
||||
LinphoneCore *native_ptr = pylinphone_Core_get_native_ptr(self);
|
||||
|
||||
if (native_ptr == NULL) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid linphone.Core instance");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pylinphone_trace(1, "[PYLINPHONE] >>> %s(%p [%p])", __FUNCTION__, self, native_ptr);
|
||||
_devices = linphone_core_get_sound_devices(native_ptr);
|
||||
pylinphone_dispatch_messages();
|
||||
|
||||
_list = PyList_New(0);
|
||||
while (*_devices != NULL) {
|
||||
PyObject *_item = PyString_FromString(*_devices);
|
||||
PyList_Append(_list, _item);
|
||||
_devices++;
|
||||
}
|
||||
|
||||
pylinphone_trace(-1, "[PYLINPHONE] <<< %s -> %p", __FUNCTION__, _list);
|
||||
return _list;
|
||||
}
|
||||
|
||||
static PyObject * pylinphone_Core_get_video_devices(PyObject *self, void *closure) {
|
||||
PyObject *_list;
|
||||
const char **_devices;
|
||||
LinphoneCore *native_ptr = pylinphone_Core_get_native_ptr(self);
|
||||
|
||||
if (native_ptr == NULL) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid linphone.Core instance");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pylinphone_trace(1, "[PYLINPHONE] >>> %s(%p [%p])", __FUNCTION__, self, native_ptr);
|
||||
_devices = linphone_core_get_video_devices(native_ptr);
|
||||
pylinphone_dispatch_messages();
|
||||
|
||||
_list = PyList_New(0);
|
||||
while (*_devices != NULL) {
|
||||
PyObject *_item = PyString_FromString(*_devices);
|
||||
PyList_Append(_list, _item);
|
||||
_devices++;
|
||||
}
|
||||
|
||||
pylinphone_trace(-1, "[PYLINPHONE] <<< %s -> %p", __FUNCTION__, _list);
|
||||
return _list;
|
||||
}
|
||||
|
||||
static PyObject * pylinphone_Core_class_method_new(PyObject *cls, PyObject *args) {
|
||||
LinphoneCore * cresult;
|
||||
pylinphone_CoreObject *self;
|
||||
|
|
@ -197,9 +248,11 @@ static PyObject * pylinphone_Core_class_method_new_with_config(PyObject *cls, Py
|
|||
|
||||
static void pylinphone_ChatRoom_callback_chat_message_state_changed(LinphoneChatMessage *msg, LinphoneChatMessageState state, void *ud) {
|
||||
PyGILState_STATE pygil_state;
|
||||
PyObject * pycm = NULL;
|
||||
PyObject * func = NULL;
|
||||
pylinphone_ChatRoomObject *pycr = (pylinphone_ChatRoomObject *)ud;
|
||||
PyObject *pycm = NULL;
|
||||
PyObject *func = NULL;
|
||||
PyObject *_dict = (PyObject *)ud;
|
||||
PyObject *_cb = PyDict_GetItemString(_dict, "callback");
|
||||
PyObject *_ud = PyDict_GetItemString(_dict, "user_data");
|
||||
|
||||
pygil_state = PyGILState_Ensure();
|
||||
pycm = linphone_chat_message_get_user_data(msg);
|
||||
|
|
@ -207,8 +260,8 @@ static void pylinphone_ChatRoom_callback_chat_message_state_changed(LinphoneChat
|
|||
pycm = pylinphone_ChatMessage_new_from_native_ptr(&pylinphone_ChatMessageType, msg);
|
||||
}
|
||||
pylinphone_trace(1, "[PYLINPHONE] >>> %s(%p, %p [%p], %d, %p)", __FUNCTION__, pycm, msg, state, ud);
|
||||
if ((pycr->send_message_cb != NULL) && PyCallable_Check(pycr->send_message_cb)) {
|
||||
if (PyEval_CallObject(pycr->send_message_cb, Py_BuildValue("OiO", pycm, state, pycr->send_message_ud)) == NULL) {
|
||||
if ((_cb != NULL) && PyCallable_Check(_cb)) {
|
||||
if (PyEval_CallObject(_cb, Py_BuildValue("OiO", pycm, state, _ud)) == NULL) {
|
||||
PyErr_Print();
|
||||
}
|
||||
}
|
||||
|
|
@ -218,6 +271,7 @@ static void pylinphone_ChatRoom_callback_chat_message_state_changed(LinphoneChat
|
|||
|
||||
static PyObject * pylinphone_ChatRoom_instance_method_send_message2(PyObject *self, PyObject *args) {
|
||||
PyObject *_chat_message;
|
||||
PyObject *_dict;
|
||||
PyObject *_cb;
|
||||
PyObject *_ud;
|
||||
LinphoneChatMessage * _chat_message_native_ptr;
|
||||
|
|
@ -234,18 +288,19 @@ static PyObject * pylinphone_ChatRoom_instance_method_send_message2(PyObject *se
|
|||
PyErr_SetString(PyExc_TypeError, "The msg argument must be a linphone.ChatMessage");
|
||||
return NULL;
|
||||
}
|
||||
if (!PyCallable_Check(_cb)) {
|
||||
if ((_cb != Py_None) && !PyCallable_Check(_cb)) {
|
||||
PyErr_SetString(PyExc_TypeError, "The status_cb argument must be a callable");
|
||||
return NULL;
|
||||
}
|
||||
if ((_chat_message_native_ptr = pylinphone_ChatMessage_get_native_ptr(_chat_message)) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
_dict = PyDict_New();
|
||||
PyDict_SetItemString(_dict, "callback", _cb);
|
||||
PyDict_SetItemString(_dict, "user_data", _ud);
|
||||
|
||||
pylinphone_trace(1, "[PYLINPHONE] >>> %s(%p [%p], %p [%p], %p, %p)", __FUNCTION__, self, native_ptr, _chat_message, _chat_message_native_ptr, _cb, _ud);
|
||||
((pylinphone_ChatRoomObject *)self)->send_message_cb = _cb;
|
||||
((pylinphone_ChatRoomObject *)self)->send_message_ud = _ud;
|
||||
linphone_chat_room_send_message2(native_ptr, _chat_message_native_ptr, pylinphone_ChatRoom_callback_chat_message_state_changed, self);
|
||||
linphone_chat_room_send_message2(native_ptr, _chat_message_native_ptr, pylinphone_ChatRoom_callback_chat_message_state_changed, _dict);
|
||||
pylinphone_dispatch_messages();
|
||||
|
||||
pylinphone_trace(-1, "[PYLINPHONE] <<< %s -> None", __FUNCTION__);
|
||||
|
|
@ -280,8 +335,8 @@ static int pylinphone_VideoSize_init(PyObject *self, PyObject *args, PyObject *k
|
|||
}
|
||||
|
||||
static PyMemberDef pylinphone_VideoSize_members[] = {
|
||||
{ "width", T_INT, offsetof(pylinphone_VideoSizeObject, vs) + offsetof(MSVideoSize, width), 0, "The width of the video" },
|
||||
{ "height", T_INT, offsetof(pylinphone_VideoSizeObject, vs) + offsetof(MSVideoSize, height), 0, "The height of the video" },
|
||||
{ "width", T_INT, offsetof(pylinphone_VideoSizeObject, vs) + offsetof(MSVideoSize, width), 0, "[int] The width of the video" },
|
||||
{ "height", T_INT, offsetof(pylinphone_VideoSizeObject, vs) + offsetof(MSVideoSize, height), 0, "[int] The height of the video" },
|
||||
{ NULL } /* Sentinel */
|
||||
};
|
||||
|
||||
|
|
@ -361,3 +416,91 @@ PyObject * PyLinphoneVideoSize_FromMSVideoSize(MSVideoSize vs) {
|
|||
}
|
||||
return pyret;
|
||||
}
|
||||
|
||||
|
||||
time_t PyDateTime_As_time_t(PyObject *obj) {
|
||||
time_t ret = -1;
|
||||
PyObject *utctimetuple = PyObject_GetAttrString(obj, "utctimetuple");
|
||||
if (utctimetuple != NULL) {
|
||||
PyObject *calendar_module = PyImport_ImportModule("calendar");
|
||||
if (calendar_module != NULL) {
|
||||
PyObject *timegm = PyObject_GetAttrString(calendar_module, "timegm");
|
||||
if (timegm != NULL) {
|
||||
PyObject *tuple = PyEval_CallObject(utctimetuple, Py_BuildValue("()"));
|
||||
PyObject *pyres = PyEval_CallObject(timegm, Py_BuildValue("(O)", tuple));
|
||||
ret = (time_t)PyLong_AsLong(pyres);
|
||||
Py_DECREF(timegm);
|
||||
}
|
||||
Py_DECREF(calendar_module);
|
||||
}
|
||||
Py_DECREF(utctimetuple);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
PyObject * PyDateTime_From_time_t(time_t t) {
|
||||
PyObject *pyret = NULL;
|
||||
PyObject *datetime_module;
|
||||
if (t == -1) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
datetime_module = PyImport_ImportModule("datetime");
|
||||
if (datetime_module != NULL) {
|
||||
PyObject *datetime_class = PyObject_GetAttrString(datetime_module, "datetime");
|
||||
if (datetime_class != NULL) {
|
||||
PyObject *utcfromtimestamp = PyObject_GetAttrString(datetime_class, "utcfromtimestamp");
|
||||
if (utcfromtimestamp != NULL) {
|
||||
pyret = PyEval_CallObject(utcfromtimestamp, Py_BuildValue("(f)", (float)t));
|
||||
if (pyret == NULL) {
|
||||
PyErr_Print();
|
||||
}
|
||||
Py_DECREF(utcfromtimestamp);
|
||||
}
|
||||
Py_DECREF(datetime_class);
|
||||
}
|
||||
Py_DECREF(datetime_module);
|
||||
}
|
||||
if (pyret == NULL) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
return pyret;
|
||||
}
|
||||
|
||||
|
||||
static PyObject * pylinphone_PayloadTypeType_module_method_string(PyObject *self, PyObject *args) {
|
||||
const char *value_str = "[invalid]";
|
||||
int value;
|
||||
PyObject *pyret;
|
||||
if (!PyArg_ParseTuple(args, "i", &value)) {
|
||||
return NULL;
|
||||
}
|
||||
pylinphone_trace(1, "[PYLINPHONE] >>> %s(%d)", __FUNCTION__, value);
|
||||
switch (value) {
|
||||
case PAYLOAD_AUDIO_CONTINUOUS:
|
||||
value_str = "PAYLOAD_AUDIO_CONTINUOUS";
|
||||
break;
|
||||
case PAYLOAD_AUDIO_PACKETIZED:
|
||||
value_str = "PAYLOAD_AUDIO_PACKETIZED";
|
||||
break;
|
||||
case PAYLOAD_VIDEO:
|
||||
value_str = "PAYLOAD_VIDEO";
|
||||
break;
|
||||
case PAYLOAD_TEXT:
|
||||
value_str = "PAYLOAD_TEXT";
|
||||
break;
|
||||
case PAYLOAD_OTHER:
|
||||
value_str = "PAYLOAD_OTHER";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
pyret = Py_BuildValue("z", value_str);
|
||||
pylinphone_trace(-1, "[PYLINPHONE] <<< %s -> %p", __FUNCTION__, pyret);
|
||||
return pyret;
|
||||
}
|
||||
|
||||
static PyMethodDef pylinphone_PayloadTypeType_ModuleMethods[] = {
|
||||
{ "string", pylinphone_PayloadTypeType_module_method_string, METH_VARARGS, "Get a string representation of a linphone.PayloadTypeType value." },
|
||||
/* Sentinel */
|
||||
{ NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
from sets import Set
|
||||
import sys
|
||||
|
||||
|
||||
|
|
@ -38,9 +39,10 @@ def compute_event_name(s):
|
|||
|
||||
|
||||
class ArgumentType:
|
||||
def __init__(self, basic_type, complete_type, linphone_module):
|
||||
def __init__(self, basic_type, complete_type, contained_type, linphone_module):
|
||||
self.basic_type = basic_type
|
||||
self.complete_type = complete_type
|
||||
self.contained_type = contained_type
|
||||
self.linphone_module = linphone_module
|
||||
self.type_str = None
|
||||
self.check_func = None
|
||||
|
|
@ -48,9 +50,12 @@ class ArgumentType:
|
|||
self.convert_from_func = None
|
||||
self.fmt_str = 'O'
|
||||
self.cfmt_str = '%p'
|
||||
self.cnativefmt_str = '%p'
|
||||
self.use_native_pointer = False
|
||||
self.cast_convert_func_result = True
|
||||
self.__compute()
|
||||
if self.basic_type == 'MSList' and self.contained_type is not None:
|
||||
self.linphone_module.mslist_types.add(self.contained_type)
|
||||
|
||||
def __compute(self):
|
||||
splitted_type = self.complete_type.split(' ')
|
||||
|
|
@ -70,20 +75,20 @@ class ArgumentType:
|
|||
elif self.basic_type == 'int':
|
||||
if 'unsigned' in splitted_type:
|
||||
self.type_str = 'unsigned int'
|
||||
self.check_func = 'PyLong_Check'
|
||||
self.convert_func = 'PyLong_AsUnsignedLong'
|
||||
self.check_func = 'PyInt_Check'
|
||||
self.convert_func = 'PyInt_AsUnsignedLongMask'
|
||||
self.fmt_str = 'I'
|
||||
self.cfmt_str = '%u'
|
||||
else:
|
||||
self.type_str = 'int'
|
||||
self.check_func = 'PyLong_Check'
|
||||
self.convert_func = 'PyLong_AsLong'
|
||||
self.check_func = 'PyInt_Check'
|
||||
self.convert_func = 'PyInt_AS_LONG'
|
||||
self.fmt_str = 'i'
|
||||
self.cfmt_str = '%d'
|
||||
elif self.basic_type in ['int8_t', 'int16_t' 'int32_t']:
|
||||
self.type_str = 'int'
|
||||
self.check_func = 'PyLong_Check'
|
||||
self.convert_func = 'PyLong_AsLong'
|
||||
self.check_func = 'PyInt_Check'
|
||||
self.convert_func = 'PyInt_AS_LONG'
|
||||
if self.basic_type == 'int8_t':
|
||||
self.fmt_str = 'c'
|
||||
elif self.basic_type == 'int16_t':
|
||||
|
|
@ -93,8 +98,8 @@ class ArgumentType:
|
|||
self.cfmt_str = '%d'
|
||||
elif self.basic_type in ['uint8_t', 'uint16_t', 'uint32_t']:
|
||||
self.type_str = 'unsigned int'
|
||||
self.check_func = 'PyLong_Check'
|
||||
self.convert_func = 'PyLong_AsUnsignedLong'
|
||||
self.check_func = 'PyInt_Check'
|
||||
self.convert_func = 'PyInt_AsUnsignedLongMask'
|
||||
if self.basic_type == 'uint8_t':
|
||||
self.fmt_str = 'b'
|
||||
elif self.basic_type == 'uint16_t':
|
||||
|
|
@ -116,8 +121,8 @@ class ArgumentType:
|
|||
self.cfmt_str = '%lu'
|
||||
elif self.basic_type == 'size_t':
|
||||
self.type_str = 'size_t'
|
||||
self.check_func = 'PyLong_Check'
|
||||
self.convert_func = 'PyLong_AsSsize_t'
|
||||
self.check_func = 'PyInt_Check'
|
||||
self.convert_func = 'PyInt_AsSsize_t'
|
||||
self.fmt_str = 'n'
|
||||
self.cfmt_str = '%lu'
|
||||
elif self.basic_type in ['float', 'double']:
|
||||
|
|
@ -135,6 +140,21 @@ class ArgumentType:
|
|||
self.convert_func = 'PyInt_AsLong'
|
||||
self.fmt_str = 'i'
|
||||
self.cfmt_str = '%d'
|
||||
elif self.basic_type == 'time_t':
|
||||
self.type_str = 'DateTime'
|
||||
self.check_func = 'PyDateTime_Check'
|
||||
self.convert_func = 'PyDateTime_As_time_t'
|
||||
self.convert_from_func = 'PyDateTime_From_time_t'
|
||||
self.fmt_str = 'O'
|
||||
self.cfmt_str = '%p'
|
||||
self.cnativefmt_str = "%ld"
|
||||
elif self.basic_type == 'MSList':
|
||||
self.type_str = 'list of linphone.' + self.contained_type
|
||||
self.check_func = 'PyList_Check'
|
||||
self.convert_func = 'PyList_AsMSListOf' + self.contained_type
|
||||
self.convert_from_func = 'PyList_FromMSListOf' + self.contained_type
|
||||
self.fmt_str = 'O'
|
||||
self.cfmt_str = '%p'
|
||||
elif self.basic_type == 'MSVideoSize':
|
||||
self.type_str = 'linphone.VideoSize'
|
||||
self.check_func = 'PyLinphoneVideoSize_Check'
|
||||
|
|
@ -151,7 +171,10 @@ class ArgumentType:
|
|||
self.fmt_str = 'i'
|
||||
self.cfmt_str = '%d'
|
||||
elif '*' in splitted_type:
|
||||
self.type_str = 'linphone.' + strip_leading_linphone(self.basic_type)
|
||||
self.use_native_pointer = True
|
||||
else:
|
||||
self.type_str = 'linphone.' + strip_leading_linphone(self.basic_type)
|
||||
|
||||
|
||||
class MethodDefinition:
|
||||
|
|
@ -162,6 +185,7 @@ class MethodDefinition:
|
|||
self.build_value_format = ''
|
||||
self.return_type = 'void'
|
||||
self.return_complete_type = 'void'
|
||||
self.return_contained_type = None
|
||||
self.method_node = method_node
|
||||
self.class_ = class_
|
||||
self.linphone_module = linphone_module
|
||||
|
|
@ -175,9 +199,10 @@ class MethodDefinition:
|
|||
if self.xml_method_return is not None:
|
||||
self.return_type = self.xml_method_return.get('type')
|
||||
self.return_complete_type = self.xml_method_return.get('completetype')
|
||||
self.return_contained_type = self.xml_method_return.get('containedtype')
|
||||
if self.return_complete_type != 'void':
|
||||
body += "\t" + self.return_complete_type + " cresult;\n"
|
||||
argument_type = ArgumentType(self.return_type, self.return_complete_type, self.linphone_module)
|
||||
argument_type = ArgumentType(self.return_type, self.return_complete_type, self.return_contained_type, self.linphone_module)
|
||||
self.build_value_format = argument_type.fmt_str
|
||||
if self.build_value_format == 'O':
|
||||
body += "\tPyObject * pyresult;\n"
|
||||
|
|
@ -188,11 +213,15 @@ class MethodDefinition:
|
|||
arg_name = "_" + xml_method_arg.get('name')
|
||||
arg_type = xml_method_arg.get('type')
|
||||
arg_complete_type = xml_method_arg.get('completetype')
|
||||
argument_type = ArgumentType(arg_type, arg_complete_type, self.linphone_module)
|
||||
arg_contained_type = xml_method_arg.get('containedtype')
|
||||
argument_type = ArgumentType(arg_type, arg_complete_type, arg_contained_type, self.linphone_module)
|
||||
self.parse_tuple_format += argument_type.fmt_str
|
||||
if argument_type.use_native_pointer:
|
||||
if argument_type.fmt_str == 'O' and argument_type.use_native_pointer:
|
||||
body += "\tPyObject * " + arg_name + ";\n"
|
||||
body += "\t" + arg_complete_type + " " + arg_name + "_native_ptr;\n"
|
||||
body += "\t" + arg_complete_type + " " + arg_name + "_native_ptr = NULL;\n"
|
||||
elif argument_type.fmt_str == 'O' and argument_type.convert_func is not None:
|
||||
body += "\tPyObject * " + arg_name + ";\n"
|
||||
body += "\t" + arg_complete_type + " " + arg_name + "_native_obj;\n"
|
||||
elif strip_leading_linphone(arg_complete_type) in self.linphone_module.enum_names:
|
||||
body += "\tint " + arg_name + ";\n"
|
||||
else:
|
||||
|
|
@ -211,13 +240,28 @@ class MethodDefinition:
|
|||
return NULL;
|
||||
}}
|
||||
""".format(fmt=self.parse_tuple_format, args=', '.join(map(lambda a: '&' + a, self.arg_names)))
|
||||
args_conversion_code = ''
|
||||
for xml_method_arg in self.xml_method_args:
|
||||
arg_name = "_" + xml_method_arg.get('name')
|
||||
arg_type = xml_method_arg.get('type')
|
||||
arg_complete_type = xml_method_arg.get('completetype')
|
||||
arg_contained_type = xml_method_arg.get('containedtype')
|
||||
argument_type = ArgumentType(arg_type, arg_complete_type, arg_contained_type, self.linphone_module)
|
||||
if argument_type.fmt_str == 'O' and argument_type.convert_func is not None:
|
||||
args_conversion_code += \
|
||||
""" {arg_name}_native_obj = {convert_func}({arg_name});
|
||||
""".format(arg_name=arg_name, convert_func=argument_type.convert_func)
|
||||
return \
|
||||
""" {class_native_ptr_check_code}
|
||||
{parse_tuple_code}
|
||||
{args_type_check_code}
|
||||
{args_native_ptr_check_code}
|
||||
{args_conversion_code}
|
||||
""".format(class_native_ptr_check_code=class_native_ptr_check_code,
|
||||
parse_tuple_code=parse_tuple_code,
|
||||
args_native_ptr_check_code=self.format_args_native_pointer_check())
|
||||
args_type_check_code=self.format_args_type_check(),
|
||||
args_native_ptr_check_code=self.format_args_native_pointer_check(),
|
||||
args_conversion_code=args_conversion_code)
|
||||
|
||||
def format_enter_trace(self):
|
||||
fmt = ''
|
||||
|
|
@ -229,14 +273,18 @@ class MethodDefinition:
|
|||
arg_name = "_" + xml_method_arg.get('name')
|
||||
arg_type = xml_method_arg.get('type')
|
||||
arg_complete_type = xml_method_arg.get('completetype')
|
||||
arg_contained_type = xml_method_arg.get('containedtype')
|
||||
if fmt != '':
|
||||
fmt += ', '
|
||||
argument_type = ArgumentType(arg_type, arg_complete_type, self.linphone_module)
|
||||
argument_type = ArgumentType(arg_type, arg_complete_type, arg_contained_type, self.linphone_module)
|
||||
fmt += argument_type.cfmt_str
|
||||
args.append(arg_name)
|
||||
if argument_type.fmt_str == 'O':
|
||||
fmt += ' [' + argument_type.cfmt_str + ']'
|
||||
args.append(arg_name)
|
||||
fmt += ' [' + argument_type.cnativefmt_str + ']'
|
||||
if argument_type.use_native_pointer:
|
||||
args.append(arg_name + '_native_ptr')
|
||||
else:
|
||||
args.append(arg_name + '_native_obj')
|
||||
args = ', '.join(args)
|
||||
if args != '':
|
||||
args = ', ' + args
|
||||
|
|
@ -249,9 +297,12 @@ class MethodDefinition:
|
|||
arg_name = "_" + xml_method_arg.get('name')
|
||||
arg_type = xml_method_arg.get('type')
|
||||
arg_complete_type = xml_method_arg.get('completetype')
|
||||
argument_type = ArgumentType(arg_type, arg_complete_type, self.linphone_module)
|
||||
if argument_type.convert_func is None:
|
||||
arg_contained_type = xml_method_arg.get('containedtype')
|
||||
argument_type = ArgumentType(arg_type, arg_complete_type, arg_contained_type, self.linphone_module)
|
||||
if argument_type.fmt_str == 'O' and argument_type.use_native_pointer:
|
||||
arg_names.append(arg_name + "_native_ptr")
|
||||
elif argument_type.fmt_str == 'O' and argument_type.convert_func is not None:
|
||||
arg_names.append(arg_name + "_native_obj")
|
||||
else:
|
||||
arg_names.append(arg_name)
|
||||
if self.return_type != 'void':
|
||||
|
|
@ -289,7 +340,7 @@ class MethodDefinition:
|
|||
}}
|
||||
""".format(func=ref_function, cast_type=self.remove_const_from_complete_type(self.return_complete_type))
|
||||
else:
|
||||
return_argument_type = ArgumentType(self.return_type, self.return_complete_type, self.linphone_module)
|
||||
return_argument_type = ArgumentType(self.return_type, self.return_complete_type, self.return_contained_type, self.linphone_module)
|
||||
if return_argument_type.convert_from_func is not None:
|
||||
convert_from_code = \
|
||||
"""pyresult = {convert_func}(cresult);
|
||||
|
|
@ -298,7 +349,7 @@ class MethodDefinition:
|
|||
else:
|
||||
result_variable = 'cresult'
|
||||
if result_variable != '':
|
||||
build_value_code = "pyret = Py_BuildValue(\"{fmt}\", {result_variable});\n".format(fmt=self.build_value_format, result_variable=result_variable)
|
||||
build_value_code = "pyret = Py_BuildValue(\"{fmt}\", {result_variable});\n".format(fmt=self.build_value_format.replace('O', 'N'), result_variable=result_variable)
|
||||
body = \
|
||||
""" {c_function_call_code}
|
||||
pylinphone_dispatch_messages();
|
||||
|
|
@ -323,12 +374,7 @@ class MethodDefinition:
|
|||
|
||||
def format_return_result(self):
|
||||
if self.return_complete_type != 'void':
|
||||
if self.build_value_format == 'O':
|
||||
return \
|
||||
""" Py_DECREF(pyresult);
|
||||
return pyret;"""
|
||||
else:
|
||||
return "\treturn pyret;"
|
||||
return "\treturn pyret;"
|
||||
return "\tPy_RETURN_NONE;"
|
||||
|
||||
def format_return_none_trace(self):
|
||||
|
|
@ -346,19 +392,51 @@ class MethodDefinition:
|
|||
}}
|
||||
""".format(class_name=self.class_['class_name'], return_value=return_value)
|
||||
|
||||
def format_args_type_check(self):
|
||||
body = ''
|
||||
for xml_method_arg in self.xml_method_args:
|
||||
arg_name = "_" + xml_method_arg.get('name')
|
||||
arg_type = xml_method_arg.get('type')
|
||||
arg_complete_type = xml_method_arg.get('completetype')
|
||||
arg_contained_type = xml_method_arg.get('containedtype')
|
||||
argument_type = ArgumentType(arg_type, arg_complete_type, arg_contained_type, self.linphone_module)
|
||||
if argument_type.fmt_str == 'O':
|
||||
if argument_type.use_native_pointer:
|
||||
body += \
|
||||
""" if (({arg_name} != Py_None) && !PyObject_IsInstance({arg_name}, (PyObject *)&pylinphone_{arg_type}Type)) {{
|
||||
PyErr_SetString(PyExc_TypeError, "The '{arg_name}' argument must be a {type_str} instance.");
|
||||
return NULL;
|
||||
}}
|
||||
""".format(arg_name=arg_name, arg_type=strip_leading_linphone(arg_type), type_str=argument_type.type_str)
|
||||
else:
|
||||
body += \
|
||||
""" if (!{check_func}({arg_name})) {{
|
||||
PyErr_SetString(PyExc_TypeError, "The '{arg_name}' argument must be a {type_str} instance.");
|
||||
return NULL;
|
||||
}}
|
||||
""".format(arg_name=arg_name, check_func=argument_type.check_func, type_str=argument_type.type_str)
|
||||
if body != '':
|
||||
body = body[1:] # Remove leading '\t'
|
||||
return body
|
||||
|
||||
def format_args_native_pointer_check(self):
|
||||
body = ''
|
||||
for xml_method_arg in self.xml_method_args:
|
||||
arg_name = "_" + xml_method_arg.get('name')
|
||||
arg_type = xml_method_arg.get('type')
|
||||
arg_complete_type = xml_method_arg.get('completetype')
|
||||
argument_type = ArgumentType(arg_type, arg_complete_type, self.linphone_module)
|
||||
if argument_type.fmt_str == 'O':
|
||||
arg_contained_type = xml_method_arg.get('containedtype')
|
||||
argument_type = ArgumentType(arg_type, arg_complete_type, arg_contained_type, self.linphone_module)
|
||||
if argument_type.fmt_str == 'O' and argument_type.use_native_pointer:
|
||||
body += \
|
||||
""" if (({arg_name}_native_ptr = pylinphone_{arg_type}_get_native_ptr({arg_name})) == NULL) {{
|
||||
return NULL;
|
||||
""" if (({arg_name} != NULL) && ({arg_name} != Py_None)) {{
|
||||
if (({arg_name}_native_ptr = pylinphone_{arg_type}_get_native_ptr({arg_name})) == NULL) {{
|
||||
return NULL;
|
||||
}}
|
||||
}}
|
||||
""".format(arg_name=arg_name, arg_type=strip_leading_linphone(arg_type))
|
||||
if body != '':
|
||||
body = body[1:] # Remove leading '\t'
|
||||
return body
|
||||
|
||||
def parse_method_node(self):
|
||||
|
|
@ -507,8 +585,8 @@ class SetterMethodDefinition(MethodDefinition):
|
|||
def format_arguments_parsing(self):
|
||||
if self.first_argument_type.check_func is None:
|
||||
attribute_type_check_code = \
|
||||
"""if (!PyObject_IsInstance(value, (PyObject *)&pylinphone_{class_name}Type)) {{
|
||||
PyErr_SetString(PyExc_TypeError, "The {attribute_name} attribute value must be a linphone.{class_name} instance");
|
||||
"""if ((value != Py_None) && !PyObject_IsInstance(value, (PyObject *)&pylinphone_{class_name}Type)) {{
|
||||
PyErr_SetString(PyExc_TypeError, "The '{attribute_name}' attribute value must be a linphone.{class_name} instance.");
|
||||
return -1;
|
||||
}}
|
||||
""".format(class_name=self.first_arg_class, attribute_name=self.attribute_name)
|
||||
|
|
@ -518,31 +596,37 @@ class SetterMethodDefinition(MethodDefinition):
|
|||
checknotnone = "(value != Py_None) && "
|
||||
attribute_type_check_code = \
|
||||
"""if ({checknotnone}!{checkfunc}(value)) {{
|
||||
PyErr_SetString(PyExc_TypeError, "The {attribute_name} attribute value must be a {type_str}");
|
||||
PyErr_SetString(PyExc_TypeError, "The '{attribute_name}' attribute value must be a {type_str}.");
|
||||
return -1;
|
||||
}}
|
||||
""".format(checknotnone=checknotnone, checkfunc=self.first_argument_type.check_func, attribute_name=self.attribute_name, type_str=self.first_argument_type.type_str)
|
||||
if self.first_argument_type.convert_func is None:
|
||||
attribute_conversion_code = "{arg_name} = value;\n".format(arg_name="_" + self.first_arg_name)
|
||||
else:
|
||||
attribute_conversion_code = ''
|
||||
if (self.first_argument_type.convert_func is None) or \
|
||||
(self.first_argument_type.fmt_str == 'O' and self.first_argument_type.convert_func is not None):
|
||||
attribute_conversion_code += "{arg_name} = value;\n".format(arg_name="_" + self.first_arg_name)
|
||||
if self.first_argument_type.convert_func is not None:
|
||||
cast_code = ''
|
||||
suffix = ''
|
||||
if self.first_argument_type.cast_convert_func_result:
|
||||
cast_code = "({arg_type})".format(arg_type=self.first_arg_complete_type)
|
||||
attribute_conversion_code = "{arg_name} = {cast_code}{convertfunc}(value);\n".format(
|
||||
arg_name="_" + self.first_arg_name, cast_code=cast_code, convertfunc=self.first_argument_type.convert_func)
|
||||
if self.first_argument_type.fmt_str == 'O' and self.first_argument_type.convert_func is not None:
|
||||
suffix = '_native_obj'
|
||||
attribute_conversion_code += "\t{arg_name}{suffix} = {cast_code}{convertfunc}(value);\n".format(
|
||||
arg_name="_" + self.first_arg_name, suffix=suffix, cast_code=cast_code, convertfunc=self.first_argument_type.convert_func)
|
||||
attribute_native_ptr_check_code = ''
|
||||
if self.first_argument_type.use_native_pointer:
|
||||
attribute_native_ptr_check_code = \
|
||||
"""{arg_name}_native_ptr = pylinphone_{arg_class}_get_native_ptr({arg_name});
|
||||
if ({arg_name}_native_ptr == NULL) {{
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid linphone.{arg_class} instance");
|
||||
return -1;
|
||||
"""if ({arg_name} != Py_None) {{
|
||||
if (({arg_name}_native_ptr = pylinphone_{arg_class}_get_native_ptr({arg_name})) == NULL) {{
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid linphone.{arg_class} instance.");
|
||||
return -1;
|
||||
}}
|
||||
}}
|
||||
""".format(arg_name="_" + self.first_arg_name, arg_class=self.first_arg_class)
|
||||
return \
|
||||
""" {native_ptr_check_code}
|
||||
if (value == NULL) {{
|
||||
PyErr_SetString(PyExc_TypeError, "Cannot delete the {attribute_name} attribute");
|
||||
PyErr_SetString(PyExc_TypeError, "Cannot delete the '{attribute_name}' attribute.");
|
||||
return -1;
|
||||
}}
|
||||
{attribute_type_check_code}
|
||||
|
|
@ -555,13 +639,15 @@ class SetterMethodDefinition(MethodDefinition):
|
|||
attribute_native_ptr_check_code=attribute_native_ptr_check_code)
|
||||
|
||||
def format_c_function_call(self):
|
||||
use_native_ptr = ''
|
||||
if self.first_argument_type.use_native_pointer:
|
||||
use_native_ptr = '_native_ptr'
|
||||
suffix = ''
|
||||
if self.first_argument_type.fmt_str == 'O' and self.first_argument_type.use_native_pointer:
|
||||
suffix = '_native_ptr'
|
||||
elif self.first_argument_type.fmt_str == 'O' and self.first_argument_type.convert_func is not None:
|
||||
suffix = '_native_obj'
|
||||
return \
|
||||
""" {method_name}(native_ptr, {arg_name}{use_native_ptr});
|
||||
""" {method_name}(native_ptr, {arg_name}{suffix});
|
||||
pylinphone_dispatch_messages();
|
||||
""".format(arg_name="_" + self.first_arg_name, method_name=self.method_node.get('name'), use_native_ptr=use_native_ptr)
|
||||
""".format(arg_name="_" + self.first_arg_name, method_name=self.method_node.get('name'), suffix=suffix)
|
||||
|
||||
def format_return_trace(self):
|
||||
return "\tpylinphone_trace(-1, \"[PYLINPHONE] <<< %s -> 0\", __FUNCTION__);\n"
|
||||
|
|
@ -577,8 +663,9 @@ class SetterMethodDefinition(MethodDefinition):
|
|||
self.attribute_name = self.method_node.get('property_name')
|
||||
self.first_arg_type = self.xml_method_args[0].get('type')
|
||||
self.first_arg_complete_type = self.xml_method_args[0].get('completetype')
|
||||
self.first_arg_contained_type = self.xml_method_args[0].get('containedtype')
|
||||
self.first_arg_name = self.xml_method_args[0].get('name')
|
||||
self.first_argument_type = ArgumentType(self.first_arg_type, self.first_arg_complete_type, self.linphone_module)
|
||||
self.first_argument_type = ArgumentType(self.first_arg_type, self.first_arg_complete_type, self.first_arg_contained_type, self.linphone_module)
|
||||
self.first_arg_class = strip_leading_linphone(self.first_arg_type)
|
||||
|
||||
class EventCallbackMethodDefinition(MethodDefinition):
|
||||
|
|
@ -595,7 +682,8 @@ class EventCallbackMethodDefinition(MethodDefinition):
|
|||
arg_name = 'py' + xml_method_arg.get('name')
|
||||
arg_type = xml_method_arg.get('type')
|
||||
arg_complete_type = xml_method_arg.get('completetype')
|
||||
argument_type = ArgumentType(arg_type, arg_complete_type, self.linphone_module)
|
||||
arg_contained_type = xml_method_arg.get('containedtype')
|
||||
argument_type = ArgumentType(arg_type, arg_complete_type, arg_contained_type, self.linphone_module)
|
||||
if argument_type.fmt_str == 'O':
|
||||
specific += "\tPyObject * " + arg_name + " = NULL;\n"
|
||||
return "{common}\n{specific}".format(common=common, specific=specific)
|
||||
|
|
@ -606,7 +694,8 @@ class EventCallbackMethodDefinition(MethodDefinition):
|
|||
arg_name = xml_method_arg.get('name')
|
||||
arg_type = xml_method_arg.get('type')
|
||||
arg_complete_type = xml_method_arg.get('completetype')
|
||||
argument_type = ArgumentType(arg_type, arg_complete_type, self.linphone_module)
|
||||
arg_contained_type = xml_method_arg.get('containedtype')
|
||||
argument_type = ArgumentType(arg_type, arg_complete_type, arg_contained_type, self.linphone_module)
|
||||
if argument_type.fmt_str == 'O':
|
||||
type_class = self.find_class_definition(arg_type)
|
||||
get_user_data_code = ''
|
||||
|
|
@ -629,9 +718,10 @@ class EventCallbackMethodDefinition(MethodDefinition):
|
|||
arg_name = xml_method_arg.get('name')
|
||||
arg_type = xml_method_arg.get('type')
|
||||
arg_complete_type = xml_method_arg.get('completetype')
|
||||
arg_contained_type = xml_method_arg.get('containedtype')
|
||||
if fmt != '':
|
||||
fmt += ', '
|
||||
argument_type = ArgumentType(arg_type, arg_complete_type, self.linphone_module)
|
||||
argument_type = ArgumentType(arg_type, arg_complete_type, arg_contained_type, self.linphone_module)
|
||||
fmt += argument_type.cfmt_str
|
||||
args.append(arg_name)
|
||||
args=', '.join(args)
|
||||
|
|
@ -646,7 +736,8 @@ class EventCallbackMethodDefinition(MethodDefinition):
|
|||
arg_name = xml_method_arg.get('name')
|
||||
arg_type = xml_method_arg.get('type')
|
||||
arg_complete_type = xml_method_arg.get('completetype')
|
||||
argument_type = ArgumentType(arg_type, arg_complete_type, self.linphone_module)
|
||||
arg_contained_type = xml_method_arg.get('containedtype')
|
||||
argument_type = ArgumentType(arg_type, arg_complete_type, arg_contained_type, self.linphone_module)
|
||||
fmt += argument_type.fmt_str
|
||||
if argument_type.fmt_str == 'O':
|
||||
args.append('py' + arg_name)
|
||||
|
|
@ -659,7 +750,7 @@ class EventCallbackMethodDefinition(MethodDefinition):
|
|||
PyErr_Print();
|
||||
}}
|
||||
}}
|
||||
""".format(fmt=fmt, args=args)
|
||||
""".format(fmt=fmt.replace('O', 'N'), args=args)
|
||||
|
||||
def format_return_trace(self):
|
||||
return "\tpylinphone_trace(-1, \"[PYLINPHONE] <<< %s\", __FUNCTION__);\n"
|
||||
|
|
@ -687,6 +778,7 @@ class LinphoneModule(object):
|
|||
def __init__(self, tree, blacklisted_classes, blacklisted_events, blacklisted_functions, hand_written_functions):
|
||||
self.internal_instance_method_names = ['destroy', 'ref', 'unref']
|
||||
self.internal_property_names = ['user_data']
|
||||
self.mslist_types = Set([])
|
||||
self.enums = []
|
||||
self.enum_names = []
|
||||
xml_enums = tree.findall("./enums/enum")
|
||||
|
|
@ -731,6 +823,7 @@ class LinphoneModule(object):
|
|||
c['class_type_methods'] = []
|
||||
c['class_type_hand_written_methods'] = []
|
||||
c['class_instance_hand_written_methods'] = []
|
||||
c['class_hand_written_properties'] = []
|
||||
c['class_object_members'] = ''
|
||||
if c['class_name'] == 'Core':
|
||||
c['class_object_members'] = "\tPyObject *vtable_dict;"
|
||||
|
|
@ -746,8 +839,6 @@ class LinphoneModule(object):
|
|||
ev['event_name'] = compute_event_name(ev['event_cname'])
|
||||
ev['event_doc'] = self.__format_doc(xml_event.find('briefdescription'), xml_event.find('detaileddescription'))
|
||||
self.events.append(ev)
|
||||
elif c['class_name'] == 'ChatRoom':
|
||||
c['class_object_members'] = "\tPyObject *send_message_cb;\n\tPyObject *send_message_ud;"
|
||||
xml_type_methods = xml_class.findall("./classmethods/classmethod")
|
||||
for xml_type_method in xml_type_methods:
|
||||
if xml_type_method.get('deprecated') == 'true':
|
||||
|
|
@ -791,31 +882,45 @@ class LinphoneModule(object):
|
|||
p['property_name'] = property_name
|
||||
xml_property_getter = xml_property.find("./getter")
|
||||
xml_property_setter = xml_property.find("./setter")
|
||||
if xml_property_getter is not None and (
|
||||
xml_property_getter.get('name') in blacklisted_functions or xml_property_getter.get('deprecated') == 'true'):
|
||||
continue
|
||||
if xml_property_setter is not None and (
|
||||
xml_property_setter.get('name') in blacklisted_functions or xml_property_setter.get('deprecated') == 'true'):
|
||||
continue
|
||||
handwritten_property = False
|
||||
if xml_property_getter is not None:
|
||||
xml_property_getter.set('property_name', property_name)
|
||||
p['getter_name'] = xml_property_getter.get('name').replace(c['class_c_function_prefix'], '')
|
||||
p['getter_xml_node'] = xml_property_getter
|
||||
p['getter_reference'] = "(getter)pylinphone_" + c['class_name'] + "_" + p['getter_name']
|
||||
p['getter_definition_begin'] = "static PyObject * pylinphone_" + c['class_name'] + "_" + p['getter_name'] + "(PyObject *self, void *closure) {"
|
||||
p['getter_definition_end'] = "}"
|
||||
else:
|
||||
p['getter_reference'] = "NULL"
|
||||
if xml_property_getter.get('name') in blacklisted_functions or xml_property_getter.get('deprecated') == 'true':
|
||||
continue
|
||||
elif xml_property_getter.get('name') in hand_written_functions:
|
||||
handwritten_property = True
|
||||
if xml_property_setter is not None:
|
||||
xml_property_setter.set('property_name', property_name)
|
||||
p['setter_name'] = xml_property_setter.get('name').replace(c['class_c_function_prefix'], '')
|
||||
p['setter_xml_node'] = xml_property_setter
|
||||
p['setter_reference'] = "(setter)pylinphone_" + c['class_name'] + "_" + p['setter_name']
|
||||
p['setter_definition_begin'] = "static int pylinphone_" + c['class_name'] + "_" + p['setter_name'] + "(PyObject *self, PyObject *value, void *closure) {"
|
||||
p['setter_definition_end'] = "}"
|
||||
if xml_property_setter.get('name') in blacklisted_functions or xml_property_setter.get('deprecated') == 'true':
|
||||
continue
|
||||
elif xml_property_setter.get('name') in hand_written_functions:
|
||||
handwritten_property = True
|
||||
if handwritten_property:
|
||||
p['getter_reference'] = 'NULL'
|
||||
p['setter_reference'] = 'NULL'
|
||||
if xml_property_getter is not None:
|
||||
p['getter_reference'] = '(getter)pylinphone_' + c['class_name'] + '_get_' + p['property_name']
|
||||
if xml_property_setter is not None:
|
||||
p['setter_reference'] = '(setter)pylinphone_' + c['class_name'] + '_set_' + p['property_name']
|
||||
c['class_hand_written_properties'].append(p)
|
||||
else:
|
||||
p['setter_reference'] = "NULL"
|
||||
c['class_properties'].append(p)
|
||||
if xml_property_getter is not None:
|
||||
xml_property_getter.set('property_name', property_name)
|
||||
p['getter_name'] = xml_property_getter.get('name').replace(c['class_c_function_prefix'], '')
|
||||
p['getter_xml_node'] = xml_property_getter
|
||||
p['getter_reference'] = "(getter)pylinphone_" + c['class_name'] + "_" + p['getter_name']
|
||||
p['getter_definition_begin'] = "static PyObject * pylinphone_" + c['class_name'] + "_" + p['getter_name'] + "(PyObject *self, void *closure) {"
|
||||
p['getter_definition_end'] = "}"
|
||||
else:
|
||||
p['getter_reference'] = "NULL"
|
||||
if xml_property_setter is not None:
|
||||
xml_property_setter.set('property_name', property_name)
|
||||
p['setter_name'] = xml_property_setter.get('name').replace(c['class_c_function_prefix'], '')
|
||||
p['setter_xml_node'] = xml_property_setter
|
||||
p['setter_reference'] = "(setter)pylinphone_" + c['class_name'] + "_" + p['setter_name']
|
||||
p['setter_definition_begin'] = "static int pylinphone_" + c['class_name'] + "_" + p['setter_name'] + "(PyObject *self, PyObject *value, void *closure) {"
|
||||
p['setter_definition_end'] = "}"
|
||||
else:
|
||||
p['setter_reference'] = "NULL"
|
||||
c['class_properties'].append(p)
|
||||
self.classes.append(c)
|
||||
# Format events definitions
|
||||
for ev in self.events:
|
||||
|
|
@ -849,11 +954,11 @@ class LinphoneModule(object):
|
|||
p['property_doc'] = ''
|
||||
if p.has_key('setter_xml_node'):
|
||||
p['setter_body'] = SetterMethodDefinition(self, c, p['setter_xml_node']).format()
|
||||
p['property_doc'] = self.__format_doc(p['setter_xml_node'].find('briefdescription'), p['setter_xml_node'].find('detaileddescription'))
|
||||
p['property_doc'] = self.__format_setter_doc(p['setter_xml_node'])
|
||||
if p.has_key('getter_xml_node'):
|
||||
p['getter_body'] = GetterMethodDefinition(self, c, p['getter_xml_node']).format()
|
||||
if p['property_doc'] == '':
|
||||
p['property_doc'] = self.__format_doc(p['getter_xml_node'].find('briefdescription'), p['getter_xml_node'].find('detaileddescription'))
|
||||
p['property_doc'] = self.__format_getter_doc(p['getter_xml_node'])
|
||||
except Exception, e:
|
||||
e.args += (c['class_name'], p['property_name'])
|
||||
raise
|
||||
|
|
@ -869,6 +974,14 @@ class LinphoneModule(object):
|
|||
except Exception, e:
|
||||
e.args += (c['class_name'], 'dealloc_body')
|
||||
raise
|
||||
# Convert mslist_types to a list of dictionaries for the template
|
||||
d = []
|
||||
for mslist_type in self.mslist_types:
|
||||
t = {}
|
||||
t['c_contained_type'] = mslist_type
|
||||
t['python_contained_type'] = strip_leading_linphone(mslist_type)
|
||||
d.append(t)
|
||||
self.mslist_types = d
|
||||
|
||||
def __format_doc_node(self, node):
|
||||
desc = ''
|
||||
|
|
@ -928,18 +1041,49 @@ class LinphoneModule(object):
|
|||
method_type = xml_node.tag
|
||||
if method_type != 'classmethod' and len(xml_method_args) > 0:
|
||||
xml_method_args = xml_method_args[1:]
|
||||
doc += '\n'
|
||||
if len(xml_method_args) > 0:
|
||||
doc += "\n\nArguments:"
|
||||
for xml_method_arg in xml_method_args:
|
||||
arg_name = xml_method_arg.get('name')
|
||||
arg_type = xml_method_arg.get('type')
|
||||
arg_complete_type = xml_method_arg.get('completetype')
|
||||
arg_contained_type = xml_method_arg.get('containedtype')
|
||||
argument_type = ArgumentType(arg_type, arg_complete_type, arg_contained_type, self)
|
||||
arg_doc = self.__format_doc_content(None, xml_method_arg.find('description'))
|
||||
doc += '\n\t' + arg_name
|
||||
doc += '\n:param ' + arg_name + ':'
|
||||
if arg_doc != '':
|
||||
doc += ': ' + arg_doc
|
||||
doc += ' ' + arg_doc
|
||||
doc += '\n:type ' + arg_name + ': ' + argument_type.type_str
|
||||
if xml_method_return is not None:
|
||||
return_type = xml_method_return.get('type')
|
||||
return_complete_type = xml_method_return.get('completetype')
|
||||
return_contained_type = xml_method_return.get('containedtype')
|
||||
if return_complete_type != 'void':
|
||||
return_doc = self.__format_doc_content(None, xml_method_return.find('description'))
|
||||
doc += '\n\nReturns:\n\t' + return_doc
|
||||
return_argument_type = ArgumentType(return_type, return_complete_type, return_contained_type, self)
|
||||
doc += '\n:returns: ' + return_doc
|
||||
doc += '\n:rtype: ' + return_argument_type.type_str
|
||||
doc = self.__replace_doc_special_chars(doc)
|
||||
return doc
|
||||
|
||||
def __format_setter_doc(self, xml_node):
|
||||
xml_method_arg = xml_node.findall('./arguments/argument')[1]
|
||||
arg_type = xml_method_arg.get('type')
|
||||
arg_complete_type = xml_method_arg.get('completetype')
|
||||
arg_contained_type = xml_method_arg.get('containedtype')
|
||||
argument_type = ArgumentType(arg_type, arg_complete_type, arg_contained_type, self)
|
||||
doc = self.__format_doc_content(xml_node.find('briefdescription'), xml_node.find('detaileddescription'))
|
||||
doc = '[' + argument_type.type_str + '] ' + doc
|
||||
doc = self.__replace_doc_special_chars(doc)
|
||||
return doc
|
||||
|
||||
def __format_getter_doc(self, xml_node):
|
||||
xml_method_return = xml_node.find('./return')
|
||||
return_type = xml_method_return.get('type')
|
||||
return_complete_type = xml_method_return.get('completetype')
|
||||
return_contained_type = xml_method_return.get('containedtype')
|
||||
return_argument_type = ArgumentType(return_type, return_complete_type, return_contained_type, self)
|
||||
doc = self.__format_doc_content(xml_node.find('briefdescription'), xml_node.find('detaileddescription'))
|
||||
doc = '[' + return_argument_type.type_str + '] ' + doc
|
||||
doc = self.__replace_doc_special_chars(doc)
|
||||
return doc
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include <Python.h>
|
||||
#include <structmember.h>
|
||||
#include <datetime.h>
|
||||
#include <linphone/linphonecore.h>
|
||||
#include <linphone/linphone_tunnel.h>
|
||||
#include <linphone/linphonecore_utils.h>
|
||||
|
|
@ -69,6 +70,32 @@ static PyObject * pylinphone_{{class_name}}_instance_method_{{method_name}}(PyOb
|
|||
{{/class_instance_hand_written_methods}}
|
||||
{{/classes}}
|
||||
|
||||
{{#mslist_types}}
|
||||
PyObject * PyList_FromMSListOf{{c_contained_type}}(const MSList *msl) {
|
||||
PyObject *pyl = PyList_New(0);
|
||||
while (msl != NULL) {
|
||||
{{c_contained_type}} *native_ptr = ({{c_contained_type}} *)msl->data;
|
||||
PyObject *item = pylinphone_{{python_contained_type}}_new_from_native_ptr(&pylinphone_{{python_contained_type}}Type, native_ptr);
|
||||
PyList_Append(pyl, item);
|
||||
msl = ms_list_next(msl);
|
||||
}
|
||||
return pyl;
|
||||
}
|
||||
|
||||
MSList * PyList_AsMSListOf{{c_contained_type}}(PyObject *pyl) {
|
||||
MSList *msl = NULL;
|
||||
Py_ssize_t idx;
|
||||
Py_ssize_t size = PyList_Size(pyl);
|
||||
for (idx = 0; idx < size; idx++) {
|
||||
PyObject *item = PyList_GetItem(pyl, idx);
|
||||
{{c_contained_type}} *native_ptr = pylinphone_{{python_contained_type}}_get_native_ptr(item);
|
||||
msl = ms_list_append(msl, native_ptr);
|
||||
}
|
||||
return msl;
|
||||
}
|
||||
|
||||
{{/mslist_types}}
|
||||
|
||||
{{#events}}
|
||||
{{{event_callback_definition}}}
|
||||
{{/events}}
|
||||
|
|
@ -139,6 +166,9 @@ static PyMethodDef pylinphone_{{class_name}}_methods[] = {
|
|||
{{/class_properties}}
|
||||
|
||||
static PyGetSetDef pylinphone_{{class_name}}_getseters[] = {
|
||||
{{#class_hand_written_properties}}
|
||||
{ "{{property_name}}", {{getter_reference}}, {{setter_reference}}, "" },
|
||||
{{/class_hand_written_properties}}
|
||||
{{#class_properties}}
|
||||
{ "{{property_name}}", {{getter_reference}}, {{setter_reference}}, "{{{property_doc}}}" },
|
||||
{{/class_properties}}
|
||||
|
|
@ -236,6 +266,7 @@ PyMODINIT_FUNC initlinphone(void) {
|
|||
PyObject *m;
|
||||
PyObject *menum;
|
||||
|
||||
PyDateTime_IMPORT;
|
||||
pylinphone_init_logging();
|
||||
|
||||
{{#classes}}
|
||||
|
|
@ -258,6 +289,15 @@ PyMODINIT_FUNC initlinphone(void) {
|
|||
{{/enum_values}}
|
||||
{{/enums}}
|
||||
|
||||
menum = Py_InitModule3("PayloadTypeType", pylinphone_PayloadTypeType_ModuleMethods, "Type of linphone.PayloadType.");
|
||||
if (menum == NULL) return;
|
||||
if (PyModule_AddObject(m, "PayloadTypeType", menum) < 0) return;
|
||||
if (PyModule_AddIntConstant(menum, "PAYLOAD_AUDIO_CONTINUOUS", PAYLOAD_AUDIO_CONTINUOUS) < 0) return;
|
||||
if (PyModule_AddIntConstant(menum, "PAYLOAD_AUDIO_PACKETIZED", PAYLOAD_AUDIO_PACKETIZED) < 0) return;
|
||||
if (PyModule_AddIntConstant(menum, "PAYLOAD_VIDEO", PAYLOAD_VIDEO) < 0) return;
|
||||
if (PyModule_AddIntConstant(menum, "PAYLOAD_TEXT", PAYLOAD_TEXT) < 0) return;
|
||||
if (PyModule_AddIntConstant(menum, "PAYLOAD_OTHER", PAYLOAD_OTHER) < 0) return;
|
||||
|
||||
{{#classes}}
|
||||
Py_INCREF(&pylinphone_{{class_name}}Type);
|
||||
PyModule_AddObject(m, "{{class_name}}", (PyObject *)&pylinphone_{{class_name}}Type);
|
||||
|
|
|
|||
177
tools/python/doc/Makefile
Normal file
177
tools/python/doc/Makefile
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
# Makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
PAPER =
|
||||
BUILDDIR = build
|
||||
|
||||
# User-friendly check for sphinx-build
|
||||
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
|
||||
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
|
||||
endif
|
||||
|
||||
# Internal variables.
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||
# the i18n builder cannot share the environment and doctrees with the others
|
||||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||
|
||||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
|
||||
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo " html to make standalone HTML files"
|
||||
@echo " dirhtml to make HTML files named index.html in directories"
|
||||
@echo " singlehtml to make a single large HTML file"
|
||||
@echo " pickle to make pickle files"
|
||||
@echo " json to make JSON files"
|
||||
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||
@echo " qthelp to make HTML files and a qthelp project"
|
||||
@echo " devhelp to make HTML files and a Devhelp project"
|
||||
@echo " epub to make an epub"
|
||||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
||||
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
|
||||
@echo " text to make text files"
|
||||
@echo " man to make manual pages"
|
||||
@echo " texinfo to make Texinfo files"
|
||||
@echo " info to make Texinfo files and run them through makeinfo"
|
||||
@echo " gettext to make PO message catalogs"
|
||||
@echo " changes to make an overview of all changed/added/deprecated items"
|
||||
@echo " xml to make Docutils-native XML files"
|
||||
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
|
||||
@echo " linkcheck to check all external links for integrity"
|
||||
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILDDIR)/*
|
||||
|
||||
html:
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||
|
||||
dirhtml:
|
||||
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
||||
|
||||
singlehtml:
|
||||
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
||||
|
||||
pickle:
|
||||
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
||||
@echo
|
||||
@echo "Build finished; now you can process the pickle files."
|
||||
|
||||
json:
|
||||
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
||||
@echo
|
||||
@echo "Build finished; now you can process the JSON files."
|
||||
|
||||
htmlhelp:
|
||||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||
".hhp project file in $(BUILDDIR)/htmlhelp."
|
||||
|
||||
qthelp:
|
||||
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
||||
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
||||
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Linphone.qhcp"
|
||||
@echo "To view the help file:"
|
||||
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Linphone.qhc"
|
||||
|
||||
devhelp:
|
||||
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
||||
@echo
|
||||
@echo "Build finished."
|
||||
@echo "To view the help file:"
|
||||
@echo "# mkdir -p $$HOME/.local/share/devhelp/Linphone"
|
||||
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Linphone"
|
||||
@echo "# devhelp"
|
||||
|
||||
epub:
|
||||
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
||||
@echo
|
||||
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
||||
|
||||
latex:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo
|
||||
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
||||
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
||||
"(use \`make latexpdf' here to do that automatically)."
|
||||
|
||||
latexpdf:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through pdflatex..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
latexpdfja:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through platex and dvipdfmx..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
text:
|
||||
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
||||
@echo
|
||||
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
||||
|
||||
man:
|
||||
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
||||
@echo
|
||||
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
||||
|
||||
texinfo:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo
|
||||
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
||||
@echo "Run \`make' in that directory to run these through makeinfo" \
|
||||
"(use \`make info' here to do that automatically)."
|
||||
|
||||
info:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo "Running Texinfo files through makeinfo..."
|
||||
make -C $(BUILDDIR)/texinfo info
|
||||
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
||||
|
||||
gettext:
|
||||
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
||||
@echo
|
||||
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
||||
|
||||
changes:
|
||||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
||||
@echo
|
||||
@echo "The overview file is in $(BUILDDIR)/changes."
|
||||
|
||||
linkcheck:
|
||||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
||||
@echo
|
||||
@echo "Link check complete; look for any errors in the above output " \
|
||||
"or in $(BUILDDIR)/linkcheck/output.txt."
|
||||
|
||||
doctest:
|
||||
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
||||
@echo "Testing of doctests in the sources finished, look at the " \
|
||||
"results in $(BUILDDIR)/doctest/output.txt."
|
||||
|
||||
xml:
|
||||
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
|
||||
@echo
|
||||
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
|
||||
|
||||
pseudoxml:
|
||||
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
|
||||
@echo
|
||||
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
|
||||
242
tools/python/doc/make.bat
Normal file
242
tools/python/doc/make.bat
Normal file
|
|
@ -0,0 +1,242 @@
|
|||
@ECHO OFF
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
if "%SPHINXBUILD%" == "" (
|
||||
set SPHINXBUILD=sphinx-build
|
||||
)
|
||||
set BUILDDIR=build
|
||||
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source
|
||||
set I18NSPHINXOPTS=%SPHINXOPTS% source
|
||||
if NOT "%PAPER%" == "" (
|
||||
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
|
||||
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
|
||||
)
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
if "%1" == "help" (
|
||||
:help
|
||||
echo.Please use `make ^<target^>` where ^<target^> is one of
|
||||
echo. html to make standalone HTML files
|
||||
echo. dirhtml to make HTML files named index.html in directories
|
||||
echo. singlehtml to make a single large HTML file
|
||||
echo. pickle to make pickle files
|
||||
echo. json to make JSON files
|
||||
echo. htmlhelp to make HTML files and a HTML help project
|
||||
echo. qthelp to make HTML files and a qthelp project
|
||||
echo. devhelp to make HTML files and a Devhelp project
|
||||
echo. epub to make an epub
|
||||
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
|
||||
echo. text to make text files
|
||||
echo. man to make manual pages
|
||||
echo. texinfo to make Texinfo files
|
||||
echo. gettext to make PO message catalogs
|
||||
echo. changes to make an overview over all changed/added/deprecated items
|
||||
echo. xml to make Docutils-native XML files
|
||||
echo. pseudoxml to make pseudoxml-XML files for display purposes
|
||||
echo. linkcheck to check all external links for integrity
|
||||
echo. doctest to run all doctests embedded in the documentation if enabled
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "clean" (
|
||||
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
|
||||
del /q /s %BUILDDIR%\*
|
||||
goto end
|
||||
)
|
||||
|
||||
|
||||
%SPHINXBUILD% 2> nul
|
||||
if errorlevel 9009 (
|
||||
echo.
|
||||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||
echo.installed, then set the SPHINXBUILD environment variable to point
|
||||
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||
echo.may add the Sphinx directory to PATH.
|
||||
echo.
|
||||
echo.If you don't have Sphinx installed, grab it from
|
||||
echo.http://sphinx-doc.org/
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if "%1" == "html" (
|
||||
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "dirhtml" (
|
||||
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "singlehtml" (
|
||||
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "pickle" (
|
||||
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can process the pickle files.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "json" (
|
||||
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can process the JSON files.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "htmlhelp" (
|
||||
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can run HTML Help Workshop with the ^
|
||||
.hhp project file in %BUILDDIR%/htmlhelp.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "qthelp" (
|
||||
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can run "qcollectiongenerator" with the ^
|
||||
.qhcp project file in %BUILDDIR%/qthelp, like this:
|
||||
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Linphone.qhcp
|
||||
echo.To view the help file:
|
||||
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Linphone.ghc
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "devhelp" (
|
||||
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "epub" (
|
||||
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The epub file is in %BUILDDIR%/epub.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "latex" (
|
||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "latexpdf" (
|
||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||
cd %BUILDDIR%/latex
|
||||
make all-pdf
|
||||
cd %BUILDDIR%/..
|
||||
echo.
|
||||
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "latexpdfja" (
|
||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||
cd %BUILDDIR%/latex
|
||||
make all-pdf-ja
|
||||
cd %BUILDDIR%/..
|
||||
echo.
|
||||
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "text" (
|
||||
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The text files are in %BUILDDIR%/text.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "man" (
|
||||
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The manual pages are in %BUILDDIR%/man.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "texinfo" (
|
||||
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "gettext" (
|
||||
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "changes" (
|
||||
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.The overview file is in %BUILDDIR%/changes.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "linkcheck" (
|
||||
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Link check complete; look for any errors in the above output ^
|
||||
or in %BUILDDIR%/linkcheck/output.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "doctest" (
|
||||
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Testing of doctests in the sources finished, look at the ^
|
||||
results in %BUILDDIR%/doctest/output.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "xml" (
|
||||
%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The XML files are in %BUILDDIR%/xml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "pseudoxml" (
|
||||
%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
|
||||
goto end
|
||||
)
|
||||
|
||||
:end
|
||||
260
tools/python/doc/source/conf.py
Normal file
260
tools/python/doc/source/conf.py
Normal file
|
|
@ -0,0 +1,260 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Linphone documentation build configuration file, created by
|
||||
# sphinx-quickstart on Wed Aug 20 15:37:38 2014.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its
|
||||
# containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#needs_sphinx = '1.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix of source filenames.
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The encoding of source files.
|
||||
#source_encoding = 'utf-8-sig'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'Linphone'
|
||||
copyright = u'2014, Belledonne Communications'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '3.7'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '3.7.0'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#language = None
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
#today = ''
|
||||
# Else, today_fmt is used as the format for a strftime call.
|
||||
#today_fmt = '%B %d, %Y'
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = []
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all
|
||||
# documents.
|
||||
#default_role = None
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#add_function_parentheses = True
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
#add_module_names = True
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
#show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# A list of ignored prefixes for module index sorting.
|
||||
#modindex_common_prefix = []
|
||||
|
||||
# If true, keep warnings as "system message" paragraphs in the built documents.
|
||||
#keep_warnings = False
|
||||
|
||||
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
html_theme = 'default'
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#html_theme_options = {}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
#html_theme_path = []
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
#html_title = None
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#html_short_title = None
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
#html_logo = None
|
||||
|
||||
# The name of an image file (within the static path) to use as favicon of the
|
||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#html_favicon = None
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
|
||||
# Add any extra paths that contain custom files (such as robots.txt or
|
||||
# .htaccess) here, relative to this directory. These files are copied
|
||||
# directly to the root of the documentation.
|
||||
#html_extra_path = []
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
#html_last_updated_fmt = '%b %d, %Y'
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
#html_use_smartypants = True
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
#html_sidebars = {}
|
||||
|
||||
# Additional templates that should be rendered to pages, maps page names to
|
||||
# template names.
|
||||
#html_additional_pages = {}
|
||||
|
||||
# If false, no module index is generated.
|
||||
#html_domain_indices = True
|
||||
|
||||
# If false, no index is generated.
|
||||
#html_use_index = True
|
||||
|
||||
# If true, the index is split into individual pages for each letter.
|
||||
#html_split_index = False
|
||||
|
||||
# If true, links to the reST sources are added to the pages.
|
||||
#html_show_sourcelink = True
|
||||
|
||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||
#html_show_sphinx = True
|
||||
|
||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||
#html_show_copyright = True
|
||||
|
||||
# If true, an OpenSearch description file will be output, and all pages will
|
||||
# contain a <link> tag referring to it. The value of this option must be the
|
||||
# base URL from which the finished HTML is served.
|
||||
#html_use_opensearch = ''
|
||||
|
||||
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||
#html_file_suffix = None
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'Linphonedoc'
|
||||
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#'preamble': '',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
('index', 'Linphone.tex', u'Linphone Documentation',
|
||||
u'Belledonne Communications', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
#latex_logo = None
|
||||
|
||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||
# not chapters.
|
||||
#latex_use_parts = False
|
||||
|
||||
# If true, show page references after internal links.
|
||||
#latex_show_pagerefs = False
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#latex_show_urls = False
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#latex_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#latex_domain_indices = True
|
||||
|
||||
|
||||
# -- Options for manual page output ---------------------------------------
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'linphone', u'Linphone Documentation',
|
||||
[u'Belledonne Communications'], 1)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#man_show_urls = False
|
||||
|
||||
|
||||
# -- Options for Texinfo output -------------------------------------------
|
||||
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'Linphone', u'Linphone Documentation',
|
||||
u'Belledonne Communications', 'Linphone', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#texinfo_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#texinfo_domain_indices = True
|
||||
|
||||
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||
#texinfo_show_urls = 'footnote'
|
||||
|
||||
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
||||
#texinfo_no_detailmenu = False
|
||||
26
tools/python/doc/source/index.rst
Normal file
26
tools/python/doc/source/index.rst
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
.. Linphone documentation master file, created by
|
||||
sphinx-quickstart on Wed Aug 20 15:37:38 2014.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
Welcome to Linphone's documentation!
|
||||
====================================
|
||||
|
||||
Contents:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
.. automodule:: linphone
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. autoattribute:: linphone.__version__
|
||||
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`search`
|
||||
|
||||
|
|
@ -3,7 +3,7 @@ import logging
|
|||
import sys
|
||||
import threading
|
||||
import time
|
||||
from linphone import linphone
|
||||
import linphone
|
||||
|
||||
|
||||
class Response:
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# Copyright (C) 2014 Belledonne Communications SARL
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
from distutils.core import setup, Extension
|
||||
|
||||
m = Extension('linphone',
|
||||
include_dirs = ['/home/ghislain/linphone-install/include'],
|
||||
libraries = ['linphone'],
|
||||
library_dirs = ['/home/ghislain/linphone-install/lib'],
|
||||
sources = ['linphone.c']
|
||||
)
|
||||
setup(name = 'Linphone', version = '1.0', description = 'Linphone package', ext_modules = [m])
|
||||
Loading…
Add table
Reference in a new issue