[AsteriskBrasil] ordem de playback do moh do asterisk com bug ? será?

Caio Begotti caio em ueberalles.net
Quinta Agosto 16 09:13:30 BRT 2007


Ontem estávamos no IRC e o dioedu (Diógenes M.) tava com um problema que
parecia bug do MOH. A ordem dos arquivos no playback não era identificável
facilmente, mesmo ele não usando a opção random. O dia passou e à noitinha
resolvemos olhar o fonte do Asterisk e agora resolvi postar pra ficar
arquivado o que aprendemos.

Achei algumas funções de leitura de dir/file no res_musiconhold.c e
notei o include do dirent.h do Linux, que tem na Wikipédia os detalhes
sórdidos: http://en.wikipedia.org/wiki/Dirent.h

Aí não entendi como o dirent.h ordenava e segundo um cara do trabalho disse,
que manja bastante, o dirent respeita (ou deveria respeitar)
o locale do sistema também, possivelmente. Aí quis confirmar e joguei
um verde pra cima do Corydon:

----
<caio1982> the file seeking in res_musiconhold when not random is
according dirent.h, right? is it alphabetically or what? I looked for
a way to change the type of the seek (by atime/mtime, size, name)

<Corydon76-dig> it's in directory order

<Corydon76-dig> i.e. the physical order of the entries

<Corydon76-dig> if you never delete anything from the directory,
they're in the order in which they were added to the directory, at
least on ext3

<caio1982> hmmm thank you :)

<Corydon76-dig> on reiser (and other hash-directory filesystems), the
order is probably alphabetical

<caio1982> my case is ext3 indeed, that explains

<Corydon76-dig> On Mac, it definitely is alphabetical, because HFS
uses a B-tree for its directory structure

<Corydon76-dig> Of course, Mac also has UFS, though I'm not sure if
that version of UFS includes the hash directory structures

<Corydon76-dig> There, far more information that you could ever
possibly want to know about filesystems...

<caio1982> the more the better :)
----

Ou seja: não é um bug, é uma feature não documentada...

-- 
Caio Begotti (caio1982)
http://caio.ueberalles.net



Mais detalhes sobre a lista de discussão AsteriskBrasil