Results 1 to 1 of 1

Thread: Can anyone help me to make another zimlet for Asterisk

  1. #1
    Join Date
    Sep 2007
    Rep Power

    Default Can anyone help me to make another zimlet for Asterisk

    I use Trixbox (trixbox, an Asterisk-based PBX Phone System (formerly Asterisk@Home) | trixbox) version of Asterisk. It has PHPAGI interface which can be used to originate calls. I have prepared a php script that originates call. To make a call from Zimbra zimlet just need to connect via http to Asterisk with a special url.
    The example of the originating url is:
    This url makes Asterisk to call extension 207, when 207 answers Asterisk connects it with number *43 (echo test).

    Php script:
    PHP Code:
    if (
    $remoteaddr == 'XXX.XXX.XXX.XXX') {
        if (
    $passwd == 'ZimbraCallMaker') {
    $fp fsockopen ("localhost"5038, &$errno, &$errstr20);
            if (!
    $fp) {
    $resstr="PHPAGI error $errstr ($errno)";
            else {
    fputs ($fp"Action: login\r\n");
    fputs ($fp"Username: phpagi\r\n");
    fputs ($fp"Secret: phpagi\r\n");
    fputs ($fp"Events: off\r\n\r\n");
    sleep(1) ;
    fputs ($fp"MaxRetries: 2\r\n");
    fputs ($fp"RetryTime: 10\r\n");
    fputs ($fp"WaitTime: 30\r\n");
    fputs ($fp"Action: Originate\r\n");
    fputs ($fp"Channel: SIP/$local\r\n");
    fputs ($fp"Callerid: $local\r\n");
    fputs ($fp"Context: custom-cb-dial\r\n");
    sleep(1) ;
    fputs ($fp"Exten: $dest\r\n");
    fputs ($fp"Priority: 1\r\n\r\n");
    sleep(1) ;
    fclose ($fp);
        else { 
    $res=2$resstr='invalid password'; }
    else {
    $resstr='invalid IP';
    1. This script checks remote IP address to allow make calls via it only from Zimbra IP. Replace XXX.XXX.XXX.XXX with valid IP.
    2. Put the password you like instead "ZimbraCallMaker".
    3. Replace PHPAGI username and secret with valid ones for your Asterisk.
    4. Create "custom-cb-dial" context or replace it with the name of context you are using to make calls from extensions (perhaps from-internal)
    In my case "custom-cb-dial" is:
    exten => _X.,1,Wait(1)
    exten => _X.,n,NoOp(Callback from:${CALLERID(num)} to:${EXTEN})
    exten => _X.,n,Playback(number)
    exten => _X.,n,SayDigits(${EXTEN})
    exten => _X.,n,NoOp(goto internal)
    exten => _X.,n,goto(from-internal,${EXTEN},1)
    exten => _*X.,1,Wait(1)
    exten => _*X.,n,NoOp(Callback from:${CALLERID(num)} to:${EXTEN})
    exten => _*X.,n,Playback(number)
    exten => _*X.,n,SayDigits(${EXTEN})
    exten => _*X.,n,NoOp(goto internal)
    exten => _*X.,n,goto(from-internal,${EXTEN},1)
    It says to caller "number" then pronounces destination number digits and after that call is originated according rules for internal extensions.
    Last edited by borispr; 10-05-2007 at 06:40 AM.

Similar Threads

  1. Replies: 21
    Last Post: 02-04-2010, 09:06 AM
  2. Replies: 5
    Last Post: 01-11-2008, 04:34 AM
  3. Replies: 13
    Last Post: 07-20-2007, 03:21 AM
  4. Domain Admin Error: Permission Denied
    By shanson in forum Administrators
    Replies: 3
    Last Post: 05-29-2007, 05:48 AM
  5. Post instsallation problems
    By Assaf in forum Installation
    Replies: 14
    Last Post: 01-29-2007, 10:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts