Handle calling phone numbers for tigase.im jabber accounts. Use voip.tigase.im as target domain.

git-svn-id: http://yate.null.ro/svn/yate/trunk@5246 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2012-08-28 15:07:58 +00:00
parent 028a02cf82
commit 4915f1e631
1 changed files with 32 additions and 1 deletions

View File

@ -708,6 +708,13 @@ static inline bool isGmailAccount(ClientAccount* acc)
(acc->contact()->uri().getHost() &= s_googleDomain);
}
// Check if a given account is tigase.im
static inline bool isTigaseImAccount(ClientAccount* acc)
{
static String s_tigaseIm = "tigase.im";
return acc && acc->contact() && (acc->contact()->uri().getHost() &= s_tigaseIm);
}
// Check if a given domain is a Google MUC server
static inline bool isGoogleMucDomain(const String& domain)
{
@ -3104,7 +3111,7 @@ static void updateTelAccList(bool ok, ClientAccount* acc)
if (!acc)
return;
DDebug(ClientDriver::self(),DebugAll,"updateTelAccList(%d,%p)",ok,acc);
if (ok && (isTelProto(acc->protocol()) || isGmailAccount(acc)))
if (ok && (isTelProto(acc->protocol()) || isGmailAccount(acc) || isTigaseImAccount(acc)))
Client::self()->updateTableRow(s_account,acc->toString());
else
Client::self()->delTableRow(s_account,acc->toString());
@ -5616,6 +5623,30 @@ bool DefaultLogic::callStart(NamedList& params, Window* wnd, const String& cmd)
return false;
}
}
else if (account && isTigaseImAccount(m_accounts->findAccount(account))) {
// Allow calling user@domain
int pos = ns.find('@');
bool valid = (pos > 0) && (ns.find('.',pos + 2) >= pos);
if (!valid) {
target = ns;
Client::fixPhoneNumber(target,"().- ");
}
if (target) {
target = target + "@voip.tigase.im/yate";
// params.addParam("ojingle_version","0");
params.addParam("dtmfmethod","rfc2833");
params.addParam("offericeudp",String::boolText(false));
String callParams = params[YSTRING("call_parameters")];
callParams.append("dtmfmethod,ojingle_version,ojingle_flags,offericeudp",",");
params.setParam("call_parameters",callParams);
}
else if (!valid) {
showError(wnd,"Incorrect number");
Debug(ClientDriver::self(),DebugNote,
"Failed to call: invalid gmail number '%s'",params.getValue("target"));
return false;
}
}
}
// Delete the number from the "callto" widget and put it in the callto history
if (ns) {