Merged revisions 27973 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r27973 | file | 2006-05-17 19:34:08 -0300 (Wed, 17 May 2006) | 2 lines

Fix codec priority stuff during authentication (issue #6194 reported by jkoopmann)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@27974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Joshua Colp 20 years ago
parent 6eb1d09ad9
commit a6480b61b0

@ -476,7 +476,10 @@ struct chan_iax2_pvt {
int maxtime; int maxtime;
/*! Peer Address */ /*! Peer Address */
struct sockaddr_in addr; struct sockaddr_in addr;
/*! Actual used codec preferences */
struct ast_codec_pref prefs; struct ast_codec_pref prefs;
/*! Requested codec preferences */
struct ast_codec_pref rprefs;
/*! Our call number */ /*! Our call number */
unsigned short callno; unsigned short callno;
/*! Peer callno */ /*! Peer callno */
@ -4693,8 +4696,11 @@ static int check_access(int callno, struct sockaddr_in *sin, struct iax_ies *ies
if (ies->version) if (ies->version)
version = ies->version; version = ies->version;
if(ies->codec_prefs) /* Use provided preferences until told otherwise for actual preferences */
if(ies->codec_prefs) {
ast_codec_pref_convert(&iaxs[callno]->rprefs, ies->codec_prefs, 32, 0);
ast_codec_pref_convert(&iaxs[callno]->prefs, ies->codec_prefs, 32, 0); ast_codec_pref_convert(&iaxs[callno]->prefs, ies->codec_prefs, 32, 0);
}
if (!gotcapability) if (!gotcapability)
iaxs[callno]->peercapability = iaxs[callno]->peerformat; iaxs[callno]->peercapability = iaxs[callno]->peerformat;
@ -6297,7 +6303,7 @@ static int socket_process(struct iax2_thread *thread)
struct iax_frame *duped_fr; struct iax_frame *duped_fr;
char host_pref_buf[128]; char host_pref_buf[128];
char caller_pref_buf[128]; char caller_pref_buf[128];
struct ast_codec_pref pref,rpref; struct ast_codec_pref pref;
char *using_prefs = "mine"; char *using_prefs = "mine";
dblbuf[0] = 0; /* Keep GCC from whining */ dblbuf[0] = 0; /* Keep GCC from whining */
@ -6817,11 +6823,13 @@ retryowner:
strcpy(host_pref_buf, "disabled"); strcpy(host_pref_buf, "disabled");
} else { } else {
using_prefs = "mine"; using_prefs = "mine";
if(ies.codec_prefs) { /* If the information elements are in here... use them */
ast_codec_pref_convert(&rpref, ies.codec_prefs, 32, 0); if (ies.codec_prefs)
ast_codec_pref_convert(&iaxs[fr.callno]->rprefs, ies.codec_prefs, 32, 0);
if (ast_codec_pref_index(&iaxs[fr.callno]->rprefs, 0)) {
/* If we are codec_first_choice we let the caller have the 1st shot at picking the codec.*/ /* If we are codec_first_choice we let the caller have the 1st shot at picking the codec.*/
if (ast_test_flag(iaxs[fr.callno], IAX_CODEC_USER_FIRST)) { if (ast_test_flag(iaxs[fr.callno], IAX_CODEC_USER_FIRST)) {
pref = rpref; pref = iaxs[fr.callno]->rprefs;
using_prefs = "caller"; using_prefs = "caller";
} else { } else {
pref = iaxs[fr.callno]->prefs; pref = iaxs[fr.callno]->prefs;
@ -6830,7 +6838,7 @@ retryowner:
pref = iaxs[fr.callno]->prefs; pref = iaxs[fr.callno]->prefs;
format = ast_codec_choose(&pref, iaxs[fr.callno]->capability & iaxs[fr.callno]->peercapability, 0); format = ast_codec_choose(&pref, iaxs[fr.callno]->capability & iaxs[fr.callno]->peercapability, 0);
ast_codec_pref_string(&rpref, caller_pref_buf, sizeof(caller_pref_buf) - 1); ast_codec_pref_string(&iaxs[fr.callno]->rprefs, caller_pref_buf, sizeof(caller_pref_buf) - 1);
ast_codec_pref_string(&iaxs[fr.callno]->prefs, host_pref_buf, sizeof(host_pref_buf) - 1); ast_codec_pref_string(&iaxs[fr.callno]->prefs, host_pref_buf, sizeof(host_pref_buf) - 1);
} }
if (!format) { if (!format) {
@ -6861,12 +6869,12 @@ retryowner:
strcpy(host_pref_buf,"disabled"); strcpy(host_pref_buf,"disabled");
} else { } else {
using_prefs = "mine"; using_prefs = "mine";
if(ies.codec_prefs) { if (ast_codec_pref_index(&iaxs[fr.callno]->rprefs, 0)) {
/* Do the opposite of what we tried above. */ /* Do the opposite of what we tried above. */
if (ast_test_flag(iaxs[fr.callno], IAX_CODEC_USER_FIRST)) { if (ast_test_flag(iaxs[fr.callno], IAX_CODEC_USER_FIRST)) {
pref = iaxs[fr.callno]->prefs; pref = iaxs[fr.callno]->prefs;
} else { } else {
pref = rpref; pref = iaxs[fr.callno]->rprefs;
using_prefs = "caller"; using_prefs = "caller";
} }
format = ast_codec_choose(&pref, iaxs[fr.callno]->peercapability & iaxs[fr.callno]->capability, 1); format = ast_codec_choose(&pref, iaxs[fr.callno]->peercapability & iaxs[fr.callno]->capability, 1);
@ -7219,11 +7227,11 @@ retryowner2:
strcpy(host_pref_buf, "disabled"); strcpy(host_pref_buf, "disabled");
} else { } else {
using_prefs = "mine"; using_prefs = "mine";
if(ies.codec_prefs) { if (ies.codec_prefs)
/* If we are codec_first_choice we let the caller have the 1st shot at picking the codec.*/ ast_codec_pref_convert(&iaxs[fr.callno]->rprefs, ies.codec_prefs, 32, 0);
ast_codec_pref_convert(&rpref, ies.codec_prefs, 32, 0); if (ast_codec_pref_index(&iaxs[fr.callno]->rprefs, 0)) {
if (ast_test_flag(iaxs[fr.callno], IAX_CODEC_USER_FIRST)) { if (ast_test_flag(iaxs[fr.callno], IAX_CODEC_USER_FIRST)) {
ast_codec_pref_convert(&pref, ies.codec_prefs, 32, 0); pref = iaxs[fr.callno]->rprefs;
using_prefs = "caller"; using_prefs = "caller";
} else { } else {
pref = iaxs[fr.callno]->prefs; pref = iaxs[fr.callno]->prefs;
@ -7232,7 +7240,7 @@ retryowner2:
pref = iaxs[fr.callno]->prefs; pref = iaxs[fr.callno]->prefs;
format = ast_codec_choose(&pref, iaxs[fr.callno]->capability & iaxs[fr.callno]->peercapability, 0); format = ast_codec_choose(&pref, iaxs[fr.callno]->capability & iaxs[fr.callno]->peercapability, 0);
ast_codec_pref_string(&rpref, caller_pref_buf, sizeof(caller_pref_buf) - 1); ast_codec_pref_string(&iaxs[fr.callno]->rprefs, caller_pref_buf, sizeof(caller_pref_buf) - 1);
ast_codec_pref_string(&iaxs[fr.callno]->prefs, host_pref_buf, sizeof(host_pref_buf) - 1); ast_codec_pref_string(&iaxs[fr.callno]->prefs, host_pref_buf, sizeof(host_pref_buf) - 1);
} }
if (!format) { if (!format) {
@ -7266,12 +7274,12 @@ retryowner2:
strcpy(host_pref_buf,"disabled"); strcpy(host_pref_buf,"disabled");
} else { } else {
using_prefs = "mine"; using_prefs = "mine";
if(ies.codec_prefs) { if (ast_codec_pref_index(&iaxs[fr.callno]->rprefs, 0)) {
/* Do the opposite of what we tried above. */ /* Do the opposite of what we tried above. */
if (ast_test_flag(iaxs[fr.callno], IAX_CODEC_USER_FIRST)) { if (ast_test_flag(iaxs[fr.callno], IAX_CODEC_USER_FIRST)) {
pref = iaxs[fr.callno]->prefs; pref = iaxs[fr.callno]->prefs;
} else { } else {
pref = rpref; pref = iaxs[fr.callno]->rprefs;
using_prefs = "caller"; using_prefs = "caller";
} }
format = ast_codec_choose(&pref, iaxs[fr.callno]->peercapability & iaxs[fr.callno]->capability, 1); format = ast_codec_choose(&pref, iaxs[fr.callno]->peercapability & iaxs[fr.callno]->capability, 1);

Loading…
Cancel
Save