MétaCan
Menu
Retour à la cohorte
Enregistrement W197679350

Caller id with asterisk and Ajax

2006· article· en· W197679350 sur OpenAlexaboutno aff
Mike Diehl

Notice bibliographique

RevueLinux journal · 2006
Typearticle
Langueen
DomaineSocial Sciences
ThématiqueSoftware Engineering and Design Patterns
Établissements canadiensnon disponible
Organismes subventionnairesnon disponible
Mots-clésAjaxAsteriskComputer scienceWorld Wide WebOperating systemVoice over IPWeb applicationThe Internet
DOInon disponible

Résumé

récupéré en direct d'OpenAlex

Combine Asterisk and Ajax to display incoming and outgoing call information. I've been using an Asterisk server to handle all of our telephone service for about a year now. During this time, I've discovered many really neat things that can be done with Asterisk, VoIP and various other technologies. One of the more gimmicky things I've done is sent the caller-ID information from incoming calls to a Web page on my browser, in real time. To do this, I had to use Asterisk, Perl, CGI, HTML, CSS, SQL, XML and Asynchronous JavaScript, or Ajax. There are a lot of different pieces to bring together, but sometimes that's what makes a project interesting. Here's how it works in a nutshell. When someone calls us at the house, the Asterisk server waits for the caller-ID information to be sent. The server then puts this information, and a few other pieces of information, into a file in a subdirectory under /tmp. This is all done in the Asterisk dial plan. Then, I have a Web page open in my browser that runs a JavaScript program every second. This JavaScript program uses an XMLHttpRequest object to query the server for new caller-ID information. The CGI script on the server returns an XML file containing the caller information. The JavaScript program parses the returned XML and displays the content. I've created a Cascading Style Sheet (CSS) that makes the caller information look like a sticky note placed on the Web page. When the incoming call is complete, the Asterisk server creates a Call Detail Record, or CDR, which resides in an SQL database. Each time the JavaScript contacts the server, the CGI script looks for the CDR. If it exists, the program knows that the call is over and deletes the caller information file in /tmp. This has the effect of causing the sticky notes to disappear when the call is complete. As an added bonus, the program supports up to four concurrent calls and can be used to indicate outbound calls as well. It's kind of nice to be able to see who's on the phone, regardless of whether the person is the caller or callee, without having to interrupt the person on the phone to ask. When my boys get older, this may become an even more important feature. For this system to work, you must configure your Asterisk server to put CDRs in an SQL database. By default, Asterisk puts CDRs in a comma-delimited file. The problem is that the flat file CDRs don't contain the call's unique ID, which this system uses to detect when a call has completed. The CDRs that get put into the SQL database contain this field. This shouldn't be a steep requirement though. As I recall, configuring Asterisk to store CDRs in a Postgres database was fairly straightforward and well documented in the cdr_pgsql.conf file. You also could use a MySQL or ODBC database, if you like. The first, and easiest, part of this project is to modify the Asterisk dial plan to create the flat file when an incoming or outgoing call is made. Once you determine where to make the change, it's a simple one-line addition, as shown here (all one line): exten => s, n, system(echo IN#${CALLERID(name)} ↪#${CALLERID(number)}#${UNIQUEID} > ↪/tmp/panels/cid/${UNIQUEID}) This line creates a file in /tmp/panels/cid that contains four fields, delimited by the # character. Of course, you need to create /tmp/panels/cid and give it appropriate permissions so that the Asterisk server can create files in it Caller ID with Asterisk and Ajax http://0-delivery.acm.org.innopac.lib.ryerson.ca/10.1145/1190000/11... 2 of 8 8/27/2007 7:15 PM and the CGI script can read and delete those files. The first field is either IN or OUT and indicates that the call is INcoming, or OUTgoing. The next two fields call the CALLERID() function to retrieve the caller's name and phone number. The last field is the call's unique identifier. You need to place this line in your dial plan, such that the server has already received the caller-ID information but before the call is handed off to the dial command. If you want to receive information about outgoing calls, you could add a line like this to your dial plan: exten => s, n, system(echo OUT##${EXTEN}#${UNIQUEID} ↪> /tmp/panels/cid/${UNIQUEID}) In the case of the outgoing call, we don't have any caller-ID information to display, so the second field is left blank. We do know the number that was dialed, which is retrieved via the ${EXTEN} variable in the third field. In both the incoming and outgoing cases, you need to make sure to update the extension field and the priority fields (s and n in this example). For the purpose of demonstration, I've stripped the Web page down to its most basic requirements, as shown in Listing 1. Listing 1. Example Web Page9159l1.qrk CID Test @import cid.css; start_cid(); Your Content Would Go Here. This seemingly simple HTML code does a lot of things. First, it loads the cid.js JavaScript code. Then, it imports a stylesheet called cid.css. This stylesheet will give you a lot of flexibility to customize the appearance of the sticky notes. Then, the HTML code creates four div sections, called phone1 through phone4. These sections will be made visible later on and will be filled in with caller information. Finally, the HTML code starts the periodic polling by calling the start_cid() function. We'll discuss that function later. Even though my CSS skills aren't world-class, I've included a sample cid.css file to get you started (Listing 2). Listing 2. Sample cid.css File9159l2.qrk div#phone1{ background: #FFFFCC; display: none; position: absolute; border-top: thin solid black; border-left: thin solid black; border-right: 6px solid black; border-bottom: 6px solid black; Caller ID with Asterisk and Ajax http://0-delivery.acm.org.innopac.lib.ryerson.ca/10.1145/1190000/11... 3 of 8 8/27/2007 7:15 PM top: 85%; left: 2%; width: 20%; height: 5em; } div#phone2{ background: #FFFFCC; display: none; position: absolute; border-top: thin solid black; border-left: thin solid black; border-right: 6px solid black; border-bottom: 6px solid black; top: 85%; left: 27%; width: 20%; height: 5em; } div#phone3{ background: #FFFFCC; display: none; position: absolute; border-top: thin solid black; border-left: thin solid black; border-right: 6px solid black; border-bottom: 6px solid black; top: 85%; left: 52%; width: 20%; height: 5em; } div#phone4{ background: #FFFFCC; display: none; position: absolute; border-top: thin solid black; border-left: thin solid black; border-right: 6px solid black; border-bottom: 6px solid black; top: 85%; left: 77%; width: 20%; height: 5em; } This CSS file could have been made more concise by putting all of the common formatting in a common class; I'll leave that as an exercise for the reader. This stylesheet creates four evenly spaced sticky notes at the bottom of the screen. The sticky notes are yellow with a neat 3-D drop-shadow effect (Figure 1). Caller ID with Asterisk and Ajax http://0-delivery.acm.org.innopac.lib.ryerson.ca/10.1145/1190000/11... 4 of 8 8/27/2007 7:15 PM Figure 1. The incoming call information is displayed in a Web page in sticky note format. Now, it's time to take a look at the CGI script (Listing 3). Listing 3. CGI Script9159l3.qrk

Récupéré en direct depuis OpenAlex et désinversé. Les résumés ne sont pas conservés dans cette base de données : les index inversés représentent 8,6 Go des 9,3 Go de texte de la base, et le serveur dispose de 13 Go libres.

Comment cette classification a été obtenuedéplier

Prédiction machine sur la base complète

Imitation des enseignants

Ni prévalence calibrée, ni vérité terrain. Validation humaine à venir. Le volet Gemma est une étiquette directe du modèle pour chaque travail de la base, lue sur la notice réduite au titre. Le volet Codex est un classifieur appris des 10 348 étiquettes directes de Codex et calibré sur les taux pondérés de l'échantillon; les champs sans appui suffisant ne portent aucun appel Codex. Le mode candidate est l'union des deux volets; le consensus est leur intersection. Ces sorties portent le statut machine_predicted_unvalidated et ne sont pas des étiquettes humaines.

score de la tête « metaresearch » (Codex)0,003
score de la tête « metaresearch » (Gemma)0,010
Version: metacan-v3-hybrid-931329e0061cStatut de validation: machine_predicted_unvalidated
Catégories candidatesaucune
Catégories consensuellesaucune
DomaineSignal candidat: aucune · Signal consensuel: aucune
Devis d'étudeSignal candidat: Sans objet · Signal consensuel: Sans objet
GenreSignal candidat: Autre · Signal consensuel: aucune
Score de désaccord entre enseignants0,125
Score d'incertitude au seuil0,417

Scores du classifieur distillé par catégorie (deux têtes)

CatégorieCodexGemma
Métarecherche0,0030,010
Méta-épidémiologie (sens strict)0,0020,001
Méta-épidémiologie (sens large)0,0010,001
Bibliométrie0,0020,001
Études des sciences et des technologies0,0020,001
Communication savante0,0050,006
Science ouverte0,0020,006
Intégrité de la recherche0,0020,004
Charge utile insuffisante (le modèle a refusé de juger)0,1250,113

Scores machine (provisoires)

Les deux têtes enseignantes du modèle étudiant, lues sur ce travail. Un score ordonne la base pour la relecture; il n'affirme jamais une catégorie, et le statut de validation accompagne chaque rangée tel quel.

Scores de référence d'un modèle non mature (critères de maturité non atteints, 7 itérations). Un score ordonne; il n'affirme jamais une catégorie.

Tête enseignante Opus0,006
Tête enseignante GPT0,229
Écart entre enseignants0,223 · la distance entre les deux têtes enseignantes sur ce seul travail
Statut de validationscore_only:v0-immature-baseline · tel quel depuis la passe de notation : score_only signifie que le nombre peut ordonner les travaux, et qu'aucune étiquette de catégorie n'en découle

Classification

machine, non validée

Prédiction automatique; un appel candidat d’une seule source (Gemma direct ou Codex distillé), pas un consensus.

Les modèles n’ont appliqué aucune catégorie : rien dans la taxonomie ne correspondait à ce travail.
Devis d'étudeSans objet
Domainenon disponible
GenreAutre

Le détail, modèle par modèle et score par score, se trouve en fin de page sous « Comment cette classification a été obtenue ».

En bref

Citations0
Publié2006
Routes d'admission1
Résumé présentoui

Explorer davantage

Même revueLinux journalMême sujetSoftware Engineering and Design PatternsTravaux en français237 207