Skip to content

Commit

Permalink
Merge commit for 4.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaian committed Apr 29, 2024
2 parents 35312bc + 991a0a7 commit 2e221ec
Show file tree
Hide file tree
Showing 75 changed files with 755 additions and 237 deletions.
34 changes: 34 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
Mon, 29 Apr 2024 09:07:23 +0200 IvozProvider Team <[email protected]>

* IvozProvider 4.0.5 released

* Portals
- Banned address order #2621
- Restricted admins impersonation permission #2604
- Fixed search by special characters #2626
- Get Migration bundle back #2631
- Fixed terminals foreign key resolver race condition #2627
- Brand not shown on sip domains #2629
- Fixed multilanguage issues #2630
- Outgoing routing form rework #2625
- Avoid delete referenced application server #2628

* Schema
- Fix endpoints hints migration #2634

* Proxies
- kamtrunks: reject calls to retail DDI linked to no retail account #2623
- kamusers: avoid routing within dialog SUBSCRIBE to wrong AS #2624
- kamusers: stop using attributes per contact (ulattrs) #2637
- kamusers: SUBSCRIBE Event dialog only #2638

* Application Server
- Asterisk default Dial options #2636
- Enabled sorcery caches for endpoints, aors and identifies #2635
- Limited max hint watchers to 50 subscriptions

* Security
- build(deps): bump axios from 1.6.0 to 1.6.1 in /web/portal #2620
- build(deps): bump express from 4.18.2 to 4.19.2 in /web/portal #2594
- build(deps): bump vite from 3.2.8 to 3.2.10 in /web/portal #2599

Fri, 12 Apr 2024 08:37:49 +0200 IvozProvider Team <[email protected]>

* IvozProvider 4.0.4 released
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ If you want to test an [standalone](https://irontec.github.io/ivozprovider/en/ar
| oldoldstable (oasis 1.7) | [![iso http](web/admin/public/images/iso-http-green.png)](https://packages.irontec.com/isos/ivozprovider-1.7.1-oasis-amd64.iso) | [![iso http](web/admin/public/images/iso-http-green.png)](https://packages.irontec.com/isos/ivozprovider-1.7.1-oasis-i386.iso)|
| oldstable (artemis 2.23.0) | [![iso http](web/admin/public/images/iso-http-green.png)](https://packages.irontec.com/isos/ivozprovider-2.23~2.23.0-artemis-amd64.iso) | |
| stable (halliday 3.4.1) | [![iso http](web/admin/public/images/iso-http-green.png)](https://packages.irontec.com/isos/ivozprovider-3.4~3.4.1-halliday-amd64.iso) | |
| testing (tempest 4.0.4) | [![iso http](web/admin/public/images/iso-http-green.png)](https://packages.irontec.com/isos/ivozprovider-4.0~4.0.0-tempest-amd64.iso) | |
| testing (tempest 4.0.5) | [![iso http](web/admin/public/images/iso-http-green.png)](https://packages.irontec.com/isos/ivozprovider-4.0~4.0.0-tempest-amd64.iso) | |


You can read about differences between releases [here](https://github.com/irontec/ivozprovider/blob/bleeding/FAQ.md#what-release-should-i-use).
Expand Down
2 changes: 1 addition & 1 deletion asterisk/config/dialplan/click2dial.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exten => _[+*0-9]!,1,NoOp(Call Click2Dial from ${C2DENDPOINT} to ${EXTEN})
same => n,Set(CALLERID(name)=Click2Dial - ${ORIGINATE_EXTEN})
same => n,Set(CALLERID(num)=${ORIGINATE_EXTEN})
same => n,Set(DIAL_DST=PJSIP/${C2DENDPOINT})
same => n,Dial(${DIAL_DST},${DIAL_TIMEOUT},${DIAL_OPTS}b(click2dial-user-headers^${EXTEN}^1)L(${MAX_DURATION})U(click2dial-user-response))
same => n,Dial(${DIAL_DST},${DIAL_TIMEOUT},${DIAL_DEF_OPTS}${DIAL_OPTS}b(click2dial-user-headers^${EXTEN}^1)L(${MAX_DURATION})U(click2dial-user-response))

;; Gosub to set headers to dialed channel to user
[click2dial-user-headers]
Expand Down
16 changes: 8 additions & 8 deletions asterisk/config/dialplan/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,25 @@ include => sounds
[queues]
exten => _[+*0-9]!,1,NoOp(Call from queue ${QUEUE} to extension ${EXTEN})
same => n,AGI(agi://${FASTAGI_SERVER}/fastagi-runner.php?command=Dialplan/Queues)
same => n,Dial(${DIAL_DST},${DIAL_TIMEOUT},${DIAL_OPTS}b(add-headers^${EXTEN}^1))
same => n,Dial(${DIAL_DST},${DIAL_TIMEOUT},${DIAL_DEF_OPTS}${DIAL_OPTS}b(add-headers^${EXTEN}^1))

;;---------------------------------------------------------------------------------------------------
;;------------------------------------[ Dial Contexts ]--------------------------------------
;;---------------------------------------------------------------------------------------------------
;; Context for calling a user (and handle User call forwards after the call)
[call-user-cfw]
exten => _[+*0-9]!,1,NoOp(Calling from ${CALLERID(all)} to ${DIAL_DST})
same => n,Dial(${DIAL_DST},${DIAL_TIMEOUT},${DIAL_OPTS}b(add-headers^${EXTEN}^1)L(${MAX_DURATION}))
same => n,Dial(${DIAL_DST},${DIAL_TIMEOUT},${DIAL_DEF_OPTS}${DIAL_OPTS}b(add-headers^${EXTEN}^1)L(${MAX_DURATION}))
same => n,AGI(agi://${FASTAGI_SERVER}/fastagi-runner.php?command=Dialplan/UserStatus)

[call-user]
exten => _[+*0-9]!,1,NoOp(Calling from ${CALLERID(all)} to ${DIAL_DST})
same => n,Dial(${DIAL_DST},${DIAL_TIMEOUT},${DIAL_OPTS}b(add-headers^${EXTEN}^1)L(${MAX_DURATION}))
same => n,Dial(${DIAL_DST},${DIAL_TIMEOUT},${DIAL_DEF_OPTS}${DIAL_OPTS}b(add-headers^${EXTEN}^1)L(${MAX_DURATION}))

;; Context for Calling an external number through a trunk proxy
[call-world]
exten => _[+*0-9]!,1,NoOp(Calling external number)
same => n,Dial(${DIAL_DST},${DIAL_TIMEOUT},${DIAL_OPTS}ib(add-headers^${EXTEN}^1)L(${MAX_DURATION}))
same => n,Dial(${DIAL_DST},${DIAL_TIMEOUT},${DIAL_DEF_OPTS}${DIAL_OPTS}ib(add-headers^${EXTEN}^1)L(${MAX_DURATION}))

;; Context for Calling a user from an IVR (and handle IVR Noanswer call forwards)
[call-ivr]
Expand All @@ -71,7 +71,7 @@ exten => _[+*0-9]!,1,NoOp(Calling from IVR to ${DIAL_DST})
[call-huntgroup]
exten => _[+*0-9]!,1,NoOp(Calling huntgroup)
same => n,AGI(agi://${FASTAGI_SERVER}/fastagi-runner.php?command=Dialplan/HuntGroups)
same => n,Dial(${DIAL_DST},${DIAL_TIMEOUT},${DIAL_OPTS})
same => n,Dial(${DIAL_DST},${DIAL_TIMEOUT},${DIAL_DEF_OPTS}${DIAL_OPTS})
same => n,AGI(agi://${FASTAGI_SERVER}/fastagi-runner.php?command=Dialplan/HuntGroupStatus)

[call-huntgroup-member]
Expand All @@ -86,7 +86,7 @@ exten => _[+*0-9]!,1,NoOp(Calling conference room ${EXTEN})
;; Context for calling through a friendly trunk
[call-friend]
exten => _[+*0-9]!,1,NoOp(Calling ${EXTEN} through ${DIAL_ENDPOINT})
same => n,Dial(${DIAL_DST},${DIAL_TIMEOUT},${DIAL_OPTS}b(add-headers^${EXTEN}^1)L(${MAX_DURATION}))
same => n,Dial(${DIAL_DST},${DIAL_TIMEOUT},${DIAL_DEF_OPTS}${DIAL_OPTS}b(add-headers^${EXTEN}^1)L(${MAX_DURATION}))
same => n,AGI(agi://${FASTAGI_SERVER}/fastagi-runner.php?command=Dialplan/FriendStatus)

;; Context for calling a queue
Expand All @@ -99,13 +99,13 @@ exten => _[+*0-9]!,1,NoOp(Calling to ${QUEUE})
;; Context for calling through a residential device
[call-residential]
exten => _[+*0-9]!,1,NoOp(Calling ${EXTEN} through ${DIAL_ENDPOINT})
same => n,Dial(${DIAL_DST},${DIAL_TIMEOUT},${DIAL_OPTS}b(add-headers^${EXTEN}^1)L(${MAX_DURATION}))
same => n,Dial(${DIAL_DST},${DIAL_TIMEOUT},${DIAL_DEF_OPTS}${DIAL_OPTS}b(add-headers^${EXTEN}^1)L(${MAX_DURATION}))
same => n,AGI(agi://${FASTAGI_SERVER}/fastagi-runner.php?command=Dialplan/ResidentialStatus)

;; Context for calling to a retail account
[call-retail]
exten => _[+*0-9]!,1,NoOp(Calling ${DIAL_ENDPOINT})
same => n,Dial(${DIAL_DST},${DIAL_TIMEOUT},${DIAL_OPTS}b(add-headers^${EXTEN}^1)L(${MAX_DURATION}))
same => n,Dial(${DIAL_DST},${DIAL_TIMEOUT},${DIAL_DEF_OPTS}${DIAL_OPTS}b(add-headers^${EXTEN}^1)L(${MAX_DURATION}))

;; Context for leaving a user voicemail
[call-voicemail]
Expand Down
8 changes: 6 additions & 2 deletions asterisk/config/extensions.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
; General dialplan configration variables
[globals]
MAX_DURATION=10800000 ; Max call duration in ms (3h)
FASTAGI_SERVER=127.0.0.1:4573 ; FastAGI server address
; Max call duration in ms (3h)
MAX_DURATION=10800000
; FastAGI server address
FASTAGI_SERVER=127.0.0.1:4573
; Default Dial Options
DIAL_DEF_OPTS=

; Dialplan files
#include "dialplan/*.conf"
3 changes: 3 additions & 0 deletions asterisk/config/sorcery.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
;

[res_pjsip]
endpoint/cache = memory_cache,object_lifetime_stale=600,object_lifetime_maximum=1800,expire_on_reload=yes,full_backend_cache=yes
endpoint = config,pjsip.conf,criteria=type=endpoint
endpoint = realtime,ps_endpoints
aor/cache = memory_cache,object_lifetime_stale=1500,object_lifetime_maximum=1800,expire_on_reload=yes,full_backend_cache=yes
aor = config,pjsip.conf,criteria=type=aor
aor = realtime,ps_aors
voicemail = realtime,voicemail

[res_pjsip_endpoint_identifier_ip]
identify/cache = memory_cache,object_lifetime_stale=600,object_lifetime_maximum=1800,expire_on_reload=yes,full_backend_cache=yes
identify = config,pjsip.conf,criteria=type=identify
identify = realtime,ps_identify
8 changes: 7 additions & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
ivozprovider (4.0~4.0.4) UNRELEASED; urgency=medium
ivozprovider (4.0~4.0.5) UNRELEASED; urgency=medium

* Version bump to 4.0.5

-- Irontec IvozProvider Team <[email protected]> Mon, 29 Apr 2024 09:02:57 +0200

ivozprovider (4.0~4.0.4) unstable; urgency=medium

* Version bump to 4.0.4

Expand Down
11 changes: 11 additions & 0 deletions debian/ivozprovider-profile-as.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,21 @@ function setup_fastagi_server()
sed -i -r "s/(FASTAGI_SERVER *= *).*/\1$FASTAGI_SERVER/" /etc/asterisk/extensions.conf
}

function setup_default_dial_opts()
{
# Get default dial options
db_get ivozprovider/dial_default_opts || true
DIAL_DEF_OPTS=$RET

# Configure default dial options
sed -i -r "s/(DIAL_DEF_OPTS *= *).*/\1$DIAL_DEF_OPTS/" /etc/asterisk/extensions.conf
}

#######################################################################################################################
#######################################################################################################################
setup_php
setup_mysql_access
setup_fastagi_server
setup_default_dial_opts

:
6 changes: 6 additions & 0 deletions debian/ivozprovider-profile-as.templates
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,9 @@ Type: string
Default: 127.0.0.1:4573
Description: Fastagi Server address.
Description-es.UTF-8: Direccion IP del servidor fastagi.

Template: ivozprovider/dial_default_opts
Type: string
Default:
Description: Default dial options
Description-es.UTF-8: Opciones por defecto de dial
5 changes: 5 additions & 0 deletions kamailio/trunks/config/kamailio.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -1640,6 +1640,11 @@ route[SETUP_KAMUSERS_CALL] {
# Check DDI is routed to a retail account
$xavp(ra) = $null;
sql_xquery("cb", "SELECT RA.name AS username, DS.domain AS domain FROM DDIs D INNER JOIN RetailAccounts RA ON D.retailAccountId=RA.id INNER JOIN Domains DS ON RA.domainId=DS.id WHERE DDIE164='$rU'", "ra");
if ($xavp(ra) == $null) {
xwarn("[$dlg_var(cidhash)] SETUP-KAMUSERS-CALL: $rU retail DDI not assigned to any retail account, reject\n");
send_reply("404", "No destination [SKC]");
exit;
}

# Update $ru using retail account username@domain
$ru = "sip:" + $xavp(ra=>username) + '@' + $xavp(ra=>domain);
Expand Down
76 changes: 56 additions & 20 deletions kamailio/users/config/kamailio.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ modparam("usrloc", "nat_bflag", FLB_NATB)
modparam("usrloc", "db_mode", 2)
modparam("usrloc", "db_url", DBURL)
modparam("usrloc", "timer_interval", 30)
modparam("usrloc|tm", "xavp_contact", "ulattrs")

# RR
modparam("rr","enable_double_rr", 1)
Expand Down Expand Up @@ -369,6 +368,8 @@ modparam("htable", "htable", "dmq=>size=8;autoexpire=10800;dmqreplicate=1;")
modparam("htable", "htable", "srcban=>size=8;autoexpire=43200")
modparam("htable", "htable", "badauthcnt=>size=8;autoexpire=43200")
modparam("htable", "htable", "aors=>size=10")
modparam("htable", "htable", "companyIdPerDomain=>size=10")
modparam("htable", "htable", "AsPerCompanyId=>size=10")
modparam("htable", "enable_dmq", 1)

# SANITY
Expand Down Expand Up @@ -1224,6 +1225,12 @@ route[DISPATCH_TO_AS] {

# Save CallID <-> AS relationship
$sht(dialogs=>$ci::applicationserver) = $du;

# Cache companyId <-> AS relationship
$sht(AsPerCompanyId=>$dlg_var(companyId)) = $du;

# Cache domain <-> companyId relationship
$sht(companyIdPerDomain=>$fd) = $dlg_var(companyId);
}

route[LOOKUP] {
Expand Down Expand Up @@ -1262,6 +1269,9 @@ route[LOOKUP] {
exit;
}

# Save branches socket
route(SAVE_BRANCHES_SOCKET);

# Load contact or contacts
if (!t_next_contacts()) {
xinfo("[$dlg_var(cidhash)] LOOKUP: One contact found for $tu, calling $ru\n");
Expand All @@ -1271,6 +1281,24 @@ route[LOOKUP] {
}
}

route[SAVE_BRANCHES_SOCKET] {
if (!is_method("INVITE")) return;

$var(i) = 0;
while ($xavp(tm_contacts[$var(i)]) != $null) {
$avp(reversed) = $xavp(tm_contacts[$var(i)]=>sock);
$var(i) = $var(i) + 1;
}

# AVP are LIFO, reverse items
$var(i) = 0;
while ($(avp(reversed)[$var(i)]) != $null) {
$var(branchsock) = $(avp(reversed)[$var(i)]);
$avp(branchsockaddr) = $(var(branchsock){s.select,1,:});
$var(i) = $var(i) + 1;
}
}

route[APPLY_RETAIL_CFW] {
xnotice("[$dlg_var(cidhash)] APPLY-RETAIL-CFW: $dlg_var(retail_callfwdType) call-forward to $dlg_var(retail_callfwdTarget) $ru\n");
$avp(retail_cfwd) = 'yes';
Expand Down Expand Up @@ -1920,6 +1948,8 @@ route[WITHINDLG] {
} else if (is_method("NOTIFY")) {
# Add Record-Route for in-dialog NOTIFY as per RFC 6665.
record_route();
} else if (is_method("SUBSCRIBE")) {
route(CHECK_SUBSCRIBE_AS);
}
route(RELAY);
} else {
Expand All @@ -1938,6 +1968,22 @@ route[WITHINDLG] {
}
}

route[CHECK_SUBSCRIBE_AS] {
if ($var(is_from_inside)) return;

if ($sht(companyIdPerDomain=>$fd) == $null) return;
$var(companyId) = $sht(companyIdPerDomain=>$fd);

if ($sht(AsPerCompanyId=>$var(companyId)) == $null) return;
$var(as) = $sht(AsPerCompanyId=>$var(companyId));

if ($ru == $var(as)) return;

xwarn("[$dlg_var(cidhash)] CHECK-SUBSCRIBE-AS: companyId '$var(companyId)' now uses AS '$var(as)', not '$ru', reject\n");
send_reply("500", "Internal Server Error [CSA]");
exit;
}

route[REFER] {
if (is_present_hf("Refer-to")) {
xinfo("[$dlg_var(cidhash)] REFER: $fU transfers call to $hdr(Refer-to)\n");
Expand Down Expand Up @@ -2141,14 +2187,6 @@ route[REGISTER] {
}
}

# Store in kam_users_location_attrs used transport to retrieve it in lookup
$xavp(ulattrs=>transport) = $proto;

# Store external socket if different from main users address
if ($Ri != $var(usersAddress)) {
$xavp(ulattrs[0]=>extrasocket) = $Ri;
}

if (is_present_hf("Contact")) {
$var(contact_uri) = @contact.uri;
}
Expand Down Expand Up @@ -2813,8 +2851,8 @@ event_route[dialog:start] {
$dlg_var(ws) = 'yes';
}

if ($xavp(ulattrs[$T_branch_idx]=>extrasocket) != $null) {
$dlg_var(externalSocket) = $xavp(ulattrs[$T_branch_idx]=>extrasocket);
if ($(avp(branchsockaddr)[$T_branch_idx]) != $null) {
$dlg_var(externalSocket) = $(avp(branchsockaddr)[$T_branch_idx]);
}

#!ifdef WITH_REALTIME
Expand Down Expand Up @@ -2879,8 +2917,11 @@ onsend_route {
route[TRANSPORT_DETECT] {
if (!is_method("INVITE")) return;

$var(dstTransport) = $(nh(P){s.tolower});
xinfo("[$dlg_var(cidhash)] TRANSPORT_DETECT: Request transport: $proto - destination transport: $var(dstTransport)\n");

if (is_request() && !has_totag()) {
if ($proto == 'ws' || $proto == 'wss' || $xavp(ulattrs[$T_branch_idx]=>transport) == 'ws' || $xavp(ulattrs[$T_branch_idx]=>transport) == 'wss') {
if ($proto == 'ws' || $proto == 'wss' || $var(dstTransport) == 'ws' || $var(dstTransport) == 'wss') {
xnotice("[$dlg_var(cidhash)] TRANSPORT_DETECT: Mark branch as WSS\n");
setbflag(FLB_WEBSOCKETS);
}
Expand Down Expand Up @@ -2993,8 +3034,8 @@ route[RTPENGINE_INTERFACES] {
if ($var(is_from_inside)) {
if ($dlg_var(externalSocket) != $null) {
$var(interfaces) = "direction=" + $var(usersAddress) + " direction=" + $dlg_var(externalSocket);
} else if ($xavp(ulattrs[$T_branch_idx]=>extrasocket) != $null) {
$var(interfaces) = "direction=" + $var(usersAddress) + " direction=" + $xavp(ulattrs[$T_branch_idx]=>extrasocket);
} else if ($(avp(branchsockaddr)[$T_branch_idx]) != $null) {
$var(interfaces) = "direction=" + $var(usersAddress) + " direction=" + $(avp(branchsockaddr)[$T_branch_idx]);
} else {
$var(interfaces) = "direction=" + $var(usersAddress) + " direction=" + $var(usersAddress);
}
Expand Down Expand Up @@ -3049,12 +3090,7 @@ route[QUALITY] {
route[PRESENCE] {
if(!is_method("PUBLISH|SUBSCRIBE|NOTIFY")) return;

if(is_method("SUBSCRIBE") && $hdr(Event)=="message-summary") {
send_reply("404", "No voicemail service");
exit;
}

if(is_method("SUBSCRIBE") && $hdr(Event)=="as-feature-event") {
if(is_method("SUBSCRIBE") && $hdr(Event) != "dialog") {
send_reply("489", "Bad Event");
exit;
}
Expand Down
Loading

0 comments on commit 2e221ec

Please sign in to comment.