ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Need some PHP help for this script

    Scheduled Pinned Locked Moved IT Discussion
    phpdeveloperhelpscriptyealinkfreepbxasterisk
    14 Posts 4 Posters 2.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ObsolesceO
      Obsolesce
      last edited by

      It's hard to work without having data to use. Could you copy all that data from your screenshot to a text file so I can copy / paste that to use?

      JaredBuschJ 1 Reply Last reply Reply Quote 0
      • JaredBuschJ
        JaredBusch @Obsolesce
        last edited by

        @obsolesce said in Need some PHP help for this script:

        It's hard to work without having data to use. Could you copy all that data from your screenshot to a text file so I can copy / paste that to use?

        Sorry I went offline after that to play a game of Life with the kids.

        1 Reply Last reply Reply Quote 0
        • JaredBuschJ
          JaredBusch
          last edited by

          For anyone interested. Thanks to @Obsolesce this is progressing nicely.

          Current code is on my github.

          Have extensions being parsed into an array. Now just to wrap things into a pretty form.

          0_1532312957331_94eb9591-cf64-4559-a125-e4b13f99aba7-image.png

          1 Reply Last reply Reply Quote 1
          • JaredBuschJ
            JaredBusch
            last edited by

            I added AstMan.php to github and it contains all the connection stuff wrapped in functions with error handling. But I am having a hell of a time trying to use them.
            https://github.com/sorvani/freepbx-helper-scripts/blob/master/AstMan.php

            @dafyre .........

            1 Reply Last reply Reply Quote 1
            • dafyreD
              dafyre
              last edited by

              @JaredBusch -- Check my pull request.

              JaredBuschJ 1 Reply Last reply Reply Quote 0
              • JaredBuschJ
                JaredBusch @dafyre
                last edited by

                @dafyre said in Need some PHP help for this script:

                @JaredBusch -- Check my pull request.

                That worked, minus a syntax correction.
                0_1532355947016_b1a85472-4c44-4a38-8139-9ef3c7661356-image.png

                1 Reply Last reply Reply Quote 1
                • JaredBuschJ
                  JaredBusch
                  last edited by

                  Added in @Obsolesce's last commit for the form.
                  0_1532357038561_129fcd20-34a4-4889-adb5-108779e6150c-image.png

                  Now to make the form actually submit.

                  1 Reply Last reply Reply Quote 1
                  • JaredBuschJ
                    JaredBusch
                    last edited by

                    next bit. I have this being returned by a function.

                    string(3771) "Asterisk Call Manager/4.0.3
                    Response: Success
                    Message: Authentication accepted
                    
                    Event: FullyBooted
                    Privilege: system,all
                    Uptime: 151132
                    LastReload: 40568
                    Status: Fully Booted
                    
                    Response: Success
                    EventList: start
                    Message: Following are Events for each object associated with the Endpoint
                    
                    Event: EndpointDetail
                    <snip not needed>
                    
                    Event: AuthDetail
                    <snip not needed>
                    
                    Event: AorDetail
                    <snip not needed>
                    
                    Event: ContactStatusDetail
                    AOR: 5120
                    URI: sip:[email protected]:5060
                    UserAgent: Yealink SIP-T42G 29.83.0.35
                    RegExpire: 1532368885
                    ViaAddress: 10.202.0.150:5060
                    CallID: [email protected]
                    Status: Reachable
                    RoundtripUsec: 15857
                    EndpointName: 5120
                    ID: 5120;@9e6900eb84ddc2a05701b109000ae8e5
                    AuthenticateQualify: 0
                    OutboundProxy: 
                    Path: 
                    QualifyFrequency: 60
                    QualifyTimeout: 3.000
                    
                    
                    Event: EndpointDetailComplete
                    EventList: Complete
                    ListItems: 4
                    
                    Response: Goodbye
                    Message: Thanks for all the fish.
                    
                    

                    I do not need the Event responses except for ContactStatusDetail.
                    I want to get that section dropped into an array in PHP.

                    if I am somehow getting each line of text in the variable $line, I can use explode I believe?

                    $split =  explode(":",$line,2);
                    

                    I would then need to add each line to an array?

                    1 Reply Last reply Reply Quote 0
                    • JaredBuschJ
                      JaredBusch
                      last edited by JaredBusch

                      Frustration and finally progress. Buttons do nothing yet, but @Obsolesce has been working on that in his spare time.

                      0_1532404624691_3aae8246-d367-48a9-83bb-35e9f7ca5f6b-image.png

                      Currently requires 2 files from my github. AstMan.php and yealink.reload.php

                      1 1 Reply Last reply Reply Quote 2
                      • 1
                        1337 @JaredBusch
                        last edited by 1337

                        @jaredbusch said in Need some PHP help for this script:

                        0_1532404624691_3aae8246-d367-48a9-83bb-35e9f7ca5f6b-image.png

                        What you're building looks a little like what you have in 3CX. They also show ip address, mac address and the user name and some other minor stuff. As options besides reload (called reprovision) and reboot, they also "firmware update" and also a direct link to the phones webserver.
                        Maybe some of that would make sense to add to your php script?

                        PS. Checking the input from the form is relatively easy. Make sure the form tag in the generated html uses post <form method="post"> . Then when you receive the values into the php script you can do print_r($_POST); and you'll see how everything looks. Then it's just a matter of going through the $_POST array and picking out the extensions you selected.

                        It's the name of the checkboxes in html that will appear in the $_POST array. So when the html table is generated use the extension number as name for the checkboxes, for instance ext_101, ext_102 etc.

                        1 Reply Last reply Reply Quote 2
                        • JaredBuschJ
                          JaredBusch
                          last edited by

                          This is now working at a basic level.

                          Code on GitHub.

                          1 Reply Last reply Reply Quote 4
                          • JaredBuschJ
                            JaredBusch
                            last edited by

                            github updated. files renamed a bit. Still a work in progress, but things working much better.

                            0_1533163657304_1cb7dbcf-38f3-48da-a102-fc1f7348fe17-image.png

                            1 Reply Last reply Reply Quote 3
                            • 1 / 1
                            • First post
                              Last post