]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Make sure that read/write format are set up correctly
authorRussell Bryant <russell@russellbryant.com>
Tue, 21 Dec 2004 20:15:29 +0000 (20:15 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 21 Dec 2004 20:15:29 +0000 (20:15 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/v1-0@4515 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_iax2.c

index 510995b7e049f1d784e9fb029a7af95614f49a9b..3b175a09474434108ffa8402f0f2cf163e3283b3 100755 (executable)
@@ -2711,8 +2711,8 @@ static struct ast_channel *ast_iax2_new(int callno, int state, int capability)
                tmp->type = type;
                /* We can support any format by default, until we get restricted */
                tmp->nativeformats = capability;
-               tmp->readformat = 0;
-               tmp->writeformat = 0;
+               tmp->readformat = ast_best_codec(capability);
+               tmp->writeformat = ast_best_codec(capability);
                tmp->pvt->pvt = CALLNO_TO_PTR(i->callno);
                tmp->pvt->send_digit = iax2_digit;
                tmp->pvt->send_text = iax2_sendtext;
@@ -6270,7 +6270,7 @@ static struct ast_channel *iax2_request(char *type, int format, void *data)
        ast_mutex_unlock(&iaxsl[callno]);
        if (c) {
                /* Choose a format we can live with */
-               if (c->nativeformats & format)
+               if (c->nativeformats & format) 
                        c->nativeformats &= format;
                else {
                        native = c->nativeformats;
@@ -6283,6 +6283,8 @@ static struct ast_channel *iax2_request(char *type, int format, void *data)
                        }
                        c->nativeformats = native;
                }
+               c->readformat = ast_best_codec(c->nativeformats);
+               c->writeformat = c->readformat;
        }
        return c;
 }