Fix codec negiocation on inbound calls. Bugs 3980, 4021, 4045

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5526 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jeremy McNamara 2005-04-29 04:22:47 +00:00
parent b2c3f0464f
commit 45f7567d70
2 changed files with 22 additions and 10 deletions

View File

@ -559,6 +559,7 @@ static struct oh323_peer *build_peer(char *name, struct ast_variable *v)
static int oh323_digit(struct ast_channel *c, char digit) static int oh323_digit(struct ast_channel *c, char digit)
{ {
struct oh323_pvt *p = (struct oh323_pvt *) c->tech_pvt; struct oh323_pvt *p = (struct oh323_pvt *) c->tech_pvt;
char *token;
if (h323debug) if (h323debug)
ast_log(LOG_DEBUG, "Sending digit %c on %s\n", digit, c->name); ast_log(LOG_DEBUG, "Sending digit %c on %s\n", digit, c->name);
if (!p) if (!p)
@ -569,10 +570,15 @@ static int oh323_digit(struct ast_channel *c, char digit)
} }
/* If in-band DTMF is desired, send that */ /* If in-band DTMF is desired, send that */
if ((p->dtmfmode & H323_DTMF_INBAND)) { if ((p->dtmfmode & H323_DTMF_INBAND)) {
h323_send_tone(p->cd.call_token, digit); token = p->cd.call_token ? strdup(p->cd.call_token) : NULL;
}
ast_mutex_unlock(&p->lock); ast_mutex_unlock(&p->lock);
h323_send_tone(token, digit);
if (token)
free(token);
oh323_update_info(c); oh323_update_info(c);
}
else
ast_mutex_unlock(&p->lock);
return 0; return 0;
} }
@ -1014,6 +1020,7 @@ static struct oh323_pvt *oh323_alloc(int callid)
pvt->cd.call_reference = callid; pvt->cd.call_reference = callid;
pvt->bridge = bridging; pvt->bridge = bridging;
pvt->dtmfmode = dtmfmode; pvt->dtmfmode = dtmfmode;
pvt->capability = capability;
if (pvt->dtmfmode & H323_DTMF_RFC2833) { if (pvt->dtmfmode & H323_DTMF_RFC2833) {
pvt->nonCodecCapability |= AST_RTP_DTMF; pvt->nonCodecCapability |= AST_RTP_DTMF;
} }
@ -1194,10 +1201,6 @@ static struct ast_channel *oh323_request(const char *type, int format, void *dat
ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%d'\n", format); ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%d'\n", format);
return NULL; return NULL;
} }
/* Assign default capabilities */
pvt->capability = capability;
pvt->dtmfmode = H323_DTMF_RFC2833;
strncpy(tmp, dest, sizeof(tmp) - 1); strncpy(tmp, dest, sizeof(tmp) - 1);
host = strchr(tmp, '@'); host = strchr(tmp, '@');
if (host) { if (host) {
@ -1222,6 +1225,8 @@ static struct ast_channel *oh323_request(const char *type, int format, void *dat
return NULL; return NULL;
} }
} }
else
memcpy(&pvt->options, &global_options, sizeof(pvt->options));
/* pass on our capabilites to the H.323 stack */ /* pass on our capabilites to the H.323 stack */
ast_mutex_lock(&caplock); ast_mutex_lock(&caplock);
@ -1291,7 +1296,7 @@ struct rtp_info *external_rtp_create(unsigned call_reference, const char * token
struct oh323_pvt *pvt; struct oh323_pvt *pvt;
struct sockaddr_in us; struct sockaddr_in us;
struct rtp_info *info; struct rtp_info *info;
static char iabuf[INET_ADDRSTRLEN]; char iabuf[INET_ADDRSTRLEN];
info = (struct rtp_info *)malloc(sizeof(struct rtp_info)); info = (struct rtp_info *)malloc(sizeof(struct rtp_info));
if (!info) { if (!info) {
@ -2405,6 +2410,12 @@ int unload_module()
} }
h323_gk_urq(); h323_gk_urq();
h323_end_process(); h323_end_process();
io_context_destroy(io);
sched_context_destroy(sched);
delete_users();
delete_aliases();
prune_peers();
ast_mutex_destroy(&aliasl.lock);
ast_mutex_destroy(&userl.lock); ast_mutex_destroy(&userl.lock);
ast_mutex_destroy(&peerl.lock); ast_mutex_destroy(&peerl.lock);
return 0; return 0;

View File

@ -97,7 +97,7 @@ int PAsteriskLog::Buffer::overflow(int c)
{ {
if (pptr() >= epptr()) { if (pptr() >= epptr()) {
int ppos = pptr() - pbase(); int ppos = pptr() - pbase();
char *newptr = string.GetPointer(string.GetSize() + 10); char *newptr = string.GetPointer(string.GetSize() + 2000);
setp(newptr, newptr + string.GetSize() - 1); setp(newptr, newptr + string.GetSize() - 1);
pbump(ppos); pbump(ppos);
} }
@ -134,7 +134,7 @@ int PAsteriskLog::Buffer::sync()
free(str); free(str);
string = PString(); string = PString();
char *base = string.GetPointer(10); char *base = string.GetPointer(2000);
setp(base, base + string.GetSize() - 1); setp(base, base + string.GetSize() - 1);
return 0; return 0;
} }
@ -1092,6 +1092,7 @@ void h323_end_process(void)
endPoint->ClearAllCalls(); endPoint->ClearAllCalls();
endPoint->RemoveListener(NULL); endPoint->RemoveListener(NULL);
delete endPoint; delete endPoint;
endPoint = NULL;
PTrace::SetLevel(0); PTrace::SetLevel(0);
delete localProcess; delete localProcess;
delete logstream; delete logstream;