Soporte & Consultoria

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

sábado, 22 de abril de 2023

Originate command example

 channel originate Local/18097243481@internal extension 1020@playing-audio



[internal]

exten => _18[024]9nxxxxxx,1,Dial(PJSIP/${EXTEN}@8001)

same=>n,hangup()



[playing-audio]

exten=>1020,1,Wait(1)

exten=>1020,n,Playback(/home/ambiorixg12/Downloads/tarjeta)

same=>n,hangup()

jueves, 26 de enero de 2023

Asterisk queue cli manipulation

 Get  queue name channel name sort by longest  waiting


 asterisk -x " queue show " | grep SIP | awk '{print $2 " " $4} ' | sort -k 2 -rn 


SIP/voipessential-in-00000022 24:17,

SIP/voipessential-in-00000023 9:32,

SIP/voipessential-in-00000025 3:20,

SIP/voipessential-in-00000024 3:25


 asterisk -x " queue show" | grep has | awk -Fhas '{print $1}'

9000 

6000 

7000 

7205007949 

8000 



SIP/voipessential-in-00000022

Find if  a channel  is  in an specific queue

asterisk  -x " queue show  7205007949" | grep 'SIP/voipessential-in-00000022' | awk '{print $2}'


SIP/voipessential-in-00000022

martes, 24 de enero de 2023

redirect based on afile

 <?php

$queues=file("/home/phpagi-2.20/info.conf");

print_r($queues);


//$queues = explode("-",$queues);


foreach($queues as $key=> $value){


$q=explode("-",$value);


echo shell_exec("php /home/phpagi-2.20/redirect.php $q[0] $q[1]");


}

?>



file content


queue did

support-106

101-201

102-202

103-203


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


<?php
$queue=$argv[1];
 $dst=$argv[2];

//$chan=shell_exec("asterisk -x \" core show channels concise\" | awk -F! '{print $1}' |awk 'NR==1'");
echo $chan=shell_exec("asterisk -x \" queue show $queue\" | grep SIP | awk '{print $2}' |awk 'NR==1'");
$chan =preg_replace('/\s+/', '',$chan);

echo  "$chan\n";
echo $redirectn=shell_exec("/usr/sbin/asterisk -x \"channel redirect $chan redirect,$dst,1\"");


?>



AMI check calls and redirect calls

 <?php

$command="core show  channels";


$socket = fsockopen("10.0.0.200","5038", $errno, $errstr, 10);

      if (!$socket){

        echo "$errstr ($errno)\n";

        }else{

            fputs($socket, "Action: Login\r\n");

            fputs($socket, "UserName: admin\r\n");

            fputs($socket, "Secret: 144\r\n\r\n");

            fputs($socket, "Action: Command\r\n");

            fputs($socket, "Command: $command\r\n\r\n");

           fputs($socket, "Action: Logoff\r\n\r\n");

           while (!feof($socket)){


echo  $result=fgets($socket);


}

}

?>



[public]


exten=>_x.,1,Answer()

same=>n,Set(calls=${SHELL(php /home/phpagi-2.20/calls_ami.php  | grep "active calls"  | awk  '{print $2}')})

same=>n,Set(trunk=issabel)

same=>n,Set(limit=0)

same=>n,GotoIf($["${calls:0:-1}">="${limit}"]?queue)

same=>n,Dial(SIP/${trunk}/${EXTEN})

same=>n,hangup

same=>n(queue),queue(support)

same=>n,hangup





<?php

$queue=$argv[1];

 $dst=$argv[2];


//$chan=shell_exec("asterisk -x \" core show channels concise\" | awk -F! '{print $1}' |awk 'NR==1'");

echo $chan=shell_exec("asterisk -x \" queue show $queue\" | grep SIP | awk '{print $2}' |awk 'NR==1'");

$chan =preg_replace('/\s+/', '',$chan);


echo  "$chan\n";

echo $redirectn=shell_exec("/usr/sbin/asterisk -x \"channel redirect $chan redirect,$dst,1\"");



?>





[redirect]

exten=>_x.,1,Noop(******transferring call***)

same=>n,Dial(SIP/${trunk}/${EXTEN})



jueves, 19 de enero de 2023

pjsip configuration

extensions.conf

;;;;;;;;;;;


[internal]

exten => _6XXX,1,Dial(PJSIP/${EXTEN})

same=>n,hangup()


exten => _*6XXX,1,Dial(${PJSIP_DIAL_CONTACTS(${EXTEN:1})})

same=>n,hangup()



exten => _x.,1,Dial(PJSIP/${EXTEN}@8001)

same=>n,hangup()


;exten => _9NXXNXXXXXX,1,Dial(PJSIP/mytrunk/sip:${EXTEN:1}@203.0.113.1:5060)

;same=>n,hangup()



[from-freepbx]

exten=>_x.,1,Dial(PJSIP/${EXTEN},45)

same=>n,hangup()



[from-gateway]

exten=>8001,1,NooP( incoming call from ${CALLERID(num)})

same=>n,Set(pseudodid=${PJSIP_HEADER(read,From)})

same=>n,Set(pseudodid=${CUT(pseudodid,@,1)})

same=>n,Set(__pseudodid=${CUT(pseudodid,<,1)})

same=>n,Set(__phone=${pseudodid})

same=>n,Set(CALLERID(num)=${phone})

same=>n,Dial(PJSIP/6000)

same=>n,hangup()



;;;;;;;;pjsip.conf;;;;;;;;;;;;;;;;;;;;


[transport-udp]

type=transport

protocol=udp

bind=0.0.0.0:5060

local_net=10.0.0.0/24


;;;;;;;;;;;;;


[6000]

type=endpoint

context=internal

disallow=all

allow=ulaw

allow=alaw

callerid=6000

direct_media=no

force_rport=yes

ice_support=yes

identify_by=username

mailboxes= 6000

moh_suggest=default

rewrite_contact=yes

rtp_symmetric=yes

send_diversion=yes 

send_pai=yes    ; Send the P Asserted Identity header (default: "no")

send_rpid=yes   ; Send the Remote Party ID header (default: "no")

trust_id_inbound=no

trust_id_outbound=no 

allow_transfer=yes

from_user=6000

mwi_from_user=6000

set_var=id=6001;name=ambiorix

auth=6000

aors=6000

direct_media=no

transport=transport-udp


[6000]

type=auth

auth_type=userpass

password=19111@@!

username=6000


[6000]

type=aor

max_contacts= 5

qualify_frequency=1    ; Interval at which to qualify an AoR (default: "0")

authenticate_qualify=no

remove_existing=yes

maximum_expiration=7200        ; Maximum time to keep an AoR (default: "7200")

minimum_expiration=6000  ; Minimum keep alive time for an AoR (default: "60")

default_expiration=3600

mailboxes=6000

authenticate_qualify=no


;;;;;;;;;;;;

[6001]

type=endpoint

context=internal

disallow=all

allow=ulaw

allow=alaw

callerid=6001

direct_media=no

force_rport=yes

ice_support=yes

identify_by=username

mailboxes= 6001

moh_suggest=default

rewrite_contact=yes

rtp_symmetric=yes

send_diversion=yes 

send_pai=yes    ; Send the P Asserted Identity header (default: "no")

send_rpid=yes   ; Send the Remote Party ID header (default: "no")

trust_id_inbound=no

trust_id_outbound=no 

allow_transfer=yes

from_user=6001

mwi_from_user=6001

set_var=id=6001;name=ambiorix

auth=6001

aors=6001

direct_media=no

transport=transport-udp


[6001]

type=auth

auth_type=userpass

password=19111@@!

username=6001


[6001]

type=aor

max_contacts= 5

qualify_frequency=1    ; Interval at which to qualify an AoR (default: "0")

authenticate_qualify=no

remove_existing=yes

maximum_expiration=7200        ; Maximum time to keep an AoR (default: "7200")

minimum_expiration=6000  ; Minimum keep alive time for an AoR (default: "60")

default_expiration=3600

mailboxes=6001

authenticate_qualify=no

;;;;;;;;;;;;;;;;;;;;;;;;;;;;



[6002]

type=endpoint

context=internal

disallow=all

allow=ulaw

allow=alaw

callerid=6002

direct_media=no

force_rport=yes

ice_support=yes

identify_by=username

mailboxes= 6002

moh_suggest=default

rewrite_contact=yes

rtp_symmetric=yes

send_diversion=yes 

send_pai=yes    ; Send the P Asserted Identity header (default: "no")

send_rpid=yes   ; Send the Remote Party ID header (default: "no")

trust_id_inbound=no

trust_id_outbound=no 

allow_transfer=yes

from_user=6002

mwi_from_user=6002

set_var=id=6001;name=ambiorix

auth=6002

aors=6002

direct_media=no

transport=transport-udp


[6002]

type=auth

auth_type=userpass

password=19111@@!

username=6002


[6002]

type=aor

max_contacts= 5

qualify_frequency=1    ; Interval at which to qualify an AoR (default: "0")

authenticate_qualify=no

remove_existing=yes

maximum_expiration=7200        ; Maximum time to keep an AoR (default: "7200")

minimum_expiration=6000  ; Minimum keep alive time for an AoR (default: "60")

default_expiration=3600

mailboxes=6000

authenticate_qualify=no


;;;;;;;;;;;;trunks ;;;;;;;;;;;;;;;;;;;;;;


[twilio]

type=aor

contact=sip:ambiorixg12.pstn.us1.twilio.com:5060

qualify_frequency=100

authenticate_qualify=no

remove_existing=yes

maximum_expiration=7200        ; Maximum time to keep an AoR (default: "7200")

minimum_expiration=6000  ; Minimum keep alive time for an AoR (default: "60")

default_expiration=3600 

authenticate_qualify=no



[twilio]

type=endpoint

context=from-trunk

disallow=all

allow=ulaw

allow=alaw

direct_media=no

force_rport=yes

ice_support=yes

moh_suggest=default

rewrite_contact=yes

rtp_symmetric=yes

send_diversion=yes

send_pai=yes    ; Send the P Asserted Identity header (default: "no")

send_rpid=yes   ; Send the Remote Party ID header (default: "no")

trust_id_inbound=yes

trust_id_outbound=yes

allow_transfer=yes

from_user=twilio

set_var=id=twilio;name=twilio_trunk

aors=twilio

direct_media=no

transport=transport-udp



[twilio]

type=identify

endpoint=twilio

match=54.172.60.0/8

match=68.183.142.204






[8001]

type=endpoint

context=from-gateway

disallow=all

allow=ulaw

allow=alaw

direct_media=no

force_rport=yes

ice_support=yes

identify_by=username

moh_suggest=default

rewrite_contact=yes

rtp_symmetric=yes

send_diversion=yes 

send_pai=yes    ; Send the P Asserted Identity header (default: "no")

send_rpid=yes   ; Send the Remote Party ID header (default: "no")

trust_id_inbound=yes

trust_id_outbound=yes 

allow_transfer=yes

auth=8001

aors=8001

direct_media=no

transport=transport-udp


[8001]

type=auth

auth_type=userpass

password=19111139z733

username=8001


[8001]

type=aor

max_contacts= 5

qualify_frequency=1    ; Interval at which to qualify an AoR (default: "0")

authenticate_qualify=no

remove_existing=yes

maximum_expiration=7200        ; Maximum time to keep an AoR (default: "7200")

minimum_expiration=6000  ; Minimum keep alive time for an AoR (default: "60")

default_expiration=3600

mailboxes=8001

authenticate_qualify=no


;;;;;;;;;;registration;;;;;;;;;;;;


[FreePBX]

type=auth

auth_type=userpass

password=rz#6c2a6aa9e3f52e

username=311



[FreePBX]

type = registration

server_uri = sip:155.138.223.92:28641;udp

client_uri = sip:311@155.138.223.92:28641;udp

outbound_auth=FreePBX

contact_user=6002  ;send incoming calls to this extension

expiration=120

line=yes

endpoint=FreePBX

max_retries=10


[FreePBX]

type=endpoint

context=from-freepbx ; context for incomings

disallow=all

allow=ulaw

allow=alaw

direct_media=no

force_rport=yes

ice_support=ye

identify_by=ip ; this will  aut incoming callsh base on  the ip on the identify section

moh_suggest=default

rewrite_contact=yes

rtp_symmetric=yes

send_diversion=yes

send_pai=yes    ; Send the P Asserted Identity header (default: "no")

send_rpid=yes   ; Send the Remote Party ID header (default: "no")

trust_id_inbound=yes

trust_id_outbound=yes

allow_transfer=yes

direct_media=no

transport=transport-udp


[FreePBX]

type=identify

endpoint=FreePBX

match=155.138.223.92 ;carrier source ip


https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Configuration_res_pjsip_outbound_registration#Asterisk20Configuration_res_pjsip_outbound_registration-registration_max_retries

https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Configuration_res_pjsip

https://wiki.asterisk.org/wiki/display/AST/res_pjsip+Configuration+Examples

lunes, 5 de diciembre de 2022

Asterisk Project… Conferencing Applications ConfBridge


Overview

Asterisk, since its early days, has offered a conferencing application called MeetMe (app_meetme.so). MeetMe provides DAHDI-mixed software-based bridges for multi-party audio conferencing. MeetMe is used by nearly all Asterisk implementations - small office, call center, large office, feature-server, third-party application, etc. It has been extremely successful as an audio bridge.
Over time, several significant limitations of MeetMe have been encountered by its users. Among these are two of distinction: MeetMe requires DAHDI for mixing, and is thus limited to 8kHz (PSTN) audio sampling rates; and MeetMe is delivered in a fairly static form, it does not provide extensive configuration options.
To address these limitations, a new conferencing application, based upon the ConfBridge application introduced in Asterisk 1.6.0, is now available with Asterisk 10. This new ConfBridge application replaces the older ConfBridge application. It is not intended to be a direct replacement for MeetMe, it will not provide feature parity with the MeetMe application. Instead, the new ConfBridge application delivers a completely redesigned set of functionality that most users will find more than sufficient, and in many ways better, for their conferencing needs.