aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorjeremy <jeremy@f38db490-d61c-443f-a65b-d21fe96a405b>2005-05-02 18:46:36 +0000
committerjeremy <jeremy@f38db490-d61c-443f-a65b-d21fe96a405b>2005-05-02 18:46:36 +0000
commit89acfbc498b9b948d1c44d086945acd821d78362 (patch)
tree273116cb6024e2cb170864ae1e6d1c7bcf0ee41f /channels
parent51c204f0f376565a1e6ae905f9cb0182f52b5a53 (diff)
Fix dtmfmode, dtmfcodec capability, Faststart for users and peers. Bug #4112
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5551 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_h323.c72
-rwxr-xr-xchannels/h323/ast_h323.cpp2
-rwxr-xr-xchannels/h323/chan_h323.h21
3 files changed, 68 insertions, 27 deletions
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index c14b0d4b1..a91a4e722 100755
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -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,8 +2094,23 @@ 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);
+ peer->next = peerl.peers;
+ 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;
diff --git a/channels/h323/ast_h323.cpp b/channels/h323/ast_h323.cpp
index 80cabd6ff..2fd4d8c9a 100755
--- a/channels/h323/ast_h323.cpp
+++ b/channels/h323/ast_h323.cpp
@@ -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;
}
diff --git a/channels/h323/chan_h323.h b/channels/h323/chan_h323.h
index 3be251e80..9ac4a061b 100755
--- a/channels/h323/chan_h323.h
+++ b/channels/h323/chan_h323.h
@@ -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;