mirror of
https://github.com/jambonz/jambonz-webapp.git
synced 2026-07-04 19:21:58 +00:00
Add inputs to Carrier form to support outbound registration (#138)
* add fromUser fromDomain and usePublicIpInContact * change label placement for usePublicIpInContact checkbox * apply 1st review comments Co-authored-by: eglehelms <e.helms@cognigy.com>
This commit is contained in:
+4
-1
@@ -256,8 +256,11 @@ export interface Carrier {
|
||||
e164_leading_plus: boolean;
|
||||
requires_register: boolean;
|
||||
register_username: null | string;
|
||||
register_sip_realm: null | string;
|
||||
register_password: null | string;
|
||||
register_sip_realm: null | string;
|
||||
register_from_user: null | string;
|
||||
register_from_domain: null | string;
|
||||
register_public_ip_in_contact: boolean;
|
||||
tech_prefix: null | string;
|
||||
diversion: null | string;
|
||||
inbound_auth_username: string;
|
||||
|
||||
@@ -90,6 +90,9 @@ export const CarrierForm = ({
|
||||
const [sipPass, setSipPass] = useState("");
|
||||
const [sipRealm, setSipRealm] = useState("");
|
||||
const [initialRegister, setInitialRegister] = useState(false);
|
||||
const [fromUser, setFromUser] = useState("");
|
||||
const [fromDomain, setFromDomain] = useState("");
|
||||
const [regPublicIpInContact, setRegPublicIpInContact] = useState(false);
|
||||
|
||||
const [prefix, setPrefix] = useState("");
|
||||
const [initialPrefix, setInitialPrefix] = useState(false);
|
||||
@@ -146,12 +149,24 @@ export const CarrierForm = ({
|
||||
if (obj.register_sip_realm) {
|
||||
setSipRealm(obj.register_sip_realm);
|
||||
}
|
||||
if (obj.register_from_user) {
|
||||
setFromUser(obj.register_from_user);
|
||||
}
|
||||
if (obj.register_from_domain) {
|
||||
setFromDomain(obj.register_from_domain);
|
||||
}
|
||||
if (obj.register_public_ip_in_contact) {
|
||||
setRegPublicIpInContact(obj.register_public_ip_in_contact);
|
||||
}
|
||||
|
||||
if (
|
||||
obj.requires_register ||
|
||||
obj.register_username ||
|
||||
obj.register_password ||
|
||||
obj.register_sip_realm
|
||||
obj.register_sip_realm ||
|
||||
obj.register_from_user ||
|
||||
obj.register_from_domain ||
|
||||
obj.register_public_ip_in_contact
|
||||
) {
|
||||
setInitialRegister(true);
|
||||
} else {
|
||||
@@ -456,6 +471,10 @@ export const CarrierForm = ({
|
||||
register_username: sipUser.trim() || null,
|
||||
register_password: sipPass.trim() || null,
|
||||
register_sip_realm: sipRealm.trim() || null,
|
||||
register_from_user: sipRegister && fromUser ? fromUser.trim() : null,
|
||||
register_from_domain:
|
||||
sipRegister && fromDomain ? fromDomain.trim() : null,
|
||||
register_public_ip_in_contact: sipRegister && regPublicIpInContact,
|
||||
tech_prefix: prefix.trim() || null,
|
||||
diversion: diversion.trim() || null,
|
||||
is_active: isActive,
|
||||
@@ -675,6 +694,9 @@ export const CarrierForm = ({
|
||||
setSipPass("");
|
||||
setSipRealm("");
|
||||
setSipRegister(false);
|
||||
setFromUser("");
|
||||
setFromDomain("");
|
||||
setRegPublicIpInContact(false);
|
||||
}
|
||||
}}
|
||||
>
|
||||
@@ -737,6 +759,36 @@ export const CarrierForm = ({
|
||||
required={sipRegister}
|
||||
onChange={(e) => setSipRealm(e.target.value)}
|
||||
/>
|
||||
<label htmlFor="from_user">SIP From User</label>
|
||||
<input
|
||||
id="from_user"
|
||||
name="from_user"
|
||||
type="text"
|
||||
value={fromUser}
|
||||
placeholder="Optional: specify user part of SIP From header"
|
||||
onChange={(e) => setFromUser(e.target.value)}
|
||||
/>
|
||||
<label htmlFor="from_domain">SIP From Domain</label>
|
||||
<input
|
||||
id="from_domain"
|
||||
name="from_domain"
|
||||
type="text"
|
||||
value={fromDomain}
|
||||
placeholder="Optional: specify host part of SIP From header"
|
||||
onChange={(e) => setFromDomain(e.target.value)}
|
||||
/>
|
||||
<label htmlFor="reg_public_ip_in_contact" className="chk">
|
||||
<input
|
||||
id="reg_public_ip_in_contact"
|
||||
name="reg_public_ip_in_contact"
|
||||
type="checkbox"
|
||||
checked={regPublicIpInContact}
|
||||
onChange={(e) =>
|
||||
setRegPublicIpInContact(e.target.checked)
|
||||
}
|
||||
/>
|
||||
<div>Use Public IP in Contact</div>
|
||||
</label>
|
||||
</>
|
||||
)}
|
||||
</Checkzone>
|
||||
|
||||
Reference in New Issue
Block a user