3 Copyright (C) 2000 Simon MORLAT (simon.morlat@linphone.org)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Library General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #include "linphonecore.h"
25 #include "mediastreamer2/mediastream.h"
31 void linphone_proxy_config_write_all_to_config_file(LinphoneCore *lc){
34 for(elem=lc->sip_conf.proxies,i=0;elem!=NULL;elem=ms_list_next(elem),i++){
35 LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data;
36 linphone_proxy_config_write_to_config_file(lc->config,cfg,i);
40 void linphone_proxy_config_init(LinphoneProxyConfig *obj){
41 memset(obj,0,sizeof(LinphoneProxyConfig));
51 * Creates an empty proxy config.
53 LinphoneProxyConfig *linphone_proxy_config_new(){
54 LinphoneProxyConfig *obj=NULL;
55 obj=ms_new(LinphoneProxyConfig,1);
56 linphone_proxy_config_init(obj);
61 * Destroys a proxy config.
63 * @note: LinphoneProxyConfig that have been removed from LinphoneCore with
64 * linphone_core_remove_proxy_config() must not be freed.
66 void linphone_proxy_config_destroy(LinphoneProxyConfig *obj){
67 if (obj->reg_proxy!=NULL) ms_free(obj->reg_proxy);
68 if (obj->reg_identity!=NULL) ms_free(obj->reg_identity);
69 if (obj->reg_route!=NULL) ms_free(obj->reg_route);
70 if (obj->ssctx!=NULL) sip_setup_context_free(obj->ssctx);
71 if (obj->realm!=NULL) ms_free(obj->realm);
72 if (obj->type!=NULL) ms_free(obj->type);
73 if (obj->dial_prefix!=NULL) ms_free(obj->dial_prefix);
74 if (obj->op) sal_op_release(obj->op);
75 if (obj->publish_op) sal_op_release(obj->publish_op);
79 * Returns a boolean indicating that the user is sucessfully registered on the proxy.
81 bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *obj){
82 return obj->registered;
86 * Sets the proxy address
88 * Examples of valid sip proxy address are:
89 * - IP address: sip:87.98.157.38
90 * - IP address with port: sip:87.98.157.38:5062
91 * - hostnames : sip:sip.example.net
93 int linphone_proxy_config_set_server_addr(LinphoneProxyConfig *obj, const char *server_addr){
94 LinphoneAddress *addr=NULL;
97 if (obj->reg_proxy!=NULL) ms_free(obj->reg_proxy);
100 if (server_addr!=NULL && strlen(server_addr)>0){
101 if (strstr(server_addr,"sip:")==NULL){
102 modified=ms_strdup_printf("sip:%s",server_addr);
103 addr=linphone_address_new(modified);
107 addr=linphone_address_new(server_addr);
109 obj->reg_proxy=linphone_address_as_string_uri_only(addr);
110 linphone_address_destroy(addr);
112 ms_warning("Could not parse %s",server_addr);
120 * Sets the user identity as a SIP address.
122 * This identity is normally formed with display name, username and domain, such
124 * Alice <sip:alice@example.net>
125 * The REGISTER messages will have from and to set to this identity.
128 int linphone_proxy_config_set_identity(LinphoneProxyConfig *obj, const char *identity){
129 LinphoneAddress *addr;
130 if (identity!=NULL && strlen(identity)>0){
131 addr=linphone_address_new(identity);
132 if (!addr || linphone_address_get_username(addr)==NULL){
133 ms_warning("Invalid sip identity: %s",identity);
135 linphone_address_destroy(addr);
138 if (obj->reg_identity!=NULL) {
139 ms_free(obj->reg_identity);
140 obj->reg_identity=NULL;
142 obj->reg_identity=ms_strdup(identity);
146 obj->realm=ms_strdup(linphone_address_get_domain(addr));
147 linphone_address_destroy(addr);
154 const char *linphone_proxy_config_get_domain(const LinphoneProxyConfig *cfg){
160 * When a route is set, all outgoing calls will go to the route's destination if this proxy
161 * is the default one (see linphone_core_set_default_proxy() ).
163 int linphone_proxy_config_set_route(LinphoneProxyConfig *obj, const char *route)
165 if (obj->reg_route!=NULL){
166 ms_free(obj->reg_route);
170 LinphoneAddress *addr;
171 /*try to prepend 'sip:' */
172 if (strstr(route,"sip:")==NULL){
173 obj->reg_route=ms_strdup_printf("sip:%s",route);
174 }else obj->reg_route=ms_strdup(route);
175 addr=linphone_address_new(obj->reg_route);
177 ms_free(obj->reg_route);
179 }else linphone_address_destroy(addr);
184 bool_t linphone_proxy_config_check(LinphoneCore *lc, LinphoneProxyConfig *obj){
185 if (obj->reg_proxy==NULL){
186 if (lc->vtable.display_warning)
187 lc->vtable.display_warning(lc,_("The sip proxy address you entered is invalid, it must start with \"sip:\""
188 " followed by a hostname."));
191 if (obj->reg_identity==NULL){
192 if (lc->vtable.display_warning)
193 lc->vtable.display_warning(lc,_("The sip identity you entered is invalid.\nIt should look like "
194 "sip:username@proxydomain, such as sip:alice@example.net"));
201 * Indicates whether a REGISTER request must be sent to the proxy.
203 void linphone_proxy_config_enableregister(LinphoneProxyConfig *obj, bool_t val){
204 obj->reg_sendregister=val;
208 * Sets the registration expiration time in seconds.
210 void linphone_proxy_config_expires(LinphoneProxyConfig *obj, int val){
215 void linphone_proxy_config_enable_publish(LinphoneProxyConfig *obj, bool_t val){
219 * Starts editing a proxy configuration.
221 * Because proxy configuration must be consistent, applications MUST
222 * call linphone_proxy_config_edit() before doing any attempts to modify
223 * proxy configuration (such as identity, proxy address and so on).
224 * Once the modifications are done, then the application must call
225 * linphone_proxy_config_done() to commit the changes.
227 void linphone_proxy_config_edit(LinphoneProxyConfig *obj){
228 if (obj->reg_sendregister){
230 if (obj->registered) {
231 sal_unregister(obj->op);
232 obj->registered=FALSE;
237 void linphone_proxy_config_apply(LinphoneProxyConfig *obj,LinphoneCore *lc)
240 linphone_proxy_config_done(obj);
243 static char *guess_contact_for_register(LinphoneProxyConfig *obj){
244 LinphoneAddress *proxy=linphone_address_new(obj->reg_proxy);
247 if (proxy==NULL) return NULL;
248 host=linphone_address_get_domain (proxy);
250 LinphoneAddress *contact;
251 char localip[LINPHONE_IPADDR_SIZE];
254 linphone_core_get_local_ip(obj->lc,host,localip);
255 contact=linphone_address_new(obj->reg_identity);
256 linphone_address_set_domain (contact,localip);
257 linphone_address_set_port_int(contact,linphone_core_get_sip_port(obj->lc));
258 linphone_address_set_display_name(contact,NULL);
260 linphone_core_get_sip_transports(obj->lc,&tr);
261 if (tr.udp_port <= 0) {
263 sal_address_set_param(contact,"transport","tcp");
264 } else if (tr.tls_port>0) {
265 sal_address_set_param(contact,"transport","tls");
268 ret=linphone_address_as_string(contact);
269 linphone_address_destroy(contact);
271 linphone_address_destroy (proxy);
275 static void linphone_proxy_config_register(LinphoneProxyConfig *obj){
276 if (obj->reg_sendregister){
279 sal_op_release(obj->op);
280 obj->op=sal_op_new(obj->lc->sal);
281 contact=guess_contact_for_register(obj);
282 sal_op_set_contact(obj->op,contact);
284 sal_op_set_user_pointer(obj->op,obj);
285 if (sal_register(obj->op,obj->reg_proxy,obj->reg_identity,obj->expires)==0) {
286 linphone_proxy_config_set_state(obj,LinphoneRegistrationProgress,"Registration in progress");
288 linphone_proxy_config_set_state(obj,LinphoneRegistrationFailed,"Registration failed");
294 * Refresh a proxy registration.
295 * This is useful if for example you resuming from suspend, thus IP address may have changed.
297 void linphone_proxy_config_refresh_register(LinphoneProxyConfig *obj){
298 if (obj->reg_sendregister && obj->op){
299 obj->registered=FALSE;
300 sal_register_refresh(obj->op,obj->expires);
306 * Sets a dialing prefix to be automatically prepended when inviting a number with
307 * #linphone_core_invite.
310 void linphone_proxy_config_set_dial_prefix(LinphoneProxyConfig *cfg, const char *prefix){
311 if (cfg->dial_prefix!=NULL){
312 ms_free(cfg->dial_prefix);
313 cfg->dial_prefix=NULL;
315 if (prefix && prefix[0]!='\0') cfg->dial_prefix=ms_strdup(prefix);
319 * Returns dialing prefix.
323 const char *linphone_proxy_config_get_dial_prefix(const LinphoneProxyConfig *cfg){
324 return cfg->dial_prefix;
328 * Sets whether liblinphone should replace "+" by "00" in dialed numbers (passed to
329 * #linphone_core_invite ).
332 void linphone_proxy_config_set_dial_escape_plus(LinphoneProxyConfig *cfg, bool_t val){
333 cfg->dial_escape_plus=val;
337 * Returns whether liblinphone should replace "+" by "00" in dialed numbers (passed to
338 * #linphone_core_invite ).
341 bool_t linphone_proxy_config_get_dial_escape_plus(const LinphoneProxyConfig *cfg){
342 return cfg->dial_escape_plus;
346 static bool_t is_a_phone_number(const char *username){
348 for(p=username;*p!='\0';++p){
361 static char *flatten_number(const char *number){
362 char *result=ms_malloc0(strlen(number)+1);
365 for(r=number;*r!='\0';++r){
366 if (*r=='+' || isdigit(*r)){
374 static void copy_result(const char *src, char *dest, size_t destlen, bool_t escape_plus){
377 if (escape_plus && src[0]=='+' && destlen>2){
384 for(;(i<destlen-1) && *src!='\0';++i){
392 static char *append_prefix(const char *number, const char *prefix){
393 char *res=ms_malloc(strlen(number)+strlen(prefix)+1);
395 return strcat(res,number);
398 int linphone_proxy_config_normalize_number(LinphoneProxyConfig *proxy, const char *username, char *result, size_t result_len){
401 if (is_a_phone_number(username)){
402 flatten=flatten_number(username);
403 ms_message("Flattened number is '%s'",flatten);
404 numlen=strlen(flatten);
405 if (numlen>10 || flatten[0]=='+' || proxy->dial_prefix==NULL || proxy->dial_prefix[0]=='\0'){
406 ms_message("No need to add a prefix");
407 /* prefix is already there */
408 copy_result(flatten,result,result_len,proxy->dial_escape_plus);
411 }else if (proxy->dial_prefix && proxy->dial_prefix[0]!='\0'){
414 ms_message("Need to prefix with %s",proxy->dial_prefix);
416 /*remove initial number before prepending prefix*/
419 prefixed=append_prefix(flatten+skipped,proxy->dial_prefix);
421 copy_result(prefixed,result,result_len,proxy->dial_escape_plus);
424 }else strncpy(result,username,result_len);
429 * Commits modification made to the proxy configuration.
431 int linphone_proxy_config_done(LinphoneProxyConfig *obj)
433 if (!linphone_proxy_config_check(obj->lc,obj)) return -1;
435 linphone_proxy_config_write_all_to_config_file(obj->lc);
439 void linphone_proxy_config_set_realm(LinphoneProxyConfig *cfg, const char *realm)
441 if (cfg->realm!=NULL) {
445 if (realm!=NULL) cfg->realm=ms_strdup(realm);
448 int linphone_proxy_config_send_publish(LinphoneProxyConfig *proxy,
449 LinphoneOnlineStatus presence_mode){
451 SalOp *op=sal_op_new(proxy->lc->sal);
452 err=sal_publish(op,linphone_proxy_config_get_identity(proxy),
453 linphone_proxy_config_get_identity(proxy),linphone_online_status_to_sal(presence_mode));
454 if (proxy->publish_op!=NULL)
455 sal_op_release(proxy->publish_op);
456 proxy->publish_op=op;
461 * Returns the route set for this proxy configuration.
463 const char *linphone_proxy_config_get_route(const LinphoneProxyConfig *obj){
464 return obj->reg_route;
468 * Returns the SIP identity that belongs to this proxy configuration.
470 * The SIP identity is a SIP address (Display Name <sip:username@domain> )
472 const char *linphone_proxy_config_get_identity(const LinphoneProxyConfig *obj){
473 return obj->reg_identity;
477 * Returns TRUE if PUBLISH request is enabled for this proxy.
479 bool_t linphone_proxy_config_publish_enabled(const LinphoneProxyConfig *obj){
484 * Returns the proxy's SIP address.
486 const char *linphone_proxy_config_get_addr(const LinphoneProxyConfig *obj){
487 return obj->reg_proxy;
491 * Returns the duration of registration.
493 int linphone_proxy_config_get_expires(const LinphoneProxyConfig *obj){
498 * Returns TRUE if registration to the proxy is enabled.
500 bool_t linphone_proxy_config_register_enabled(const LinphoneProxyConfig *obj){
501 return obj->reg_sendregister;
504 struct _LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig *obj){
509 * Add a proxy configuration.
510 * This will start registration on the proxy, if registration is enabled.
512 int linphone_core_add_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *cfg){
513 if (!linphone_proxy_config_check(lc,cfg)) return -1;
514 if (ms_list_find(lc->sip_conf.proxies,cfg)!=NULL){
515 ms_warning("ProxyConfig already entered, ignored.");
518 lc->sip_conf.proxies=ms_list_append(lc->sip_conf.proxies,(void *)cfg);
519 linphone_proxy_config_apply(cfg,lc);
524 * Removes a proxy configuration.
526 * LinphoneCore will then automatically unregister and place the proxy configuration
527 * on a deleted list. For that reason, a removed proxy does NOT need to be freed.
529 void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *cfg){
530 lc->sip_conf.proxies=ms_list_remove(lc->sip_conf.proxies,(void *)cfg);
531 /* add to the list of destroyed proxies, so that the possible unREGISTER request can succeed authentication */
532 lc->sip_conf.deleted_proxies=ms_list_append(lc->sip_conf.deleted_proxies,(void *)cfg);
533 cfg->deletion_date=ms_time(NULL);
534 /* this will unREGISTER */
535 linphone_proxy_config_edit(cfg);
536 if (lc->default_proxy==cfg){
537 lc->default_proxy=NULL;
541 * Erase all proxies from config.
545 void linphone_core_clear_proxy_config(LinphoneCore *lc){
546 MSList* list=ms_list_copy(linphone_core_get_proxy_config_list((const LinphoneCore*)lc));
547 for(;list!=NULL;list=list->next){
548 linphone_core_remove_proxy_config(lc,(LinphoneProxyConfig *)list->data);
553 * Sets the default proxy.
555 * This default proxy must be part of the list of already entered LinphoneProxyConfig.
556 * Toggling it as default will make LinphoneCore use the identity associated with
557 * the proxy configuration in all incoming and outgoing calls.
559 void linphone_core_set_default_proxy(LinphoneCore *lc, LinphoneProxyConfig *config){
560 /* check if this proxy is in our list */
562 if (ms_list_find(lc->sip_conf.proxies,config)==NULL){
563 ms_warning("Bad proxy address: it is not in the list !");
564 lc->default_proxy=NULL;
568 lc->default_proxy=config;
572 void linphone_core_set_default_proxy_index(LinphoneCore *lc, int index){
573 if (index<0) linphone_core_set_default_proxy(lc,NULL);
574 else linphone_core_set_default_proxy(lc,ms_list_nth_data(lc->sip_conf.proxies,index));
578 * Returns the default proxy configuration, that is the one used to determine the current identity.
580 int linphone_core_get_default_proxy(LinphoneCore *lc, LinphoneProxyConfig **config){
582 if (config!=NULL) *config=lc->default_proxy;
583 if (lc->default_proxy!=NULL){
584 pos=ms_list_position(lc->sip_conf.proxies,ms_list_find(lc->sip_conf.proxies,(void *)lc->default_proxy));
590 * Returns an unmodifiable list of entered proxy configurations.
592 const MSList *linphone_core_get_proxy_config_list(const LinphoneCore *lc){
593 return lc->sip_conf.proxies;
596 void linphone_proxy_config_write_to_config_file(LpConfig *config, LinphoneProxyConfig *obj, int index)
600 sprintf(key,"proxy_%i",index);
601 lp_config_clean_section(config,key);
605 if (obj->type!=NULL){
606 lp_config_set_string(config,key,"type",obj->type);
608 if (obj->reg_proxy!=NULL){
609 lp_config_set_string(config,key,"reg_proxy",obj->reg_proxy);
611 if (obj->reg_route!=NULL){
612 lp_config_set_string(config,key,"reg_route",obj->reg_route);
614 if (obj->reg_identity!=NULL){
615 lp_config_set_string(config,key,"reg_identity",obj->reg_identity);
617 lp_config_set_int(config,key,"reg_expires",obj->expires);
618 lp_config_set_int(config,key,"reg_sendregister",obj->reg_sendregister);
619 lp_config_set_int(config,key,"publish",obj->publish);
620 lp_config_set_int(config,key,"dial_escape_plus",obj->dial_escape_plus);
621 lp_config_set_string(config,key,"dial_prefix",obj->dial_prefix);
626 LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LpConfig *config, int index)
629 const char *identity;
631 LinphoneProxyConfig *cfg;
634 sprintf(key,"proxy_%i",index);
636 if (!lp_config_has_section(config,key)){
640 cfg=linphone_proxy_config_new();
642 identity=lp_config_get_string(config,key,"reg_identity",NULL);
643 proxy=lp_config_get_string(config,key,"reg_proxy",NULL);
645 linphone_proxy_config_set_identity(cfg,identity);
646 linphone_proxy_config_set_server_addr(cfg,proxy);
648 tmp=lp_config_get_string(config,key,"reg_route",NULL);
649 if (tmp!=NULL) linphone_proxy_config_set_route(cfg,tmp);
651 linphone_proxy_config_expires(cfg,lp_config_get_int(config,key,"reg_expires",600));
652 linphone_proxy_config_enableregister(cfg,lp_config_get_int(config,key,"reg_sendregister",0));
654 linphone_proxy_config_enable_publish(cfg,lp_config_get_int(config,key,"publish",0));
656 linphone_proxy_config_set_dial_escape_plus(cfg,lp_config_get_int(config,key,"dial_escape_plus",0));
657 linphone_proxy_config_set_dial_prefix(cfg,lp_config_get_string(config,key,"dial_prefix",NULL));
659 tmp=lp_config_get_string(config,key,"type",NULL);
660 if (tmp!=NULL && strlen(tmp)>0)
661 linphone_proxy_config_set_sip_setup(cfg,tmp);
666 static void linphone_proxy_config_activate_sip_setup(LinphoneProxyConfig *cfg){
667 SipSetupContext *ssc;
668 SipSetup *ss=sip_setup_lookup(cfg->type);
669 LinphoneCore *lc=linphone_proxy_config_get_core(cfg);
672 ssc=sip_setup_context_new(ss,cfg);
674 if (cfg->reg_identity==NULL){
675 ms_error("Invalid identity for this proxy configuration.");
678 caps=sip_setup_context_get_capabilities(ssc);
679 if (caps & SIP_SETUP_CAP_ACCOUNT_MANAGER){
680 if (sip_setup_context_login_account(ssc,cfg->reg_identity,NULL)!=0){
681 if (lc->vtable.display_warning){
682 char *tmp=ms_strdup_printf(_("Could not login as %s"),cfg->reg_identity);
683 lc->vtable.display_warning(lc,tmp);
689 if (caps & SIP_SETUP_CAP_PROXY_PROVIDER){
691 if (sip_setup_context_get_proxy(ssc,NULL,proxy,sizeof(proxy))==0){
692 linphone_proxy_config_set_server_addr(cfg,proxy);
694 ms_error("Could not retrieve proxy uri !");
700 SipSetup *linphone_proxy_config_get_sip_setup(LinphoneProxyConfig *cfg){
701 if (cfg->ssctx!=NULL) return cfg->ssctx->funcs;
702 if (cfg->type!=NULL){
703 return sip_setup_lookup(cfg->type);
708 void linphone_proxy_config_update(LinphoneProxyConfig *cfg){
709 LinphoneCore *lc=cfg->lc;
711 if (cfg->type && cfg->ssctx==NULL){
712 linphone_proxy_config_activate_sip_setup(cfg);
714 if (!lc->sip_conf.register_only_when_network_is_up || lc->network_reachable)
715 linphone_proxy_config_register(cfg);
716 if (cfg->publish && cfg->publish_op==NULL){
717 linphone_proxy_config_send_publish(cfg,lc->presence_mode);
723 void linphone_proxy_config_set_sip_setup(LinphoneProxyConfig *cfg, const char *type){
726 cfg->type=ms_strdup(type);
727 if (linphone_proxy_config_get_addr(cfg)==NULL){
728 /*put a placeholder so that the sip setup gets saved into the config */
729 linphone_proxy_config_set_server_addr(cfg,"sip:undefined");
733 SipSetupContext *linphone_proxy_config_get_sip_setup_context(LinphoneProxyConfig *cfg){
741 LinphoneAccountCreator *linphone_account_creator_new(struct _LinphoneCore *core, const char *type){
742 LinphoneAccountCreator *obj;
743 LinphoneProxyConfig *cfg;
744 SipSetup *ss=sip_setup_lookup(type);
745 SipSetupContext *ssctx;
749 if (!(sip_setup_get_capabilities(ss) & SIP_SETUP_CAP_ACCOUNT_MANAGER)){
750 ms_error("%s cannot manage accounts.",type);
753 obj=ms_new0(LinphoneAccountCreator,1);
754 cfg=linphone_proxy_config_new();
755 ssctx=sip_setup_context_new(ss,cfg);
758 set_string(&obj->domain,sip_setup_context_get_domains(ssctx)[0]);
763 void linphone_account_creator_set_username(LinphoneAccountCreator *obj, const char *username){
764 set_string(&obj->username,username);
767 void linphone_account_creator_set_password(LinphoneAccountCreator *obj, const char *password){
768 set_string(&obj->password,password);
771 void linphone_account_creator_set_domain(LinphoneAccountCreator *obj, const char *domain){
772 set_string(&obj->domain,domain);
775 const char * linphone_account_creator_get_username(LinphoneAccountCreator *obj){
776 return obj->username;
779 const char * linphone_account_creator_get_domain(LinphoneAccountCreator *obj){
783 int linphone_account_creator_test_existence(LinphoneAccountCreator *obj){
784 SipSetupContext *ssctx=obj->ssctx;
785 char *uri=ms_strdup_printf("%s@%s",obj->username,obj->domain);
786 int err=sip_setup_context_account_exists(ssctx,uri);
791 LinphoneProxyConfig * linphone_account_creator_validate(LinphoneAccountCreator *obj){
792 SipSetupContext *ssctx=obj->ssctx;
793 char *uri=ms_strdup_printf("%s@%s",obj->username,obj->domain);
794 int err=sip_setup_context_create_account(ssctx,uri,obj->password);
798 return sip_setup_context_get_proxy_config(ssctx);
803 void linphone_account_creator_destroy(LinphoneAccountCreator *obj){
805 ms_free(obj->username);
807 ms_free(obj->password);
809 ms_free(obj->domain);
810 if (!obj->succeeded){
811 linphone_proxy_config_destroy(sip_setup_context_get_proxy_config(obj->ssctx));
815 void linphone_proxy_config_set_user_data(LinphoneProxyConfig *cr, void * ud) {
819 void * linphone_proxy_config_get_user_data(LinphoneProxyConfig *cr) {
820 return cr->user_data;
823 void linphone_proxy_config_set_state(LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const char *message){
824 LinphoneCore *lc=cfg->lc;
826 if (lc && lc->vtable.registration_state_changed){
827 lc->vtable.registration_state_changed(lc,cfg,state,message);
831 LinphoneRegistrationState linphone_proxy_config_get_state(const LinphoneProxyConfig *cfg){
835 const char *linphone_registration_state_to_string(LinphoneRegistrationState cs){
837 case LinphoneRegistrationCleared:
838 return "LinphoneRegistrationCleared";
840 case LinphoneRegistrationNone:
841 return "LinphoneRegistrationNone";
843 case LinphoneRegistrationProgress:
844 return "LinphoneRegistrationProgress";
846 case LinphoneRegistrationOk:
847 return "LinphoneRegistrationOk";
849 case LinphoneRegistrationFailed:
850 return "LinphoneRegistrationFailed";
856 LinphoneReason linphone_proxy_config_get_error(const LinphoneProxyConfig *cfg) {
860 void linphone_proxy_config_set_error(LinphoneProxyConfig *cfg,LinphoneReason error) {