parent.dial mini browser

  1. 3 years ago

    Hi FOP2 Team,

    Until now our team also focus developement crm telemarketing system that integrated to FOP2 Page. Our crm embeded on mini browser FOP2.

    But i still have issue how to mapping "customer_id" on database CRM with "recording_file" on table asteriskcdr

    Do you have other solution for this case?, so when we using function click dial "parent.dial" can send other parameter, example like this :

    $row['phone1']="081287264002";
    $numberstrip = preg_replace("/[^0-9]/","",$row['phone1']);
    echo "<a href='#' onclick='parent.dial(\"$numberstrip\","\$customer_id\")'>081287264002</a>";

    This same like "Originate Variable" can send to asterisk.

    I really appreciate your help to implement my request.

    Thanks

  2. 2 years ago

    Hi FOP2 Team,

    Any update for my Question?

    Thanks

  3. admin

    19 Jul 2016 Administrator

    It might be quite simply to write a small .php application to do a dial using AMI that you can customise to set any variables you want, instead of using parent.dial in FOP2. You can include asmanager.php, a library that is part of FOP2 Manager, and use that to talk to the manager and issue commands, use this as a guide, it is not working code:

    <?php
    require_once("admin/asmanager.php");
    $host='localhost';
    $port='5038';
    $user='admin';
    $secret='amp111';
    $astman = new AsteriskManager();
    if($res = $astman->connect($host":".$port, $user,$secret, 'off')) {
            $astman->Originate($channel,$exten,$context,$priority,$timeout,$callerid,$variable,$account,$application,$data);
    }
  4. Hi FOP2.

    Now it working:

    my code as below :
    originate.php
    <?php
    require_once("/var/www/html/fop2/admin/asmanager.php");
    $astman = new AsteriskManager();
    $extension=trim($_REQUEST['extension']);
    $phone_number=trim($_REQUEST['phone_number']);
    $cust_id=trim($_REQUEST['cust_id']);
    $uniq_id=trim($_REQUEST['uniq_id']);
    //Originate($channel, $exten, $context, $priority, $timeout, $callerid, $variable, $account, $application, $data)
    if(!empty($extension) && !empty($phone_number) && !empty($cust_id)){
    global $astman, $conf;
    if($astman->connect()){
    $res = $astman->Originate('SIP/'.$extension,$phone_number,'from-internal',1,null,$phone_number,'PARAM_VALUE=CUSTOMER_ID='.$cust_id,null,null,null,null);

    if(false) {
    $this->log("Failed to login.");
    $this->disconnect();
    return false;
    }

    if($res['Response']=='Error') {
    return false;
    }

    echo true;
    }
    }else{
    return false;
    }
    ?>

    php script

    $ph="081287264002";
    $cust_id = empty($_REQUEST['cust_id'])?'1234':$_REQUEST['cust_id'];
    $extension = empty($_SESSION['extension'])?'1000':$_SESSION['extension'];
    $numberstrip = preg_replace("/[^0-9]/","",$ph);
    $cust_id=preg_replace("/[^0-9]/","",$cust_id);
    echo "<a href='#' onclick='parent_dial(\"$numberstrip\",\"$cust_id\",\"$extension\")'>{$ph}</a>";

    my.js

    <script type="text/javascript">
    function parent_dial(phone_number,cust_id,extension){
    $.ajax({
    url: 'http://my/zd/originate.php',
    type: 'POST',
    dataType: 'text',
    data: 'extension='+ extension+'&phone_number='+ phone_number+'&cust_id='+cust_id,
    success: function (response) {

    $(".result").html(response);
    },
    error: function () {
    alert("error");
    }
    });
    }
    </script>

  5. Edited 2 years ago by moses

    Halo FOP2,

    After i recheck again, i have issue.

    If i dialed number from minibrowser using module asmanager, we can't see log queue_log.

    Why it happen?

    Is there something wrong with my code ?

    $res = $astman->Originate('SIP/'.$extension,$phone_number,'from-internal',1,null,$phone_number,'PARAM_VALUE=CUSTOMER_ID='.$cust_id,null,null,null,null);

    I need to track outbound call if i using "module asmanager", because we using reporting asternic call center.

    here is my log when i dial using astmanager

     -- Executing [081287264002@from-internal:1] Macro("SIP/101-000000e7", "user-callerid,LIMIT,EXTERNAL,") in new stack
        -- Executing [s@macro-user-callerid:1] Set("SIP/101-000000e7", "TOUCH_MONITOR=1469009041.291") in new stack
        -- Executing [s@macro-user-callerid:2] NoOp("SIP/101-000000e7", "PARAMMMMMMMMMMMMMMMMMMm = CUSTOMER_ID=1234") in new stack
        -- Executing [s@macro-user-callerid:3] NoOp("SIP/101-000000e7", "PARAMMMMMMMMMMMMMMMMMMm = ") in new stack
        -- Executing [s@macro-user-callerid:4] Set("SIP/101-000000e7", "AMPUSER=081287264002") in new stack
        -- Executing [s@macro-user-callerid:5] GotoIf("SIP/101-000000e7", "0?report") in new stack
        -- Executing [s@macro-user-callerid:6] ExecIf("SIP/101-000000e7", "1?Set(REALCALLERIDNUM=081287264002)") in new stack
        -- Executing [s@macro-user-callerid:7] Set("SIP/101-000000e7", "AMPUSER=") in new stack
        -- Executing [s@macro-user-callerid:8] GotoIf("SIP/101-000000e7", "0?limit") in new stack
        -- Executing [s@macro-user-callerid:9] Set("SIP/101-000000e7", "AMPUSERCIDNAME=") in new stack
        -- Executing [s@macro-user-callerid:10] MYSQL("SIP/101-000000e7", "Connect connid localhost myusername mypass asterisk") in new stack
        -- Executing [s@macro-user-callerid:11] MYSQL("SIP/101-000000e7", "Query resultid 227 select name from users where extension=''") in new stack
        -- Executing [s@macro-user-callerid:12] MYSQL("SIP/101-000000e7", "Fetch foundrow 228 mem_name") in new stack
        -- Executing [s@macro-user-callerid:13] MYSQL("SIP/101-000000e7", "Query resultid 227 update fop2buttons set label='' where exten=''") in new stack
        -- Executing [s@macro-user-callerid:14] UserEvent("SIP/101-000000e7", "FOP2CHANGEBUTTONLABEL,Action: UserEvent,FOP2Channel: USER/,Label: ,Context: GENERAL") in new stack
        -- Executing [s@macro-user-callerid:15] MYSQL("SIP/101-000000e7", "Query resultid 227 update fop2buttons set label='' where exten=''") in new stack
        -- Executing [s@macro-user-callerid:16] MYSQL("SIP/101-000000e7", "Disconnect 227") in new stack
        -- Executing [s@macro-user-callerid:17] GotoIf("SIP/101-000000e7", "1?report") in new stack
        -- Goto (macro-user-callerid,s,25)
        -- Executing [s@macro-user-callerid:25] GotoIf("SIP/101-000000e7", "1?continue") in new stack
        -- Goto (macro-user-callerid,s,38)
        -- Executing [s@macro-user-callerid:38] Set("SIP/101-000000e7", "CALLERID(number)=081287264002") in new stack
        -- Executing [s@macro-user-callerid:39] Set("SIP/101-000000e7", "CALLERID(name)=CS-Lela") in new stack
        -- Executing [s@macro-user-callerid:40] Set("SIP/101-000000e7", "CDR(cnum)=081287264002") in new stack
        -- Executing [s@macro-user-callerid:41] Set("SIP/101-000000e7", "CDR(cnam)=CS-Lela") in new stack
        -- Executing [s@macro-user-callerid:42] Set("SIP/101-000000e7", "CHANNEL(language)=en") in new stack
        -- Executing [081287264002@from-internal:2] ExecIf("SIP/101-000000e7", "0 ?Set(CDR(accountcode)=)") in new stack
        -- Executing [081287264002@from-internal:3] Set("SIP/101-000000e7", "__REC_POLICY_MODE=always") in new stack
        -- Executing [081287264002@from-internal:4] Set("SIP/101-000000e7", "MOHCLASS=default") in new stack
        -- Executing [081287264002@from-internal:5] ExecIf("SIP/101-000000e7", "1?Set(TRUNKCIDOVERRIDE=628111714937)") in new stack
        -- Executing [081287264002@from-internal:6] Set("SIP/101-000000e7", "_NODEST=") in new stack
        -- Executing [081287264002@from-internal:7] Gosub("SIP/101-000000e7", "sub-record-check,s,1(out,081287264002,)") in new stack
        -- Executing [s@sub-record-check:1] Set("SIP/101-000000e7", "REC_POLICY_MODE_SAVE=always") in new stack
        -- Executing [s@sub-record-check:2] GotoIf("SIP/101-000000e7", "1?check") in new stack
        -- Goto (sub-record-check,s,7)
        -- Executing [s@sub-record-check:7] Set("SIP/101-000000e7", "__MON_FMT=wav") in new stack
        -- Executing [s@sub-record-check:8] GotoIf("SIP/101-000000e7", "1?next") in new stack
        -- Goto (sub-record-check,s,11)
        -- Executing [s@sub-record-check:11] ExecIf("SIP/101-000000e7", "0?Return()") in new stack
        -- Executing [s@sub-record-check:12] ExecIf("SIP/101-000000e7", "0?Set(__REC_POLICY_MODE=)") in new stack
        -- Executing [s@sub-record-check:13] GotoIf("SIP/101-000000e7", "0?out,1") in new stack
        -- Executing [s@sub-record-check:14] Set("SIP/101-000000e7", "__REC_STATUS=INITIALIZED") in new stack
        -- Executing [s@sub-record-check:15] Set("SIP/101-000000e7", "NOW=1469009043") in new stack
        -- Executing [s@sub-record-check:16] Set("SIP/101-000000e7", "__DAY=20") in new stack
        -- Executing [s@sub-record-check:17] Set("SIP/101-000000e7", "__MONTH=07") in new stack
        -- Executing [s@sub-record-check:18] Set("SIP/101-000000e7", "__YEAR=2016") in new stack
        -- Executing [s@sub-record-check:19] Set("SIP/101-000000e7", "__TIMESTR=20160720-170403") in new stack
        -- Executing [s@sub-record-check:20] Set("SIP/101-000000e7", "__FROMEXTEN=081287264002") in new stack
        -- Executing [s@sub-record-check:21] Set("SIP/101-000000e7", "__CALLFILENAME=out-081287264002-081287264002-20160720-170403-1469009041.291") in new stack
        -- Executing [s@sub-record-check:22] Goto("SIP/101-000000e7", "out,1") in new stack
        -- Goto (sub-record-check,out,1)
        -- Executing [out@sub-record-check:1] ExecIf("SIP/101-000000e7", "0?Set(__REC_POLICY_MODE=)") in new stack
        -- Executing [out@sub-record-check:2] GosubIf("SIP/101-000000e7", "1?record,1(exten,081287264002,081287264002)") in new stack
        -- Executing [record@sub-record-check:1] Set("SIP/101-000000e7", "AUDIOHOOK_INHERIT(MixMonitor)=yes") in new stack
        -- Executing [record@sub-record-check:2] MixMonitor("SIP/101-000000e7", "2016/07/20/out-081287264002-081287264002-20160720-170403-1469009041.291.wav,,/usr/local/parselog/update_mix_mixmonitor.pl ^{UNIQUEID} ^{MIXMONITOR_FILENAME}") in new stack
        -- Executing [record@sub-record-check:3] Set("SIP/101-000000e7", "__REC_STATUS=RECORDING") in new stack
        -- Executing [record@sub-record-check:4] Set("SIP/101-000000e7", "CDR(recordingfile)=out-081287264002-081287264002-20160720-170403-1469009041.291.wav") in new stack
        -- Executing [record@sub-record-check:5] Return("SIP/101-000000e7", "") in new stack
        -- Executing [out@sub-record-check:3] Return("SIP/101-000000e7", "") in new stack
        -- Executing [081287264002@from-internal:8] Macro("SIP/101-000000e7", "dialout-trunk,3,081287264002,,off") in new stack
        -- Executing [s@macro-dialout-trunk:1] Set("SIP/101-000000e7", "DIAL_TRUNK=3") in new stack
        -- Executing [s@macro-dialout-trunk:2] GosubIf("SIP/101-000000e7", "0?sub-pincheck,s,1()") in new stack
        -- Executing [s@macro-dialout-trunk:3] GotoIf("SIP/101-000000e7", "0?disabletrunk,1") in new stack
        -- Executing [s@macro-dialout-trunk:4] Set("SIP/101-000000e7", "DIAL_NUMBER=081287264002") in new stack
        -- Executing [s@macro-dialout-trunk:5] Set("SIP/101-000000e7", "DIAL_TRUNK_OPTIONS=Ttr") in new stack
        -- Executing [s@macro-dialout-trunk:6] Set("SIP/101-000000e7", "OUTBOUND_GROUP=OUT_3") in new stack
        -- Executing [s@macro-dialout-trunk:7] GotoIf("SIP/101-000000e7", "1?nomax") in new stack
        -- Goto (macro-dialout-trunk,s,9)
        -- Executing [s@macro-dialout-trunk:9] GotoIf("SIP/101-000000e7", "0?skipoutcid") in new stack
        -- Executing [s@macro-dialout-trunk:10] Set("SIP/101-000000e7", "DIAL_TRUNK_OPTIONS=Tt") in new stack
        -- Executing [s@macro-dialout-trunk:11] Macro("SIP/101-000000e7", "outbound-callerid,3") in new stack
        -- Executing [s@macro-outbound-callerid:1] ExecIf("SIP/101-000000e7", "0?Set(CALLERPRES()=)") in new stack
        -- Executing [s@macro-outbound-callerid:2] ExecIf("SIP/101-000000e7", "0?Set(REALCALLERIDNUM=081287264002)") in new stack
        -- Executing [s@macro-outbound-callerid:3] GotoIf("SIP/101-000000e7", "1?normcid") in new stack
        -- Goto (macro-outbound-callerid,s,6)
        -- Executing [s@macro-outbound-callerid:6] Set("SIP/101-000000e7", "USEROUTCID=") in new stack
        -- Executing [s@macro-outbound-callerid:7] Set("SIP/101-000000e7", "EMERGENCYCID=") in new stack
        -- Executing [s@macro-outbound-callerid:8] Set("SIP/101-000000e7", "TRUNKOUTCID=") in new stack
        -- Executing [s@macro-outbound-callerid:9] GotoIf("SIP/101-000000e7", "1?trunkcid") in new stack
        -- Goto (macro-outbound-callerid,s,14)
        -- Executing [s@macro-outbound-callerid:14] ExecIf("SIP/101-000000e7", "0?Set(CALLERID(all)=)") in new stack
        -- Executing [s@macro-outbound-callerid:15] ExecIf("SIP/101-000000e7", "0?Set(CALLERID(all)=)") in new stack
      == Begin MixMonitor Recording SIP/101-000000e7
        -- Executing [s@macro-outbound-callerid:16] ExecIf("SIP/101-000000e7", "1?Set(CALLERID(all)=628111714937)") in new stack
        -- Executing [s@macro-outbound-callerid:17] ExecIf("SIP/101-000000e7", "0?Set(CALLERPRES()=prohib_passed_screen)") in new stack
        -- Executing [s@macro-outbound-callerid:18] Set("SIP/101-000000e7", "CDR(outbound_cnum)=628111714937") in new stack
        -- Executing [s@macro-outbound-callerid:19] Set("SIP/101-000000e7", "CDR(outbound_cnam)=") in new stack
        -- Executing [s@macro-dialout-trunk:12] GosubIf("SIP/101-000000e7", "0?sub-flp-3,s,1()") in new stack
        -- Executing [s@macro-dialout-trunk:13] Set("SIP/101-000000e7", "OUTNUM=081287264002") in new stack
        -- Executing [s@macro-dialout-trunk:14] Set("SIP/101-000000e7", "custom=SIP/DALNET-1") in new stack
        -- Executing [s@macro-dialout-trunk:15] ExecIf("SIP/101-000000e7", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default)Tt)") in new stack
        -- Executing [s@macro-dialout-trunk:16] ExecIf("SIP/101-000000e7", "0?Set(DIAL_TRUNK_OPTIONS=TtM(confirm))") in new stack
        -- Executing [s@macro-dialout-trunk:17] Macro("SIP/101-000000e7", "dialout-trunk-predial-hook,") in new stack
        -- Executing [s@macro-dialout-trunk-predial-hook:1] NoOp("SIP/101-000000e7", "Test Track Outbound") in new stack
        -- Executing [s@macro-dialout-trunk-predial-hook:2] NoOp("SIP/101-000000e7", "Trunk is SIP/DALNET-1") in new stack
        -- Executing [s@macro-dialout-trunk-predial-hook:3] NoOp("SIP/101-000000e7", "Dialout number is 081287264002") in new stack
        -- Executing [s@macro-dialout-trunk-predial-hook:4] NoOp("SIP/101-000000e7", "Dial options are Tt") in new stack
        -- Executing [s@macro-dialout-trunk-predial-hook:5] Set("SIP/101-000000e7", "QDIALER_AGENT=") in new stack
        -- Executing [s@macro-dialout-trunk-predial-hook:6] GotoIf("SIP/101-000000e7", "0?nextcheck") in new stack
        -- Executing [s@macro-dialout-trunk-predial-hook:7] NoOp("SIP/101-000000e7", "NO AMPUSER, exit normally with no tracking outbound") in new stack
        -- Executing [s@macro-dialout-trunk-predial-hook:8] MacroExit("SIP/101-000000e7", "") in new stack
        -- Executing [s@macro-dialout-trunk:18] GotoIf("SIP/101-000000e7", "0?bypass,1") in new stack
        -- Executing [s@macro-dialout-trunk:19] ExecIf("SIP/101-000000e7", "0?Set(CONNECTEDLINE(num,i)=081287264002)") in new stack
        -- Executing [s@macro-dialout-trunk:20] ExecIf("SIP/101-000000e7", "0?Set(CONNECTEDLINE(name,i)=CID:628111714937)") in new stack
        -- Executing [s@macro-dialout-trunk:21] GotoIf("SIP/101-000000e7", "0?customtrunk") in new stack
        -- Executing [s@macro-dialout-trunk:22] Dial("SIP/101-000000e7", "SIP/DALNET-1/081287264002,300,Tt") in new stack
      == Using SIP RTP TOS bits 184
      == Using SIP RTP CoS mark 5
        -- Called SIP/DALNET-1/081287264002
           > 0x11eae20 -- Probation passed - setting RTP source address to 139.192.3.2:43186
           > 0x11eae20 -- Probation passed - setting RTP source address to 139.192.3.2:43186
        -- SIP/DALNET-1-000000e8 is making progress passing it to SIP/101-000000e7
           > 0x110d040 -- Probation passed - setting RTP source address to 103.22.251.101:6034
        -- SIP/DALNET-1-000000e8 is ringing
        -- SIP/DALNET-1-000000e8 answered SIP/101-000000e7
           > 0x110d040 -- Probation passed - setting RTP source address to 103.22.251.101:6034
        -- Executing [h@macro-dialout-trunk:1] Macro("SIP/101-000000e7", "hangupcall,") in new stack
        -- Executing [s@macro-hangupcall:1] GotoIf("SIP/101-000000e7", "1?theend") in new stack
        -- Goto (macro-hangupcall,s,3)
        -- Executing [s@macro-hangupcall:3] ExecIf("SIP/101-000000e7", "0?Set(CDR(recordingfile)=)") in new stack
    

    Thanks

  6. Hi FOP2,

    Now it solve, i should set "account" and "callerid"

    $res = $astman->Originate('SIP/'.$extension,$phone_number,'from-internal',1,null,$extension,'PARAM_VALUE=CUSTOMER_ID='.$cust_id,'cs-outbound',null,null,null);

    Thanks

or Sign Up to reply!