From 89f3e2ceda901574092b14bd37a5079e9d95ed84 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 12 Jul 2013 09:04:10 +0200 Subject: [PATCH] set callid more early, add option to disable uuid (to reduce message size) --- coreapi/bellesip_sal/sal_op_impl.c | 12 ++++++++++-- coreapi/linphonecore.c | 2 +- coreapi/offeranswer.c | 3 ++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/coreapi/bellesip_sal/sal_op_impl.c b/coreapi/bellesip_sal/sal_op_impl.c index c2a198353..b8bdeb1a1 100644 --- a/coreapi/bellesip_sal/sal_op_impl.c +++ b/coreapi/bellesip_sal/sal_op_impl.c @@ -205,6 +205,7 @@ static int _sal_op_send_request_with_contact(SalOp* op, belle_sip_request_t* req belle_sip_provider_t* prov=op->base.root->prov; belle_sip_uri_t* outbound_proxy=NULL; belle_sip_header_contact_t* contact; + int result =-1; _sal_op_add_custom_headers(op, (belle_sip_message_t*)request); @@ -264,7 +265,14 @@ static int _sal_op_send_request_with_contact(SalOp* op, belle_sip_request_t* req /*hmm just in case we already have authentication param in cache*/ belle_sip_provider_add_authorization(op->base.root->prov,request,NULL,NULL); } - return belle_sip_client_transaction_send_request_to(client_transaction,outbound_proxy/*might be null*/); + result = belle_sip_client_transaction_send_request_to(client_transaction,outbound_proxy/*might be null*/); + + /*update call id if not set yet for this OP*/ + if (result == 0 && !op->base.call_id) { + op->base.call_id=ms_strdup(belle_sip_header_call_id_get_call_id(BELLE_SIP_HEADER_CALL_ID(belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(request), belle_sip_header_call_id_t)))); + } + + return result; } @@ -519,7 +527,7 @@ bool_t sal_op_get_body(SalOp *op, belle_sip_message_t *msg, SalBody *salbody){ salbody->size=belle_sip_header_content_length_get_content_length(clen); return TRUE; } - memset(salbody,0,sizeof(salbody)); + memset(salbody,0,sizeof(SalBody)); return FALSE; } void sal_op_set_privacy(SalOp* op,SalPrivacyMask privacy) { diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 93b2e5a46..28be12be3 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1230,7 +1230,7 @@ static void misc_config_read (LinphoneCore *lc) { char tmp[64]; sal_create_uuid(lc->sal,tmp,sizeof(tmp)); lp_config_set_string(config,"misc","uuid",tmp); - }else + }else if (strcmp(uuid,"0")!=0) /*to allow to disable sip.instance*/ sal_set_uuid(lc->sal, uuid); } diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index c07e6e381..42d856310 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -40,7 +40,8 @@ static PayloadType * find_payload_type_best_match(const MSList *l, const Payload for (elem=l;elem!=NULL;elem=elem->next){ pt=(PayloadType*)elem->data; /* the compare between G729 and G729A is for some stupid uncompliant phone*/ - if ( (strcasecmp(pt->mime_type,refpt->mime_type)==0 || + if ( pt->mime_type && refpt->mime_type && + (strcasecmp(pt->mime_type,refpt->mime_type)==0 || (strcasecmp(pt->mime_type, "G729") == 0 && strcasecmp(refpt->mime_type, "G729A") == 0 )) && pt->clock_rate==refpt->clock_rate){ candidate=pt;