Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

FOP2 Community Forum

  1. Home
  2. Support
  3. Checkdir.php Load page on 'answer' instead of 'ringing'

Checkdir.php Load page on 'answer' instead of 'ringing'

Scheduled Pinned Locked Moved Support
9 Posts 4 Posters 399 Views
  • 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.
  • A
    A
    AkkerKid
    wrote on last edited by
    #1

    I'm trying to set FOP2 up so that only when a call is picked up, it'll open a certain web page. Currently the contents of the file are as follows:
    <?php
    require_once('config.php');
    function custom_popup($ALLVAR) {
    $clidnum = $ALLVAR['clidnum'];
    $clidname = $ALLVAR['clidname'];
    $fromqueue = $ALLVAR['fromqueue'];
    $exten = $ALLVAR['exten'];
    $poptype = $ALLVAR['poptype'];
    $clidname = base64_decode($ALLVAR['clidname']);
    $clidnum = base64_decode($ALLVAR['clidnum']);
    header("Content-type: text/javascript");
    echo "window.open('http://OurSugarCrmServer/crm/AsteriskSugDir.php?&search=$clidnum');\n";
    return 0; // We still want regular notifications
    }
    $ret = custom_popup($_GET);
    exit;
    Header( "X-JSON: ({ 'clidnum': '$clidnum', 'clidname': '$clidname', 'picture': '$picture', 'queue': '$fromqueue' })");
    ?>

    I'm no PHP coder, so I don't really know what to do at this point. I've tried changing the "If" section that was there from
    if($ALLVAR['poptype']=="ringing") {
    to
    if($ALLVAR['poptype']=="answered") {

    Of course it wasn't that easy. :roll:
    So instead I just got rid of that statement and created this line to help me figure out what other 'poptype' values there were:
    echo "window.open('http://$poptype');\n";
    That didn't do anything for me.
    I'm thinking I'll have to go further up the code tree to find whatever activates the checkdir.php file and set it to only use it when the call is answered instead of when it's ringing. I'm thinking that'll be the swf on the client though... Any Ideas?
    Thanks!
    --AkkerKid

    1 Reply Last reply
    0
    • N
      N
      nicolas
      wrote on last edited by
      #2

      Hello,

      The stock checkdir.php includes different code blocks (if else) for poptype "ringing" or "onconnect". But there is a really important thing to note, the connect popup only works when receiving AGENTCONNECT manager events. Those events are generated only for calls delivered from a queue and when that queue has the eventwhencalled=yes set.

      It will NOT popup on connected calls that are not from the queue.

      So, restore the stock checkdir.php , look at the if poptype "ringing", do not touch that part but look at the else, that block is the one you need to modify to output some javascript code for open a popup on connect.

      Bet regards,

      1 Reply Last reply
      0
      • A
        A
        AkkerKid
        wrote on last edited by
        #3

        It's still not working. I turned on "Event When Called:" and edited my checkdir.php to show the following:

        <?php
        require_once('config.php');
        function custom_popup($ALLVAR) {
        // For Asternic Tag Call
        if($ALLVAR['poptype']=="onconnect") {
        // RINGING NOTIFICATION
        $clidnum = $ALLVAR['clidnum'];
        $poptype = $ALLVAR['poptype'];
        $clidnum = base64_decode($ALLVAR['clidnum']);
        header("Content-type: text/javascript");
        echo "window.open('http://OurSugarCrmServer/crm/AsteriskSugDir.php?&search=$clidnum');\n";
        } else {}
        return 0;
        }
        exit;
        ?>

        The subtext of Event When Called is "When this option is set to YES, the following manager events will be generated: AgentCalled, AgentDump, AgentConnect and AgentComplete." So I also tried "AgentConnect" in the IF statement where "onconnect" is thinking maybe my Trixbox server uses non-standard outputs. That didn't work either. Also, when I make changes in this file, should I restart the server or will the changes take effect as soon as I save?

        1 Reply Last reply
        0
        • N
          N
          nicolas
          wrote on last edited by
          #4

          poptype should be "connect" instead of "onconnect".

          The easiest way is to work your way in the stock checkdir.php instead of writing your own from scratch.

          1 Reply Last reply
          0
          • S
            S
            steve_connected
            wrote on last edited by
            #5

            Hi ,

            System Details:
            Elastix 2.0.0-38
            Asterisk 1.6.2.10
            FOP2 2.21(final)

            I've run into what appears to be the same problem. I can't generate a screen pop when a call is answered / connected from the queue. The screenpop only works on ringing.

            queues_additional.conf has eventwhencalled = yes

            [500]
            announce-frequency=0
            announce-holdtime=no
            announce-position=no
            autofill=no
            eventmemberstatus=yes
            eventwhencalled=yes
            joinempty=yes
            leavewhenempty=no
            maxlen=0
            periodic-announce-frequency=0
            queue-callswaiting=silence/1
            queue-thereare=silence/1
            queue-youarenext=silence/1
            reportholdtime=no
            retry=5
            ringinuse=yes
            servicelevel=60
            strategy=ringall
            timeout=15
            weight=0
            wrapuptime=0
            member=Local/3000@from-queue/n,0,John Lennon,SIP/3000
            member=Local/3001@from-queue/n,0,Paul McCartney,SIP/3001
            member=Local/3004@from-queue/n,0,Mick Jagger,SIP/3004
            
            [501]
            announce-frequency=0
            announce-holdtime=no
            announce-position=no
            autofill=no
            eventmemberstatus=yes
            eventwhencalled=yes
            joinempty=yes
            leavewhenempty=no
            maxlen=0
            periodic-announce-frequency=0
            queue-callswaiting=silence/1
            queue-thereare=silence/1
            queue-youarenext=silence/1
            reportholdtime=no
            retry=2
            ringinuse=yes
            servicelevel=60
            strategy=ringall
            timeout=20
            weight=0
            wrapuptime=0
            member=Local/3001@from-queue/n,0,Paul McCartney,SIP/3001
            member=Local/3002@from-queue/n,0,George Harrison,SIP/3002
            member=Local/3004@from-queue/n,0,Mick Jagger,SIP/3004
            
            

            fop2.cfg has the ringing = 0 and the connect=1

            [root@pbx001 fop2]# vi fop2.cfg
              notify_on_ringing = 0
              notify_on_connect = 1
            

            I'm using the "stock" checkdir.php

            Thanks
            Steve

            1 Reply Last reply
            0
            • S
              S
              steve_connected
              wrote on last edited by
              #6

              Hi

              I've run into the same problem. I'm unable to get a screen-pop when the call is "connected" from a queue. The screen-pop works fine for "ringing".

              System Details:
              FOP2 = 2.21 (final)
              Asterisk 1.6.2.10
              Elastix 2.0.0.38

              queues_additional.conf has eventwhencalled=yes

              [500]
              announce-frequency=0
              announce-holdtime=no
              announce-position=no
              autofill=no
              eventmemberstatus=yes
              eventwhencalled=yes
              joinempty=yes
              leavewhenempty=no
              maxlen=0
              periodic-announce-frequency=0
              queue-callswaiting=silence/1
              queue-thereare=silence/1
              queue-youarenext=silence/1
              reportholdtime=no
              retry=5
              ringinuse=yes
              servicelevel=60
              strategy=ringall
              timeout=15
              weight=0
              wrapuptime=0
              member=Local/3000@from-queue/n,0,John Lennon,SIP/3000
              member=Local/3001@from-queue/n,0,Paul McCartney,SIP/3001
              member=Local/3004@from-queue/n,0,Mick Jagger,SIP/3004
              

              notify_on_ringing = 0 and notify_on_connect = 1 in the /usr/local/fop2/fop2.cfg

              [root@pbx001 fop2]# pwd
              /usr/local/fop2
              [root@pbx001 fop2]# grep notify fop2.cfg
              ; notification on state RINGING (notify_on_ringing=1).
              ; eventwhencalled=yes and then set here notify_on_connect=1,
              notify_on_ringing = 0
              notify_on_connect = 1
              

              Thanks
              Steve

              1 Reply Last reply
              0
              • N
                N
                nicolas
                wrote on last edited by
                #7

                It should work fine, but you must be sure you have the correct block in checkdir.php for call notifications on connect. The stock config.php includes a check at the very top for "poptype", if its "ringing" then blah, blah, and else blah, blah.

                The else block is executed on connect, and the stock file has everything commented out. You must uncomment/modify your checkdir.php file so it actually does something useful.

                1 Reply Last reply
                0
                • P
                  P
                  philiplucasmail
                  wrote on last edited by
                  #8

                  Hi,
                  I am not able to get this working either:

                  if($ALLVAR['poptype']=="ringing") {
                      file_put_contents('/tmp/fop2_test.txt', print_r($ALLVAR, 1));
                  } else {
                      file_put_contents('/tmp/fop2_test2.txt', print_r($ALLVAR, 1));
                  }
                  

                  (sample of checkdir.php file)

                  fop2_test.txt gets created but not fop2_test2.txt

                  I have set Event When Called to Yes within the queue config.

                  Is there anything else that may be missing? I am trying to pass the unique call id to a web service, I assume when a popup is triggered on connect of a call it will pass a variable like uniqueid within $ALLVAR ?

                  Thanks.

                  1 Reply Last reply
                  0
                  • N
                    N
                    nicolas
                    wrote on last edited by
                    #9

                    in fop2.cfg you must set notify_on_connect=1

                    1 Reply Last reply
                    0

                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                    With your input, this post could be even better 💗

                    Register Login
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    Powered by NodeBB Contributors
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups