Affichage des résultats 1 à 7 sur 7

Discussion: Probleme AGI

  1. #1
    Membre Senior
    Date d'inscription
    octobre 2010
    Messages
    144
    Downloads
    1
    Uploads
    0

    Probleme AGI

    Bonjour
    J'ai ecris un script AGI pour s'excuter a la fin d'un appel, sur le CLI, l' AGI s'excute bien mais au niveau fonctionelle rien n'est fait :(; l'agi est suposer envoyer un petit fichier texte par FTP, j'ai verifier son fonctionnement il est nike (il s'excute normalement a partir d'un terminal et copie le fichier sur le serveur distant)

    Code:
     
    #!/bin/bash
    retour=/tmp/ConvertFile/retour.txt
    {
    sleep 1
    echo "user Administrateur \$agem001"
    sleep 1
    echo "put retour.txt"
    sleep 5
    } | ftp -n 192.168.2.10
    Code:
     
        -- Attempting call on SIP/4000 for s@outboundmsg1:1 (Retry 1)
      == Using SIP RTP TOS bits 184
      == Using SIP RTP CoS mark 5
        -- Executing [s@outboundmsg1:1] Set("SIP/4000-0000001f", "TIMEOUT(digit)=5") in new stack
        -- Digit timeout set to 5.000
        -- Executing [s@outboundmsg1:2] Set("SIP/4000-0000001f", "TIMEOUT(response)=10") in new stack
        -- Response timeout set to 10.000
        -- Executing [s@outboundmsg1:3] Answer("SIP/4000-0000001f", "") in new stack
        -- Executing [s@outboundmsg1:4] Wait("SIP/4000-0000001f", "1") in new stack
        -- Executing [s@outboundmsg1:5] BackGround("SIP/4000-0000001f", "outboundmsgs/Msgvocal,m") in new stack
        -- <SIP/4000-0000001f> Playing 'outboundmsgs/Msgvocal.slin' (language 'en')
        -- Executing [2@outboundmsg1:1] Goto("SIP/4000-0000001f", "msgack,s,1") in new stack
        -- Goto (msgack,s,1)
        -- Executing [s@msgack:1] Playback("SIP/4000-0000001f", "outboundmsgs/byefr") in new stack
        -- <SIP/4000-0000001f> Playing 'outboundmsgs/byefr.slin' (language 'en')
        -- Executing [s@msgack:2] NoOp("SIP/4000-0000001f", "Ecriture dans le fichier retour.txt") in new stack
        -- Executing [s@msgack:3] Hangup("SIP/4000-0000001f", "") in new stack
      == Spawn extension (msgack, s, 3) exited non-zero on 'SIP/4000-0000001f'
        -- Executing [h@msgack:1] System("SIP/4000-0000001f", "echo -e "resultat : 1 ok" >> /tmp/ConvertFile/retour.txt") in new stack
        -- Executing [h@msgack:2] AGI("SIP/4000-0000001f", "/tmp/ConvertFile/test_2.agi") in new stack
        -- Launched AGI Script /tmp/ConvertFile/test_2.agi
        -- <SIP/4000-0000001f>AGI Script /tmp/ConvertFile/test_2.agi completed, returning 0
        -- Executing [h@msgack:3] AGI("SIP/4000-0000001f", "/tmp/ConvertFile/test_3.agi") in new stack
        -- Launched AGI Script /tmp/ConvertFile/test_3.agi
        -- <SIP/4000-0000001f>AGI Script /tmp/ConvertFile/test_3.agi completed, returning 0
    Code:
      
    [msgack]
    exten => s,1,Playback(outboundmsgs/byefr)
    exten => s,n,NoOp(Ecriture dans le fichier retour.txt)
    exten => s,n,Hangup()
    exten => h,1,system(echo -e "resultat : 1 ok" >> /tmp/ConvertFile/retour.txt)
    exten => h,n,AGI(/tmp/ConvertFile/test_2.agi)
    exten => h,n,AGI(/tmp/ConvertFile/test_3.agi)
    Au debut les deux script 2 et 3 etaient ensemble mais j'ai ceparer pour etre sure que c pas une erreur au debut du script
    Voyez vous un probleme quelque part ??
    Dernière modification par stepatchin ; 29/11/2010 à 10h37.

  2. #2
    Membre Association
    Date d'inscription
    août 2010
    Messages
    856
    Downloads
    0
    Uploads
    0
    Pour t'aider à déboguer l'agi, je te conseille l'exercice suivant: passe une variable à ton script agi, fait renvoyer le contenu de cette variable à ton dialplan par le script agi, et affiche cette variable dans la CLI.

  3. #3
    Membre Senior
    Date d'inscription
    octobre 2010
    Messages
    144
    Downloads
    1
    Uploads
    0
    Je vais faire ca Lundi mais c bizarre qu'il execute le 2eme script mais le 3eme c juste la partie FTP qui deconne
    Peute etre que l'execution des AGI par asterisk n'aime pas le FTP ??

  4. #4
    Membre Senior
    Date d'inscription
    octobre 2010
    Messages
    144
    Downloads
    1
    Uploads
    0
    Bonjour
    Après une recherche sur le livre Oreilly, j'ai trouve ca :
    Code:
    If you want to run an AGI when no channel exists (such as in an h extension), use the DeadAGI() application instead.
    Ca sera probablement la réponse, je vais essayé ca cette aprem et je vous tiens au courant

    Apres debueug voila le resultat :

    Code:
    -- Executing [h@msgack:3] DeadAGI("SIP/4000-00000005", "/tmp/ConvertFile/test_3.agi") in new stack
        -- Launched AGI Script /tmp/ConvertFile/test_3.agi
    <SIP/4000-00000005>AGI Tx >> agi_request: /tmp/ConvertFile/test_3.agi
    <SIP/4000-00000005>AGI Tx >> agi_channel: SIP/4000-00000005
    <SIP/4000-00000005>AGI Tx >> agi_language: en
    <SIP/4000-00000005>AGI Tx >> agi_type: SIP
    <SIP/4000-00000005>AGI Tx >> agi_uniqueid: 1291039354.5
    <SIP/4000-00000005>AGI Tx >> agi_version: 1.6.2.14
    <SIP/4000-00000005>AGI Tx >> agi_callerid: unknown
    <SIP/4000-00000005>AGI Tx >> agi_calleridname: unknown
    <SIP/4000-00000005>AGI Tx >> agi_callingpres: 0
    <SIP/4000-00000005>AGI Tx >> agi_callingani2: 0
    <SIP/4000-00000005>AGI Tx >> agi_callington: 0
    <SIP/4000-00000005>AGI Tx >> agi_callingtns: 0
    <SIP/4000-00000005>AGI Tx >> agi_dnid: unknown
    <SIP/4000-00000005>AGI Tx >> agi_rdnis: unknown
    <SIP/4000-00000005>AGI Tx >> agi_context: msgack
    <SIP/4000-00000005>AGI Tx >> agi_extension: h
    <SIP/4000-00000005>AGI Tx >> agi_priority: 3
    <SIP/4000-00000005>AGI Tx >> agi_enhanced: 0.0
    <SIP/4000-00000005>AGI Tx >> agi_accountcode:
    <SIP/4000-00000005>AGI Tx >> agi_threadid: 1109850432
    <SIP/4000-00000005>AGI Tx >>
      == Manager 'admin' logged on from 127.0.0.1
        -- <SIP/4000-00000005>AGI Script /tmp/ConvertFile/test_3.agi completed, returning 0
    Dernière modification par stepatchin ; 29/11/2010 à 12h46.

  5. #5
    Membre Association
    Date d'inscription
    août 2010
    Messages
    856
    Downloads
    0
    Uploads
    0
    C'est bien vous avancez.

    Si vous avez du temps, lisez ce livre:
    Packt - Asterisk Gateway Interface 1.4 and 1.6 Programming

    Je l'ai acheté à sa sortie début 2009, depuis plus aucune galère sur le débogage des agi.

  6. #6
    Membre Senior
    Date d'inscription
    octobre 2010
    Messages
    144
    Downloads
    1
    Uploads
    0
    Merci pour le tuyau
    Sinon j'ai essayer plein d'autres script agi et ca marche les variables sont bien transmisent, ya juste celui du transfert FTP qui marche pas :'(

  7. #7
    Membre Senior
    Date d'inscription
    octobre 2010
    Messages
    144
    Downloads
    1
    Uploads
    0
    Finalement j'ai réussi a envoyer mon fichier mais part une autre façon (partage SMB) du coup plus besoin d'envoi FTP, juste un cp dans le disque de partage
    mais bon ca reste faisable de faire avec le FTP mais bon faut trouver pk il marche pas

    Merci a vous

Règles de messages

  • Vous ne pouvez pas créer de nouvelles discussions
  • Vous ne pouvez pas envoyer des réponses
  • Vous ne pouvez pas envoyer des pièces jointes
  • Vous ne pouvez pas modifier vos messages
  •