Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/sbc/SBCCallLeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ void SBCCallLeg::applyAProfile()

if(!call_profile.dlg_contact_params.empty())
dlg->setContactParams(call_profile.dlg_contact_params);

dlg->setContact(call_profile.aleg_contact);
}

int SBCCallLeg::applySSTCfg(AmConfigReader& sst_cfg,
Expand Down
28 changes: 14 additions & 14 deletions apps/sbc/SBCCallProfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ bool SBCCallProfile::readFromConfiguration(const string& name,
contact.hiding_prefix = cfg.getParameter("contact_hiding_prefix");
contact.hiding_vars = cfg.getParameter("contact_hiding_vars");

if (!bleg_contact.readConfig(cfg)) return false;
if (!aleg_contact.readConfig(cfg,"aleg_")) return false;
if (!bleg_contact.readConfig(cfg,"bleg_")) return false;
if (!codec_prefs.readConfig(cfg)) return false;
if (!transcoder.readConfig(cfg)) return false;
hold_settings.readConfig(cfg);
Expand Down Expand Up @@ -583,7 +584,9 @@ bool SBCCallProfile::readFromConfiguration(const string& name,

codec_prefs.infoPrint();
transcoder.infoPrint();
bleg_contact.infoPrint();

INFO("SBC: A leg contact: %s\n", aleg_contact.print().c_str());
INFO("SBC: B leg contact: %s\n", bleg_contact.print().c_str());

return true;
}
Expand Down Expand Up @@ -788,6 +791,7 @@ bool SBCCallProfile::evaluate(ParamReplacerCtx& ctx,
REPLACE_NONEMPTY_STR(outbound_proxy);
REPLACE_NONEMPTY_STR(next_hop);

if (!aleg_contact.evaluate(ctx,req)) return false;
if (!bleg_contact.evaluate(ctx,req)) return false;
if (!transcoder.evaluate(ctx,req)) return false;

Expand Down Expand Up @@ -1781,16 +1785,16 @@ bool SBCCallProfile::HoldSettings::evaluate(ParamReplacerCtx& ctx, const AmSipRe
return true;
}

bool SBCCallProfile::BLegContact::readConfig(AmConfigReader &cfg)
bool SBCCallProfile::LegContact::readConfig(AmConfigReader &cfg, const string &prefix)
{
uri_host = cfg.getParameter("bleg_contact_host");
uri_port = cfg.getParameter("bleg_contact_port");
uri_user = cfg.getParameter("bleg_contact_user");
uri_param = cfg.getParameter("bleg_contact_uri_params");
display_name = cfg.getParameter("bleg_contact_displayname");
uri_host = cfg.getParameter(prefix+"contact_host");
uri_port = cfg.getParameter(prefix+"contact_port");
uri_user = cfg.getParameter(prefix+"contact_user");
uri_param = cfg.getParameter(prefix+"contact_uri_params");
display_name = cfg.getParameter(prefix+"contact_displayname");

int pos = 0;
string params = cfg.getParameter("bleg_contact_params");
string params = cfg.getParameter(prefix+"contact_params");
if(params.empty()) return true;
if(!parse_params(params,pos)) {
ERROR("bleg_contact_params parsing failed");
Expand All @@ -1799,7 +1803,7 @@ bool SBCCallProfile::BLegContact::readConfig(AmConfigReader &cfg)
return true;
}

bool SBCCallProfile::BLegContact::evaluate(ParamReplacerCtx& ctx, const AmSipRequest& req)
bool SBCCallProfile::LegContact::evaluate(ParamReplacerCtx& ctx, const AmSipRequest& req)
{
REPLACE_NONEMPTY_STR(uri_host);
REPLACE_NONEMPTY_STR(uri_port);
Expand All @@ -1815,7 +1819,3 @@ bool SBCCallProfile::BLegContact::evaluate(ParamReplacerCtx& ctx, const AmSipReq
return true;
}

void SBCCallProfile::BLegContact::infoPrint() const
{
INFO("SBC: B leg contact: %s\n", print().c_str());
}
7 changes: 3 additions & 4 deletions apps/sbc/SBCCallProfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,13 @@ struct SBCCallProfile

Contact contact;

class BLegContact
class LegContact
: public AmUriParser
{
public:
bool readConfig(AmConfigReader &cfg);
bool readConfig(AmConfigReader &cfg, const string &prefix);
bool evaluate(ParamReplacerCtx& ctx, const AmSipRequest& req);
void infoPrint() const;
} bleg_contact;
} aleg_contact, bleg_contact;

string callid;

Expand Down
1 change: 1 addition & 0 deletions apps/sbc/SBCSimpleRelay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ int SimpleRelayDialog::initUAS(const AmSipRequest& req,
fix_replaces_ref = cp.fix_replaces_ref=="yes";

setContactParams(cp.dlg_contact_params);
setContact(cp.aleg_contact);

return 0;
}
Expand Down
20 changes: 11 additions & 9 deletions doc/Readme.sbc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -588,18 +588,20 @@ Examples:

Contact header rewriting
------------------------
SBC can add/alter Contact header parts for both legs.

SBC can add/alter Contact header parts
for the the outgoing initial INVITE by using the following options:
available variables:

- bleg_contact_host
- bleg_contact_port
- bleg_contact_user
- bleg_contact_displayname
- bleg_contact_params
- bleg_contact_uri_params
- {leg}_contact_host
- {leg}_contact_port
- {leg}_contact_user
- {leg}_contact_displayname
- {leg}_contact_params
- {leg}_contact_uri_params

note: bleg_contact_params and bleg_contact_uri_params
where {leg} is 'aleg' or 'bleg'

note: *_contact_params and *_contact_uri_params
are strings with semicolon-separated params list.

not specified or empty after placeholders substitution parts will be left untouched.
Expand Down