forked from mirrors/linphone-iphone
an op is considered as secure if both from and to uri are sips
This commit is contained in:
parent
8f186adebb
commit
92abb3d3e5
6 changed files with 30 additions and 12 deletions
|
|
@ -119,6 +119,11 @@ void sal_op_resend_request(SalOp* op, belle_sip_request_t* request);
|
|||
int sal_op_send_and_create_refresher(SalOp* op,belle_sip_request_t* req, int expires,belle_sip_refresher_listener_t listener );
|
||||
belle_sip_response_t *sal_op_create_response_from_request(SalOp *op, belle_sip_request_t *req, int code);
|
||||
|
||||
/*
|
||||
* return true if both from and to uri are sips
|
||||
* */
|
||||
bool_t sal_op_is_secure(const SalOp* op);
|
||||
|
||||
void sal_process_authentication(SalOp *op);
|
||||
belle_sip_header_contact_t* sal_op_create_contact(SalOp *op) ;
|
||||
|
||||
|
|
|
|||
|
|
@ -612,7 +612,6 @@ int sal_call_notify_ringing(SalOp *op, bool_t early_media){
|
|||
/*accept an incoming call or, during a call accept a reINVITE*/
|
||||
int sal_call_accept(SalOp*h){
|
||||
belle_sip_response_t *response;
|
||||
belle_sip_header_address_t* contact= (belle_sip_header_address_t*)sal_op_get_contact_address(h);
|
||||
belle_sip_header_contact_t* contact_header;
|
||||
|
||||
if (!h->pending_server_trans) {
|
||||
|
|
@ -634,7 +633,7 @@ int sal_call_accept(SalOp*h){
|
|||
}
|
||||
}
|
||||
|
||||
if (contact && (contact_header=belle_sip_header_contact_create(contact))) {
|
||||
if ((contact_header=sal_op_create_contact(h))) {
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(response),BELLE_SIP_HEADER(contact_header));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,11 +87,19 @@ int sal_op_get_auth_requested(SalOp *op, const char **realm, const char **userna
|
|||
|
||||
belle_sip_header_contact_t* sal_op_create_contact(SalOp *op){
|
||||
belle_sip_header_contact_t* contact_header;
|
||||
belle_sip_uri_t* contact_uri;
|
||||
if (sal_op_get_contact_address(op)) {
|
||||
contact_header = belle_sip_header_contact_create(BELLE_SIP_HEADER_ADDRESS(sal_op_get_contact_address(op)));
|
||||
} else {
|
||||
contact_header= belle_sip_header_contact_new();
|
||||
}
|
||||
if (!(contact_uri=belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(contact_header)))) {
|
||||
/*no uri, just creating a new one*/
|
||||
contact_uri=belle_sip_uri_new();
|
||||
belle_sip_header_address_set_uri(BELLE_SIP_HEADER_ADDRESS(contact_header),contact_uri);
|
||||
}
|
||||
belle_sip_uri_set_secure(contact_uri,sal_op_is_secure(op));
|
||||
|
||||
belle_sip_header_contact_set_automatic(contact_header,op->base.root->auto_contacts);
|
||||
if (op->base.root->uuid){
|
||||
if (belle_sip_parameters_has_parameter(BELLE_SIP_PARAMETERS(contact_header),"+sip.instance")==0){
|
||||
|
|
@ -121,6 +129,9 @@ belle_sip_request_t* sal_op_build_request(SalOp *op,const char* method) {
|
|||
to_header = belle_sip_header_to_create(BELLE_SIP_HEADER_ADDRESS(sal_op_get_to_address(op)),NULL);
|
||||
req_uri = (belle_sip_uri_t*)belle_sip_object_clone((belle_sip_object_t*)belle_sip_header_address_get_uri((belle_sip_header_address_t*)to_header));
|
||||
|
||||
|
||||
belle_sip_uri_set_secure(req_uri,sal_op_is_secure(op));
|
||||
|
||||
req=belle_sip_request_create(
|
||||
req_uri,
|
||||
method,
|
||||
|
|
@ -240,7 +251,7 @@ static int _sal_op_send_request_with_contact(SalOp* op, belle_sip_request_t* req
|
|||
belle_sip_message("Transport is not specified, using %s because UDP is not available.",transport);
|
||||
belle_sip_uri_set_transport_param(next_hop_uri,transport);
|
||||
}
|
||||
belle_sip_uri_fix(next_hop_uri);
|
||||
/* not really usefull belle_sip_uri_fix(next_hop_uri);*/
|
||||
}
|
||||
if ((strcmp(method,"REGISTER")==0 || strcmp(method,"SUBSCRIBE")==0) && transport &&
|
||||
(strcasecmp(transport,"TCP")==0 || strcasecmp(transport,"TLS")==0)){
|
||||
|
|
@ -554,3 +565,10 @@ void sal_op_set_privacy(SalOp* op,SalPrivacyMask privacy) {
|
|||
SalPrivacyMask sal_op_get_privacy(const SalOp* op) {
|
||||
return op->privacy;
|
||||
}
|
||||
|
||||
bool_t sal_op_is_secure(const SalOp* op) {
|
||||
const SalAddress* from = sal_op_get_from_address(op);
|
||||
const SalAddress* to = sal_op_get_to_address(op);
|
||||
|
||||
return from && to && strcasecmp("sips",sal_address_get_scheme(from))==0 && strcasecmp("sips",sal_address_get_scheme(to))==0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ int sal_message_send(SalOp *op, const char *from, const char *to, const char* co
|
|||
if (to)
|
||||
sal_op_set_to(op,to);
|
||||
op->dir=SalOpDirOutgoing;
|
||||
|
||||
req=sal_op_build_request(op,"MESSAGE");
|
||||
if (sal_op_get_contact(op)){
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(sal_op_create_contact(op)));
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ int linphone_proxy_config_set_server_addr(LinphoneProxyConfig *obj, const char *
|
|||
obj->reg_proxy=NULL;
|
||||
|
||||
if (server_addr!=NULL && strlen(server_addr)>0){
|
||||
if (strstr(server_addr,"sip:")==NULL){
|
||||
if (strstr(server_addr,"sip:")==NULL && strstr(server_addr,"sips:")==NULL){
|
||||
modified=ms_strdup_printf("sip:%s",server_addr);
|
||||
addr=linphone_address_new(modified);
|
||||
ms_free(modified);
|
||||
|
|
@ -182,11 +182,11 @@ int linphone_proxy_config_set_route(LinphoneProxyConfig *obj, const char *route)
|
|||
ms_free(obj->reg_route);
|
||||
obj->reg_route=NULL;
|
||||
}
|
||||
if (route!=NULL){
|
||||
if (route!=NULL && route[0] !='\0'){
|
||||
SalAddress *addr;
|
||||
char *tmp;
|
||||
/*try to prepend 'sip:' */
|
||||
if (strstr(route,"sip:")==NULL){
|
||||
if (strstr(route,"sip:")==NULL && strstr(route,"sips:")==NULL){
|
||||
tmp=ms_strdup_printf("sip:%s",route);
|
||||
}else tmp=ms_strdup(route);
|
||||
addr=sal_address_new(tmp);
|
||||
|
|
@ -259,13 +259,8 @@ void linphone_proxy_config_apply(LinphoneProxyConfig *obj,LinphoneCore *lc)
|
|||
obj->lc=lc;
|
||||
linphone_proxy_config_done(obj);
|
||||
}
|
||||
#ifndef USE_BELLESIP
|
||||
static char *guess_contact_for_register(LinphoneProxyConfig *obj){
|
||||
char *ret=NULL;
|
||||
#else
|
||||
LinphoneAddress *guess_contact_for_register(LinphoneProxyConfig *obj){
|
||||
LinphoneAddress *ret=NULL;
|
||||
#endif
|
||||
LinphoneAddress *proxy=linphone_address_new(obj->reg_proxy);
|
||||
|
||||
const char *host;
|
||||
|
|
|
|||
|
|
@ -466,7 +466,7 @@ void linphone_gtk_text_received ( LinphoneCore *lc, LinphoneChatRoom *room,
|
|||
GtkWidget *w;
|
||||
gboolean send=TRUE;
|
||||
/*GtkNotebook *notebook= ( GtkNotebook * ) linphone_gtk_get_widget ( main_window,"viewswitch" );*/
|
||||
char *from=linphone_address_as_string ( linphone_chat_message_get_from ( msg ) );
|
||||
char *from=linphone_address_as_string_uri_only( linphone_chat_message_get_from ( msg ) );
|
||||
|
||||
w= ( GtkWidget* ) g_object_get_data ( G_OBJECT ( friendlist ),"chatview" );
|
||||
if ( w!=NULL ) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue