Commit 66044e77 authored by Gautier Pelloux-Prayer's avatar Gautier Pelloux-Prayer
Browse files

Factorization of linphone_configure_op for every linphone core requests

parent b8c9c809
......@@ -701,7 +701,6 @@ 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);
char *from_str;
const SalMediaDescription *md;
LinphoneFirewallPolicy fpol;
......@@ -721,12 +720,13 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
/*the following sends an option request back to the caller so that
we get a chance to discover our nat'd address before answering.*/
call->ping_op=sal_op_new(lc->sal);
from_str=linphone_address_as_string_uri_only(from);
linphone_configure_op(lc, call->ping_op, from, NULL, FALSE);
sal_op_set_route(call->ping_op,sal_op_get_network_origin(op));
sal_op_set_user_pointer(call->ping_op,call);
sal_op_set_realm(call->ping_op,linphone_proxy_config_get_realm(linphone_core_lookup_known_proxy(call->core, to)));
sal_ping(call->ping_op,linphone_core_find_best_identity(lc,from),from_str);
ms_free(from_str);
sal_ping(call->ping_op,sal_op_get_from(call->ping_op), sal_op_get_to(call->ping_op));
}
}
......
......@@ -412,6 +412,7 @@ void _linphone_proxy_config_unregister(LinphoneProxyConfig *obj) {
static void linphone_proxy_config_register(LinphoneProxyConfig *obj){
if (obj->reg_sendregister){
LinphoneAddress* proxy=linphone_address_new(obj->reg_proxy);
LinphoneAddress* to=linphone_address_new(obj->reg_identity);
char* proxy_string;
LinphoneAddress *contact;
ms_message("LinphoneProxyConfig [%p] about to register (LinphoneCore version: %s)",obj,linphone_core_get_version());
......@@ -420,12 +421,18 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *obj){
if (obj->op)
sal_op_release(obj->op);
obj->op=sal_op_new(obj->lc->sal);
linphone_configure_op(obj->lc, obj->op, to, NULL, FALSE);
linphone_address_destroy(to);
if ((contact=guess_contact_for_register(obj))) {
sal_op_set_contact_address(obj->op,contact);
linphone_address_destroy(contact);
}
sal_op_set_user_pointer(obj->op,obj);
sal_op_set_realm(obj->op, obj->realm);
if (sal_register(obj->op,proxy_string,obj->reg_identity,obj->expires)==0) {
linphone_proxy_config_set_state(obj,LinphoneRegistrationProgress,"Registration in progress");
} else {
......@@ -967,11 +974,15 @@ int linphone_proxy_config_send_publish(LinphoneProxyConfig *proxy, LinphonePrese
if (proxy->state==LinphoneRegistrationOk || proxy->state==LinphoneRegistrationCleared){
if (proxy->publish_op==NULL){
LinphoneAddress *to=linphone_address_new(linphone_proxy_config_get_identity(proxy));
proxy->publish_op=sal_op_new(proxy->lc->sal);
sal_op_set_route(proxy->publish_op,proxy->reg_proxy);
sal_op_set_from(proxy->publish_op,linphone_proxy_config_get_identity(proxy));
sal_op_set_to(proxy->publish_op,linphone_proxy_config_get_identity(proxy));
sal_op_set_realm(proxy->publish_op,linphone_proxy_config_get_realm(proxy));
linphone_configure_op(proxy->lc, proxy->publish_op,
to, NULL, FALSE);
if (to!=NULL){
linphone_address_destroy(to);
}
if (lp_config_get_int(proxy->lc->config,"sip","publish_msg_with_contact",0)){
SalAddress *addr=sal_address_new(linphone_proxy_config_get_identity(proxy));
sal_op_set_contact_address(proxy->publish_op,addr);
......
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