diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 1a8afe3b12..026ae42fe5 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3546,6 +3546,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session char *host = NULL, *dest_to = NULL; const char *hval = NULL; char *not_const = NULL; + int cid_locked = 0; *new_session = NULL; @@ -3614,7 +3615,8 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session } tech_pvt->transport = gateway_ptr->register_transport; - + tech_pvt->cid_type = gateway_ptr->cid_type; + cid_locked = 1; /* * Handle params, strip them off the destination and add them to the @@ -3852,7 +3854,9 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session switch_ivr_transfer_variable(session, nsession, "sip_video_fmtp"); switch_ivr_transfer_variable(session, nsession, "sip-force-contact"); switch_ivr_transfer_variable(session, nsession, "sip_sticky_contact"); - switch_ivr_transfer_variable(session, nsession, "sip_cid_type"); + if (!cid_locked) { + switch_ivr_transfer_variable(session, nsession, "sip_cid_type"); + } if (switch_core_session_compare(session, nsession)) { /* It's another sofia channel! so lets cache what they use as a pt for telephone event so @@ -3863,7 +3867,9 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session switch_assert(ctech_pvt != NULL); tech_pvt->bte = ctech_pvt->te; tech_pvt->bcng_pt = ctech_pvt->cng_pt; - tech_pvt->cid_type = ctech_pvt->cid_type; + if (!cid_locked) { + tech_pvt->cid_type = ctech_pvt->cid_type; + } if (sofia_test_flag(tech_pvt, TFLAG_ENABLE_SOA)) { sofia_set_flag(ctech_pvt, TFLAG_ENABLE_SOA); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index c42f7a83a8..d2c34cf9a9 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -313,6 +313,12 @@ typedef enum { REG_FLAG_MAX } reg_flags_t; +typedef enum { + CID_TYPE_RPID, + CID_TYPE_PID, + CID_TYPE_NONE +} sofia_cid_type_t; + typedef enum { REG_STATE_UNREGED, REG_STATE_TRYING, @@ -416,6 +422,7 @@ struct sofia_gateway { struct sofia_gateway *next; sofia_gateway_subscription_t *subscriptions; int distinct_to; + sofia_cid_type_t cid_type; }; typedef enum { @@ -430,12 +437,6 @@ typedef enum { MEDIA_OPT_BYPASS_AFTER_ATT_XFER = (1 << 1) } sofia_media_options_t; -typedef enum { - CID_TYPE_RPID, - CID_TYPE_PID, - CID_TYPE_NONE -} sofia_cid_type_t; - struct sofia_profile { int debug; char *name;