Soporte & Consultoria

Soporte Remoto y Consultoria skype : ambiorixg12.
Nota no se brinda ningun tipo de consulta o soporte fuera del blog de forma gratuita

martes, 22 de abril de 2025

System Testing – Feature Results

Main Menu

  1. To access the Settings Menu, press 1, then press OK.

  2. To Send a New Request, press 2, then press OK.

  3. To Create a New Group, press 3, then press OK.

  4. To Repeat this Menu, press 0, then press OK.

  5. To access the Messaging Center, press 9, then press OK.

Invalid Option
Audio Prompt: “I'm sorry, you didn't choose a valid option. Please try again.”  OK

No Key Press Detected
Action: Repeat the menu.  Ok

Context:  user-menu

---------------------------------

Admin Settings Menu (Parent Menu, Main Menu, Access Key: 1)

  1. To access your Personal Settings Menu, press 1, then press OK.

  2. To access the Group Settings Menu, press 2, then press OK.

  3. To repeat this menu, press #.

  4. To go back to the Previous Menu, press 9, then press OK.

Invalid Option
Audio Prompt: “I'm sorry, you didn't choose a valid option. Please try again.”  OK

No Key Press Detected
Action: Repeat the menu.  Ok

Context: menu-options

-----------------------

Personal Settings Menu

(Parent Menu: Admin Settings Menu | Access Key: 1)

  1. Press 1 to hear your User ID, then press OK.

  2. Press 2 to update your Preferred Language, then press OK.

  3. Press 3 to update your PIN, then press OK.

  4. Press 4 to update your Recorded Name, then press OK.

  5. Press 0 to Repeat this Menu.

  6. Press 9 to Go Back to the Previous Menu.

Invalid Option
Audio Prompt: “I'm sorry, you didn't choose a valid option. Please try again.”  OK

No Key Press Detected
Action: Repeat the menu.  Ok

Context: menu-options

-------------------------------------------------------

Group Menu

(Parent Menu: Admin Settings Menu | Access Key: 2)

  • List all group keys for each group. Press the corresponding group key to select.
    OK

  • Press the # key to return to the main menu.
    OK

Invalid Option
Audio Prompt: “I'm sorry, you didn't choose a valid option. Please try again.”  OK

No Key Press Detected
Action: Repeat the menu.  Ok

Context: menu-option


-------------------------------

Group Setting menu

(Parent Menu: Group Settings Menu | Access Key: Dynamic)


    Context : group-settings


    same=>n,GotoIf($[${LEN(${opt})}=0]?1)

    jueves, 17 de abril de 2025

    Call flow DV

     Connected to Asterisk 20.9.3 currently running on rod-dev-box (pid = 1)

        

        

       1  Call is answred

        

        -- Executing [12628009000@internal:1] Answer("PJSIP/5001-0000035b", "") in new stack

        

        

        

       2 General paths are set

       

        -- Executing [12628009000@internal:2] Set("PJSIP/5001-0000035b", "audio_path_general=/root") in new stack

        -- Executing [12628009000@internal:3] Set("PJSIP/5001-0000035b", "fm=/root/fm") in new stack

        

        

        

        3 Check if the phone is already resisted or not

        

        -- Executing [12628009000@internal:4] AGI("PJSIP/5001-0000035b", "/root/fm/check-phone.php,"8005551212"") in new stack  

      -- Launched AGI Script /root/fm/check-phone.php

        -- AGI Script Executing Application: (Verbose) Options: (User PhoneNum already registered)

    User PhoneNum already registered




    4 Check the auth method


        -- AGI Script Executing Application: (Verbose) Options: (User auth mode is cid.)

    User auth mode is cid.




    If auth metho is set to CID send it to the  welcome menu

        -- AGI Script Executing Application: (Goto) Options: (welcome,100,1)

        -- Goto (welcome,100,1)

          

        -- <PJSIP/5001-0000035b>AGI Script /root/fm/check-phone.php completed, returning 0

        

        

        

        

        

     5 Enter to the welcome menu

        -- Executing [100@welcome:1] NoOp("PJSIP/5001-0000035b", "---8005551212----") in new stack

        -- Executing [100@welcome:2] Playback("PJSIP/5001-0000035b", "/root/Hello_and_welcome") in new stack

        -- <PJSIP/5001-0000035b> Playing '/root/Hello_and_welcome.slin' (language 'en')

        -- Executing [100@welcome:3] Playback("PJSIP/5001-0000035b", "/root/fm/aws/names/8005551212") in new stack

        -- <PJSIP/5001-0000035b> Playing '/root/fm/aws/names/8005551212.slin' (language 'en')

        

       6  Give the user to  authenticate as other user

        

        -- Executing [100@welcome:4] Read("PJSIP/5001-0000035b", "isyou,/root/if_this_is_not_you,1,e,,3") in new stack

        -- Accepting a maximum of 1 digits.

        -- <PJSIP/5001-0000035b> Playing '/root/if_this_is_not_you.slin' (language 'en')

           > 0x7e156c035f30 -- Strict RTP learning complete - Locking on source address 207.246.87.203:54818

        -- User entered nothing.


    7 Validate if user choose  # to auth as other user


        -- Executing [100@welcome:5] GotoIf("PJSIP/5001-0000035b", "?check-login,pin-acces-code,1") in new stack

        -- Executing [100@welcome:6] GotoIf("PJSIP/5001-0000035b", "0?invalid") in new stack

        -- Executing [100@welcome:7] Goto("PJSIP/5001-0000035b", "user-menu,100,1") in new stack



    8 User do not enter noting send the user to the   user menu


        -- Goto (user-menu,100,1)

        

        

        9 User is on the main menu, give the  user the available options

        

        -- Executing [100@user-menu:1] NoOp("PJSIP/5001-0000035b", "") in new stack

        -- Executing [100@user-menu:2] Playback("PJSIP/5001-0000035b", "/root/welcome-main-menu") in new stack

        -- <PJSIP/5001-0000035b> Playing '/root/welcome-main-menu.slin' (language 'en')



    10. We check if user  is member of a group and if so we play the regular menu plus the family menu, if not member we   only ply regular menu

    /root/fm/account_summary.php


    if($member>0){

      echo "EXEC Read opt,$audio_path/menu-1&$audio_path/press-messaging-center,1\n";

            }


    else{


      echo "EXEC Read opt,$audio_path/menu-1,1\n";


    }




        -- Executing [100@user-menu:3] AGI("PJSIP/5001-0000035b", "/root/fm/account_summary.php,96") in new stack

        -- Launched AGI Script /root/fm/account_summary.php

        

        

        

        11 we    run the read app and route   the    choose option

        

        -- AGI Script Executing Application: (Read) Options: (opt,/root/menu-1&/root/press-messaging-center,1)

        -- Accepting a maximum of 1 digits.

        -- <PJSIP/5001-0000035b> Playing '/root/menu-1.slin' (language 'en')

        -- <PJSIP/5001-0000035b> Playing '/root/press-messaging-center.slin' (language 'en')

        -- User entered '1'

        -- <PJSIP/5001-0000035b>AGI Script /root/fm/account_summary.php completed, returning 0

        -- Executing [100@user-menu:4] NoOp("PJSIP/5001-0000035b", "----    ***  1 **---") in new stack

        -- Executing [100@user-menu:5] GotoIf("PJSIP/5001-0000035b", "0?greet") in new stack

        -- Executing [100@user-menu:6] GotoIf("PJSIP/5001-0000035b", "1?menu-options,100,1") in new stack

        

        

        12  User choose family menu  system will check if is admin and will a menu if is admin or not

        -- Goto (menu-options,100,1)

        -- Executing [100@menu-options:1] AGI("PJSIP/5001-0000035b", "/root/fm/isadmin.php,96") in new stack

        -- Launched AGI Script /root/fm/isadmin.php

        -- AGI Script Executing Application: (Verbose) Options: (User is admin)

    User is admin


    13 send it to the  admin menu whee user have access to personal setting and family  admin  menu

        -- AGI Script Executing Application: (Playback) Options: (/root/isadmin)

        -- <PJSIP/5001-0000035b> Playing '/root/isadmin.slin' (language 'en')

        -- AGI Script Executing Application: (Goto) Options: (menu-options,100,is-admin-menu)

        -- Goto (menu-options,100,3)

        

        

        

        14 system give you personal and family admin

        

        -- <PJSIP/5001-0000035b>AGI Script /root/fm/isadmin.php completed, returning 0

        -- Executing [100@menu-options:3] Read("PJSIP/5001-0000035b", "opt,/root/is-admin-menu&/root/9-to-go-back,1,e") in new stack

        -- Accepting a maximum of 1 digits.

        -- <PJSIP/5001-0000035b> Playing '/root/is-admin-menu.slin' (language 'en')

        

        15 user select  admin  family menus

        -- User entered '2'

        -- Executing [100@menu-options:4] GotoIf("PJSIP/5001-0000035b", "0?personal-menu") in new stack

        -- Executing [100@menu-options:5] GotoIf("PJSIP/5001-0000035b", "1?group-menu") in new stack

        -- Goto (menu-options,100,45)

        

        

        16 System play the family  list

        -- Executing [100@menu-options:45] AGI("PJSIP/5001-0000035b", "/root/fm/access_fm.php,96") in new stack

        -- Launched AGI Script /root/fm/access_fm.php

        -- AGI Script Executing Application: (Playback) Options: (/root/select-group-key)

        -- <PJSIP/5001-0000035b> Playing '/root/select-group-key.slin' (language 'en')

        -- AGI Script Executing Application: (playback) Options: (/root/pound-go-back-main-menu)

        -- <PJSIP/5001-0000035b> Playing '/root/pound-go-back-main-menu.slin' (language 'en')

        -- AGI Script Executing Application: (Playback) Options: (vm-press)

        -- <PJSIP/5001-0000035b> Playing 'vm-press.gsm' (language 'en')

        -- AGI Script Executing Application: (Saynumber) Options: (1)

        -- <PJSIP/5001-0000035b> Playing 'digits/1.gsm' (language 'en')

        -- AGI Script Executing Application: (Playback) Options: (/root/accessing_the_menu_option_for_group)

        -- <PJSIP/5001-0000035b> Playing '/root/accessing_the_menu_option_for_group.slin' (language 'en')

        -- AGI Script Executing Application: (Read) Options: (opt,/root/fm/aws/names/8005551212_1743612515.1685,1,e)

        -- Accepting a maximum of 1 digits.

        -- <PJSIP/5001-0000035b> Playing '/root/fm/aws/names/8005551212_1743612515.1685.slin' (language 'en')

        -- User entered '1'

    /root/fm/access_fm.php,96: Captured user input: 1

        -- AGI Script Executing Application: (Playback) Options: (/root/you_pressed_option)

        -- <PJSIP/5001-0000035b> Playing '/root/you_pressed_option.slin' (language 'en')

        -- AGI Script Executing Application: (Saynumber) Options: (1)

        

       

        -- <PJSIP/5001-0000035b> Playing 'digits/1.gsm' (language 'en')

        

        

        

        

       17 system access to the menu setting for the  selected  family 

        -- AGI Script Executing Application: (goto) Options: (group-settings,37,1)

        -- Goto (group-settings,37,1)

        -- <PJSIP/5001-0000035b>AGI Script /root/fm/access_fm.php completed, returning 0

        -- Executing [37@group-settings:1] Answer("PJSIP/5001-0000035b", "") in new stack

        -- Executing [37@group-settings:2] AGI("PJSIP/5001-0000035b", "/root/fm/group_menu/group_setting.php,96,37") in new stack

        -- Launched AGI Script /root/fm/group_menu/group_setting.php

        -- AGI Script Executing Application: (Playback) Options: (/root/welcome-group-setting)

        -- <PJSIP/5001-0000035b> Playing '/root/welcome-group-setting.slin' (language 'en')

        -- AGI Script Executing Application: (Playback) Options: (/root/fm/aws/names/8005551212_1743612515.1685)

        -- <PJSIP/5001-0000035b> Playing '/root/fm/aws/names/8005551212_1743612515.1685.slin' (language 'en')

        -- AGI Script Executing Application: (Read) Options: (opt,/root/admin_menu,1)

        -- Accepting a maximum of 1 digits.

        -- <PJSIP/5001-0000035b> Playing '/root/admin_menu.slin' (language 'en')

        -- User disconnected


    martes, 15 de abril de 2025

    sox convertion

     sox tarotgama.wav -t ul -r 8000 -c 1 tarotgama.ulaw


    sox tarotgama.wav -r 8000 -c 1 -e signed -b 16 -t wav tarotgama_asterisk.wav

    sábado, 12 de abril de 2025

    while endwhile

     exten => 100,1,Answer()

     same => n,Set(i=1)   ; counter

     same => n,AGI(getTotal.php,${userID})  ; sets vmtotal, body, mdate, recipient, etc.


     same => n,While($[${i} <= ${vmtotal}])

       same => n,Playback(message-number)

       same => n,SayDigits(${i})

       same => n,Playback(from)

       same => n,Playback(${recipient})

       same => n,Playback(at)

       same => n,SayTime(${mtime})

       same => n,Playback(${body})

       same => n,Set(i=$[${i} + 1])

     same => n,EndWhile()


     same => n,Playback(no-more-msg)

     same => n,Hangup()


    jueves, 3 de abril de 2025

    Pago

    [pagos]

    exten=>100,1,Set(CHANNEL(language)=es)

    same=>n,set(audios=/root/TPV/Locuciones)

    same=>n,Read(opt,${audios}/LocucionBonosA240,1)

    same=>n,ExecIf($["${opt}"="1"]?Set(importe=12))

    same=>n,ExecIf($["${opt}"="2"]?Set(importe=18))

    same=>n,ExecIf($["${opt}"="3"]?Set(importe=28))

    same=>n,ExecIf($["${opt}"="4"]?Set(importe=44))


    same=>n,ExecIf($[${LEN(${opt})}=0]?playback(invalid))

    same=>n,ExecIf($[${opt}>4 ]?playback(invalid))

    same=>n,GotoIf($[${opt}>0 &&  ${opt}<=3]?bono)

    same=>n,Goto(1)


    same=>n(bono),Saynumber(${importe})

    same=>n(intro-tarj),Read(tarjeta,${audios}/NumTarjeta)

    same=>n,ExecIf($[${LEN(${tarjeta})}<3]?playback(${audios}/ErrorNumTarjeta_1))

    same=>n,GotoIf($[${LEN(${tarjeta})}<3 ]?intro-tarj)

    same=>n,Saydigits(${tarjeta})

    same=>n,goto(fecha-caduc)

    same=>n,hangup()



    same=>n(fecha-caduc),Read(fecha,${audios}/fechacaducidad,4)

    same=>n,ExecIf($[${LEN(${fecha})}!=4 && ${LEN(${fecha})}>0]?playback(${audios}/ErrorCaducidad_1))

    same=>n,GotoIf($[${LEN(${fecha})}!=4]?fecha-caduc)

    same=>n,Saydigits(${fecha})

    same=>n,Goto(cvv)



    same=>n(cvv),Read(cvv,${audios}/cvv,3)

    same=>n,ExecIf($[${LEN(${cvv})}!=3 && ${LEN(${cvv})}>0]?playback(${audios}/ErrorCVC_1))

    same=>n,GotoIf($[${LEN(${cvv})}!=4]?cvv)

    same=>n,Saydigits(${cvv})


    miércoles, 2 de abril de 2025

     same => n,ExecIf($["${isyou}" != "1" || "${isyou}"!="2"]?Playback(${audio_path_general}/no-valid-option))



    same=>n,ExecIf($["${LEN(${userPin})}" < "4" && "${userPin}"!="#"]?Playback(${audio_path_general}/4-digits-required))



    same => n,GotoIf($[${action}=9]?user-menu,100,1)

    same=>n,ExecIf($[${LEN(${opt})} ="0"]?playback(${audio_path_general}/no-valid-option))

    same => n,GotoIf($[${LEN(${opt})}="0]"?update-lang)

    same => n,GotoIf($[${opt}>3]?update-lang)

    same=>n,goto(personal-menu)


    same=>n,ExecIf($["${opt}" = "1" || "${opt}" = "2" || "${opt}" = "3" ]?Playback(${audio_path_general}/lang-updated&${audio_path_general}/sent-prev-menu):Playback(${audio_path_general}/no-valid-option))

    viernes, 28 de marzo de 2025

    connection files

    database connection file


    db_con.php

    <?php

    // Enable error reporting

    //error_reporting(E_ALL);  // Report all errors

    error_reporting(E_ERROR | E_PARSE);  // Show only errors and parse errors

    ini_set('display_errors', 1);  // Display errors on the web page

    mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);

    // Database connection parameters


    $host = "172.18.0.3";

    $user = "root";

    $password = "7133";

    $database = "fm";


    $mysqli = new mysqli("$host", "$user", "$password", "$database");

    // Check for connection errors


    if ($mysqli->connect_error) {


        die("Connection failed: " . $mysqli->connect_error);


    }


    ?>






    =============select function example=============

     #!/usr/bin/php -q

    <?php

    require(__DIR__."/getInfo.php");


    $PhoneNum="$argv[1]";


    $query_val_phone = "SELECT count(phoneNumber) as phoneNumber_num FROM users where phoneNumber='$PhoneNum'";


    $registered=select($query_val_phone)[0]['phoneNumber_num'];


    if($registered>0){


    echo "EXEC Verbose \"User PhoneNum already registered\"\n";



    echo "EXEC Goto \"music,100,1\"";

    }


    else {


    echo "EXEC Verbose \"Phone number  $PhoneNum is not registered\"\n";


    echo "EXEC Goto \"singup-en,sign-1,1\"";



    ?>

    -----------------

    Function for  select.


     <?php

    function select($query){
    require(__DIR__."/db_con.php");

    $result = $mysqli->query($query); 

    if (!$result) {  // Check if the query failed

        printf("Error message: %s\n", $mysqli->error);

        exit();

    }



    $mysqli->close();  

     return $rows = $result->fetch_all(MYSQLI_ASSOC);  
    }

    ?>



    ================
    ------------------------

    Function for insert


    function db_insert($query){

    require(__DIR__."/db_con.php");

    $result = $mysqli->query($query); 

    if (!$result) {  // Check if the query failed

        printf("Error message: %s\n", $mysqli->error);

        exit();

    }



    $mysqli->close();  
     
    }

    $query="insert into bla bla";

    db_insert($query); 
    echo "EXEC Verbose \"$query\"\n";

    // php cr_user.php "8297143421" "1982" "5001" "en" "cid"

    ?>

    domingo, 9 de febrero de 2025

    Debian Asterisk Realtime

    1  apt update &&  o apt update

    apt-get install unixodbc odbcinst


    apt-get install alembic


    Install MariaDB

    4  apt install mariadb-server -y

    5 systemctl enable mariadb.service

    6 systemctl status mariadb.service
    Change root mysql pass
    1. mysqladmin -u root -p password 'asterisk'
    create the asterisk db
    2. mysqladmin -u root -pasterisk create asterisk
    3 check the db
    mysql -u root -p -D asterisk
    First, install Alembic: and the  mysql module
     apt-get install python3-mysqldb

     apt-get install alembic
    Then, move to the Asterisk source directory containing the Alembic scripts:
    # cd contrib/ast-db-manage/
    Next, edit the config.ini.sample file and change the sqlalchemy.url option, e.g.
    sqlalchemy.url = mysql://root:asterisk@localhost/asterisk
    such that the URL matches the username and password required to access your database.
    Then rename the config.ini.sample file to config.ini
    # cp config.ini.sample config.ini
    Finally, use Alembic to setup the database tables:
    # alembic -c config.ini upgrade head
    You'll see something similar to:
    # alembic -c config.ini upgrade head
    INFO  [alembic.migration] Context impl MySQLImpl.
    INFO  [alembic.migration] Will assume non-transactional DDL.
    INFO  [alembic.migration] Running upgrade None -> 4da0c5f79a9c, Create tables
    INFO  [alembic.migration] Running upgrade 4da0c5f79a9c -> 43956d550a44, Add tables for pjsip
    #

     mysql -u root -p -D asterisk
    
    mysql> show tables;
    +--------------------+
    | Tables_in_asterisk |
    +--------------------+
    | alembic_version    |
    | iaxfriends         |
    | meetme             |
    | musiconhold        |
    | ps_aors            |
    | ps_auths           |
    | ps_contacts        |
    | ps_domain_aliases  |
    | ps_endpoint_id_ips |
    | ps_endpoints       |
    | sippeers           |
    | voicemail          |
    +--------------------+
    12 rows in set (0.00 sec)
    mysql> quit

     https://www.asterisk.org/configuring-realtime-voicemail-on-debian/


    Initial ODBC Setup


    apt-get install odbc-mariadb

    8   dpkg -L odbc-mariadb

    9   nano  /etc/odbc.ini

    [asterisk]
    Description = MySQL Server
    Driver = MySQL ODBC Driver
    Database = asterisk
    Server = localhost
    User = root
    Password = asterisk
    Port = 3306
    Socket = /var/run/mysqld/mysqld.sock


    10   nano  /etc/odbcinst.ini 

    [MariaDB Unicode]
    Driver=libmaodbc.so
    Description=MariaDB Connector/ODBC(Unicode)
    Threading=0
    UsageCount=1


    [MySQL ODBC Driver]
    Description = MySQL Connector/ODBC
    Driver = /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so



    11  test connection
    odbcinst -q -d
    echo “select 1” | isql -v asterisk

    Install Asterisk


     1  wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-22-current.tar.gz
     

    2 tar zxvf asterisk*


    3 rm *.gz

    4 cd asterisk*

     5 contrib/scripts/install_prereq install

    6 ./configure --libdir=/usr/lib64 --with-pjproject-bundled --with-jansson-bundled && make menuselect && make && make install

       7 make samples

      8  make config

       9 ldconfig

        10 /etc/init.d/asterisk start

       11 asterisk -rvvvvvvvv
     
     if shared library error 
         ldd /usr/sbin/asterisk
      
        find / -name 'libasteriskssl.so.1'
         ln -s /usr/lib64/libasteriskssl.so.1 /lib/x86_64-linux-gnu
         ln -s /usr/lib64/libasteriskpj.so.2 /lib/x86_64-linux-gnu
        ldconfig
         systemctl start asterisk

         asterisk -rvvvvvvvv



    Configure asterisk ODBC files


    /etc/asterisk/res_odbc.conf
    [asterisk]
    enabled => yes
    dsn => asterisk
    username => root
    password => asterisk
    pre-connect => yes


    /etc/asterisk/cdr_adaptive_odbc.conf

    [asterisk]
    connection=asterisk
    table=cdr
    alias start => calldate




    module reload res_odbc.so

    Check connection

    asterisk_realtime*CLI> odbc show all

    ODBC DSN Settings
    -----------------

      Name:   asterisk
      DSN:    asterisk
        Number of active connections: 1 (out of 1)
        Logging: Disabled

    Asterisk relatime configuration 
    /etc/asterisk/sorcery.conf
    [res_pjsip] ; Realtime PJSIP configuration wizard
    endpoint=realtime,ps_endpoints
    auth=realtime,ps_auths
    aor=realtime,ps_aors
    domain_alias=realtime,ps_domain_aliases
    contact=realtime,ps_contacts

    [res_pjsip_endpoint_identifier_ip]
    identify=realtime,ps_endpoint_id_ips

    [res_pjsip_outbound_registration]
    registration=realtime,ps_registrations




    /etc/asterisk/extconfig.conf
    ps_endpoints => odbc,asterisk
    ps_auths => odbc,asterisk
    ps_aors => odbc,asterisk
    ps_domain_aliases => odbc,asterisk
    ps_endpoint_id_ips => odbc,asterisk
    ps_contacts => odbc,asterisk
    ps_registrations = odbc,asterisk


    etc/asterisk/modules.conf
    preload => res_odbc.so
    preload => res_config_odbc.so
    noload => chan_sip.so 


    /etc/asterisk/pjsip.conf
    [transport-udp]
    type=transport
    protocol=udp
    bind=0.0.0.0


    /etc/asterisk/extensions.conf
    [testing]
    exten=>_x.,1,Dial(PJSIP/${EXTEN},120)
    same=>n,hangup()

    RESTART the asterisk service after add the transport


    core restart now


    ALTER TABLE ps_contacts

    ADD COLUMN qualify_2xx_only VARCHAR(255) AFTER qualify_timeout;


    https://hotkey404.com/fix-missing-asterisk-library-error-libasteriskssl-so-1-libasteriskpj-so-2-not-found/



    https://docs.vultr.com/how-to-install-mariadb-on-debian-12


    https://asterisk-rd.blogspot.com/search?q=rocky


    sudo apt install apache2

    sudo apt install php php-mysql php-cli

    sudo systemctl status apache2

    sudo systemctl enable apache2

    sudo systemctl restart apache2


    1. Disable UFW (Temporarily)

    sudo ufw disable

    2. Check UFW Status
    sudo ufw status


    3. Remove UFW (Optional)
    sudo apt remove --purge ufw

    viernes, 31 de enero de 2025

    sábado, 11 de enero de 2025

    getting read variable value from agi GET VAARIABLE

     #!/usr/bin/php

    <?php


    // Send the Read command to capture user input

    echo "EXEC Read opt,demo-thanks,1\n";

    flush(); // Ensure the command is sent to Asterisk


    // Capture the response for EXEC Read

    while (!feof(STDIN)) {

        $line = trim(fgets(STDIN));

        if (strpos($line, '200 result=') === 0) {

            break; // Stop reading after receiving the result

        }

    }


    // Send the GET VARIABLE command to retrieve the value of 'opt'

    echo "GET VARIABLE opt\n";

    flush(); // Ensure the command is sent to Asterisk


    // Initialize a variable to store the result

    $userInput = null;


    // Capture the response for GET VARIABLE

    while (!feof(STDIN)) {

        $line = trim(fgets(STDIN));

        if (preg_match('/^200 result=1 \((.*)\)$/', $line, $matches)) {

            $userInput = $matches[1]; // Store the captured value

            break;

        }

    }


    // Use the captured value

    if ($userInput !== null) {

        echo "VERBOSE \"Captured user input: $userInput\"\n"; // Debug output to Asterisk CLI

        flush();

    }


    ?>