dect
/
asterisk
Archived
13
0
Fork 0

DTMF mode is bitmask, not valued field

git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43574 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
pcadach 2006-09-24 18:53:44 +00:00
parent 7415f890e3
commit 11b3b49960
2 changed files with 15 additions and 7 deletions

View File

@ -1254,12 +1254,12 @@ static int update_common_options(struct ast_variable *v, struct call_options *op
ast_parse_allow_disallow(&options->prefs, &options->capability, v->value, 0);
} else if (!strcasecmp(v->name, "dtmfmode")) {
if (!strcasecmp(v->value, "inband")) {
options->dtmfmode = H323_DTMF_INBAND;
options->dtmfmode |= H323_DTMF_INBAND;
} else if (!strcasecmp(v->value, "rfc2833")) {
options->dtmfmode = H323_DTMF_RFC2833;
options->dtmfmode |= H323_DTMF_RFC2833;
} else {
ast_log(LOG_WARNING, "Unknown dtmf mode '%s', using rfc2833\n", v->value);
options->dtmfmode = H323_DTMF_RFC2833;
options->dtmfmode |= H323_DTMF_RFC2833;
}
} else if (!strcasecmp(v->name, "dtmfcodec")) {
tmp = atoi(v->value);
@ -1333,6 +1333,7 @@ static struct oh323_user *build_user(char *name, struct ast_variable *v, struct
oldha = user->ha;
user->ha = (struct ast_ha *)NULL;
memcpy(&user->options, &global_options, sizeof(user->options));
user->options.dtmfmode = 0;
/* Set default context */
strncpy(user->context, default_context, sizeof(user->context) - 1);
if (user && !found)
@ -1377,6 +1378,8 @@ static struct oh323_user *build_user(char *name, struct ast_variable *v, struct
user->ha = ast_append_ha(v->name, v->value, user->ha);
}
}
if (!user->options.dtmfmode)
user->options.dtmfmode = global_options.dtmfmode;
ASTOBJ_UNMARK(user);
ast_free_ha(oldha);
return user;
@ -1438,6 +1441,7 @@ static struct oh323_peer *build_peer(const char *name, struct ast_variable *v, s
oldha = peer->ha;
peer->ha = NULL;
memcpy(&peer->options, &global_options, sizeof(peer->options));
peer->options.dtmfmode = 0;
peer->addr.sin_port = htons(h323_signalling_port);
peer->addr.sin_family = AF_INET;
if (!found && name)
@ -1475,6 +1479,8 @@ static struct oh323_peer *build_peer(const char *name, struct ast_variable *v, s
ast_copy_string(peer->mailbox, v->value, sizeof(peer->mailbox));
}
}
if (!peer->options.dtmfmode)
peer->options.dtmfmode = global_options.dtmfmode;
ASTOBJ_UNMARK(peer);
ast_free_ha(oldha);
return peer;
@ -2729,7 +2735,7 @@ static int reload_config(int is_reload)
global_options.fastStart = 1;
global_options.h245Tunneling = 1;
global_options.dtmfcodec = H323_DTMF_RFC2833_PT;
global_options.dtmfmode = H323_DTMF_RFC2833;
global_options.dtmfmode = 0;
global_options.capability = GLOBAL_CAPABILITY;
global_options.bridge = 1; /* Do native bridging by default */
strncpy(default_context, "default", sizeof(default_context) - 1);
@ -2822,6 +2828,8 @@ static int reload_config(int is_reload)
/* dummy */
}
}
if (!global_options.dtmfmode)
global_options.dtmfmode = H323_DTMF_RFC2833;
for (cat = ast_category_browse(cfg, NULL); cat; cat = ast_category_browse(cfg, cat)) {
if (strcasecmp(cat, "general")) {

View File

@ -1204,7 +1204,7 @@ void MyH323Connection::SendUserInputTone(char tone, unsigned duration, unsigned
void MyH323Connection::OnUserInputTone(char tone, unsigned duration, unsigned logicalChannel, unsigned rtpTimestamp)
{
if (dtmfMode == H323_DTMF_RFC2833) {
if ((dtmfMode & H323_DTMF_RFC2833)) {
if (h323debug) {
cout << "\t-- Received user input tone (" << tone << ") from remote" << endl;
}
@ -1299,7 +1299,7 @@ BOOL MyH323Connection::OnReceivedCapabilitySet(const H323Capabilities & remoteCa
if (cap != NULL) {
RTP_DataFrame::PayloadTypes pt = ((H323_UserInputCapability*)cap)->GetPayloadType();
on_set_rfc2833_payload(GetCallReference(), (const char *)GetCallToken(), (int)pt);
if ((dtmfMode == H323_DTMF_RFC2833) && (sendUserInputMode == SendUserInputAsTone))
if ((dtmfMode & H323_DTMF_RFC2833) && (sendUserInputMode == SendUserInputAsTone))
sendUserInputMode = SendUserInputAsInlineRFC2833;
if (h323debug) {
cout << "\t-- Inbound RFC2833 on payload " << pt << endl;
@ -1514,7 +1514,7 @@ void MyH323Connection::SetCapabilities(int cap, int dtmf_mode, void *_prefs, int
lastcap++;
dtmfMode = dtmf_mode;
if (dtmf_mode == H323_DTMF_INBAND) {
if ((dtmfMode & H323_DTMF_INBAND)) {
localCapabilities.SetCapability(0, lastcap, new H323_UserInputCapability(H323_UserInputCapability::BasicString));
sendUserInputMode = SendUserInputAsString;
} else {