mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-29 18:19:30 +00:00
Fix dtmfmode, dtmfcodec capability, Faststart for users and peers. Bug #4112
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5551 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -357,7 +357,8 @@ static struct oh323_user *build_user(char *name, struct ast_variable *v)
|
||||
if (user) {
|
||||
memset(user, 0, sizeof(struct oh323_user));
|
||||
strncpy(user->name, name, sizeof(user->name) - 1);
|
||||
user->options.dtmfcodec = 101;
|
||||
memcpy(&user->options, &global_options, sizeof(user->options));
|
||||
user->capability = capability;
|
||||
/* set a native brigding default value */
|
||||
user->bridge = bridging;
|
||||
/* and default context */
|
||||
@@ -367,8 +368,8 @@ static struct oh323_user *build_user(char *name, struct ast_variable *v)
|
||||
strncpy(user->context, v->value, sizeof(user->context) - 1);
|
||||
} else if (!strcasecmp(v->name, "bridge")) {
|
||||
user->bridge = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "nat")) {
|
||||
user->nat = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "nat")) {
|
||||
user->nat = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "noFastStart")) {
|
||||
user->options.noFastStart = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "noH245Tunneling")) {
|
||||
@@ -403,6 +404,29 @@ static struct oh323_user *build_user(char *name, struct ast_variable *v)
|
||||
user->options.progress_audio = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "dtmfcodec")) {
|
||||
user->options.dtmfcodec = atoi(v->value);
|
||||
} else if (!strcasecmp(v->name, "dtmfmode")) {
|
||||
if (!strcasecmp(v->value, "inband")) {
|
||||
user->dtmfmode = H323_DTMF_INBAND;
|
||||
} else if (!strcasecmp(v->value, "rfc2833")) {
|
||||
user->dtmfmode = H323_DTMF_RFC2833;
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Unknown DTMF Mode %s, using RFC2833\n", v->value);
|
||||
user->dtmfmode = H323_DTMF_RFC2833;
|
||||
}
|
||||
} else if (!strcasecmp(v->name, "allow")) {
|
||||
format = ast_getformatbyname(v->value);
|
||||
if (format < 1) {
|
||||
ast_log(LOG_WARNING, "Cannot allow unknown format '%s'\n", v->value);
|
||||
} else {
|
||||
user->capability |= format;
|
||||
}
|
||||
} else if (!strcasecmp(v->name, "disallow")) {
|
||||
format = ast_getformatbyname(v->value);
|
||||
if (format < 1) {
|
||||
ast_log(LOG_WARNING, "Cannot disallow unknown format '%s'\n", v->value);
|
||||
} else {
|
||||
user->capability &= ~format;
|
||||
}
|
||||
} else if (!strcasecmp(v->name, "host")) {
|
||||
if (!strcasecmp(v->value, "dynamic")) {
|
||||
ast_log(LOG_ERROR, "A dynamic host on a type=user does not make any sense\n");
|
||||
@@ -473,8 +497,9 @@ static struct oh323_peer *build_peer(char *name, struct ast_variable *v)
|
||||
peer->ha = NULL;
|
||||
peer->addr.sin_family = AF_INET;
|
||||
peer->capability = capability;
|
||||
peer->options.dtmfcodec = 101;
|
||||
peer->dtmfmode = H323_DTMF_RFC2833;
|
||||
peer->dtmfmode = dtmfmode;
|
||||
peer->bridge = bridging;
|
||||
memcpy(&peer->options, &global_options, sizeof(peer->options));
|
||||
|
||||
while(v) {
|
||||
if (!strcasecmp(v->name, "bridge")) {
|
||||
@@ -530,7 +555,7 @@ static struct oh323_peer *build_peer(char *name, struct ast_variable *v)
|
||||
if (format < 1) {
|
||||
ast_log(LOG_WARNING, "Cannot disallow unknown format '%s'\n", v->value);
|
||||
} else {
|
||||
peer->capability |= ~format;
|
||||
peer->capability &= ~format;
|
||||
}
|
||||
} else if (!strcasecmp(v->name, "host")) {
|
||||
if (!strcasecmp(v->value, "dynamic")) {
|
||||
@@ -1537,7 +1562,7 @@ call_options_t *setup_incoming_call(call_details_t cd)
|
||||
}
|
||||
strncpy(pvt->context, user->context, sizeof(pvt->context) - 1);
|
||||
pvt->bridge = user->bridge;
|
||||
pvt->nat = user->nat;
|
||||
pvt->nat = user->nat;
|
||||
if (!ast_strlen_zero(pvt->cd.call_dest_e164)) {
|
||||
strncpy(pvt->exten, cd.call_dest_e164, sizeof(pvt->exten) - 1);
|
||||
} else {
|
||||
@@ -2043,13 +2068,13 @@ int reload_config(void)
|
||||
} else if (!strcasecmp(v->name, "dtmfcodec")) {
|
||||
global_options.dtmfcodec = atoi(v->value);
|
||||
} else if (!strcasecmp(v->name, "UserByAlias")) {
|
||||
userbyalias = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "bridge")) {
|
||||
bridging = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "noFastStart")) {
|
||||
global_options.noFastStart = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "noH245Tunneling")) {
|
||||
global_options.noH245Tunneling = ast_true(v->value);
|
||||
userbyalias = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "bridge")) {
|
||||
bridging = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "noFastStart")) {
|
||||
global_options.noFastStart = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "noH245Tunneling")) {
|
||||
global_options.noH245Tunneling = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "noSilenceSuppression")) {
|
||||
global_options.noSilenceSuppression = ast_true(v->value);
|
||||
}
|
||||
@@ -2061,7 +2086,7 @@ int reload_config(void)
|
||||
if (strcasecmp(cat, "general")) {
|
||||
utype = ast_variable_retrieve(cfg, cat, "type");
|
||||
if (utype) {
|
||||
if (!strcasecmp(utype, "user") || !strcasecmp(utype, "friend")) {
|
||||
if (!strcasecmp(utype, "user")) {
|
||||
user = build_user(cat, ast_variable_browse(cfg, cat));
|
||||
if (user) {
|
||||
ast_mutex_lock(&userl.lock);
|
||||
@@ -2069,7 +2094,7 @@ int reload_config(void)
|
||||
userl.users = user;
|
||||
ast_mutex_unlock(&userl.lock);
|
||||
}
|
||||
} else if (!strcasecmp(utype, "peer") || !strcasecmp(utype, "friend")) {
|
||||
} else if (!strcasecmp(utype, "peer")) {
|
||||
peer = build_peer(cat, ast_variable_browse(cfg, cat));
|
||||
if (peer) {
|
||||
ast_mutex_lock(&peerl.lock);
|
||||
@@ -2077,6 +2102,21 @@ int reload_config(void)
|
||||
peerl.peers = peer;
|
||||
ast_mutex_unlock(&peerl.lock);
|
||||
}
|
||||
} else if (!strcasecmp(utype, "friend")) {
|
||||
user = build_user(cat, ast_variable_browse(cfg, cat));
|
||||
peer = build_peer(cat, ast_variable_browse(cfg, cat));
|
||||
if (user) {
|
||||
ast_mutex_lock(&userl.lock);
|
||||
user->next = userl.users;
|
||||
userl.users = user;
|
||||
ast_mutex_unlock(&userl.lock);
|
||||
}
|
||||
if (peer) {
|
||||
ast_mutex_lock(&peerl.lock);
|
||||
peer->next = peerl.peers;
|
||||
peerl.peers = peer;
|
||||
ast_mutex_unlock(&peerl.lock);
|
||||
}
|
||||
} else if (!strcasecmp(utype, "h323") || !strcasecmp(utype, "alias")) {
|
||||
alias = build_alias(cat, ast_variable_browse(cfg, cat));
|
||||
if (alias) {
|
||||
|
@@ -298,7 +298,7 @@ int MyH323EndPoint::MakeCall(const PString & dest, PString & token, unsigned int
|
||||
cout << " -- Making call to " << fullAddress << " without gatekeeper." << endl;
|
||||
}
|
||||
}
|
||||
if (!(connection = (MyH323Connection *)H323EndPoint::MakeCallLocked(fullAddress, token))) {
|
||||
if (!(connection = (MyH323Connection *)H323EndPoint::MakeCallLocked(fullAddress, token, opts))) {
|
||||
if (h323debug) {
|
||||
cout << "Error making call to \"" << fullAddress << '"' << endl;
|
||||
}
|
||||
|
@@ -31,16 +31,16 @@
|
||||
/** call_option struct holds various bits
|
||||
* of information for each call */
|
||||
typedef struct call_options {
|
||||
char cid_num[80];
|
||||
char cid_name[80];
|
||||
int noFastStart;
|
||||
int noH245Tunneling;
|
||||
int noSilenceSuppression;
|
||||
unsigned int port;
|
||||
int progress_setup;
|
||||
int progress_alert;
|
||||
int progress_audio;
|
||||
int dtmfcodec;
|
||||
char cid_num[80];
|
||||
char cid_name[80];
|
||||
int noFastStart;
|
||||
int noH245Tunneling;
|
||||
int noSilenceSuppression;
|
||||
unsigned int port;
|
||||
int progress_setup;
|
||||
int progress_alert;
|
||||
int progress_audio;
|
||||
int dtmfcodec;
|
||||
} call_options_t;
|
||||
|
||||
/* structure to hold the valid asterisk users */
|
||||
@@ -51,6 +51,7 @@ struct oh323_user {
|
||||
char callerid[80];
|
||||
char accountcode[20];
|
||||
int amaflags;
|
||||
int capability;
|
||||
int bridge;
|
||||
int nat;
|
||||
int dtmfmode;
|
||||
|
Reference in New Issue
Block a user