Click-to-Call

Discussion in 'Elastix 2.x' started by trigger, Mar 19, 2009.

  1. trigger

    Joined:
    Feb 17, 2009
    Messages:
    27
    Likes Received:
    0
    Bonjour,
    j'utilise Click-to-Call, ça sonne un SoftPhone mais quand je répond il renvoie la tonalité d'occupation alors que sur l' écran du soft est marqué "call estabilished" (x-lite).

    mon code PHP se présente comme suit (piece jointe).
     
  2. trigger

    Joined:
    Feb 17, 2009
    Messages:
    27
    Likes Received:
    0
    Code:
    <html>
    <head>
    <title>Click-to-Call</title>
    </head>
    <body>
    <?
    #Click-To-Call script brought to you by VoipJots.com
    
    
    #------------------------------------------------------------------------------------------
    #edit the below variable values to reflect your system/information
    #------------------------------------------------------------------------------------------
    
    #specify the name/ip address of your asterisk box
    #if your are hosting this page on your asterisk box, then you can use
    #127.0.0.1 as the host IP.  Otherwise, you will need to edit the following
    #line in manager.conf, under the Admin user section:
    #permit=127.0.0.1/255.255.255.0
    #change to:
    #permit=127.0.0.1/255.255.255.0,xxx.xxx.xxx.xxx ;(the ip address of the server this page is running on)
    $strHost = "@ip serveur SIP";
    
    #specify the username you want to login with (these users are defined in /etc/asterisk/manager.conf)
    #this user is the default AAH AMP user; you shouldn't need to change, if you're using AAH.
    $strUser = "manager";
    
    $strSecret = "passwrd";
    #specify the password for the above user
    
    #specify the channel (extension) you want to receive the call requests with
    #e.g. SIP/XXX, IAX2/XXXX, ZAP/XXXX, etc
    $strChannel = "SIP/XXXX";
    
    #specify the context to make the outgoing call from.  By default, AAH uses from-internal
    #Using from-internal will make you outgoing dialing rules apply
    $strContext = "from-internal";
    
    #specify the amount of time you want to try calling the specified channel before hangin up
    $strWaitTime = "30";
    
    #specify the priority you wish to place on making this call
    $strPriority = "1";
    
    #specify the maximum amount of retries
    $strMaxRetry = "2";
    
    #--------------------------------------------------------------------------------------------
    #Shouldn't need to edit anything below this point to make this script work
    #--------------------------------------------------------------------------------------------
    #get the phone number from the posted form
    $strExten = $_POST['txtphonenumber'];
    
    #specify the caller id for the call
    $strCallerId = "WEB USER <$strExten>";
    
    $length = strlen($strExten);
    
    if ($length == 4 && is_numeric($strExten))
    {
    $oSocket = fsockopen($strHost, 5038, $errnum, $errdesc) or die("Connection to host failed");
    
    fputs($oSocket, "Action: login\r\n");
    fputs($oSocket, "Username: $strUser\r\n");
    fputs($oSocket, "Secret: $strSecret\r\n\r\n");
    fputs($oSocket, "Events: off\r\n");
    fputs($oSocket, "Action: originate\r\n");
    fputs($oSocket, "Channel: $strChannel\r\n");
    fputs($oSocket, "WaitTime: $strWaitTime\r\n");
    fputs($oSocket, "CallerId: $strCallerId\r\n");
    fputs($oSocket, "Exten: $strExten\r\n");
    fputs($oSocket, "Context: $strContext\r\n");
    fputs($oSocket, "Async: true\r\n"); 
    fputs($oSocket, "Priority: $strPriority\r\n\r\n");
    fputs($oSocket, "Action: Logoff\r\n\r\n");
    fclose($oSocket);
    
    ?>
    
    <p>
    <br><br><br>
    <table width="300" border="1" bordercolor="#630000" cellpadding="3" cellspacing="0" align="center">
    	<tr><td>
    	<font size="2" face="verdana,georgia" color="#630000">Nous essayons actuellement de vous appeler. Veuillez être patient, et attente
     votre téléphone sonner ! <br>Si votre téléphone ne sonne pas après 2 minutes,nous faisons des excuses, mais le corespondent est out, ou déjà 
     au téléphone.
    	<br>[url=<? echo $_SERVER['PHP_SELF'] ?>]Réessayez[/url]</font>
    	</td></tr>
    </table>
    </p>
    <?
    }
    else
    {
    ?>
    <p>
    <table width="300" border="1" bordercolor="#630000" cellpadding="3" cellspacing="0">
    	<tr><td>
    	<font size="2" face="verdana,arial,georgia" color="#630000">Entrer votre numero de telephone (4XXX) !
    	</font>
    	<form action="<? echo $_SERVER['PHP_SELF'] ?>" method="post">
    		<input type="text" size="20" maxlength="4" name="txtphonenumber"><br>
    		<input type="submit" value="APPEL">
    	</form>
    	</td></tr>
    </table>
    </p>
    <?
    }
    ?>
    </body>
    </html>
     
  3. danardf

    Joined:
    Dec 3, 2007
    Messages:
    8,069
    Likes Received:
    12
    Mouai.... ça ne me dit pas grand chose.
    Tu as regardé ce qui ce passait en mode CLI pendant ton action clic2call?
     
  4. danardf

    Joined:
    Dec 3, 2007
    Messages:
    8,069
    Likes Received:
    12
    Oupss.... bonjour quand même :woohoo:
     
  5. ramoncio

    Joined:
    May 12, 2010
    Messages:
    1,663
    Likes Received:
    0
  6. danardf

    Joined:
    Dec 3, 2007
    Messages:
    8,069
    Likes Received:
    12
    Thank's Ramoncio for you help. ;)

    Ok I transltate your post, but i think that trigger can read the English. But in case where....

    Ramancio a écrit:
     
  7. danardf

    Joined:
    Dec 3, 2007
    Messages:
    8,069
    Likes Received:
    12
    The trigger problem:
     
  8. ramoncio

    Joined:
    May 12, 2010
    Messages:
    1,663
    Likes Received:
    0
    What this code does is:
    When the user clicks on the button "call me" after writing his name and phone number, asterisk calls you
    to $strChannel = "SIP/XXXX"; You have to define an existing channel in $strChannel
    You can also define any other number, as your mobile, to receive the call #$strChannel = "local/666959595@from-internal";
    When you answer your internal extension or outside number defined in $strChannel, then asterisk calls the number introduced by the client, but first it checks the digits in the number.
    I had to modify $length == 9, this checks the introduced number to have 9 digits as we use here in Spain.
    Or you can also put $length < 15 if you want the called number to be less than 15 digits.
     
  9. danardf

    Joined:
    Dec 3, 2007
    Messages:
    8,069
    Likes Received:
    12
    Quand tu clique sur le bouton "call me" après avoir écrit le nom et le n° de téléphone, asterisk t'appelle au: $strChannel = "SIP/XXXX"; ; Vous avez définit un canal existant dans $strChannel

    Tu peux aussi définir un autre numéro, comme ton portable pour recevoir l'appel #$strChannel = "local/666959595@from-internal";
    Quand tu réponds, ton extension interne ou le n° externe est définie dans $strChannel, alors asterisk appelle le numéro introduit par le client, mais d'abord il vérifie les chiffres dans le numéro.
    J'avais modifé $length == 9, ça vérifie qu'il y a bien 9 chiffres comme ici en Espagne.
    Ou, tu peux aussi entrer $length < 15 si tu veux les n° appelés doivent être inférieur à 15 chiffres.

    En espérant que j'ai bien traduit :huh: :side:
     
  10. ramoncio

    Joined:
    May 12, 2010
    Messages:
    1,663
    Likes Received:
    0
    I also must say thank you to Ward Mundy at Nerd Vittles for this great click 2 dial tutorial:

    http://nerdvittles.com/?p=168

    where we got this php code and very nice instructions.
     
  11. danardf

    Joined:
    Dec 3, 2007
    Messages:
    8,069
    Likes Received:
    12
    Aussi je dis merci à Ward Mundy et à Nerd Vittlespour pour ce tutorial click 2 dial
    http://nerdvittles.com/?p=168
    Où nous avons les codes php et de très belles instructions.
     
  12. trigger

    Joined:
    Feb 17, 2009
    Messages:
    27
    Likes Received:
    0
    slt !

    ça marche tjrs pas , voici ce que je reçoi depuis l CLI>
     
  13. danardf

    Joined:
    Dec 3, 2007
    Messages:
    8,069
    Likes Received:
    12
    Ben je ne vois pas le [file]
    Peut-être un bug !
    Certainement, car les Emoticons ne sont pas visibles.

    Tu sais lire l'Anglais?
    Si c'est le cas, je peux te laisser dialoguer avec Ramoncio.
    Sinon, je fais l'interprète.
     
  14. trigger

    Joined:
    Feb 17, 2009
    Messages:
    27
    Likes Received:
    0
    plutot pb de taille de fichier ... bon j' ai choisi le text brut :

    elastix*CLI>
    Code:
      == Parsing '/etc/asterisk/manager.conf': Found
      == Parsing '/etc/asterisk/manager_additional.conf': Found
      == Parsing '/etc/asterisk/manager_custom.conf': Found
      == Manager 'admin' logged on from 127.0.0.1
      == Manager 'admin' logged off from 127.0.0.1
           > Channel SIP/4005-0a1d13c8 was answered.
        -- Executing [4005@from-internal:1] Macro("SIP/4005-0a1d13c8", "exten-vm|novm|4005") in new st    ack
        -- Executing [s@macro-exten-vm:1] Macro("SIP/4005-0a1d13c8", "user-callerid") in new stack
        -- Executing [s@macro-user-callerid:1] NoOp("SIP/4005-0a1d13c8", "user-callerid: WEB 4005") in     new stack
        -- Executing [s@macro-user-callerid:2] Set("SIP/4005-0a1d13c8", "AMPUSER=4005") in new stack
        -- Executing [s@macro-user-callerid:3] GotoIf("SIP/4005-0a1d13c8", "0?report") in new stack
        -- Executing [s@macro-user-callerid:4] ExecIf("SIP/4005-0a1d13c8", "1|Set|REALCALLERIDNUM=4005    ") in new stack
        -- Executing [s@macro-user-callerid:5] NoOp("SIP/4005-0a1d13c8", "REALCALLERIDNUM is 4005") in     new stack
        -- Executing [s@macro-user-callerid:6] Set("SIP/4005-0a1d13c8", "AMPUSER=4005") in new stack
        -- Executing [s@macro-user-callerid:7] Set("SIP/4005-0a1d13c8", "AMPUSERCIDNAME=vianney") in n    ew stack
        -- Executing [s@macro-user-callerid:8] GotoIf("SIP/4005-0a1d13c8", "0?report") in new stack
        -- Executing [s@macro-user-callerid:9] Set("SIP/4005-0a1d13c8", "AMPUSERCID=4005") in new stac    k
        -- Executing [s@macro-user-callerid:10] Set("SIP/4005-0a1d13c8", "CALLERID(all)="vianney" <400    5>") in new stack
        -- Executing [s@macro-user-callerid:11] Set("SIP/4005-0a1d13c8", "REALCALLERIDNUM=4005") in ne    w stack
        -- Executing [s@macro-user-callerid:12] ExecIf("SIP/4005-0a1d13c8", "0|Set|CHANNEL(language)="    ) in new stack
        -- Executing [s@macro-user-callerid:13] NoOp("SIP/4005-0a1d13c8", "TTL:  ARG1: novm") in new s    tack
        -- Executing [s@macro-user-callerid:14] GotoIf("SIP/4005-0a1d13c8", "0?continue") in new stack
        -- Executing [s@macro-user-callerid:15] Set("SIP/4005-0a1d13c8", "__TTL=64") in new stack
        -- Executing [s@macro-user-callerid:16] GotoIf("SIP/4005-0a1d13c8", "1?continue") in new stack
        -- Goto (macro-user-callerid,s,23)
        -- Executing [s@macro-user-callerid:23] NoOp("SIP/4005-0a1d13c8", "Using CallerID "vianney" <4    005>") in new stack
        -- Executing [s@macro-exten-vm:2] Set("SIP/4005-0a1d13c8", "FROMCONTEXT=exten-vm") in new stac    k
        -- Executing [s@macro-exten-vm:3] Set("SIP/4005-0a1d13c8", "VMBOX=novm") in new stack
        -- Executing [s@macro-exten-vm:4] Set("SIP/4005-0a1d13c8", "EXTTOCALL=4005") in new stack
        -- Executing [s@macro-exten-vm:5] Set("SIP/4005-0a1d13c8", "CFUEXT=") in new stack
        -- Executing [s@macro-exten-vm:6] Set("SIP/4005-0a1d13c8", "CFBEXT=") in new stack
        -- Executing [s@macro-exten-vm:7] Set("SIP/4005-0a1d13c8", "RT=""") in new stack
        -- Executing [s@macro-exten-vm:8] Macro("SIP/4005-0a1d13c8", "record-enable|4005|IN") in new s    tack
        -- Executing [s@macro-record-enable:1] GotoIf("SIP/4005-0a1d13c8", "0?2:4") in new stack
        -- Goto (macro-record-enable,s,4)
        -- Executing [s@macro-record-enable:4] AGI("SIP/4005-0a1d13c8", "recordingcheck|20090321-18355    0|1237660546.126") in new stack
        -- Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
      recordingcheck|20090321-183550|1237660546.126: Inbound recording not enabled
        -- AGI Script recordingcheck completed, returning 0
        -- Executing [s@macro-record-enable:5] NoOp("SIP/4005-0a1d13c8", "No recording needed") in new     stack
        -- Executing [s@macro-exten-vm:9] Macro("SIP/4005-0a1d13c8", "dial||tr|4005") in new stack
        -- Executing [s@macro-dial:1] GotoIf("SIP/4005-0a1d13c8", "1?dial") in new stack
        -- Goto (macro-dial,s,3)
        -- Executing [s@macro-dial:3] AGI("SIP/4005-0a1d13c8", "dialparties.agi") in new stack
        -- Launched AGI Script /var/lib/asterisk/agi-bin/dialparties.agi
      dialparties.agi: Starting New Dialparties.agi
      == Parsing '/etc/asterisk/manager.conf': Found
      == Parsing '/etc/asterisk/manager_additional.conf': Found
      == Parsing '/etc/asterisk/manager_custom.conf': Found
      == Manager 'admin' logged on from 127.0.0.1
      dialparties.agi: Caller ID name is 'vianney' number is '4005'
      dialparties.agi: USE_CONFIRMATION:  'FALSE'
      dialparties.agi: RINGGROUP_INDEX:   ''
      dialparties.agi: Methodology of ring is  'none'
        --  dialparties.agi: Added extension 4005 to extension map
        --  dialparties.agi: Extension 4005 cf is disabled
        --  dialparties.agi: Extension 4005 do not disturb is disabled
           >  dialparties.agi: extnum 4005 has:  cw: 0; hascfb: 0 [] hascfu: 0 []
           >  dialparties.agi: ExtensionState: 1
      dialparties.agi: Extension 4005 has ExtensionState: 1
        --  dialparties.agi: Checking CW and CFB status for extension 4005
      dialparties.agi: Extension 4005 is not available to be called
      dialparties.agi: Extension 4005 has call waiting disabled
        --  dialparties.agi: Filtered ARG3:
      == Manager 'admin' logged off from 127.0.0.1
        -- AGI Script dialparties.agi completed, returning 0
        -- Executing [s@macro-dial:4] NoOp("SIP/4005-0a1d13c8", "Returned from dialparties with no ext    ensions to call and DIALSTATUS: BUSY") in new stack
        -- Executing [s@macro-exten-vm:10] Set("SIP/4005-0a1d13c8", "SV_DIALSTATUS=BUSY") in new stack
        -- Executing [s@macro-exten-vm:11] GosubIf("SIP/4005-0a1d13c8", "0?docfu|1") in new stack
        -- Executing [s@macro-exten-vm:12] GosubIf("SIP/4005-0a1d13c8", "0?docfb|1") in new stack
        -- Executing [s@macro-exten-vm:13] Set("SIP/4005-0a1d13c8", "DIALSTATUS=BUSY") in new stack
        -- Executing [s@macro-exten-vm:14] NoOp("SIP/4005-0a1d13c8", "Voicemail is novm") in new stack
        -- Executing [s@macro-exten-vm:15] GotoIf("SIP/4005-0a1d13c8", "1?s-BUSY|1") in new stack
        -- Goto (macro-exten-vm,s-BUSY,1)
        -- Executing [s-BUSY@macro-exten-vm:1] NoOp("SIP/4005-0a1d13c8", "Extension is reporting BUSY     and not passing to Voicemail") in new stack
        -- Executing [s-BUSY@macro-exten-vm:2] PlayTones("SIP/4005-0a1d13c8", "busy") in new stack
        -- Executing [s-BUSY@macro-exten-vm:3] Busy("SIP/4005-0a1d13c8", "20") in new stack
      == Spawn extension (macro-exten-vm, s-BUSY, 3) exited non-zero on 'SIP/4005-0a1d13c8' in macro '    exten-vm'
     
  15. danardf

    Joined:
    Dec 3, 2007
    Messages:
    8,069
    Likes Received:
    12
    J'ai mis ta capture en [ code ]
     
  16. danardf

    Joined:
    Dec 3, 2007
    Messages:
    8,069
    Likes Received:
    12
    Bonjour Trigger.

    Essayes donc de valider l'appelle en attente sur ton extension (Call Waiting)!
     
  17. ramoncio

    Joined:
    May 12, 2010
    Messages:
    1,663
    Likes Received:
    0
    It seems SIP/4005 is busy.
    Can you normally call SIP/4005?
     
  18. danardf

    Joined:
    Dec 3, 2007
    Messages:
    8,069
    Likes Received:
    12
    Hi Ramoncio.

    Into the dump, there's 4005 is busy.
    I think that the call waiting is maybe disabled!?
     
  19. ramoncio

    Joined:
    May 12, 2010
    Messages:
    1,663
    Likes Received:
    0
    4005 shouldn't be busy, if it is the extension he would like to receive the call in.
    Call waiting would just warn him when he is busy, beeping with an incoming call.
     
  20. danardf

    Joined:
    Dec 3, 2007
    Messages:
    8,069
    Likes Received:
    12
    Sometimes, when the call waiting is disable, it is not possible to receive a call. even when the extension is free. After enabled the call waiting, all was good.
    I did see this problem sometimes. I don't know why. :huh:
     

Share This Page