Added PJSIP support for Asterisk 16

git-svn-id: svn://192.168.202.10@3505 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2021-08-27 14:36:09 +00:00
parent a5c6987149
commit 233b9a5847
15 changed files with 844 additions and 52 deletions
+2
View File
@@ -682,6 +682,8 @@ OTHER CHANGES:
189. Changed agc/dispo_send_email.php to only allow attachments in the new
"agc/attachments" web directory.
190. Added Asterisk 16 "PJSIP" compatibility
+355 -3
View File
@@ -151,9 +151,10 @@
# 210605-1407 - Added purging of vicidial_tiltx_shaken_log log entries
# 210630-1630 - Remove commas from mailbox name before writing to conf file, use "Full Name" for a phone's mailbox name, if set
# 210712-2312 - Added purging of vicidial_lead_24hour_calls table
# 210827-0939 - Added PJSIP compatibility
#
$build = '210712-2312';
$build = '210827-0939';
$DB=0; # Debug flag
$teodDB=0; # flag to log Timeclock End of Day processes to log file
@@ -3025,7 +3026,122 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$i++;
}
##### BEGIN Generate the SIP carriers for this server_ip #####
##### END Generate the SIP carriers for this server_ip #####
##### BEGIN Generate the PJSIP_WIZ carriers for this server_ip #####
$stmtA = "SELECT carrier_id,carrier_name,registration_string,template_id,account_entry,globals_string,dialplan_entry,carrier_description FROM vicidial_server_carriers where server_ip IN('$server_ip','0.0.0.0') and active='Y' and protocol='PJSIP_WIZ' order by carrier_id;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$i=0;
while ($sthArows > $i)
{
@aryA = $sthA->fetchrow_array;
$carrier_id[$i] = $aryA[0];
$carrier_name[$i] = $aryA[1];
$registration_string[$i] = $aryA[2];
$template_id[$i] = $aryA[3];
$account_entry[$i] = $aryA[4];
$globals_string[$i] = $aryA[5];
$dialplan_entry[$i] = $aryA[6];
$carrier_description[$i] = $aryA[7];
$i++;
}
$sthA->finish();
$i=0;
while ($sthArows > $i)
{
$template_contents[$i]='';
if ( (length($template_id[$i]) > 1) && ($template_id[$i] !~ /--NONE--/) )
{
$stmtA = "SELECT template_contents FROM vicidial_conf_templates where template_id='$template_id[$i]';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthBrows=$sthA->rows;
if ($sthBrows > 0)
{
@aryA = $sthA->fetchrow_array;
$template_contents[$i] = "$aryA[0]";
}
$sthA->finish();
}
$ext .= "$globals_string[$i]\n";
# PJSIP doesnt use registration strings
# Registrion is defined in the account entry
# $pjsip .= "$registration_string[$i]\n";
$Lext .= "; VICIDIAL Carrier: $carrier_id[$i] - $carrier_name[$i]\n";
if (length($carrier_description[$i]) > 0) {$Lext .= "; $carrier_description[$i]\n";}
$Lext .= "$dialplan_entry[$i]\n";
$Lpjsipw .= "; VICIDIAL Carrier: $carrier_id[$i] - $carrier_name[$i]\n";
if (length($carrier_description[$i]) > 0) {$Lpjsipw .= "; $carrier_description[$i]\n";}
$Lpjsipw .= "$account_entry[$i]\n";
$Lpjsipw .= "$template_contents[$i]\n";
$i++;
}
##### END Generate the PJSIP_WIZ carriers for this server_ip #####
##### BEGIN Generate the PJSIP carriers for this server_ip #####
$stmtA = "SELECT carrier_id,carrier_name,registration_string,template_id,account_entry,globals_string,dialplan_entry,carrier_description FROM vicidial_server_carriers where server_ip IN('$server_ip','0.0.0.0') and active='Y' and protocol='PJSIP' order by carrier_id;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$i=0;
while ($sthArows > $i)
{
@aryA = $sthA->fetchrow_array;
$carrier_id[$i] = $aryA[0];
$carrier_name[$i] = $aryA[1];
$registration_string[$i] = $aryA[2];
$template_id[$i] = $aryA[3];
$account_entry[$i] = $aryA[4];
$globals_string[$i] = $aryA[5];
$dialplan_entry[$i] = $aryA[6];
$carrier_description[$i] = $aryA[7];
$i++;
}
$sthA->finish();
$i=0;
while ($sthArows > $i)
{
$template_contents[$i]='';
if ( (length($template_id[$i]) > 1) && ($template_id[$i] !~ /--NONE--/) )
{
$stmtA = "SELECT template_contents FROM vicidial_conf_templates where template_id='$template_id[$i]';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthBrows=$sthA->rows;
if ($sthBrows > 0)
{
@aryA = $sthA->fetchrow_array;
$template_contents[$i] = "$aryA[0]";
}
$sthA->finish();
}
$ext .= "$globals_string[$i]\n";
# PJSIP doesnt use registration strings
# Registrion is defined in the account entry
# $pjsip .= "$registration_string[$i]\n";
$Lext .= "; VICIDIAL Carrier: $carrier_id[$i] - $carrier_name[$i]\n";
if (length($carrier_description[$i]) > 0) {$Lext .= "; $carrier_description[$i]\n";}
$Lext .= "$dialplan_entry[$i]\n";
$Lpjsip .= "; VICIDIAL Carrier: $carrier_id[$i] - $carrier_name[$i]\n";
if (length($carrier_description[$i]) > 0) {$Lpjsip .= "; $carrier_description[$i]\n";}
$Lpjsip .= "$account_entry[$i]\n";
$Lpjsip .= "$template_contents[$i]\n";
$i++;
}
##### END Generate the PJSIP carriers for this server_ip #####
$Pext .= "\n";
@@ -3368,6 +3484,199 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
##### END Generate the SIP phone entries #####
##### BEGIN Generate the PJSIP phone entries #####
$stmtA = "SELECT extension,dialplan_number,voicemail_id,pass,template_id,conf_override,email,template_id,conf_override,outbound_cid,fullname,phone_context,phone_ring_timeout,conf_secret,delete_vm_after_email,codecs_list,codecs_with_template,voicemail_timezone,voicemail_options,voicemail_instructions,unavail_dialplan_fwd_exten,unavail_dialplan_fwd_context FROM phones where server_ip='$server_ip' and protocol='PJSIP' and active='Y' order by extension;";
# print "$stmtA\n";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$i=0;
while ($sthArows > $i)
{
@aryA = $sthA->fetchrow_array;
$extension[$i] = $aryA[0];
$dialplan[$i] = $aryA[1];
$voicemail[$i] = $aryA[2];
$pass[$i] = $aryA[3];
$template_id[$i] = $aryA[4];
$conf_override[$i] = $aryA[5];
$email[$i] = $aryA[6];
$template_id[$i] = $aryA[7];
$conf_override[$i] = $aryA[8];
$outbound_cid[$i] = $aryA[9];
$fullname[$i] = $aryA[10];
$phone_context[$i] = $aryA[11];
$phone_ring_timeout[$i] = $aryA[12];
$conf_secret[$i] = $aryA[13];
$delete_vm_after_email[$i] = $aryA[14];
$codecs_list[$i] = $aryA[15];
$codecs_with_template[$i] = $aryA[16];
$voicemail_timezone[$i] = $aryA[17];
$voicemail_options[$i] = $aryA[18];
$voicemail_instructions[$i] = $aryA[19];
$unavail_dialplan_fwd_exten[$i] = $aryA[20];
$unavail_dialplan_fwd_context[$i] = $aryA[21];
if ( (length($SSdefault_codecs) > 2) && (length($codecs_list[$i]) < 3) )
{$codecs_list[$i] = $SSdefault_codecs;}
$active_dialplan_numbers .= "'$aryA[1]',";
$i++;
}
$sthA->finish();
$i=0;
while ($sthArows > $i)
{
$conf_entry_written=0;
$template_contents[$i]='';
$Pcodec='';
if (length($codecs_list[$i]) > 2)
{
if ($codecs_list[$i] =~ /gsm/i) {$Pcodec .= "endpoint/allow=gsm\n";}
if ($codecs_list[$i] =~ /ulaw|u-law/i) {$Pcodec .= "endpoint/allow=ulaw\n";}
if ($codecs_list[$i] =~ /alaw|a-law/i) {$Pcodec .= "endpoint/allow=alaw\n";}
if ($codecs_list[$i] =~ /g719|g\.719/i) {$Pcodec .= "endpoint/allow=g719\n";}
if ($codecs_list[$i] =~ /g722|g\.722/i) {$Pcodec .= "endpoint/allow=g722\n";}
if ($codecs_list[$i] =~ /g723|g\.723|g723\.1/i) {$Pcodec .= "endpoint/allow=g723\n";}
if ($codecs_list[$i] =~ /g726|g\.726/i) {$Pcodec .= "endpoint/allow=g726\n";}
if ($codecs_list[$i] =~ /g729|g\.729|g729a/i) {$Pcodec .= "endpoint/allow=g729\n";}
if ($codecs_list[$i] =~ /ilbc/i) {$Pcodec .= "endpoint/allow=ilbc\n";}
if ($codecs_list[$i] =~ /lpc10/i) {$Pcodec .= "endpoint/allow=lpc10\n";}
if ($codecs_list[$i] =~ /speex/i) {$Pcodec .= "endpoint/allow=speex\n";}
if ($codecs_list[$i] =~ /adpcm/i) {$Pcodec .= "endpoint/allow=adpcm\n";}
if ($codecs_list[$i] =~ /opus/i) {$Pcodec .= "endpoint/allow=opus\n";}
if ($codecs_list[$i] =~ /slin/i) {$Pcodec .= "endpoint/allow=slin\n";}
if (length($Pcodec) > 2)
{$Pcodec = "endpoint/disallow=all\n$Pcodec";}
}
else
{
$Pcodec .= "endpoint/disallow=all\n";
$Pcodec .= "endpoint/allow=gsm\n";
$Pcodec .= "endpoint/allow=ulaw\n";
}
if ($DBXXX > 0) {print "PJSIP|$extension[$i]|$codecs_list[$i]|$Pcodec\n";}
### If Phone has a template defined :
if ( (length($template_id[$i]) > 1) && ($template_id[$i] !~ /--NONE--/) )
{
$stmtA = "SELECT template_contents FROM vicidial_conf_templates where template_id='$template_id[$i]';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthBrows=$sthA->rows;
if ($sthBrows > 0)
{
@aryA = $sthA->fetchrow_array;
$template_contents[$i] = "$aryA[0]";
$template_contents[$i] =~ s/\r//g;
$Ppjsipw .= "\n\[$extension[$i]\]\n";
$Ppjsipw .= "type=wizard\n";
$Ppjsipw .= "accepts_auth=yes\n";
$Ppjsipw .= "accepts_registrations=yes\n";
$Ppjsipw .= "inbound_auth/username=$extension[$i]\n";
$Ppjsipw .= "inbound_auth/password=$conf_secret[$i]\n";
if ( (length($fullname[$i])>0) || (length($outbound_cid[$i])>0) )
{
$Ppjsipw .= "endpoint/callerid=\"$fullname[$i]\" <$outbound_cid[$i]>\n";
}
$Ppjsipw .= "endpoint/mailboxes=$voicemail[$i]\n";
if (($codecs_with_template[$i] > 0) || (!($template_contents[$i] =~ /allow=/i)))
{$Ppjsipw .= "$Pcodec";}
$Ppjsipw .= "$template_contents[$i]\n";
$conf_entry_written++;
}
$sthA->finish();
}
### If Phone has a Conf Override defined :
if (length($conf_override[$i]) > 10)
{
if ($conf_entry_written < 1)
{$Ppjsipw .= "\n\[$extension[$i]\]\n";}
$Ppjsipw .= "$conf_override[$i]\n";
$conf_entry_written++;
}
### If Phone does not have a Conf Override or Template defined :
if ($conf_entry_written < 1)
{
$Ppjsipw .= "\n\[$extension[$i]\]\n";
$Ppjsipw .= "type=wizard\n";
$Ppjsipw .= "accepts_auth=yes\n";
$Ppjsipw .= "accepts_registrations=yes\n";
$Ppjsipw .= "inbound_auth/username=$extension[$i]\n";
$Ppjsipw .= "inbound_auth/password=$conf_secret[$i]\n";
$Ppjsipw .= "aor/max_contacts = 1\n";
$Ppjsipw .= "aor/maximum_expiration = 3600\n";
$Ppjsipw .= "aor/minimum_expiration = 60\n";
$Ppjsipw .= "aor/default_expiration = 120\n";
$Ppjsipw .= "aor/qualify_frequency = 15\n";
$Ppjsipw .= "endpoint/context=$phone_context[$i]\n";
if ( (length($fullname[$i])>0) || (length($outbound_cid[$i])>0) )
{
$Ppjsipw .= "endpoint/callerid=\"$fullname[$i]\" <$outbound_cid[$i]>\n";
}
$Ppjsipw .= "endpoint/mailboxes=$voicemail[$i]\n";
$Ppjsipw .= "$Pcodec";
$Ppjsipw .= "endpoint/dtmf_mode = rfc4733\n";
$Ppjsipw .= "endpoint/trust_id_inbound = no\n";
$Ppjsipw .= "endpoint/send_rpid = yes\n";
$Ppjsipw .= "endpoint/inband_progress = no\n";
$Ppjsipw .= "endpoint/tos_audio = ef\n";
$Ppjsipw .= "endpoint/language = en\n";
$Ppjsipw .= "endpoint/rtp_symmetric = yes\n";
$Ppjsipw .= "endpoint/rewrite_contact = yes\n";
$Ppjsipw .= "endpoint/rtp_timeout = 60\n";
$Ppjsipw .= "endpoint/use_ptime = yes\n";
$Ppjsipw .= "endpoint/moh_suggest = default\n";
$Ppjsipw .= "endpoint/direct_media = no\n\n";
}
### Dialplan generation :
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
{
$Pext .= "exten => $dialplan[$i],1,Dial(PJSIP/$extension[$i]|$phone_ring_timeout[$i]|)\n";
}
else
{
$Pext .= "exten => $dialplan[$i],1,Dial(PJSIP/$extension[$i],$phone_ring_timeout[$i],)\n";
}
if (length($unavail_dialplan_fwd_exten[$i]) > 0)
{
if (length($unavail_dialplan_fwd_context[$i]) < 1)
{$unavail_dialplan_fwd_context[$i] = 'default';}
$Pext .= "exten => $dialplan[$i],2,Goto($unavail_dialplan_fwd_context[$i],$unavail_dialplan_fwd_exten[$i],1)\n";
}
else
{
if ($voicemail_instructions[$i] =~ /Y/)
{
$Pext .= "exten => $dialplan[$i],2,Goto(default,85026666666666$voicemail[$i],1)\n";
}
else
{
$Pext .= "exten => $dialplan[$i],2,Goto(default,85026666666667$voicemail[$i],1)\n";
}
}
if (!(( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6)))
{
$Pext .= "exten => $dialplan[$i],3,Hangup()\n";
}
### VM generation
if ($delete_vm_after_email[$i] =~ /Y/)
{$vm .= "$voicemail[$i] => $pass[$i],$extension[$i] Mailbox,$email[$i],,|delete=yes|tz=$voicemail_timezone[$i]|$voicemail_options[$i]\n";}
else
{$vm .= "$voicemail[$i] => $pass[$i],$extension[$i] Mailbox,$email[$i],,|delete=no|tz=$voicemail_timezone[$i]|$voicemail_options[$i]\n";}
$i++;
}
##### END Generate the PJSIP phone entries #####
if ( ($SSgenerate_cross_server_exten > 0) and (length($active_server_ips) > 7) )
{
@@ -4157,6 +4466,8 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
open(ext, ">/etc/asterisk/BUILDextensions-vicidial.conf") || die "can't open /etc/asterisk/BUILDextensions-vicidial.conf: $!\n";
open(iax, ">/etc/asterisk/BUILDiax-vicidial.conf") || die "can't open /etc/asterisk/BUILDiax-vicidial.conf: $!\n";
open(sip, ">/etc/asterisk/BUILDsip-vicidial.conf") || die "can't open /etc/asterisk/BUILDsip-vicidial.conf: $!\n";
open(pjsip,">/etc/asterisk/BUILDpjsip-vicidial.conf") || die "can't open /etc/asterisk/BUILDpjsip-vicidial.conf: $!\n";
open(pjsipw,">/etc/asterisk/BUILDpjsip_wizard-vicidial.conf") || die "can't open /etc/asterisk/BUILDpjsip_wizard-vicidial.conf: $!\n";
open(vm, ">/etc/asterisk/BUILDvoicemail-vicidial.conf") || die "can't open /etc/asterisk/BUILDvoicemail-vicidial.conf: $!\n";
open(moh, ">/etc/asterisk/BUILDmusiconhold-vicidial.conf") || die "can't open /etc/asterisk/BUILDmusiconhold-vicidial.conf: $!\n";
open(mm, ">/etc/asterisk/BUILDmeetme-vicidial.conf") || die "can't open /etc/asterisk/BUILDmeetme-vicidial.conf: $!\n";
@@ -4222,6 +4533,22 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
print sip "$Psip\n";
print sip "\n; END OF FILE Last Forced System Reload: $SSreload_timestamp\n";
print pjsip "; WARNING- THIS FILE IS AUTO-GENERATED BY VICIDIAL, ANY EDITS YOU MAKE WILL BE LOST\n";
print pjsip "\n; PJSIP General Settings: \n\n";
print pjsip "$pjsip\n";
print pjsip "\n; PJSIP Carrier Settings: \n\n";
print pjsip "$Lpjsip\n";
print pjsip "\n; END OF FILE Last Forced System Reload: $SSreload_timestamp\n";
print pjsipw "; WARNING- THIS FILE IS AUTO-GENERATED BY VICIDIAL, ANY EDITS YOU MAKE WILL BE LOST\n";
print pjsipw "\n; PJSIP_WIZ General Settings: \n\n";
print pjsipw "$pjsipw\n";
print pjsipw "\n; PJSIP_WIZ Carrier Settings: \n\n";
print pjsipw "$Lpjsipw\n";
print pjsipw "\n; PJSIP_WIZ Phone Settings: \n\n";
print pjsipw "$Ppjsipw\n";
print pjsipw "\n; END OF FILE Last Forced System Reload: $SSreload_timestamp\n";
# print vm "; WARNING- THIS FILE IS AUTO-GENERATED BY VICIDIAL, ANY EDITS YOU MAKE WILL BE LOST\n";
print vm "$vm_header_content\n";
print vm "$vm\n";
@@ -4238,6 +4565,8 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
close(ext);
close(iax);
close(sip);
close(pjsip);
close(pjsipw);
close(vm);
close(moh);
close(mm);
@@ -4268,6 +4597,12 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
if ( !-e ('/etc/asterisk/sip-vicidial.conf'))
{`echo -e \"; END OF FILE\n\" > /etc/asterisk/sip-vicidial.conf`;}
if ( !-e ('/etc/asterisk/pjsip-vicidial.conf'))
{`echo -e \"; END OF FILE\n\" > /etc/asterisk/pjsip-vicidial.conf`;}
if ( !-e ('/etc/asterisk/pjsip_wizard-vicidial.conf'))
{`echo -e \"; END OF FILE\n\" > /etc/asterisk/pjsip_wizard-vicidial.conf`;}
if ( !-e ('/etc/asterisk/voicemail.conf'))
{`echo -e \"; END OF FILE\n\" > /etc/asterisk/voicemail.conf`;}
@@ -4282,6 +4617,8 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$extCMP = compare("/etc/asterisk/BUILDextensions-vicidial.conf","/etc/asterisk/extensions-vicidial.conf");
$iaxCMP = compare("/etc/asterisk/BUILDiax-vicidial.conf","/etc/asterisk/iax-vicidial.conf");
$sipCMP = compare("/etc/asterisk/BUILDsip-vicidial.conf","/etc/asterisk/sip-vicidial.conf");
$pjsipCMP = compare("/etc/asterisk/BUILDpjsip-vicidial.conf","/etc/asterisk/pjsip-vicidial.conf");
$pjsipwCMP = compare("/etc/asterisk/BUILDpjsip_wizard-vicidial.conf","/etc/asterisk/pjsip_wizard-vicidial.conf");
$vmCMP = compare("/etc/asterisk/BUILDvoicemail-vicidial.conf","/etc/asterisk/voicemail.conf");
$mohCMP = compare("/etc/asterisk/BUILDmusiconhold-vicidial.conf","/etc/asterisk/musiconhold-vicidial.conf");
$mmCMP = compare("/etc/asterisk/BUILDmeetme-vicidial.conf","/etc/asterisk/meetme-vicidial.conf");
@@ -4351,6 +4688,20 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
if ($DB) {print "sip reload\n";}
sleep(1);
}
if ($pjsipCMP > 0)
{
`cp -f /etc/asterisk/BUILDpjsip-vicidial.conf /etc/asterisk/pjsip-vicidial.conf`;
`screen -XS asterisk eval 'stuff "pjsip reload\015"'`;
if ($DB) {print "pjsip reload\n";}
sleep(1);
}
if ($pjsipwCMP > 0)
{
`cp -f /etc/asterisk/BUILDpjsip_wizard-vicidial.conf /etc/asterisk/pjsip_wizard-vicidial.conf`;
`screen -XS asterisk eval 'stuff "pjsip reload\015"'`;
if ($DB) {print "pjsip reload\n";}
sleep(1);
}
if ($iaxCMP > 0)
{
`cp -f /etc/asterisk/BUILDiax-vicidial.conf /etc/asterisk/iax-vicidial.conf`;
@@ -4384,10 +4735,11 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
`rm -f /etc/asterisk/BUILDextensions-vicidial.conf`;
`rm -f /etc/asterisk/BUILDiax-vicidial.conf`;
`rm -f /etc/asterisk/BUILDsip-vicidial.conf`;
`rm -f /etc/asterisk/BUILDpjsip-vicidial.conf`;
`rm -f /etc/asterisk/BUILDpjsip_wizard-vicidial.conf`;
# `rm -f /etc/asterisk/BUILDvoicemail-vicidial.conf`;
`rm -f /etc/asterisk/BUILDmusiconhold-vicidial.conf`;
`rm -f /etc/asterisk/BUILDmeetme-vicidial.conf`;
}
################################################################################
##### END Creation of auto-generated conf files
+7 -4
View File
@@ -17,6 +17,7 @@
# 190121-1505 - Added RA_USER_PHONE On-Hook CID to solve last RINGAGENT issues
# 201119-2119 - Fix for time logging inserts/updates to database
# 210315-1045 - Populate the CIDname in live_sip_channels/live_channels tables, Issue #1255
# 210827-0930 - Added PJSIP compatibility
#
# constants
@@ -770,6 +771,7 @@ sub process_channels
$extension = $channel_ref->{'ApplicationData'};
$extension =~ s/^SIP\///gi; # remove "SIP/" from the beginning
$extension =~ s/^PJSIP\///gi; # remove "PJSIP/" from the beginning
$extension =~ s/-\S+$//gi; # remove everything after a -
$extension =~ s/\|.*//gi; # remove everything after the |
$extension =~ s/,.*//gi; # remove everything after the ,
@@ -779,7 +781,7 @@ sub process_channels
{$CIDnameSQL =~ substr($CIDnameSQL,0,30);}
# make sure the channel is a channel type we care about
if ( $channel_ref->{'Channel'} =~ /^IAX2|^SIP|^Local|^DAHDI/)
if ( $channel_ref->{'Channel'} =~ /^IAX2|^SIP|^Local|^DAHDI|^PJSIP/)
{
# assume all channels are trunks then check if they are not
$line_type = 'TRUNK';
@@ -810,16 +812,17 @@ sub process_channels
$counts->{'clients'}++;
}
}
elsif ($channel_ref->{'Channel'} =~ /^SIP/)
elsif (($channel_ref->{'Channel'} =~ /^SIP/) || ($channel_ref->{'Channel'} =~ /^PJSIP/))
{
# clean up the channel to get the extension
$channel_match =~ s/-\S+$//gi;
$channel_match =~ s/^SIP\///gi;
$channel_match =~ s/^PJSIP\///gi;
$channel_match =~ s/\*/\\\*/gi;
# if the channels extension is in phones
# and it is and SIP phone then it is a client
if ( ( exists ( $phones_ref->{ $channel_match } ) ) && ( $phones_ref->{ $channel_match }->{'protocol'} eq 'SIP' ) )
if ( ( exists ( $phones_ref->{ $channel_match } ) ) && ( ( $phones_ref->{ $channel_match }->{'protocol'} eq 'SIP' ) || ( $phones_ref->{ $channel_match }->{'protocol'} eq 'PJSIP' )) )
{
$line_type = 'CLIENT';
$counts->{'sip'}++;
@@ -1289,7 +1292,7 @@ sub get_phones_settings
$zap_phones++;
$zap_phone_list .= "$key|";
}
elsif ( $phones_ref->{$key}->{'protocol'} eq 'SIP' )
elsif (( $phones_ref->{$key}->{'protocol'} eq 'SIP' ) || ( $phones_ref->{$key}->{'protocol'} eq 'PJSIP' ))
{
$sip_phones++;
$sip_phone_list .= "$key|";
+4 -3
View File
@@ -90,6 +90,7 @@
# 210606-1007 - Added TILTX features for pre-carrier call filtering
# 210718-0358 - Fixes for 24-Hour Call Count Limits with standard Auto-Alt-Dialing
# 210719-1521 - Added additional state override methods for call_limit_24hour
# 210827-0936 - Added PJSIP compatibility
#
# defaults for PreFork
@@ -440,7 +441,7 @@ sub process_request
if ($AGILOG) {$agi_string = "+++++ CALL LOG START : $now_date"; &agi_output;}
if ($channel =~ /^SIP/) {$channel =~ s/-.*//gi;}
if ($channel =~ /^SIP|^PJSIP/) {$channel =~ s/-.*//gi;}
if ($channel =~ /^IAX2/) {$channel =~ s/\/\d+$//gi;}
if ($channel =~ /^Zap\/|^DAHDI\//)
{
@@ -491,7 +492,7 @@ sub process_request
if ($AGILOG) {$agi_string = $channel_group . ": $aryA[0]|$channel_line|"; &agi_output;}
}
### This section breaks the outbound dialed number down(or builds it up) to a 10 digit number and gives it a description
if ( ($channel =~ /^SIP|^IAX2/) || ( ($is_client_phone > 0) && (length($channel_group) < 1) ) )
if ( ($channel =~ /^SIP|^PJSIP|^IAX2/) || ( ($is_client_phone > 0) && (length($channel_group) < 1) ) )
{
if ( ($extension =~ /^901144/) && (length($extension)==16) ) #test 207 608 6400
{$extension =~ s/^9//gi; $channel_group = 'Outbound Intl UK';}
@@ -508,7 +509,7 @@ sub process_request
if ($is_client_phone > 0)
{$channel_group = 'Client Phone';}
$SIP_ext = $channel; $SIP_ext =~ s/SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\///gi;
$SIP_ext = $channel; $SIP_ext =~ s/PJSIP\/|SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\///gi;
$number_dialed = $extension;
$extension = $SIP_ext;
+55 -2
View File
@@ -1,4 +1,4 @@
Sending email after agent dispositions a call Started: 2015-08-06 Updated: 2021-08-23
Sending email after agent dispositions a call Started: 2015-08-06 Updated: 2021-08-25
These instructions will show you how to set up automatic emails to be sent out when an agent dispositions a call with a specific defined "sale status".
@@ -132,5 +132,58 @@ We hope you enjoy your stuff, and happy roadrunner chasing!
ACME Support Department
312-555-1212
email_body_end
HERE IS AN EXAMPLE NO AGENT CALL URL ENTRY FROM AN IN-GROUP FOR THIS FEATURE:
VARhttp://server/agc/dispo_send_email.php?container_id=INGROUP_NA_EMAIL-test&lead_id=--A--lead_id--B--&call_id=--A--call_id--B--&dispo=--A--dispo--B--&user=NOAGENTURL&pass=--A--call_id--B--&sale_status=TIMEOT---NANQUE---DROP---AFTHRS&log_to_file=1
HERE IS AN EXAMPLE SETTINGS CONTAINER TO SEND OUT AN EMAIL FROM THE ABOVE EXAMPLE:
; destination email
email_to => vicidialemailtesting@gmail.com
; sending email address
email_from => customertesting@vicidial.com
; subject of the email
email_subject => --A--dispo--B-- - 001 - --A--phone_number--B--
; body of the email
email_body_begin =>
Hello,
This email is to let you know a call from --A--phone_number--B-- has gone unanswered from in-group test.
Here is a summary call information:
In group: test In-Group
phone_number: --A--phone_number--B--
lead_id: --A--lead_id--B--
list_id: --A--list_id--B--
list_name: --A--list_name--B--
first_name: --A--first_name--B--
last_name: --A--last_name--B--
address1: --A--address1--B--
address2: --A--address2--B--
city: --A--city--B--
state: --A--state--B--
postal_code: --A--postal_code--B--
gender: --A--gender--B--
date_of_birth: --A--date_of_birth--B--
alt_phone: --A--alt_phone--B--
email: --A--email--B--
comments: --A--comments--B--
user: --A--user--B--
closer: --A--user--B--
call_id: --A--call_id--B--
ACME Call Center
email_body_end
+45
View File
@@ -0,0 +1,45 @@
[global]
type = global
contact_expiration_check_interval = 30
debug = no
default_from_user = Asterisk
default_outbound_endpoint = default_outbound_endpoint
default_realm = Asterisk
default_voicemail_extension = 8500
disable_multi_domain = false
endpoint_identifier_order = ip,username,anonymous
ignore_uri_user_options = false
keep_alive_interval = 90
max_forwards = 70
max_initial_qualify_time = 0
mwi_disable_initial_unsolicited = false
mwi_tps_queue_high = 500
mwi_tps_queue_low = -1
norefersub = yes
;regcontext = myregs
send_contact_status_on_update_registration = yes
taskprocessor_overload_trigger = global
unidentified_request_count = 5
unidentified_request_period = 5
unidentified_request_prune_interval = 30
use_callerid_contact = no
user_agent = Asterisk
[transport-udp]
type = transport
protocol = udp
bind = 0.0.0.0:5060
external_media_address = 190.124.44.160
external_signaling_address = 190.124.44.160
local_net = 192.168.0.0/255.255.0.0
local_net = 10.0.0.0/255.0.0.0
local_net = 172.16.0.0/12
local_net = 169.254.0.0/255.255.0.0
tos = cs3
[transport-wss]
type = transport
protocol = wss
bind = 0.0.0.0
#include "pjsip-vicidial.conf"
@@ -0,0 +1,165 @@
; PJSIP Wizard Configuration Samples and Quick Reference
;
; This file has several very basic configuration examples, to serve as a quick
; reference to jog your memory when you need to write up a new configuration.
; It is not intended to teach PJSIP configuration or serve as an exhaustive
; reference of options and potential scenarios.
;
; This file has two main sections.
; First, manually written examples to serve as a handy reference.
; Second, a list of all possible PJSIP config options by section. This is
; pulled from the XML config help. It only shows the synopsis for every item.
; If you want to see more detail please check the documentation sources
; mentioned at the top of this file.
; ============================================================================
; NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
;
; This file does not maintain the complete option documentation.
; ============================================================================
; Documentation
;
; The official documentation is at http://wiki.asterisk.org
; You can read the XML configuration help via Asterisk command line with
; "config show help res_pjsip_config_wizard", then you can drill down through
; the various sections and their options.
;
;============EXAMPLE WIZARD CONFIGURATION FOR A PHONE=======================
; This config would create an endpoint, aor with dynamic contact, inbound
; auth, a phoneprov object and a dialplan hint for extension 1000.
;[myphone]
;type = wizard
;accepts_auth = yes
;accepts_registrations = yes
;has_phoneprov = yes
;transport = ipv4
;has_hint = yes
;hint_exten = 1000
;inbound_auth/username = testname
;inbound_auth/password = test password
;endpoint/allow = ulaw
;endpoint/context = default
;phoneprov/MAC = 001122aa4455
;phoneprov/PROFILE = profile1
;============EXAMPLE WIZARD CONFIGURATION FOR AN ITSP TRUNK=================
; This ITSP has 2 servers available and requires registration.
; This config would create an endpoint, an aor with 2 static contacts, an
; outbound auth, an identify with 2 matches, and 2 registrations.
;[mytrunk]
;type = wizard
;sends_auth = yes
;sends_registrations = yes
;transport = ipv4
;remote_hosts = sip1.myitsp.com:5060,sip2.myitsp.com:5060
;outbound_auth/username = testname
;outbound_auth/password = test password
;endpoint/allow = ulaw
;endpoint/context = default
;========================WIZARD SECTION OPTIONS===============================
;[wizard]
; SYNOPSIS: Provides configuration wizard for common scenarios.
;sends_auth= ; Will create an outbound auth object for the endpoint and
; registration.
; If yes, outbound/username must be specified.
; (default = "no")
;accepts_auth= ; Will create an inbound auth object for the endpoint.
; If yes, inbound/username must be specified.
; (default = "no")
;sends_registrations= ; Will create an outbound registration object and an
; identify match for each host in remote_hosts (which
; must be specified).
; sends_auth must also be specified.
; (default: "no")
;sends_line_with_registrations= ; Setting this to true will cause the wizard to
; skip the creation of an identify object to match
; incoming requests to the endpoint and instead add the
; line and endpoint parameters to the outbound
; registration object.
; (default: "no")
;accepts_registrations= ; Will create an aor with dynamic contacts which will
; accept registrations.
; accepts_auth must also be specified.
; (default: "no")
;remote_hosts= ; A comma separated list of remote hosts in the form of
; <ipaddress | hostname>[:port] [,<ipaddress | hostname>[:port] ] ...
; If specified, a static contact for each host will be created
; in the aor. If accepts_registrations is no, an identify
; object is also created with a match line for each remote host.
; If an aor/contact or match/identify is explicitly supplied,
; remote_hosts will not be used to automatically create contacts
; or matches respectively.
; (default: "")
;outbound_proxy= ; Setting this is a shortcut for setting
; endpoint/outbound_proxy
; aor/outbound_proxy
; registration/outbound_proxy
;transport= ; The transport to use for the endpoint and registrations
; (default: the pjsip default)
;server_uri_pattern= ; The pattern used to construct the registration
; server_uri. The replaceable parameter ${REMOTE_HOST} isa
; available for use.
; (default: "sip:${REMOTE_HOST}")
;client_uri_pattern= ; The pattern used to construct the registration client_uri.
; The replaceable parameters ${REMOTE_HOST} and ${USERNAME}
; are available for use.
; (default: "sip:${USERNAME}@${REMOTE_HOST}")
;contact_pattern= ; The pattern used to construct the aor contact.
; The replaceable parameter ${REMOTE_HOST} is available
; for use.
; (default: "sip:${REMOTE_HOST}")
;has_phoneprov= ; Will create a phoneprov object.
; If yes, phoneprov/MAC must be specified.
; (default: "no")
;has_hint= ; Create hint and optionally a default application.
; (default: "no")
;hint_context ; Any hints created for this wizard will be placed in this
; context.
; (default: endpoint/context)
;hint_exten ; If specified, a PJSIP/<wizard_id> hint will be created
; for this extension in 'hint_context'.
; context.
; (default: none)
;hint_application ; If specified, an extension will be placed in 'hint_context'
; at priority 1 that calls this application. Could be any
; valid dialplan expression like
; "Gosub(stdexten,${EXTEN},1(${HINT}))"
; (default: "Dial(${HINT})")
;endpoint/<param> ; Any parameters to be passed directly to and validated
;aor/<param> ; by their respective objects.
;inbound_auth/<param>
;outbound_auth/<param>
;identify/<param>
;registration/<param>
;phoneprov/<param>
;type= ; Must be of type wizard (default: "")
#include "pjsip_wizard-vicidial.conf"
+104
View File
@@ -0,0 +1,104 @@
[general]
context=trunkinbound ; Default context for incoming calls
allowguest=no ; Allow or reject guest calls (default is yes)
allowoverlap=no ; Disable overlap dialing support. (Default is yes)
;allowtransfer=no ; Disable all transfers (unless enabled in peers or users)
;realm=mydomain.tld ; Realm for digest authentication
bindport=5060 ; UDP Port to bind to (SIP standard port is 5060)
bindaddr=0.0.0.0 ; IP address to bind to (0.0.0.0 binds to all)
srvlookup=yes ; Enable DNS SRV lookups on outbound calls
;domain=mydomain.tld ; Set default domain for this host
;pedantic=yes ; Enable checking of tags in headers,
;tos_sip=cs3 ; Sets TOS for SIP packets.
;tos_audio=ef ; Sets TOS for RTP audio packets.
;tos_video=af41 ; Sets TOS for RTP video packets.
;maxexpiry=3600 ; Maximum allowed time of incoming registrations
;minexpiry=60 ; Minimum length of registrations/subscriptions (default 60)
;defaultexpiry=120 ; Default length of incoming/outgoing registration
;t1min=100 ; Minimum roundtrip time for messages to monitored hosts
;notifymimetype=text/plain ; Allow overriding of mime type in MWI NOTIFY
;checkmwi=10 ; Default time between mailbox checks for peers
;buggymwi=no ; Cisco SIP firmware doesn't support the MWI RFC
;vmexten=voicemail ; dialplan extension to reach mailbox sets the
disallow=all ; First disallow all codecs
allow=ulaw ; Allow codecs in order of preference
allow=gsm
mohinterpret=default
mohsuggest=default
language=en ; Default language setting for all users/peers
relaxdtmf=yes ; Relax dtmf handling
trustrpid = no ; If Remote-Party-ID should be trusted
sendrpid = yes ; If Remote-Party-ID should be sent
progressinband=no ; If we should generate in-band ringing always
;useragent=Asterisk PBX ; Allows you to change the user agent string
;promiscredir = no ; If yes, allows 302 or REDIR to non-local SIP address
;usereqphone = no ; If yes, ";user=phone" is added to uri that contains
dtmfmode = rfc2833 ; Set default dtmfmode for sending DTMF. Default: rfc2833
;compactheaders = yes ; send compact sip headers.
videosupport=no ; Turn on support for SIP video. You need to turn this on
;maxcallbitrate=384 ; Maximum bitrate for video calls (default 384 kb/s)
callevents=yes ; generate manager events when sip ua
;alwaysauthreject = yes ; When an incoming INVITE or REGISTER is to be rejected,
;g726nonstandard = yes ; If the peer negotiates G726-32 audio, use AAL2 packing
;matchexterniplocally = yes ; Only substitute the externip or externhost setting if it matches
;regcontext=sipregistrations
rtptimeout=60 ; Terminate call if 60 seconds of no RTP or RTCP activity
;rtpholdtimeout=300 ; Terminate call if 300 seconds of no RTP or RTCP activity
;rtpkeepalive=<secs> ; Send keepalives in the RTP stream to keep NAT open
;sipdebug = yes ; Turn on SIP debugging by default, from
;recordhistory=yes ; Record SIP history by default
;dumphistory=yes ; Dump SIP history at end of SIP dialogue
;allowsubscribe=no ; Disable support for subscriptions. (Default is yes)
;subscribecontext = default ; Set a specific context for SUBSCRIBE requests
notifyringing = yes ; Notify subscriptions on RINGING state (default: no)
notifyhold = yes ; Notify subscriptions on HOLD state (default: no)
limitonpeers = yes ; Apply call limits on peers only. This will improve
;t38pt_udptl = yes ; Default false
;register => 1234:password@mysipprovider.com
;registertimeout=20 ; retry registration calls every 20 seconds (default)
;registerattempts=10 ; Number of registration attempts before we give up
;externip = 192.168.1.1 ; Address that we're going to put in outbound SIP
;externhost=test.test.com ; Alternatively you can specify a domain
;externrefresh=10 ; How often to refresh externhost if
localnet=192.168.0.0/255.255.0.0; All RFC 1918 addresses are local networks
localnet=10.0.0.0/255.0.0.0 ; Also RFC1918
localnet=172.16.0.0/12 ; Another RFC1918 with CIDR notation
localnet=169.254.0.0/255.255.0.0 ;Zero conf local network
nat=force_rport,comedia ; Global NAT settings (Affects all peers and users)
canreinvite=no ; Asterisk by default tries to redirect the
;directrtpsetup=yes ; Enable the new experimental direct RTP setup. This sets up
;rtcachefriends=yes ; Cache realtime friends by adding them to the internal list
;rtsavesysname=yes ; Save systemname in realtime database at registration
;rtupdate=yes ; Send registry updates to database using realtime? (yes|no)
;rtautoclear=yes ; Auto-Expire friends created on the fly on the same schedule
;ignoreregexpire=yes ; Enabling this setting has two functions:
;domain=mydomain.tld,mydomain-incoming
;domain=1.2.3.4 ; Add IP address as local domain
;allowexternaldomains=no ; Disable INVITE and REFER to non-local domains
;autodomain=yes ; Turn this on to have Asterisk add local host
;fromdomain=mydomain.tld ; When making outbound SIP INVITEs to
jbenable = yes ; Enables the use of a jitterbuffer on the receiving side of a
jbforce = no ; Forces the use of a jitterbuffer on the receive side of a SIP
jbmaxsize = 100 ; Max length of the jitterbuffer in milliseconds.
jbresyncthreshold = 1000 ; Jump in the frame timestamps over which the jitterbuffer is
jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of a SIP
jblog = no ; Enables jitterbuffer frame logging. Defaults to "no".
qualify=yes ; By default, qualify all peers at 2000ms
limitonpeer = yes ; enable call limit on a per peer basis, different from limitonpeers
#include sip-vicidial.conf
; register SIP account on remote machine if using SIP trunks
; register => testSIPtrunk:test@10.10.10.16:5060
;
; setup account for SIP trunking:
; [SIPtrunk]
; disallow=all
; allow=ulaw
; allow=alaw
; type=friend
; username=testSIPtrunk
; secret=test
; host=10.10.10.16
; dtmfmode=inband
; qualify=1000
+6 -5
View File
@@ -15,7 +15,7 @@ company VARCHAR(10),
picture VARCHAR(19),
messages INT(4),
old_messages INT(4),
protocol ENUM('SIP','Zap','IAX2','EXTERNAL') default 'SIP',
protocol ENUM('SIP','PJSIP','Zap','IAX2','EXTERNAL') default 'SIP',
local_gmt VARCHAR(6) default '-5.00',
ASTmgrUSERNAME VARCHAR(20) default 'cron',
ASTmgrSECRET VARCHAR(20) default '1234',
@@ -1940,7 +1940,8 @@ label_rank VARCHAR(60) default '',
label_owner VARCHAR(60) default '',
label_entry_list_id VARCHAR(60) default '',
call_limit_24hour ENUM('0','1') default '0',
call_limit_24hour_reset DATETIME default '2000-01-01 00:00:01'
call_limit_24hour_reset DATETIME default '2000-01-01 00:00:01',
allowed_sip_stacks ENUM('SIP','PJSIP','SIP_and_PJSIP') default 'SIP'
) ENGINE=MyISAM;
CREATE TABLE vicidial_campaigns_list_mix (
@@ -2345,7 +2346,7 @@ carrier_name VARCHAR(50) NOT NULL,
registration_string VARCHAR(255),
template_id VARCHAR(15) NOT NULL,
account_entry TEXT,
protocol ENUM('SIP','Zap','IAX2','EXTERNAL') default 'SIP',
protocol ENUM('SIP','PJSIP','PJSIP_WIZ','Zap','IAX2','EXTERNAL') default 'SIP',
globals_string VARCHAR(255),
dialplan_entry TEXT,
server_ip VARCHAR(15) NOT NULL,
@@ -4594,7 +4595,7 @@ CREATE TABLE vicidial_peer_event_log (
`server_ip` VARCHAR(15) COLLATE utf8_unicode_ci NOT NULL,
`host_ip` VARCHAR(15) COLLATE utf8_unicode_ci DEFAULT '',
`port` SMALLINT(6) DEFAULT NULL,
`channel_type` ENUM('IAX2','SIP') COLLATE utf8_unicode_ci DEFAULT NULL,
`channel_type` ENUM('IAX2','SIP','PJSIP') COLLATE utf8_unicode_ci DEFAULT NULL,
`peer` VARCHAR(100) COLLATE utf8_unicode_ci DEFAULT '',
`data` VARCHAR(255) COLLATE utf8_unicode_ci DEFAULT '',
PRIMARY KEY (`peer_event_id`),
@@ -5021,4 +5022,4 @@ INSERT INTO vicidial_settings_containers(container_id,container_notes,container_
UPDATE system_settings set vdc_agent_api_active='1';
UPDATE system_settings SET db_schema_version='1641',db_schema_update_date=NOW(),reload_timestamp=NOW();
UPDATE system_settings SET db_schema_version='1642',db_schema_update_date=NOW(),reload_timestamp=NOW();
+10
View File
@@ -1799,3 +1799,13 @@ unique index cicc_cd (caller_code, uniqueid)
CREATE TABLE vicidial_inbound_caller_codes_archive LIKE vicidial_inbound_caller_codes;
UPDATE system_settings SET db_schema_version='1641',db_schema_update_date=NOW() where db_schema_version < 1641;
ALTER TABLE phones MODIFY protocol ENUM('SIP','PJSIP','Zap','IAX2','EXTERNAL') default 'SIP';
ALTER TABLE vicidial_server_carriers MODIFY protocol ENUM('SIP','PJSIP','PJSIP_WIZ','Zap','IAX2','EXTERNAL') default 'SIP';
ALTER TABLE vicidial_peer_event_log MODIFY channel_type ENUM('IAX2','SIP','PJSIP') COLLATE utf8_unicode_ci DEFAULT NULL;
ALTER TABLE system_settings ADD allowed_sip_stacks ENUM('SIP','PJSIP','SIP_and_PJSIP') default 'SIP';
UPDATE system_settings SET db_schema_version='1642',db_schema_update_date=NOW() where db_schema_version < 1642;
+23 -9
View File
@@ -2,7 +2,7 @@
# install.pl version 2.14
#
# Copyright (C) 2019 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2021 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
@@ -45,6 +45,7 @@
# 170915-1458 - Added Asterisk 13 compability pieces
# 190530-1511 - Added 'S' keepalive option
# 210813-0925 - Added Asteirsk 16 option
# 210827-0926 - Added PJSIP default conf files to Asterisk 16 install
#
############################################
@@ -82,7 +83,7 @@ $VARDB_port = '3306';
# default keepalive processes:
$VARactive_keepalives = '1234568';
# default Asterisk version:
$VARasterisk_version = '1.4';
$VARasterisk_version = '13.X';
# default recording FTP archive variables:
$VARFTP_host = '10.0.0.4';
$VARFTP_user = 'cron';
@@ -2657,21 +2658,34 @@ if ( ($PROMPTcopy_conf_files =~ /y/i) || ($CLIcopy_conf_files =~ /y/i) )
}
else
{
if ($VARasterisk_version =~ /^13|^16/)
if ($VARasterisk_version =~ /^13/)
{
`cp -f ./docs/conf_examples/extensions.conf.sample-13 /etc/asterisk/extensions.conf`;
`cp -f ./docs/conf_examples/iax.conf.sample-1.4 /etc/asterisk/iax.conf`;
`cp -f ./docs/conf_examples/sip.conf.sample-1.4 /etc/asterisk/sip.conf`;
`cp -f ./docs/conf_examples/sip.conf.sample-13 /etc/asterisk/sip.conf`;
`cp -f ./docs/conf_examples/manager.conf.sample-13 /etc/asterisk/manager.conf`;
`cp -f ./docs/conf_examples/voicemail.conf.sample-1.8 /etc/asterisk/voicemail.conf`;
}
else
{
`cp -f ./docs/conf_examples/extensions.conf.sample-1.4 /etc/asterisk/extensions.conf`;
`cp -f ./docs/conf_examples/iax.conf.sample-1.4 /etc/asterisk/iax.conf`;
`cp -f ./docs/conf_examples/sip.conf.sample-1.4 /etc/asterisk/sip.conf`;
`cp -f ./docs/conf_examples/manager.conf.sample /etc/asterisk/manager.conf`;
`cp -f ./docs/conf_examples/voicemail.conf.sample /etc/asterisk/voicemail.conf`;
if ($VARasterisk_version =~ /^16/)
{
`cp -f ./docs/conf_examples/extensions.conf.sample-13 /etc/asterisk/extensions.conf`;
`cp -f ./docs/conf_examples/iax.conf.sample-1.4 /etc/asterisk/iax.conf`;
`cp -f ./docs/conf_examples/sip.conf.sample-13 /etc/asterisk/sip.conf`;
`cp -f ./docs/conf_examples/manager.conf.sample-13 /etc/asterisk/manager.conf`;
`cp -f ./docs/conf_examples/voicemail.conf.sample-1.8 /etc/asterisk/voicemail.conf`;
`cp -f ./docs/conf_examples/pjsip.conf.sample-16 /etc/asterisk/pjsip.conf`;
`cp -f ./docs/conf_examples/pjsip_wizard.conf.sample-16 /etc/asterisk/pjsip_wizard.conf`;
}
else
{
`cp -f ./docs/conf_examples/extensions.conf.sample-1.4 /etc/asterisk/extensions.conf`;
`cp -f ./docs/conf_examples/iax.conf.sample-1.4 /etc/asterisk/iax.conf`;
`cp -f ./docs/conf_examples/sip.conf.sample-1.4 /etc/asterisk/sip.conf`;
`cp -f ./docs/conf_examples/manager.conf.sample /etc/asterisk/manager.conf`;
`cp -f ./docs/conf_examples/voicemail.conf.sample /etc/asterisk/voicemail.conf`;
}
}
}
}
+5 -4
View File
@@ -518,10 +518,11 @@
# 210729-2136 - Added cid_group_id_two campaign setting
# 210822-2111 - Fix for manual dial lead search with phone_code, Issue #1322
# 210825-0912 - Fix for XSS security issue
# 210827-0749 - Added PJSIP compatibility
#
$version = '2.14-411';
$build = '210825-0912';
$version = '2.14-412';
$build = '210827-0749';
$php_script = 'vdc_db_query.php';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=865;
@@ -4786,7 +4787,7 @@ if ($ACTION == 'manDiaLnextCaLL')
$EAC='';
if ($use_eac > 0)
{
$eac_extension = preg_replace("/SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\//",'',$eac_phone);
$eac_extension = preg_replace("/PJSIP\/|SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\//",'',$eac_phone);
$EAC=" $eac_extension";
}
@@ -6572,7 +6573,7 @@ if ($ACTION == 'manDiaLonly')
$EAC='';
if ($use_eac > 0)
{
$eac_extension = preg_replace("/SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\//",'',$eac_phone);
$eac_extension = preg_replace("/PJSIP\/|SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\//",'',$eac_phone);
$EAC=" $eac_extension";
}
if ($CCID_on) {$CIDstring = "\"$MqueryCID$EAC\" <$CCID>";}
+40 -8
View File
File diff suppressed because one or more lines are too long
+16 -8
View File
@@ -1,7 +1,7 @@
<?php
# admin_phones_bulk_insert.php
#
# Copyright (C) 2020 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2021 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# this screen will insert phones into your multi-server system with aliases
#
@@ -21,10 +21,11 @@
# 180503-2015 - Added new help display
# 181130-1304 - Added template option
# 201112-1017 - Fix for side menu issue #1223
# 210827-0907 - Added PJSIP support
#
$admin_version = '2.14-14';
$build = '201112-1017';
$admin_version = '2.14-15';
$build = '210827-0907';
require("dbconnect_mysqli.php");
require("functions.php");
@@ -75,7 +76,7 @@ if (strlen($DB) < 1)
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,webroot_writable,enable_languages,language_method,admin_screen_colors,campaign_cid_areacodes_enabled,sounds_central_control_active,contacts_enabled,enable_auto_reports FROM system_settings;";
$stmt = "SELECT use_non_latin,webroot_writable,enable_languages,language_method,admin_screen_colors,campaign_cid_areacodes_enabled,sounds_central_control_active,contacts_enabled,enable_auto_reports,allowed_sip_stacks FROM system_settings;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
$ss_conf_ct = mysqli_num_rows($rslt);
@@ -91,6 +92,7 @@ if ($ss_conf_ct > 0)
$SSsounds_central_control_active = $row[6];
$SScontacts_enabled = $row[7];
$SSenable_auto_reports = $row[8];
$SSallowed_sip_stacks = $row[9];
}
##### END SETTINGS LOOKUP #####
###########################################
@@ -258,7 +260,7 @@ if ($action == "HELP")
<A NAME="registration_password">
<BR>
<B><?php echo _QXZ("Registration Password"); ?> -</B> <?php echo _QXZ("This is the registration password that will be used for all of the phones that are created. For SIP and IAX2 protocol you should use a complex password for secutiry reasons."); ?>
<B><?php echo _QXZ("Registration Password"); ?> -</B> <?php echo _QXZ("This is the registration password that will be used for all of the phones that are created. For SIP, PJSIP and IAX2 protocol you should use a complex password for secutiry reasons."); ?>
<BR><BR>
<A NAME="login_password">
@@ -278,7 +280,7 @@ if ($action == "HELP")
<A NAME="protocol">
<BR>
<B><?php echo _QXZ("Client Protocol"); ?> -</B> <?php echo _QXZ("This is the phone protocol that will be used for all phones created when submitted. SIP and IAX2 are VOIP protocols that will create conf file entries to allow those phoens to register on the servers."); ?>
<B><?php echo _QXZ("Client Protocol"); ?> -</B> <?php echo _QXZ("This is the phone protocol that will be used for all phones created when submitted. SIP, PJSIP and IAX2 are VOIP protocols that will create conf file entries to allow those phoens to register on the servers."); ?>
<BR><BR>
<A NAME="gmt">
@@ -420,7 +422,13 @@ if ($action == "BLANK")
echo "<option>"._QXZ("NO")."</option>";
echo "</select> $NWB#admin_phones_bulk_insert-create_alias$NWE </td></tr>\n";
echo "<tr bgcolor=#".$SSstd_row4_background."><td align=right>"._QXZ("Alias Suffix").": </td><td align=left><input type=text name=alias_suffix size=2 maxlength=4> $NWB#admin_phones_bulk_insert-alias_suffix$NWE </td></tr>\n";
echo "<tr bgcolor=#".$SSstd_row4_background."><td align=right>"._QXZ("Client Protocol").": </td><td align=left><select size=1 name=protocol><option value='SIP'>SIP</option><option value='Zap'>Zap</option><option value='IAX2'>IAX2</option><option value='EXTERNAL'>"._QXZ("EXTERNAL")."</option></select> $NWB#admin_phones_bulk_insert-protocol$NWE </td></tr>\n";
echo "<tr bgcolor=#".$SSstd_row4_background."><td align=right>"._QXZ("Client Protocol").": </td><td align=left><select size=1 name=protocol>";
if ( ($SSallowed_sip_stacks == 'SIP') or ($SSallowed_sip_stacks == 'SIP_and_PJSIP') ) {echo "<option>SIP</option>";}
if ( ($SSallowed_sip_stacks == 'PJSIP') or ($SSallowed_sip_stacks == 'SIP_and_PJSIP') ) {echo "<option>PJSIP</option>";}
echo "<option>Zap</option>";
echo "<option>IAX2</option>";
echo "<option value='EXTERNAL'>"._QXZ("EXTERNAL")."</option>";
echo "</select> $NWB#admin_phones_bulk_insert-protocol$NWE </td></tr>\n";
echo "<tr bgcolor=#".$SSstd_row4_background."><td align=right>"._QXZ("Local GMT").": </td><td align=left><select size=1 name=local_gmt><option>12.75</option><option>12.00</option><option>11.00</option><option>10.00</option><option>9.50</option><option>9.00</option><option>8.00</option><option>7.00</option><option>6.50</option><option>6.00</option><option>5.75</option><option>5.50</option><option>5.00</option><option>4.50</option><option>4.00</option><option>3.50</option><option>3.00</option><option>2.00</option><option>1.00</option><option>0.00</option><option>-1.00</option><option>-2.00</option><option>-3.00</option><option>-3.50</option><option>-4.00</option><option selected>-5.00</option><option>-6.00</option><option>-7.00</option><option>-8.00</option><option>-9.00</option><option>-10.00</option><option>-11.00</option><option>-12.00</option></select> ("._QXZ("Do NOT Adjust for DST").") $NWB#admin_phones_bulk_insert-gmt$NWE </td></tr>\n";
echo "<tr bgcolor=#".$SSstd_row4_background."><td align=right>"._QXZ("Phone Context").": </td><td align=left><input type=text name=phone_context size=20 maxlength=20> $NWB#admin_phones_bulk_insert-phone_context$NWE </td></tr>\n";
echo "<tr bgcolor=#".$SSstd_row4_background."><td align=right>"._QXZ("Set As Webphone").": </td><td align=left><select size=1 name=is_webphone><option value='Y'>"._QXZ("Y")."</option><option selected value='N'>"._QXZ("N")."</option><option value='Y_API_LAUNCH'>"._QXZ("Y_API_LAUNCH")."</option></select>$NWB#admin_phones_bulk_insert-is_webphone$NWE</td></tr>\n";
@@ -555,7 +563,7 @@ if ($action == "ADD_PHONES_SUBMIT")
if ($s >= 49) {$login_suffix = 'ax';}
$extension = $PN[$p];
if ( ($protocol == 'SIP') or ($protocol == 'IAX2') )
if ( ($protocol == 'SIP') or ($protocol == 'PJSIP') or ($protocol == 'IAX2') )
{$dialplan_number = "$dialplan_prefix$PN[$p]";}
else
{$dialplan_number = "$PN[$p]";}
+7 -6
View File
@@ -1,4 +1,4 @@
# version: 20210729211501
# version: 20210827075001
users-user User ID <QXZ>This field is where you put the users ID number, can be up to 8 digits in length, Must be at least 2 characters in length.</QXZ>
users-pass Password <QXZ>This field is where you put the users password. Must be at least 2 characters in length. Only letters and numbers are allowed in user passwords. A medium strength user password will be at least 10 characters in length, and a strong user password will be at least 20 characters in length and have letters as well as at least one number. It is recommended that you use a longer password if possible, stringing together several unrelated words with no spaces, and a number somewhere in the string. The maximum size of a password is 100 characters.</QXZ>
users-force_change_password Force Change Password <QXZ>If this option is set to Y then the user will be prompted to change their password the next time they log in to the administration webpage or the agent screen. Default is N.</QXZ>
@@ -842,7 +842,7 @@ list_loader-status_mismatch_action Status Mismatch Action <QXZ>Using this featur
list_loader-file_layout File layout <QXZ>The layout of the file you are loading. Standard Format uses the pre-defined standard file format. Custom layout allows the user to define the layout of the file themselves. Custom template is a hybrid of the previous two options, which allows the user to use a custom format they have defined previously and saved using the Custom Template Maker.</QXZ>
list_loader-template_id Template ID <QXZ>If the user has selected Custom layout from the File layout options, then this the template the lead loader will use. It will also override the selected list ID with the list ID that was assigned to the selected template when it was created.</QXZ>
list_loader-state_conversion State Abbreviation Lookup <QXZ>If your lead file has state names spelled out and you would like to load them into the state field as their two-character abbreviations, this feature will look up the abbreviation from the internal database. Default is DISABLED.</QXZ>
phones-extension Phone Extension <QXZ>This field is where you put the phones name as it appears to Asterisk not including the protocol or slash at the beginning. For Example: for the SIP phone SIP/test101 the Phone extension would be test101. Also, for IAX2 phones: IAX2/IAXphone1@IAXphone1 would be IAXphone1. For Zap and Dahdi attached channelbank or FXS phones make sure you put the full channel number without the prefix: Zap/25-1 would be 25-1. Another note, make sure you set the Protocol field below correctly for your type of phone. For SIP and IAX phones, this field should not contain any dashes.</QXZ>
phones-extension Phone Extension <QXZ>This field is where you put the phones name as it appears to Asterisk not including the protocol or slash at the beginning. For Example: for the SIP phone SIP/test101 the Phone extension would be test101. Also, for IAX2 phones: IAX2/IAXphone1@IAXphone1 would be IAXphone1. For Zap and Dahdi attached channelbank or FXS phones make sure you put the full channel number without the prefix: Zap/25-1 would be 25-1. Another note, make sure you set the Protocol field below correctly for your type of phone. For SIP, PJSIP and IAX phones, this field should not contain any dashes.</QXZ>
phones-dialplan_number Dial Plan Number <QXZ>This field is for the number you dial to have the phone ring. This number is defined in the extensions.conf file of your Asterisk server</QXZ>
phones-voicemail_id Voicemail Box <QXZ>This field is for the voicemail box that the messages go to for the user of this phone. We use this to check for voicemail messages and for the user to be able to use the VOICEMAIL button on astGUIclient app.</QXZ>
phones-voicemail_timezone Voicemail Zone <QXZ>This setting allows you to set the zone that this voicemail box will be set to when the time is logged for a message. Default is set in the System Settings.</QXZ>
@@ -880,7 +880,7 @@ phones-mohsuggest Music on Hold Suggest <QXZ>This option will allow you to defin
phones-picture Picture <QXZ>Not yet Implemented.</QXZ>
phones-messages New Messages <QXZ>Number of new voicemail messages for this phone on the Asterisk server.</QXZ>
phones-old_messages Old Messages <QXZ>Number of old voicemail messages for this phone on the Asterisk server.</QXZ>
phones-protocol Client Protocol <QXZ>The protocol that the phone uses to connect to the Asterisk server: SIP, IAX2, Zap . Also, there is EXTERNAL for remote dial numbers or speed dial numbers that you want to list as phones.</QXZ>
phones-protocol Client Protocol <QXZ>The protocol that the phone uses to connect to the Asterisk server: SIP, PJSIP, IAX2, Zap . Also, there is EXTERNAL for remote dial numbers or speed dial numbers that you want to list as phones.</QXZ>
phones-local_gmt Local GMT <QXZ>The difference from Greenwich Mean time, or ZULU time where the phone is located. DO NOT ADJUST FOR DAYLIGHT SAVINGS TIME. This is used by the campaign to accurately display the system time and customer time, as well as accurately log when events happen.</QXZ>
phones-phone_ring_timeout Phone Ring Timeout <QXZ>This is the amount of time, in seconds, that the phone will ring in the dialplan before sending the call to voicemail. Default is 60 seconds.</QXZ>
phones-on_hook_agent On-Hook Agent Login <QXZ>This option is only used for inbound calls going to an agent logged in with this phone. This feature will call the agent and will not send the customer to the agents session until the line is answered. Default is N for disabled.</QXZ>
@@ -1010,10 +1010,10 @@ server_carriers-carrier_id Carrier ID <QXZ>This field needs to be at least 2 cha
server_carriers-carrier_name Carrier Name <QXZ>This is the descriptive name of the carrier entry.</QXZ>
server_carriers-carrier_description Carrier Description <QXZ>This is put in the comments of the asterisk conf files above the dialplan and account entries. Maximum 255 characters.</QXZ>
server_carriers-user_group Admin User Group <QXZ>This is the administrative user group for this record, this allows admin viewing of this record restricted by user group. Default is --ALL-- which allows any admin user to view this record.</QXZ>
server_carriers-registration_string Registration String <QXZ>This field is where you can enter in the exact string needed in the IAX or SIP configuration file to register to the provider. Optional but highly recommended if your carrier allows registration.</QXZ>
server_carriers-registration_string Registration String <QXZ>This field is where you can enter in the exact string needed in the IAX, SIP or PJSIP configuration file to register to the provider. Optional but highly recommended if your carrier allows registration.</QXZ>
server_carriers-template_id Template ID <QXZ>This optional field allows you to choose a conf file template for this carrier entry.</QXZ>
server_carriers-account_entry Account Entry <QXZ>This field is used if you have not selected a template to use, and it is where you can enter in the specific account settings to be used for this carrier. If you will be taking in inbound calls from this carrier trunk you might want to set the context=trunkinbound within this field so that you can use the DID handling process within the system.</QXZ>
server_carriers-protocol Protocol <QXZ>This field allows you to define the protocol to use for the carrier entry. Currently only IAX and SIP are supported.</QXZ>
server_carriers-protocol Protocol <QXZ>This field allows you to define the protocol to use for the carrier entry. Currently only IAX, SIP and PJSIP are supported.</QXZ>
server_carriers-globals_string Globals String <QXZ>This optional field allows you to define a global variable to use for the carrier in the dialplan.</QXZ>
server_carriers-dialplan_entry Dialplan Entry <QXZ>This optional field allows you to define a set of dialplan entries to use for this carrier.</QXZ>
server_carriers-server_ip Server IP <QXZ>This is the server that this specific carrier record is associated with. If you set this to 0.0.0.0 then this carrier entry will be put on all active asterisk servers.</QXZ>
@@ -1029,6 +1029,7 @@ settings-default_language Default Language <QXZ>This is the language that the ag
settings-webroot_writable Webroot Writable <QXZ>This setting allows you to define whether temp files and authentication files should be placed in the webroot on your web server. Default is 1.</QXZ>
settings-agent_disable Agent Disable Display <QXZ>This field is used to select when to show an agent notices when their session has been disabled by the system, a manager action or by an external measure. The NOT_ACTIVE setting will disable the message on the agents screen. The LIVE_AGENT setting will only display the disabled message when the agents auto_calls record has been removed, such as during a force logout or emergency logout. Default is ALL.</QXZ>
settings-frozen_server_call_clear Clear Frozen Calls <QXZ>This option can enable the ability for the general Reports page and the optional AST_timecheck.pl script to clear out the auto_calls entries for a frozen server so they do not affect call routing. Default is 0 for disabled.</QXZ>
settings-allowed_sip_stacks Allowed SIP Stacks <QXZ>This option will determine which SIP modules in Asterisk will be allowed to be configured on your dialers for Phones and Carriers. The standard up until Asterisk 16 is -SIP- which uses the older chan_sip module. The newer PJSIP can be used with Asterisk 16 and higher, if configured properly. Default is SIP.</QXZ>
settings-allow_sipsak_messages Allow SIPSAK Messages <QXZ>If set to 1, this will allow the sipsak phones table setting to work if the phone is set to the SIP protocol. The server will send messages to the SIP phone to display on the phone display when logged into the system. This feature only works with SIP phones and requires sipsak application to be installed on the web server that the agent is logged into. Default is 0. </QXZ>
settings-vdc_agent_api_active Agent API Active <QXZ>If set to 1, this will allow the Agent API interface to function. Default is 0. </QXZ>
settings-admin_modify_refresh Admin Modify Auto-Refresh <QXZ>This is the refresh interval in seconds of the modify screens in this admin interface. Setting this to 0 will disable it, setting it below 5 will mostly make the modify screens unusable because they will refresh too quickly to change fields. This option is useful in situations where more than one manager is controlling settings on an active campaign or in-group so that the settings are refreshed frequently. Default is 0.</QXZ>
@@ -1200,7 +1201,7 @@ system_statuses System Statuses <QXZ>Through the use of system statuses, you can
admin_phones_bulk_insert-login_password Login Password <QXZ>This is the agent screen login password that will be used for all of the phones that are created.</QXZ>
admin_phones_bulk_insert-create_alias Create Alias Entries <QXZ>Setting this option to YES will create a phones alias entry for each of the extensions listed above that will tie all of the same extension entries on each server together allowing phone login load balancing to work in the agent interface.</QXZ>
admin_phones_bulk_insert-alias_suffix Alias Suffix <QXZ>This is the suffix that will be added to the extension to form the phone alias id. For example, if the extension is cc100 and the alias suffix is x, then the phone alias id used for that would be cc100x.</QXZ>
admin_phones_bulk_insert-protocol Client Protocol <QXZ>This is the phone protocol that will be used for all phones created when submitted. SIP and IAX2 are VOIP protocols that will create conf file entries to allow those phoens to register on the servers.</QXZ>
admin_phones_bulk_insert-protocol Client Protocol <QXZ>This is the phone protocol that will be used for all phones created when submitted. SIP, PJSIP and IAX2 are VOIP protocols that will create conf file entries to allow those phoens to register on the servers.</QXZ>
status_groups Status Groups <QXZ>Through the use of status groups, you can have statuses that exist for lists or in-groups specifically. The Status must be 1-6 characters in length, the description must be 2-30 characters in length and Selectable defines whether it shows up in the system as an agent disposition. The human_answered field is used when calculating the drop percentage, or abandon rate. Setting human_answered to Y will use this status when counting the human-answered calls. The Category option allows you to group several statuses into a category that can be used for statistical analysis. There are also 7 additional settings that will define the kind of status: sale, dnc, customer contact, not interested, unworkable, scheduled callback, completed. The MIN SEC and MAX SEC fields for each status will determine whether an agent can select that status at the end of their call based upon the length of the call. If the call is 10 seconds and the MIN SEC for a status is set to 20 seconds, then the agent will not be able to select that status. Also, if a call is 40 seconds and the MAX SEC for a status is set to 30 seconds, then the agent will not be able to select that status. The Status Group ID field must be between 2 and 20 characters in length, must not match a current campaign ID, and cannot contain spaces or other special characters.</QXZ>
inbound_groups-populate_lead_vendor Populate Lead Vendor <QXZ>If this option is not DISABLED, and the inbound call was not delivered with a VID option, then the system will put the value entered in this setting into the vendor_lead_code field when a new lead is inserted. Special options include INBOUND_NUMBER which will use the inbound phone number dialed. Default is INBOUND_NUMBER.</QXZ>
inbound_groups-populate_lead_comments Populate Lead Comments <QXZ>If this option is not DISABLED, then the system will put the value entered in this setting into the comments field when a new lead is inserted. Special options include CALLERID_NAME which will use the CallerID Name as supplied in the incoming phone call. Default is CALLERID_NAME.</QXZ>