Commit dc0da30d authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

More work on the DialPlan object

parent 668dc9b6
......@@ -33,10 +33,34 @@
* @{
*/
/**
* Returns the country name of the dialplan
* @return the country name
*/
LINPHONE_PUBLIC const char * linphone_dial_plan_get_country(const LinphoneDialPlan *dp);
/**
* Returns the iso country code of the dialplan
* @return the iso country code
*/
LINPHONE_PUBLIC const char * linphone_dial_plan_get_iso_country_code(const LinphoneDialPlan *dp);
/**
* Returns the country calling code of the dialplan
* @return the country calling code
*/
LINPHONE_PUBLIC const char * linphone_dial_plan_get_country_calling_code(const LinphoneDialPlan *dp);
/**
* Returns the national number length of the dialplan
* @return the national number length
*/
LINPHONE_PUBLIC int linphone_dial_plan_get_national_number_length(const LinphoneDialPlan *dp);
/**
* Returns the international call prefix of the dialplan
* @return the international call prefix
*/
LINPHONE_PUBLIC const char * linphone_dial_plan_get_international_call_prefix(const LinphoneDialPlan *dp);
/**
......
......@@ -19,7 +19,6 @@
#include "linphone/api/c-dial-plan.h"
#include "linphone/wrapper_utils.h"
#include "c-wrapper/c-wrapper.h"
#include "dial-plan/dial-plan.h"
......@@ -30,28 +29,23 @@ using namespace std;
L_DECLARE_C_OBJECT_IMPL(DialPlan);
const char * linphone_dial_plan_get_country(const LinphoneDialPlan *dp) {
//return L_STRING_TO_C(L_GET_CPP_PTR_FROM_C_OBJECT(dp).getCountry());
return NULL;
return L_STRING_TO_C(L_GET_CPP_PTR_FROM_C_OBJECT(dp)->getCountry());
}
const char * linphone_dial_plan_get_iso_country_code(const LinphoneDialPlan *dp) {
//return L_STRING_TO_C(L_GET_CPP_PTR_FROM_C_OBJECT(dp).getIsoCountryCode());
return NULL;
return L_STRING_TO_C(L_GET_CPP_PTR_FROM_C_OBJECT(dp)->getIsoCountryCode());
}
const char * linphone_dial_plan_get_country_calling_code(const LinphoneDialPlan *dp) {
//return L_STRING_TO_C(L_GET_CPP_PTR_FROM_C_OBJECT(dp).getCountryCallingCode());
return NULL;
return L_STRING_TO_C(L_GET_CPP_PTR_FROM_C_OBJECT(dp)->getCountryCallingCode());
}
int linphone_dial_plan_get_national_number_length(const LinphoneDialPlan *dp) {
//return L_GET_CPP_PTR_FROM_C_OBJECT(dp).getNationalNumberLength();
return -1;
return L_GET_CPP_PTR_FROM_C_OBJECT(dp)->getNationalNumberLength();
}
const char * linphone_dial_plan_get_international_call_prefix(const LinphoneDialPlan *dp) {
//return L_STRING_TO_C(L_GET_CPP_PTR_FROM_C_OBJECT(dp).getInternationalCallPrefix());
return NULL;
return L_STRING_TO_C(L_GET_CPP_PTR_FROM_C_OBJECT(dp)->getInternationalCallPrefix());
}
int linphone_dial_plan_lookup_ccc_from_e164(const char* e164) {
......@@ -63,15 +57,13 @@ int linphone_dial_plan_lookup_ccc_from_iso(const char* iso) {
}
const LinphoneDialPlan* linphone_dial_plan_by_ccc_as_int(int ccc) {
//LinphonePrivate::DialPlan dp = LinphonePrivate::DialPlan::findByCccAsInt(ccc);
//return L_GET_C_BACK_PTR();
return NULL; //TODO
const LinphonePrivate::DialPlan& dp = LinphonePrivate::DialPlan::findByCccAsInt(ccc);
return L_GET_C_BACK_PTR(&dp);
}
const LinphoneDialPlan* linphone_dial_plan_by_ccc(const char *ccc) {
//LinphonePrivate::DialPlan dp = LinphonePrivate::DialPlan::findByCcc(L_C_TO_STRING(ccc));
//return L_GET_C_BACK_PTR();
return NULL; //TODO
const LinphonePrivate::DialPlan& dp = LinphonePrivate::DialPlan::findByCcc(L_C_TO_STRING(ccc));
return L_GET_C_BACK_PTR(&dp);
}
const LinphoneDialPlan* linphone_dial_plan_get_all() {
......@@ -79,12 +71,10 @@ const LinphoneDialPlan* linphone_dial_plan_get_all() {
}
const bctbx_list_t * linphone_dial_plan_get_all_list() {
//const list<DialPlan> dps = LinphonePrivate::DialPlan::getAllDialPlans();
//return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST();
return NULL; //TODO
const list<LinphonePrivate::DialPlan>& dps = LinphonePrivate::DialPlan::getAllDialPlans();
return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(dps);
}
bool_t linphone_dial_plan_is_generic(const LinphoneDialPlan *ccc) {
//return L_GET_CPP_PTR_FROM_C_OBJECT(ccc).isGeneric();
return FALSE;
return L_GET_CPP_PTR_FROM_C_OBJECT(ccc)->isGeneric();
}
\ No newline at end of file
......@@ -37,6 +37,7 @@
F(ChatRoom, ChatRoom) \
F(ConferenceEvent, ConferenceEvent) \
F(ConferenceParticipantEvent, ConferenceParticipantEvent) \
F(DialPlan, DialPlan) \
F(EventLog, EventLog) \
F(MediaSessionParams, CallParams) \
F(Participant, Participant)
......@@ -72,7 +73,6 @@ BELLE_SIP_TYPE_ID(LinphoneContactSearch),
BELLE_SIP_TYPE_ID(LinphoneContent),
BELLE_SIP_TYPE_ID(LinphoneCore),
BELLE_SIP_TYPE_ID(LinphoneCoreCbs),
BELLE_SIP_TYPE_ID(LinphoneDialPlan),
BELLE_SIP_TYPE_ID(LinphoneErrorInfo),
BELLE_SIP_TYPE_ID(LinphoneEvent),
BELLE_SIP_TYPE_ID(LinphoneFactory),
......
......@@ -381,7 +381,7 @@ public:
static inline bctbx_list_t *getResolvedCListFromCppList (const std::list<CppType> &cppList) {
bctbx_list_t *result = nullptr;
for (const auto &value : cppList)
result = bctbx_list_append(result, belle_sip_object_ref(getCBackPtr(value)));
result = bctbx_list_append(result, belle_sip_object_ref(getCBackPtr(&value)));
return result;
}
......
......@@ -34,7 +34,7 @@ LINPHONE_BEGIN_NAMESPACE
* http://en.wikipedia.org/wiki/Telephone_numbers_in_Europe
* imported from https://en.wikipedia.org/wiki/List_of_mobile_phone_number_series_by_country
*/
static list<DialPlan> const DialPlans = {
list<DialPlan> const DialPlan::DialPlans = {
//Country , iso country code, e164 country calling code, number length, international usual prefix
{"Afghanistan" ,"AF" , "93" , 9 , "00" },
{"Albania" ,"AL" , "355" , 9 , "00" },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment