Skip to content

Commit

Permalink
feat: support external callers
Browse files Browse the repository at this point in the history
When receiving calls from external callers (usually from PSTN) the
endpoint won't be found, this would previously result in calls not being
allowed. The logic has been changed to support this use case.
  • Loading branch information
crazybolillo committed Oct 21, 2024
1 parent 48413f7 commit 151ea80
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion internal/service/bouncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,16 @@ func (b *Bouncer) Check(ctx context.Context, endpoint, dialed string) model.Boun
return result
}

var callerId string
if row.Callerid.Valid {
callerId = row.Callerid.String
} else {
callerId = endpoint
}

return model.BouncerResponse{
Allow: true,
Destination: row.ID,
CallerID: row.Callerid.String,
CallerID: callerId,
}
}
2 changes: 1 addition & 1 deletion internal/sqlc/queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion queries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ FROM
ps_endpoints dest
INNER JOIN
ery_extension ee ON dest.sid = ee.endpoint_id
INNER JOIN
LEFT JOIN
ps_endpoints src ON src.id = $1
WHERE
ee.extension = $2;
Expand Down

0 comments on commit 151ea80

Please sign in to comment.